@elevasis/ui 2.73.0 → 2.74.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 (97) hide show
  1. package/dist/api/index.js +3 -3
  2. package/dist/app/index.d.ts +58 -0
  3. package/dist/app/index.js +9 -10
  4. package/dist/auth/index.js +5 -6
  5. package/dist/charts/index.js +5 -6
  6. package/dist/chunk-2GIJBHZT.js +60 -0
  7. package/dist/{chunk-ETN3TTRT.js → chunk-2MRRDF32.js} +115 -8
  8. package/dist/chunk-3LOKYZJC.js +231 -0
  9. package/dist/chunk-3QHX4ZKV.js +224 -0
  10. package/dist/chunk-43LC6XAX.js +69 -0
  11. package/dist/chunk-4M2BSHVT.js +116 -0
  12. package/dist/{chunk-SWKAH2YM.js → chunk-4MXNHJTA.js} +63 -30
  13. package/dist/{chunk-LZT2H2MA.js → chunk-5A6KCFS5.js} +36 -43
  14. package/dist/{chunk-OCVSPAKM.js → chunk-6JN2TLV2.js} +1150 -4346
  15. package/dist/{chunk-JYBJMVNY.js → chunk-7ARBBELS.js} +1 -1
  16. package/dist/{chunk-AJOVWB47.js → chunk-7RJ7P6S6.js} +6 -3
  17. package/dist/chunk-ARAFQBNI.js +515 -0
  18. package/dist/{chunk-Z4ICFQXG.js → chunk-BA3AZJUR.js} +1 -1
  19. package/dist/chunk-BRTGCFBH.js +305 -0
  20. package/dist/{chunk-IGBPWD6S.js → chunk-CQPULKKL.js} +5 -3
  21. package/dist/chunk-CRA7WQZH.js +49 -0
  22. package/dist/{chunk-U2H3TIHD.js → chunk-DCQKTDIG.js} +2 -52
  23. package/dist/{chunk-3TS5U5BL.js → chunk-E6YGA5WH.js} +1 -1
  24. package/dist/chunk-FA7LMNQO.js +439 -0
  25. package/dist/chunk-FZSG6M6W.js +45 -0
  26. package/dist/chunk-GDOR57D7.js +165 -0
  27. package/dist/{chunk-CJ2232PQ.js → chunk-GO4XJ5D4.js} +1 -1
  28. package/dist/chunk-GPQQGQGT.js +645 -0
  29. package/dist/chunk-HYQOGRWG.js +54 -0
  30. package/dist/{chunk-LEPYXLJ2.js → chunk-LN4UW6S4.js} +1 -1
  31. package/dist/chunk-N6K2Q5BM.js +393 -0
  32. package/dist/{chunk-NHNTX6ZL.js → chunk-O32UQ26A.js} +3 -2
  33. package/dist/{chunk-M7WWRZ5Z.js → chunk-QFGNRKIE.js} +1 -78
  34. package/dist/{chunk-IBCEAVB2.js → chunk-R5UGIFYU.js} +41 -5
  35. package/dist/{chunk-5B2ZFO44.js → chunk-RFNJ2PTO.js} +1 -1
  36. package/dist/chunk-VM2OWOXL.js +24 -0
  37. package/dist/{chunk-ZDKPHFTH.js → chunk-W2QRBQQA.js} +5 -3
  38. package/dist/chunk-WDBNW44Z.js +49 -0
  39. package/dist/{chunk-4CW2C5BD.js → chunk-WZU3MCKI.js} +1 -1
  40. package/dist/chunk-YQQ5GRUR.js +21 -0
  41. package/dist/{chunk-PQ4B62HH.js → chunk-ZFA56VSR.js} +2 -2
  42. package/dist/{chunk-NI37YNRP.js → chunk-ZWI62BQ6.js} +7 -4
  43. package/dist/chunk-ZYNVCWDZ.js +286 -0
  44. package/dist/components/index.d.ts +187 -2
  45. package/dist/components/index.js +44 -34
  46. package/dist/components/navigation/index.js +6 -7
  47. package/dist/features/auth/index.d.ts +78 -2
  48. package/dist/features/auth/index.js +18 -9
  49. package/dist/features/clients/index.js +7 -7
  50. package/dist/features/content/index.d.ts +226 -5
  51. package/dist/features/content/index.js +263 -15
  52. package/dist/features/crm/index.d.ts +58 -0
  53. package/dist/features/crm/index.js +10 -8
  54. package/dist/features/dashboard/index.js +9 -8
  55. package/dist/features/delivery/index.d.ts +58 -0
  56. package/dist/features/delivery/index.js +23 -7
  57. package/dist/features/knowledge/index.js +5 -6
  58. package/dist/features/lead-gen/index.d.ts +9 -15
  59. package/dist/features/lead-gen/index.js +12 -8
  60. package/dist/features/monitoring/index.js +11 -9
  61. package/dist/features/monitoring/requests/index.js +8 -7
  62. package/dist/features/operations/index.js +15 -11
  63. package/dist/features/public-agent-chat/index.js +3 -1
  64. package/dist/features/settings/index.d.ts +58 -0
  65. package/dist/features/settings/index.js +9 -8
  66. package/dist/hooks/access/index.js +5 -6
  67. package/dist/hooks/delivery/index.d.ts +58 -0
  68. package/dist/hooks/delivery/index.js +3 -2
  69. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +1 -1
  70. package/dist/hooks/published.d.ts +175 -3
  71. package/dist/hooks/published.js +22 -6
  72. package/dist/initialization/index.d.ts +58 -0
  73. package/dist/knowledge/index.js +167 -11
  74. package/dist/{knowledge-search-index-RZLIVWPJ.js → knowledge-search-index-6GQK55IQ.js} +1 -1
  75. package/dist/layout/index.js +8 -9
  76. package/dist/profile/index.d.ts +58 -0
  77. package/dist/provider/index.d.ts +77 -1
  78. package/dist/provider/index.js +5 -6
  79. package/dist/provider/published.d.ts +105 -1
  80. package/dist/provider/published.js +5 -6
  81. package/dist/test-utils/index.d.ts +16 -5
  82. package/dist/test-utils/index.js +17 -18
  83. package/dist/types/index.d.ts +59 -1
  84. package/dist/utils/index.d.ts +83 -3
  85. package/dist/utils/index.js +1 -1
  86. package/package.json +6 -5
  87. package/dist/chunk-6M6OLGQY.js +0 -36
  88. package/dist/chunk-MKH2KOAO.js +0 -39
  89. package/dist/hooks/index.css +0 -659
  90. package/dist/hooks/index.d.ts +0 -14073
  91. package/dist/hooks/index.js +0 -27
  92. package/dist/supabase/index.d.ts +0 -7118
  93. package/dist/supabase/index.js +0 -3
  94. package/dist/typeform/index.d.ts +0 -462
  95. package/dist/typeform/index.js +0 -2051
  96. package/dist/typeform/schemas.d.ts +0 -67
  97. package/dist/typeform/schemas.js +0 -2
