@elevasis/ui 1.25.0 → 1.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import { FilterBar } from './chunk-PDHTXPSF.js';
2
2
  import { CustomModal } from './chunk-GBMNCNHX.js';
3
3
  import { ListSkeleton, EmptyState, PageTitleCaption, CardHeader, APIErrorAlert } from './chunk-G25YWGUL.js';
4
4
  import { AppShellLoader } from './chunk-WWEMNIHW.js';
5
- import { useDeleteCredential, useCreateCredential, useCredentials, MEMBERSHIP_STATUS_COLORS, transformMembershipToTableRow, CredentialSchemas } from './chunk-R565P6XC.js';
5
+ import { useDeleteCredential, useCreateCredential, useCredentials, MEMBERSHIP_STATUS_COLORS, transformMembershipToTableRow, CredentialSchemas } from './chunk-FURGQSSG.js';
6
6
  import { formatDateTime } from './chunk-IOKL7BKE.js';
7
7
  import { useInitialization } from './chunk-TUXTSEAF.js';
8
8
  import { useState, useEffect } from 'react';
@@ -1,7 +1,7 @@
1
1
  import { FilterBar } from './chunk-PDHTXPSF.js';
2
2
  import { CyberAreaChart } from './chunk-US4JUSI3.js';
3
3
  import { CenteredErrorState, CardHeader, StatsCardSkeleton, TrendIndicator, DetailCardSkeleton, EmptyState } from './chunk-G25YWGUL.js';
4
- import { useResolveError, useResolveAllErrors, usePaginationState, useErrorDetails, useMarkAsRead } from './chunk-QDO6NF2I.js';
4
+ import { useResolveError, useResolveAllErrors, usePaginationState, useErrorDetails, useMarkAsRead } from './chunk-GQCQDCLJ.js';
5
5
  import { formatBucketTime } from './chunk-LXHZYSMQ.js';
6
6
  import { formatDuration } from './chunk-XA34RETF.js';
7
7
  import { PAGE_SIZE_DEFAULT } from './chunk-IOKL7BKE.js';
@@ -1,4 +1,4 @@
1
- import { CredentialNameSchema, UuidSchema, useErrorNotification, showApiErrorNotification, showSuccessNotification } from './chunk-QDO6NF2I.js';
1
+ import { CredentialNameSchema, UuidSchema, useErrorNotification, showApiErrorNotification } from './chunk-GQCQDCLJ.js';
2
2
  import { useSupabase } from './chunk-NJJ3NQ7B.js';
3
3
  import { getTimeRangeDates } from './chunk-LXHZYSMQ.js';
4
4
  import { useNotificationAdapter } from './chunk-R7WLWGPO.js';
@@ -1047,323 +1047,6 @@ function useUpdateWebhookEndpoint() {
1047
1047
  }
1048
1048
  });
1049
1049
  }