@@ -0,0 +1,224 @@
1
+ import { showApiErrorNotification } from './chunk-HYQOGRWG.js';
2
+ import { useElevasisServices } from './chunk-BI5VDO2K.js';
3
+ import { useQuery, useQueries, useMutation } from '@tanstack/react-query';
4
+
5
+ // src/hooks/cloud-storage/queryKeys.ts
6
+ var cloudStorageKeys = {
7
+ all: ["cloud-storage"],
8
+ folders: () => [...cloudStorageKeys.all, "folders"],
9
+ folder: (organizationId, filters) => [...cloudStorageKeys.folders(), organizationId, filters],
10
+ thumbnails: () => [...cloudStorageKeys.all, "thumbnails"],
11
+ /**
12
+ * One key per resolved batch (at most `THUMBNAIL_BATCH_SIZE` ids) -- `useQueries`
13
+ * issues one query per batch, so the batch's own id list is part of its key.
14
+ */
15
+ thumbnailBatch: (organizationId, credentialName, batchFileIds) => [...cloudStorageKeys.thumbnails(), organizationId, credentialName, batchFileIds],
16
+ temporaryLinks: () => [...cloudStorageKeys.all, "temporary-links"],
17
+ /**
18
+ * Keyed per file. Shared by every consumer that needs the original's bytes --
19
+ * measuring, cropping, and previewing all read this one key, so a selected
20
+ * image resolves one link and downloads once rather than three times.
21
+ */
22
+ temporaryLinkFor: (organizationId, credentialName, fileId) => [...cloudStorageKeys.temporaryLinks(), organizationId, credentialName, fileId],
23
+ imageDimensions: () => [...cloudStorageKeys.all, "image-dimensions"],
24
+ /**
25
+ * Keyed per file rather than per set -- dimensions are measured one file at a time
26
+ * and a measured file stays measured no matter what else is selected alongside it.
27
+ */
28
+ imageDimensionsFor: (organizationId, credentialName, fileId) => [...cloudStorageKeys.imageDimensions(), organizationId, credentialName, fileId]
29
+ };
30
+ function useCloudStorageFolder(params) {
31
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
32
+ const { credentialName, folderPath, cursor } = params;
33
+ return useQuery({
34
+ queryKey: cloudStorageKeys.folder(workOSOrganizationId ?? void 0, { credentialName, folderPath, cursor }),
35
+ queryFn: async () => {
36
+ const searchParams = new URLSearchParams({ credentialName });
37
+ if (folderPath) searchParams.set("folderPath", folderPath);
38
+ if (cursor) searchParams.set("cursor", cursor);
39
+ return apiRequest(`/integrations/dropbox/files?${searchParams.toString()}`);
40
+ },
41
+ enabled: isReady && !!credentialName
42
+ });
43
+ }
44
+ var THUMBNAIL_BATCH_SIZE = 25;
45
+ function chunkIntoBatches(items, size) {
46
+ if (size <= 0) {
47
+ return items.length ? [items] : [];
48
+ }
49
+ const batches = [];
50
+ for (let i = 0; i < items.length; i += size) {
51
+ batches.push(items.slice(i, i + size));
52
+ }
53
+ return batches;
54
+ }
55
+ function mergeThumbnailBatches(batches) {
56
+ const thumbnails = {};
57
+ let connected = false;
58
+ for (const batch of batches) {
59
+ if (!batch) continue;
60
+ Object.assign(thumbnails, batch.thumbnails);
61
+ if (batch.connected) connected = true;
62
+ }
63
+ return { thumbnails, connected };
64
+ }
65
+ function useCloudStorageThumbnails(credentialName, fileIds) {
66
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
67
+ const batches = chunkIntoBatches(fileIds, THUMBNAIL_BATCH_SIZE);
68
+ const results = useQueries({
69
+ queries: batches.map((batchIds) => ({
70
+ queryKey: cloudStorageKeys.thumbnailBatch(workOSOrganizationId ?? void 0, credentialName, batchIds),
71
+ queryFn: async () => {
72
+ const searchParams = new URLSearchParams({ credentialName, ids: batchIds.join(",") });
73
+ return apiRequest(
74
+ `/integrations/dropbox/thumbnails?${searchParams.toString()}`
75
+ );
76
+ },
77
+ enabled: isReady && !!credentialName && batchIds.length > 0
78
+ }))
79
+ });
80
+ const { thumbnails, connected } = mergeThumbnailBatches(results.map((result) => result.data));
81
+ return {
82
+ thumbnails,
83
+ connected,
84
+ isLoading: results.some((result) => result.isLoading)
85
+ };
86
+ }
87
+ var TEMPORARY_LINK_STALE_MS = 60 * 60 * 1e3;
88
+ function useCloudStorageTemporaryLinks(credentialName, fileIds) {
89
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
90
+ const results = useQueries({
91
+ queries: fileIds.map((fileId) => ({
92
+ queryKey: cloudStorageKeys.temporaryLinkFor(workOSOrganizationId ?? void 0, credentialName, fileId),
93
+ queryFn: async () => {
94
+ const searchParams = new URLSearchParams({ credentialName, id: fileId });
95
+ const response = await apiRequest(
96
+ `/integrations/dropbox/temporary-link?${searchParams.toString()}`
97
+ );
98
+ return response.link;
99
+ },
100
+ enabled: isReady && !!credentialName && !!fileId,
101
+ staleTime: TEMPORARY_LINK_STALE_MS
102
+ }))
103
+ });
104
+ const links = {};
105
+ results.forEach((result, index) => {
106
+ const fileId = fileIds[index];
107
+ if (fileId !== void 0 && result.data !== void 0) links[fileId] = result.data;
108
+ });
109
+ return { links, isLoading: results.some((result) => result.isLoading) };
110
+ }
111
+ function measureImageDimensions(url) {
112
+ return new Promise((resolve) => {
113
+ const image = new Image();
114
+ image.onload = () => resolve({ width: image.naturalWidth, height: image.naturalHeight });
115
+ image.onerror = () => resolve(null);
116
+ image.src = url;
117
+ });
118
+ }
119
+ function useCloudStorageImageDimensions(credentialName, fileIds) {
120
+ const { isReady, workOSOrganizationId } = useElevasisServices();
121
+ const { links, isLoading: isResolvingLinks } = useCloudStorageTemporaryLinks(credentialName, fileIds);
122
+ const results = useQueries({
123
+ queries: fileIds.map((fileId) => {
124
+ const link = links[fileId];
125
+ return {
126
+ queryKey: cloudStorageKeys.imageDimensionsFor(workOSOrganizationId ?? void 0, credentialName, fileId),
127
+ queryFn: async () => link ? measureImageDimensions(link) : null,
128
+ // `link === undefined` means the link query has not settled; `null` means it
129
+ // settled with nothing, which is a measurable outcome (`null` dimensions).
130
+ enabled: isReady && !!credentialName && !!fileId && link !== void 0,
131
+ // The underlying file does not change size, so re-measuring on every remount
132
+ // would re-download the original for a value that cannot have moved.
133
+ staleTime: 60 * 60 * 1e3
134
+ };
135
+ })
136
+ });
137
+ const dimensions = {};
138
+ results.forEach((result, index) => {
139
+ const fileId = fileIds[index];
140
+ if (fileId !== void 0 && result.data !== void 0) dimensions[fileId] = result.data;
141
+ });
142
+ return { dimensions, isLoading: isResolvingLinks || results.some((result) => result.isLoading) };
143
+ }
144
+
145
+ // src/hooks/storage/queryKeys.ts
146
+ var storageKeys = {
147
+ all: ["storage"],
148
+ signedUrls: () => [...storageKeys.all, "signed-urls"],
149
+ /**
150
+ * Keyed per object rather than per set, so a path already signed stays signed no
151
+ * matter what else is requested alongside it -- the same reason
152
+ * `cloudStorageKeys.temporaryLinkFor` is per file.
153
+ */
154
+ signedUrlFor: (organizationId, bucket, path) => [...storageKeys.signedUrls(), organizationId, bucket, path]
155
+ };
156
+ async function blobToBase64(blob) {
157
+ const dataUrl = await new Promise((resolve, reject) => {
158
+ const reader = new FileReader();
159
+ reader.onload = () => resolve(reader.result);
160
+ reader.onerror = () => reject(reader.error ?? new Error("Failed to read the file"));
161
+ reader.readAsDataURL(blob);
162
+ });
163
+ const comma = dataUrl.indexOf(",");
164
+ if (comma === -1) throw new Error("Unreadable data URL while encoding the upload");
165
+ return dataUrl.slice(comma + 1);
166
+ }
167
+ function useUploadStorageFile() {
168
+ const { apiRequest } = useElevasisServices();
169
+ return useMutation({
170
+ mutationFn: async ({
171
+ bucket,
172
+ path,
173
+ file,
174
+ contentType,
175
+ upsert
176
+ }) => {
177
+ const content = await blobToBase64(file);
178
+ return apiRequest("/storage/upload", {
179
+ method: "POST",
180
+ body: JSON.stringify({
181
+ bucket,
182
+ path,
183
+ content,
184
+ contentType: contentType ?? file.type,
185
+ ...upsert === void 0 ? {} : { upsert }
186
+ })
187
+ });
188
+ },
189
+ onError: (error) => {
190
+ console.error("Failed to upload file to storage:", error);
191
+ showApiErrorNotification(error);
192
+ }
193
+ });
194
+ }
195
+ function storageObjectRefKey(ref) {
196
+ return `${ref.bucket}/${ref.path}`;
197
+ }
198
+ var SIGNED_URL_EXPIRES_IN_SECONDS = 60 * 60;
199
+ var SIGNED_URL_STALE_MS = (SIGNED_URL_EXPIRES_IN_SECONDS - 5 * 60) * 1e3;
200
+ function useStorageSignedUrls(refs) {
201
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
202
+ const results = useQueries({
203
+ queries: refs.map(({ bucket, path }) => ({
204
+ queryKey: storageKeys.signedUrlFor(workOSOrganizationId ?? void 0, bucket, path),
205
+ queryFn: async () => {
206
+ const response = await apiRequest("/storage/signed-url", {
207
+ method: "POST",
208
+ body: JSON.stringify({ bucket, path, expiresIn: SIGNED_URL_EXPIRES_IN_SECONDS })
209
+ });
210
+ return response.signedUrl;
211
+ },
212
+ enabled: isReady && !!bucket && !!path,
213
+ staleTime: SIGNED_URL_STALE_MS
214
+ }))
215
+ });
216
+ const urls = {};
217
+ results.forEach((result, index) => {
218
+ const ref = refs[index];
219
+ if (ref !== void 0 && typeof result.data === "string") urls[storageObjectRefKey(ref)] = result.data;
220
+ });
221
+ return { urls, isLoading: results.some((result) => result.isLoading) };
222
+ }
223
+
224
+ export { SIGNED_URL_EXPIRES_IN_SECONDS, TEMPORARY_LINK_STALE_MS, THUMBNAIL_BATCH_SIZE, chunkIntoBatches, cloudStorageKeys, measureImageDimensions, mergeThumbnailBatches, storageKeys, storageObjectRefKey, useCloudStorageFolder, useCloudStorageImageDimensions, useCloudStorageTemporaryLinks, useCloudStorageThumbnails, useStorageSignedUrls, useUploadStorageFile };
@@ -0,0 +1,69 @@
1
+ import { requestsKeys } from './chunk-6JN2TLV2.js';
2
+ import { useElevasisServices } from './chunk-BI5VDO2K.js';
3
+ import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
4
+
5
+ function useRequestsList(filters = {}) {
6
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
7
+ return useQuery({
8
+ queryKey: requestsKeys.list(workOSOrganizationId ?? void 0, filters),
9
+ queryFn: async () => {
10
+ const { type, severity, status, source, limit, offset } = filters;
11
+ const params = new URLSearchParams();
12
+ if (type) params.set("type", type);
13
+ if (severity) params.set("severity", severity);
14
+ if (status) params.set("status", status);
15
+ if (source) params.set("source", source);
16
+ if (limit !== void 0) params.set("limit", String(limit));
17
+ if (offset !== void 0) params.set("offset", String(offset));
18
+ const query = params.toString();
19
+ const { requests } = await apiRequest(`/requests${query ? "?" + query : ""}`);
20
+ return requests;
21
+ },
22
+ enabled: isReady
23
+ });
24
+ }
25
+ function useRequest(id) {
26
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
27
+ return useQuery({
28
+ queryKey: requestsKeys.detail(workOSOrganizationId ?? void 0, id),
29
+ queryFn: async () => {
30
+ const { request } = await apiRequest(`/requests/${id}`);
31
+ return request;
32
+ },
33
+ enabled: isReady && !!id
34
+ });
35
+ }
36
+ function useUpdateRequestStatus() {
37
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
38
+ const queryClient = useQueryClient();
39
+ return useMutation({
40
+ mutationFn: async ({ id, status }) => {
41
+ const { request } = await apiRequest(`/requests/${id}`, {
42
+ method: "PATCH",
43
+ body: JSON.stringify({ status })
44
+ });
45
+ return request;
46
+ },
47
+ onSuccess: (_data, { id }) => {
48
+ queryClient.invalidateQueries({ queryKey: requestsKeys.lists() });
49
+ queryClient.invalidateQueries({
50
+ queryKey: requestsKeys.detail(workOSOrganizationId ?? void 0, id)
51
+ });
52
+ }
53
+ });
54
+ }
55
+ function useDeleteRequest() {
56
+ const { apiRequest } = useElevasisServices();
57
+ const queryClient = useQueryClient();
58
+ return useMutation({
59
+ mutationFn: async (id) => {
60
+ await apiRequest(`/requests/${id}`, { method: "DELETE" });
61
+ return id;
62
+ },
63
+ onSuccess: () => {
64
+ queryClient.invalidateQueries({ queryKey: requestsKeys.lists() });
65
+ }
66
+ });
67
+ }
68
+
69
+ export { useDeleteRequest, useRequest, useRequestsList, useUpdateRequestStatus };
@@ -0,0 +1,116 @@
1
+ import { showApiErrorNotification } from './chunk-HYQOGRWG.js';
2
+ import { useElevasisServices } from './chunk-BI5VDO2K.js';
3
+ import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
4
+
5
+ // src/hooks/clients/queryKeys.ts
6
+ var clientsKeys = {
7
+ all: ["clients"],
8
+ lists: () => [...clientsKeys.all, "list"],
9
+ list: (organizationId, filters) => [...clientsKeys.lists(), organizationId, filters],
10
+ statuses: () => [...clientsKeys.all, "status"],
11
+ status: (organizationId) => [...clientsKeys.statuses(), organizationId],
12
+ details: () => [...clientsKeys.all, "detail"],
13
+ detail: (organizationId, id) => [...clientsKeys.details(), organizationId, id]
14
+ };
15
+ function useClients(filters = {}) {
16
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
17
+ return useQuery({
18
+ queryKey: clientsKeys.list(workOSOrganizationId ?? void 0, filters),
19
+ queryFn: async () => {
20
+ const { status, source, search, limit, offset } = filters;
21
+ const params = new URLSearchParams();
22
+ if (status) params.set("status", status);
23
+ if (source) params.set("source", source);
24
+ if (search) params.set("search", search);
25
+ if (limit !== void 0) params.set("limit", String(limit));
26
+ if (offset !== void 0) params.set("offset", String(offset));
27
+ const query = params.toString();
28
+ return apiRequest(`/clients${query ? "?" + query : ""}`);
29
+ },
30
+ enabled: isReady
31
+ });
32
+ }
33
+ function useClientStatus() {
34
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
35
+ return useQuery({
36
+ queryKey: clientsKeys.status(workOSOrganizationId ?? void 0),
37
+ queryFn: async () => {
38
+ return apiRequest("/clients/status");
39
+ },
40
+ enabled: isReady
41
+ });
42
+ }
43
+ function useClient(clientId) {
44
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
45
+ return useQuery({
46
+ queryKey: clientsKeys.detail(workOSOrganizationId ?? void 0, clientId),
47
+ queryFn: async () => {
48
+ return apiRequest(`/clients/${clientId}`);
49
+ },
50
+ enabled: isReady && !!clientId
51
+ });
52
+ }
53
+ function useCreateClient() {
54
+ const { apiRequest } = useElevasisServices();
55
+ const queryClient = useQueryClient();
56
+ return useMutation({
57
+ mutationFn: async (data) => {
58
+ return apiRequest("/clients", {
59
+ method: "POST",
60
+ body: JSON.stringify(data)
61
+ });
62
+ },
63
+ onSuccess: () => {
64
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.lists() });
65
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.statuses() });
66
+ },
67
+ onError: (error) => {
68
+ console.error("Failed to create client:", error);
69
+ showApiErrorNotification(error);
70
+ }
71
+ });
72
+ }
73
+ function useUpdateClient() {
74
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
75
+ const queryClient = useQueryClient();
76
+ return useMutation({
77
+ mutationFn: async ({ clientId, updates }) => {
78
+ return apiRequest(`/clients/${clientId}`, {
79
+ method: "PATCH",
80
+ body: JSON.stringify(updates)
81
+ });
82
+ },
83
+ onSuccess: (_data, { clientId }) => {
84
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.lists() });
85
+ void queryClient.invalidateQueries({
86
+ queryKey: clientsKeys.detail(workOSOrganizationId ?? void 0, clientId)
87
+ });
88
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.statuses() });
89
+ },
90
+ onError: (error) => {
91
+ console.error("Failed to update client:", error);
92
+ showApiErrorNotification(error);
93
+ }
94
+ });
95
+ }
96
+ function useDeleteClient() {
97
+ const { apiRequest } = useElevasisServices();
98
+ const queryClient = useQueryClient();
99
+ return useMutation({
100
+ mutationFn: async (clientId) => {
101
+ await apiRequest(`/clients/${clientId}`, {
102
+ method: "DELETE"
103
+ });
104
+ },
105
+ onSuccess: () => {
106
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.lists() });
107
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.statuses() });
108
+ },
109
+ onError: (error) => {
110
+ console.error("Failed to delete client:", error);
111
+ showApiErrorNotification(error);
112
+ }
113
+ });
114
+ }
115
+
116
+ export { clientsKeys, useClient, useClientStatus, useClients, useCreateClient, useDeleteClient, useUpdateClient };
@@ -1,13 +1,15 @@
1
1
  import { useAvailablePresets } from './chunk-ZFISGKYW.js';
2
- import { AppShellLoader } from './chunk-3TS5U5BL.js';
2
+ import { MEMBERSHIP_STATUS_COLORS, PROVISIONING_STATE_DISPLAY, transformMembershipToTableRow, useUserMemberships, useUpdateWebhookEndpoint, useDeleteWebhookEndpoint, useCreateWebhookEndpoint, useListWebhookEndpoints, useOrgRoles, useAssignRole, useRevokeRole, useOrganizationMembers, usePermissionCatalog } from './chunk-ARAFQBNI.js';
3
+ import { useDeleteCredential, useCreateCredential, useCredentials, useUpdateCredential, CredentialSchemas } from './chunk-3LOKYZJC.js';
4
+ import { AppShellLoader } from './chunk-E6YGA5WH.js';
3
5
  import { FilterBar } from './chunk-PDHTXPSF.js';
4
- import { useDeleteCredential, ListSkeleton, EmptyState, CustomModal, useCreateCredential, useCredentials, PageTitleCaption, MEMBERSHIP_STATUS_COLORS, PROVISIONING_STATE_DISPLAY, transformMembershipToTableRow, APIErrorAlert, useUserMemberships, useUpdateWebhookEndpoint, useResources, useDeleteWebhookEndpoint, useCreateWebhookEndpoint, useListWebhookEndpoints, StatCard, useOrgRoles, useAssignRole, useRevokeRole, useAccess, AccessKeys, useOrganizationMembers, usePermissionCatalog, AccessGuard, useUpdateCredential, CredentialSchemas } from './chunk-OCVSPAKM.js';
5
- import { showApiErrorNotification, showErrorNotification, showSuccessNotification } from './chunk-U2H3TIHD.js';
6
+ import { ListSkeleton, EmptyState, CustomModal, PageTitleCaption, APIErrorAlert, useResources, StatCard, useAccess, AccessKeys, AccessGuard } from './chunk-6JN2TLV2.js';
7
+ import { showApiErrorNotification, showErrorNotification, showSuccessNotification } from './chunk-HYQOGRWG.js';
6
8
  import { CardHeader } from './chunk-62GVNH5U.js';