1050
- var dealKeys = {
1051
- all: ["acq-deals"],
1052
- lists: () => [...dealKeys.all, "list"],
1053
- list: (orgId, filters) => [...dealKeys.all, "list", orgId, filters],
1054
- details: () => [...dealKeys.all, "detail"],
1055
- detail: (id) => [...dealKeys.all, "detail", id]
1056
- };
1057
- function useDeals(filters = {}) {
1058
- const supabase = useSupabase();
1059
- const { currentSupabaseOrganizationId: organizationId, isInitializing, isOrgRefreshing } = useOrganization();
1060
- const isReady = !!organizationId && !isInitializing && !isOrgRefreshing;
1061
- return useQuery({
1062
- queryKey: dealKeys.list(organizationId, filters),
1063
- queryFn: async () => {
1064
- if (!organizationId) return [];
1065
- let query = supabase.from("acq_deals").select(
1066
- `
1067
- *,
1068
- contact:acq_contacts(
1069
- id,
1070
- first_name,
1071
- last_name,
1072
- email,
1073
- title,
1074
- company:acq_companies(
1075
- id,
1076
- name,
1077
- domain
1078
- )
1079
- )
1080
- `
1081
- ).eq("organization_id", organizationId);
1082
- if (filters.stage) {
1083
- query = query.eq("cached_stage", filters.stage);
1084
- }
1085
- if (filters.search) {
1086
- query = query.ilike("contact_email", `%${filters.search}%`);
1087
- }
1088
- query = query.order("updated_at", { ascending: false });
1089
- const { data, error } = await query;
1090
- if (error) throw error;
1091
- return data || [];
1092
- },
1093
- enabled: isReady
1094
- });
1095
- }
1096
- function useDeleteDeal() {
1097
- const { apiRequest } = useElevasisServices();
1098
- const queryClient = useQueryClient();
1099
- return useMutation({
1100
- mutationFn: async (dealId) => {
1101
- await apiRequest(`/deals/${dealId}`, { method: "DELETE" });
1102
- },
1103
- onSuccess: () => {
1104
- queryClient.invalidateQueries({ queryKey: dealKeys.all });
1105
- },
1106
- onError: (error) => {
1107
- showApiErrorNotification(error);
1108
- }
1109
- });
1110
- }
1111
- function useSyncDealStage() {
1112
- const supabase = useSupabase();
1113
- const queryClient = useQueryClient();
1114
- const { currentSupabaseOrganizationId: organizationId } = useOrganization();
1115
- return useMutation({
1116
- mutationFn: async ({ dealId, stage }) => {
1117
- if (!organizationId) throw new Error("No organization context");
1118
- const { error } = await supabase.from("acq_deals").update({ cached_stage: stage }).eq("id", dealId).eq("organization_id", organizationId);
1119
- if (error) throw error;
1120
- },
1121
- onError: (error) => {
1122
- queryClient.invalidateQueries({ queryKey: dealKeys.all });
1123
- showApiErrorNotification(error);
1124
- }
1125
- });
1126
- }
1127
- var dealNoteKeys = {
1128
- all: ["dealNotes"],
1129
- list: (organizationId, dealId) => ["dealNotes", organizationId, dealId]
1130
- };
1131
- function useDealNotes(dealId) {
1132
- const supabase = useSupabase();
1133
- const { currentSupabaseOrganizationId: organizationId, isInitializing, isOrgRefreshing } = useOrganization();
1134
- const isReady = !!organizationId && !isInitializing && !isOrgRefreshing;
1135
- return useQuery({
1136
- queryKey: dealNoteKeys.list(organizationId, dealId),
1137
- queryFn: async () => {
1138
- if (!organizationId || !dealId) return [];
1139
- const { data, error } = await supabase.from("acq_deal_notes").select("*").eq("deal_id", dealId).eq("organization_id", organizationId).order("created_at", { ascending: false });
1140
- if (error) throw error;
1141
- return (data || []).map((row) => ({
1142
- id: row.id,
1143
- dealId: row.deal_id,
1144
- organizationId: row.organization_id,
1145
- authorUserId: row.author_user_id,
1146
- body: row.body,
1147
- createdAt: row.created_at,
1148
- updatedAt: row.updated_at
1149
- }));
1150
- },
1151
- enabled: isReady && !!dealId
1152
- });
1153
- }
1154
- function useCreateDealNote() {
1155
- const supabase = useSupabase();
1156
- const queryClient = useQueryClient();
1157
- const { currentSupabaseOrganizationId: organizationId } = useOrganization();
1158
- return useMutation({
1159
- mutationFn: async ({ dealId, body, authorUserId }) => {
1160
- if (!organizationId) throw new Error("No organization context");
1161
- const { data, error } = await supabase.from("acq_deal_notes").insert({
1162
- deal_id: dealId,
1163
- organization_id: organizationId,
1164
- body,
1165
- author_user_id: authorUserId ?? null
1166
- }).select().single();
1167
- if (error) throw error;
1168
- return {
1169
- id: data.id,
1170
- dealId: data.deal_id,
1171
- organizationId: data.organization_id,
1172
- authorUserId: data.author_user_id,
1173
- body: data.body,
1174
- createdAt: data.created_at,
1175
- updatedAt: data.updated_at
1176
- };
1177
- },
1178
- onSuccess: (_, variables) => {
1179
- queryClient.invalidateQueries({ queryKey: dealNoteKeys.list(organizationId, variables.dealId) });
1180
- showSuccessNotification("Note added");
1181
- },
1182
- onError: (error) => {
1183
- showApiErrorNotification(error);
1184
- }
1185
- });
1186
- }
1187
- var dealTaskKeys = {
1188
- all: ["deal-tasks"],
1189
- list: (orgId, dealId) => ["deal-tasks", orgId, dealId],
1190
- due: (orgId, window, assigneeUserId) => ["deal-tasks-due", orgId, window, assigneeUserId]
1191
- };
1192
- function transformTaskRow(row) {
1193
- return {
1194
- id: row.id,
1195
- organizationId: row.organization_id,
1196
- dealId: row.deal_id,
1197
- title: row.title,
1198
- description: row.description,
1199
- kind: row.kind,
1200
- dueAt: row.due_at,
1201
- assigneeUserId: row.assignee_user_id,
1202
- completedAt: row.completed_at,
1203
- completedByUserId: row.completed_by_user_id,
1204
- createdAt: row.created_at,
1205
- updatedAt: row.updated_at,
1206
- createdByUserId: row.created_by_user_id
1207
- };
1208
- }
1209
- function useDealTasks(dealId) {
1210
- const supabase = useSupabase();
1211
- const { currentSupabaseOrganizationId: organizationId, isInitializing, isOrgRefreshing } = useOrganization();
1212
- const isReady = !!organizationId && !isInitializing && !isOrgRefreshing;
1213
- return useQuery({
1214
- queryKey: dealTaskKeys.list(organizationId, dealId ?? ""),
1215
- queryFn: async () => {
1216
- if (!organizationId || !dealId) return [];
1217
- const { data, error } = await supabase.from("acq_deal_tasks").select("*").eq("deal_id", dealId).eq("organization_id", organizationId).order("due_at", { ascending: true, nullsFirst: false });
1218
- if (error) throw error;
1219
- return (data || []).map(transformTaskRow);
1220
- },
1221
- enabled: isReady && !!dealId
1222
- });
1223
- }
1224
- function useDealTasksDue(opts) {
1225
- const supabase = useSupabase();
1226
- const { currentSupabaseOrganizationId: organizationId, isInitializing, isOrgRefreshing } = useOrganization();
1227
- const isReady = !!organizationId && !isInitializing && !isOrgRefreshing;
1228
- const window = opts?.window ?? "today_and_overdue";
1229
- const assigneeUserId = opts?.assigneeUserId ?? null;
1230
- return useQuery({
1231
- queryKey: dealTaskKeys.due(organizationId, window, assigneeUserId),
1232
- queryFn: async () => {
1233
- if (!organizationId) return [];
1234
- const now = /* @__PURE__ */ new Date();
1235
- const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate()).toISOString();
1236
- const todayEnd = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1).toISOString();
1237
- let query = supabase.from("acq_deal_tasks").select("*").eq("organization_id", organizationId).is("completed_at", null);
1238
- if (window === "overdue") {
1239
- query = query.lt("due_at", todayStart);
1240
- } else if (window === "today") {
1241
- query = query.gte("due_at", todayStart).lt("due_at", todayEnd);
1242
- } else if (window === "today_and_overdue") {
1243
- query = query.lt("due_at", todayEnd);
1244
- } else if (window === "upcoming") {
1245
- query = query.gte("due_at", todayEnd);
1246
- }
1247
- if (assigneeUserId !== null) {
1248
- query = query.eq("assignee_user_id", assigneeUserId);
1249
- }
1250
- query = query.order("due_at", { ascending: true, nullsFirst: false });
1251
- const { data, error } = await query;
1252
- if (error) throw error;
1253
- return (data || []).map(transformTaskRow);
1254
- },
1255
- enabled: isReady
1256
- });
1257
- }
1258
- function useCreateDealTask() {
1259
- const supabase = useSupabase();
1260
- const { currentSupabaseOrganizationId: organizationId } = useOrganization();
1261
- const queryClient = useQueryClient();
1262
- return useMutation({
1263
- mutationFn: async (params) => {
1264
- if (!organizationId) throw new Error("No organization context");
1265
- const { data, error } = await supabase.from("acq_deal_tasks").insert({
1266
- deal_id: params.dealId,
1267
- organization_id: organizationId,
1268
- title: params.title,
1269
- description: params.description ?? null,
1270
- kind: params.kind ?? "other",
1271
- due_at: params.dueAt ?? null,
1272
- assignee_user_id: params.assigneeUserId ?? null,
1273
- created_by_user_id: params.createdByUserId ?? null
1274
- }).select().single();
1275
- if (error) throw error;
1276
- return transformTaskRow(data);
1277
- },
1278
- onSuccess: (_, variables) => {
1279
- queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
1280
- queryClient.invalidateQueries({
1281
- predicate: (query) => query.queryKey[0] === "deal-tasks-due"
1282
- });
1283
- showSuccessNotification("Task created");
1284
- },
1285
- onError: (error) => {
1286
- showApiErrorNotification(error);
1287
- }
1288
- });
1289
- }
1290
- function useCompleteDealTask() {
1291
- const supabase = useSupabase();
1292
- const { currentSupabaseOrganizationId: organizationId } = useOrganization();
1293
- const queryClient = useQueryClient();
1294
- return useMutation({
1295
- mutationFn: async ({ taskId, completedByUserId }) => {
1296
- if (!organizationId) throw new Error("No organization context");
1297
- const { data, error } = await supabase.from("acq_deal_tasks").update({
1298
- completed_at: (/* @__PURE__ */ new Date()).toISOString(),
1299
- completed_by_user_id: completedByUserId ?? null
1300
- }).eq("id", taskId).eq("organization_id", organizationId).select().single();
1301
- if (error) throw error;
1302
- return transformTaskRow(data);
1303
- },
1304
- onSuccess: (_, variables) => {
1305
- queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
1306
- queryClient.invalidateQueries({
1307
- predicate: (query) => query.queryKey[0] === "deal-tasks-due"
1308
- });
1309
- showSuccessNotification("Task completed");
1310
- },
1311
- onError: (error) => {
1312
- showApiErrorNotification(error);
1313
- }
1314
- });
1315
- }
1316
- function useDealDetail(acqDealId) {
1317
- const supabase = useSupabase();
1318
- const { currentSupabaseOrganizationId: organizationId, isInitializing, isOrgRefreshing } = useOrganization();
1319
- const isReady = !!organizationId && !isInitializing && !isOrgRefreshing;
1320
- return useQuery({
1321
- queryKey: [...dealKeys.detail(acqDealId), organizationId],
1322
- queryFn: async () => {
1323
- if (!organizationId || !acqDealId) return null;
1324
- const { data, error } = await supabase.from("acq_deals").select(
1325
- `
1326
- *,
1327
- contact:acq_contacts(
1328
- id,
1329
- first_name,
1330
- last_name,
1331
- email,
1332
- title,
1333
- headline,
1334
- linkedin_url,
1335
- pipeline_status,
1336
- enrichment_data,
1337
- company:acq_companies(
1338
- id,
1339
- name,
1340
- domain,
1341
- website,
1342
- linkedin_url,
1343
- segment,
1344
- category,
1345
- num_employees
1346
- )
1347
- )
1348
- `
1349
- ).eq("id", acqDealId).eq("organization_id", organizationId).single();
1350
- if (error) {
1351
- if (error.code === "PGRST116") return null;
1352
- throw error;
1353
- }
1354
- return data;
1355
- },
1356
- enabled: isReady && !!acqDealId
1357
- });
1358
- }
1359
- function useBatchTelemetry() {
1360
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1361
- return useQuery({
1362
- queryKey: ["acq-batch-telemetry", organizationId],
1363
- queryFn: () => apiRequest("/acquisition/batches/telemetry"),
1364
- enabled: isReady
1365
- });
1366
- }
1367
1050
  var projectKeys = {
1368
1051
  all: ["projects"],
1369
1052
  lists: () => [...projectKeys.all, "list"],
@@ -1730,4 +1413,4 @@ function useCreateNote() {
1730
1413
  });