7
9
  import { useInitialization } from './chunk-P45GQ3ZW.js';
8
10
  import { RoleBadge } from './chunk-UD657ICS.js';
9
11
  import { useOrganization } from './chunk-DD3CCMCZ.js';
10
- import { isAPIClientError, formatDateTime, OAUTH_FLOW_TIMEOUT } from './chunk-IBCEAVB2.js';
12
+ import { isAPIClientError, formatDateTime, OAUTH_FLOW_TIMEOUT } from './chunk-R5UGIFYU.js';
11
13
  import { useElevasisServices } from './chunk-BI5VDO2K.js';
12
14
  import { brandSupabaseOrgId } from './chunk-MQZE7SUI.js';
13
15
  import { useAuthContext } from './chunk-BRJ3QZ4E.js';
@@ -236,6 +238,31 @@ var CREDENTIAL_SCHEMAS = {
236
238
  ],
237
239
  docsUrl: "https://developer.clickup.com/docs/authentication",
238
240
  nameSuggestions: ["clickup-demo", "clickup-prod", "clickup-dev"]
241
+ },
242
+ instagram: {
243
+ type: "single_field",
244
+ label: "Instagram",
245
+ description: "Long-lived Instagram access token for publishing through Meta\u2019s Content Publishing API.",
246
+ fields: [
247
+ {
248
+ key: "accessToken",
249
+ label: "Access Token",
250
+ type: "password",
251
+ required: true,
252
+ placeholder: "IGAA...",
253
+ description: "Long-lived token from the Meta app dashboard. Valid 60 days from issue or last refresh."
254
+ },
255
+ {
256
+ key: "igUserId",
257
+ label: "Instagram User ID",
258
+ type: "text",
259
+ required: true,
260
+ placeholder: "17841400000000000",
261
+ description: "The Instagram professional account id shown beside the token on the same Meta screen."
262
+ }
263
+ ],
264
+ docsUrl: "https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/content-publishing",
265
+ nameSuggestions: ["elevasis-instagram", "instagram-prod", "instagram-dev"]
239
266
  }
240
267
  };
241
268
  function getCredentialSchema(type) {
@@ -495,20 +522,23 @@ function CreateCredentialModal({ opened, onClose, onSuccess }) {
495
522
  schema.label,
496
523
  " account."
497
524
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
498
- schema.fields?.map((field) => /* @__PURE__ */ jsx(
499
- PasswordInput,
500
- {
501
- label: field.label,
502
- description: field.description,
503
- placeholder: field.placeholder,
504
- required: field.required,
505
- value: form.values[field.key] || "",
506
- onChange: (e) => form.setFieldValue(field.key, e.target.value),
507
- error: form.errors[field.key],
508
- disabled: createCredential.isPending
509
- },
510
- field.key
511
- )),
525
+ schema.fields?.map((field) => {
526
+ const Input = field.type === "text" ? TextInput : PasswordInput;
527
+ return /* @__PURE__ */ jsx(
528
+ Input,
529
+ {
530
+ label: field.label,
531
+ description: field.description,
532
+ placeholder: field.placeholder,
533
+ required: field.required,
534
+ value: form.values[field.key] || "",
535
+ onChange: (e) => form.setFieldValue(field.key, e.target.value),
536
+ error: form.errors[field.key],
537
+ disabled: createCredential.isPending
538
+ },
539
+ field.key
540
+ );
541
+ }),
512
542
  schema.docsUrl && /* @__PURE__ */ jsxs(Text, { size: "sm", c: "dimmed", children: [
513
543
  "Get credentials from",
514
544
  " ",
@@ -2088,18 +2118,21 @@ function EditCredentialModal({ apiUrl, credential, onClose }) {
2088
2118
  ] }),
2089
2119
  !isOAuth && /* @__PURE__ */ jsxs(Fragment, { children: [
2090
2120
  /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: "Current values are encrypted and cannot be displayed. Enter new values below to replace them." }),
2091
- schema.fields?.map((field) => /* @__PURE__ */ jsx(
2092
- PasswordInput,
2093
- {
2094
- label: `New ${field.label}`,
2095
- placeholder: field.placeholder || `Enter new ${field.label.toLowerCase()}`,
2096
- value: fieldValues[field.key] || "",
2097
- onChange: (e) => handleFieldChange(field.key, e.target.value),
2098
- description: field.description,
2099
- disabled: isPending
2100
- },
2101
- field.key
2102
- )),
2121
+ schema.fields?.map((field) => {
2122
+ const Input = field.type === "text" ? TextInput : PasswordInput;
2123
+ return /* @__PURE__ */ jsx(
2124
+ Input,
2125
+ {
2126
+ label: `New ${field.label}`,
2127
+ placeholder: field.placeholder || `Enter new ${field.label.toLowerCase()}`,
2128
+ value: fieldValues[field.key] || "",
2129
+ onChange: (e) => handleFieldChange(field.key, e.target.value),
2130
+ description: field.description,
2131
+ disabled: isPending
2132
+ },
2133
+ field.key
2134
+ );
2135
+ }),
2103
2136
  updateMutation.error && /* @__PURE__ */ jsx(Alert, { icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }), color: "red", title: "Update Failed", children: "Failed to update credential" }),
2104
2137
  /* @__PURE__ */ jsxs(Group, { justify: "space-between", gap: "sm", children: [
2105
2138
  /* @__PURE__ */ jsx(Button, { variant: "light", onClick: handleClose, disabled: isPending, children: "Cancel" }),
@@ -1,13 +1,18 @@
1
- import { LEAD_GEN_API_INTERFACE } from './chunk-PQ4B62HH.js';
1
+ import { LEAD_GEN_API_INTERFACE } from './chunk-ZFA56VSR.js';
2
+ import { useListMembers, useListMember, useTransitionListMember, useDeriveActions, useArtifacts } from './chunk-GDOR57D7.js';
3
+ import { useCredentials, useVerifyCredential } from './chunk-3LOKYZJC.js';
4
+ import { useTableSort, sortData, useCompanyFacets, useCompanies, useDeleteCompanies, useContacts, useDeleteContacts } from './chunk-ZYNVCWDZ.js';
5
+ import { getSystemApiInterfaceReadiness } from './chunk-CRA7WQZH.js';
2
6
  import { sanitizeInput } from './chunk-3MEXPLWT.js';
7
+ import { useTableSelection } from './chunk-WDBNW44Z.js';
3
8
  import { PageContainer } from './chunk-BZZCNLT6.js';
4
9
  import { TableSelectionToolbar, SortableHeader } from './chunk-TUMSNGTX.js';
5
10
  import { FilterBar } from './chunk-PDHTXPSF.js';
6
- import { LeadGenSidebarMiddle, SubshellContentContainer, PageTitleCaption, acquisitionListKeys, useOptionalElevasisSystems, getAllBuildTemplates, getLeadGenStageCatalog, useListsTelemetry, useLists, useAccess, AccessKeys, CenteredErrorState, StatCard, useTableSort, sortData, usePaginationState, useTableSelection, EmptyState, CustomModal, useListActions, useList, useListProgress, useListExecutions, useDeleteList, useExecuteAsync, useCompanyFacets, useCompanies, useDeleteCompanies, useContacts, useDeleteContacts, useCreateList, JsonViewer, useCredentials, useVerifyCredential, useWorkflowExecution, useInFlightExecutions, useExecutionSSE, useListRecords, useListMembers, useListMember, useTransitionListMember, useDeriveActions, useArtifacts } from './chunk-OCVSPAKM.js';
7
- import { showApiErrorNotification, showSuccessNotification } from './chunk-U2H3TIHD.js';
11
+ import { LeadGenSidebarMiddle, SubshellContentContainer, PageTitleCaption, acquisitionListKeys, useOptionalElevasisSystems, getAllBuildTemplates, getLeadGenStageCatalog, useListsTelemetry, useLists, useAccess, AccessKeys, CenteredErrorState, StatCard, usePaginationState, EmptyState, CustomModal, useListActions, useList, useListProgress, useListExecutions, useDeleteList, useExecuteAsync, SystemReadinessAlert, useCreateList, JsonViewer, useWorkflowExecution, useInFlightExecutions, useExecutionSSE, useListRecords } from './chunk-6JN2TLV2.js';
12
+ import { showApiErrorNotification, showSuccessNotification } from './chunk-HYQOGRWG.js';
8
13
  import { SubshellSidebarSection } from './chunk-MISHPEJX.js';
9
14
  import { CardHeader } from './chunk-62GVNH5U.js';
10
- import { computeInterfaceReadiness, getSystem } from './chunk-IBCEAVB2.js';
15
+ import { getSystem } from './chunk-R5UGIFYU.js';
11
16
  import { useElevasisServices } from './chunk-BI5VDO2K.js';
12
17
  import { Stack, Group, Title, Text, Alert, Button, Collapse, Paper, Anchor, Center, Loader, SimpleGrid, Table, Badge, TextInput, Select, Checkbox, Pagination, ActionIcon, Tooltip, Tabs, ThemeIcon, Box, Textarea, Card, SegmentedControl, UnstyledButton, Pill, Drawer, JsonInput, Switch, NumberInput, MultiSelect, TagsInput, ScrollArea } from '@mantine/core';
13
18
  import { IconTarget, IconAlertCircle, IconPlayerPlay, IconArrowRight, IconListDetails, IconPlus, IconAlertTriangle, IconSearch, IconList, IconExternalLink, IconCopy, IconTrash, IconBuilding, IconUsers, IconBolt, IconLayoutDashboard, IconBuildingFactory2, IconArrowLeft, IconSparkles, IconAddressBook, IconSettings, IconChevronDown, IconChevronRight, IconRefresh, IconMail, IconUser, IconDatabase } from '@tabler/icons-react';
@@ -519,43 +524,33 @@ function toBuildStepDefinition(step) {
519
524
  }
520
525
  function getDefaultBuildTemplateId(model, templates) {
521
526
  const configuredId = getSystem(model, "sales.lead-gen")?.config?.defaultBuildTemplateId;
522
- if (typeof configuredId === "string" && templates.some((template) => template.id === configuredId)) return configuredId;
527
+ if (typeof configuredId === "string" && templates.some((template) => template.id === configuredId))
528
+ return configuredId;
523
529
  return templates[0]?.id;
524
530
  }
525
531
  function getDefaultBuildSteps(templates, defaultBuildTemplateId) {
526
532
  const template = templates.find((item) => item.id === defaultBuildTemplateId) ?? templates[0];
527
533
  return template?.steps.map((step) => toBuildStepDefinition(step)) ?? [];
528
534
  }
529
- function summarizeReadinessIssues(issues) {
530
- return issues[0]?.message;
531
- }
532
535
  function getLeadGenApiInterfaceReadiness(model) {
533
- if (!model) {
534
- return {
535
- systemPath: LEAD_GEN_API_INTERFACE.systemPath,
536
- interfaceKey: LEAD_GEN_API_INTERFACE.interfaceKey,
537
- readinessProfile: LEAD_GEN_API_INTERFACE.readinessProfile,
538
- declared: false,
539
- ready: false,
540
- reason: "No Organization Model is available for lead-gen System Interface readiness.",
541
- issues: [
542
- {
543
- family: "SYSTEM_INTERFACE_MISSING",
544
- code: "missing-organization-model",
545
- message: "No Organization Model is available for lead-gen System Interface readiness."
546
- }
547
- ]
548
- };
549
- }
550
- const readiness = computeInterfaceReadiness(model, LEAD_GEN_API_INTERFACE);
536
+ const readiness = getSystemApiInterfaceReadiness(
537
+ model,
538
+ LEAD_GEN_API_INTERFACE.systemPath,
539
+ LEAD_GEN_API_INTERFACE.interfaceKey
540
+ );
551
541
  return {
542
+ ...readiness,
552
543
  systemPath: LEAD_GEN_API_INTERFACE.systemPath,
553
544
  interfaceKey: LEAD_GEN_API_INTERFACE.interfaceKey,
554
- readinessProfile: readiness.readinessProfile,
555
- declared: getSystem(model, LEAD_GEN_API_INTERFACE.systemPath)?.apiInterface !== void 0,
556
- ready: readiness.ready,
557
- reason: summarizeReadinessIssues(readiness.issues),
558
- issues: readiness.issues
545
+ readinessProfile: model ? readiness.readinessProfile : LEAD_GEN_API_INTERFACE.readinessProfile,
546
+ reason: model ? readiness.reason : "No Organization Model is available for lead-gen System Interface readiness.",
547
+ issues: model ? readiness.issues : [
548
+ {
549
+ family: "SYSTEM_INTERFACE_MISSING",
550
+ code: "missing-organization-model",
551
+ message: "No Organization Model is available for lead-gen System Interface readiness."
552
+ }
553
+ ]
559
554
  };
560
555
  }
561
556
  function useLeadGenConfig() {
@@ -1349,16 +1344,6 @@ function ListMemberDrawer({ memberId, memberKind, listId, onClose }) {
1349
1344
  }
1350
1345
  );
1351
1346
  }
1352
- function LeadGenReadinessAlert({
1353
- canUseApiActions,
1354
- reason
1355
- }) {
1356
- if (canUseApiActions) return null;
1357
- return /* @__PURE__ */ jsxs(Alert, { icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }), color: "yellow", variant: "light", children: [
1358
- "Lead-gen API actions are disabled until System Interface readiness passes. Read-only list detail can still render when data is available.",
1359
- reason ? ` ${reason}` : ""
1360
- ] });
1361
- }
1362
1347
  function formatDateTime2(value) {
1363
1348
  if (!value) return "Not yet";
1364
1349
  return new Date(value).toLocaleString("en-US", {
@@ -3482,7 +3467,15 @@ function LeadGenListDetailPage({
3482
3467
  backButton
3483
3468
  ] })
3484
3469
  ] }),
3485
- /* @__PURE__ */ jsx(LeadGenReadinessAlert, { canUseApiActions, reason: apiDisabledReason }),
3470
+ /* @__PURE__ */ jsx(
3471
+ SystemReadinessAlert,
3472
+ {
3473
+ ready: canUseApiActions,
3474
+ actionLabel: "Lead-gen API actions",
3475
+ fallbackNote: "Read-only list detail can still render when data is available.",
3476
+ reason: apiDisabledReason
3477
+ }
3478
+ ),
3486
3479
  headerActions ? /* @__PURE__ */ jsx(Group, { gap: "xs", children: headerActions }) : null,
3487
3480
  /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsxs(Tabs, { value: activeTab, onChange: handleTabChange, keepMounted: false, children: [
3488
3481
  /* @__PURE__ */ jsxs(Tabs.List, { children: [
@@ -4525,4 +4518,4 @@ function LeadGenContactsPage({ extraColumns, replaceDefaultColumns } = {}) {
4525
4518
  ] }) });
4526
4519
  }
4527
4520
 
4528
- export { LEAD_GEN_ROUTE_LINKS, LeadGenCompaniesPage, LeadGenContactsPage, LeadGenListDetailPage, LeadGenListsPage, LeadGenOverviewPage, LeadGenReadinessAlert, LeadGenRouteShell, LeadGenSidebar, LeadGenSidebarTop, ListBuilderIndexPage, ListBuilderPage, ORPHAN_STAGE_ORDER, StepConfigForm, TabSection, deriveBusinessProgress, formatDate, getEnrichmentColor, getEnrichmentStatus, getLeadGenApiInterfaceReadiness, getLeadGenExportWorkflowId, getStateKeyColor, getStatusColor, getStepActionLabel, isLeadGenExportAction, resolveBuildPlanSteps, resolveBuildState, sortStageKeys, useDeleteLists, useLeadGenConfig };
4521
+ export { LEAD_GEN_ROUTE_LINKS, LeadGenCompaniesPage, LeadGenContactsPage, LeadGenListDetailPage, LeadGenListsPage, LeadGenOverviewPage, LeadGenRouteShell, LeadGenSidebar, LeadGenSidebarTop, ListBuilderIndexPage, ListBuilderPage, ORPHAN_STAGE_ORDER, StepConfigForm, TabSection, deriveBusinessProgress, formatDate, getEnrichmentColor, getEnrichmentStatus, getLeadGenApiInterfaceReadiness, getLeadGenExportWorkflowId, getStateKeyColor, getStatusColor, getStepActionLabel, isLeadGenExportAction, resolveBuildPlanSteps, resolveBuildState, sortStageKeys, useDeleteLists, useLeadGenConfig };