1731
1414
  }
1732
1415
 
1733
- export { ApiKeyService, CredentialSchemas, CredentialService, DeploymentService, MEMBERSHIP_STATUS_COLORS, OrganizationMembershipService, WebhookEndpointService, dealKeys, dealNoteKeys, dealTaskKeys, filterByDomainFilters, milestoneKeys, noteKeys, projectKeys, taskKeys, transformMembershipToTableRow, useActivateDeployment, useActivityFilters, useBatchTelemetry, useCommandViewDomainFilters, useCompleteDealTask, useCreateApiKey, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateMilestone, useCreateNote, useCreateProject, useCreateWebhookEndpoint, useCredentials, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDeleteApiKey, useDeleteCredential, useDeleteDeal, useDeleteDeployment, useDeleteMilestone, useDeleteProject, useDeleteTask, useDeleteWebhookEndpoint, useExecutionLogsFilters, useListApiKeys, useListDeployments, useListWebhookEndpoints, useMilestones, useOrganizationMembers, useProject, useProjectNotes, useProjects, useReactivateMembership, useResourceSearch, useResourcesDomainFilters, useStatusFilter, useSyncDealStage, useTasks, useTimeRangeDates, useUpdateApiKey, useUpdateCredential, useUpdateMemberConfig, useUpdateMilestone, useUpdateProject, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources };
1416
+ export { ApiKeyService, CredentialSchemas, CredentialService, DeploymentService, MEMBERSHIP_STATUS_COLORS, OrganizationMembershipService, WebhookEndpointService, filterByDomainFilters, milestoneKeys, noteKeys, projectKeys, taskKeys, transformMembershipToTableRow, useActivateDeployment, useActivityFilters, useCommandViewDomainFilters, useCreateApiKey, useCreateCredential, useCreateMilestone, useCreateNote, useCreateProject, useCreateWebhookEndpoint, useCredentials, useDeactivateDeployment, useDeactivateMembership, useDeleteApiKey, useDeleteCredential, useDeleteDeployment, useDeleteMilestone, useDeleteProject, useDeleteTask, useDeleteWebhookEndpoint, useExecutionLogsFilters, useListApiKeys, useListDeployments, useListWebhookEndpoints, useMilestones, useOrganizationMembers, useProject, useProjectNotes, useProjects, useReactivateMembership, useResourceSearch, useResourcesDomainFilters, useStatusFilter, useTasks, useTimeRangeDates, useUpdateApiKey, useUpdateCredential, useUpdateMemberConfig, useUpdateMilestone, useUpdateProject, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources };