@elevasis/ui 1.25.1 → 1.26.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.
@@ -1,5 +1,5 @@
1
- export { ActivityTrendChart, ChartFrame, CombinedTrendChart, CostTrendChart, CyberAreaChart, CyberDonut, CyberDonutTooltip, CyberLegendItem, HeroStatsRow, getSeriesColor, useCyberColors } from '../chunk-US4JUSI3.js';
2
- import '../chunk-G25YWGUL.js';
1
+ export { ActivityTrendChart, ChartFrame, CombinedTrendChart, CostTrendChart, CyberAreaChart, CyberDonut, CyberDonutTooltip, CyberLegendItem, HeroStatsRow, getSeriesColor, useCyberColors } from '../chunk-JHVKGZ2P.js';
2
+ import '../chunk-MCA6LOGM.js';
3
3
  import '../chunk-3KMDHCAR.js';
4
4
  import '../chunk-NNKKBSJN.js';
5
5
  import '../chunk-QJ2S46NI.js';
@@ -1,7 +1,7 @@
1
1
  import { FilterBar } from './chunk-PDHTXPSF.js';
2
- import { CyberAreaChart } from './chunk-US4JUSI3.js';
3
- import { CenteredErrorState, CardHeader, StatsCardSkeleton, TrendIndicator, DetailCardSkeleton, EmptyState } from './chunk-G25YWGUL.js';
4
- import { useResolveError, useResolveAllErrors, usePaginationState, useErrorDetails, useMarkAsRead } from './chunk-GQCQDCLJ.js';
2
+ import { CyberAreaChart } from './chunk-JHVKGZ2P.js';
3
+ import { CenteredErrorState, CardHeader, StatsCardSkeleton, TrendIndicator, DetailCardSkeleton, EmptyState } from './chunk-MCA6LOGM.js';
4
+ import { useResolveError, useResolveAllErrors, usePaginationState, useErrorDetails, useMarkAsRead } from './chunk-ZVJKIJFG.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,6 +1,6 @@
1
- import { useCyberColors, CyberLegendItem, CyberAreaChart } from './chunk-US4JUSI3.js';
2
- import { CardHeader, EmptyState } from './chunk-G25YWGUL.js';
3
- import { useResourcesHealth } from './chunk-GQCQDCLJ.js';
1
+ import { useCyberColors, CyberLegendItem, CyberAreaChart } from './chunk-JHVKGZ2P.js';
2
+ import { CardHeader, EmptyState } from './chunk-MCA6LOGM.js';
3
+ import { useResourcesHealth } from './chunk-ZVJKIJFG.js';
4
4
  import { getTimeRangeDates, formatBucketTime } from './chunk-LXHZYSMQ.js';
5
5
  import { Paper, Center, Loader, Group } from '@mantine/core';
6
6
  import { IconActivity, IconChartBar } from '@tabler/icons-react';
@@ -1,4 +1,4 @@
1
- import { CardHeader, CenteredErrorState, TrendIndicator, EmptyState, StatCard } from './chunk-G25YWGUL.js';
1
+ import { CardHeader, CenteredErrorState, TrendIndicator, EmptyState, StatCard } from './chunk-MCA6LOGM.js';
2
2
  import { getTimeRangeLabel, getTimeRangeDates, useErrorTrends, formatBucketTime } from './chunk-LXHZYSMQ.js';
3
3
  import { useRef, useState, useLayoutEffect, useEffect, useMemo, useCallback } from 'react';
4
4
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -1,8 +1,8 @@
1
1
  import { FilterBar } from './chunk-PDHTXPSF.js';
2
2
  import { CustomModal } from './chunk-GBMNCNHX.js';
3
- import { ListSkeleton, EmptyState, PageTitleCaption, CardHeader, APIErrorAlert } from './chunk-G25YWGUL.js';
3
+ import { ListSkeleton, EmptyState, PageTitleCaption, CardHeader, APIErrorAlert } from './chunk-MCA6LOGM.js';
4
4
  import { AppShellLoader } from './chunk-WWEMNIHW.js';
5
- import { useDeleteCredential, useCreateCredential, useCredentials, MEMBERSHIP_STATUS_COLORS, transformMembershipToTableRow, CredentialSchemas } from './chunk-FURGQSSG.js';
5
+ import { useDeleteCredential, useCreateCredential, useCredentials, MEMBERSHIP_STATUS_COLORS, transformMembershipToTableRow, CredentialSchemas } from './chunk-YNGQ7U5H.js';
6
6
  import { formatDateTime } from './chunk-IOKL7BKE.js';
7
7
  import { useInitialization } from './chunk-TUXTSEAF.js';
8
8
  import { useState, useEffect } from 'react';
@@ -531,7 +531,7 @@ function ResourceCard({
531
531
  {
532
532
  style: {
533
533
  display: "grid",
534
- gridTemplateColumns: "18px 200px 120px 1fr 180px 140px 14px",
534
+ gridTemplateColumns: "18px 200px 120px 1fr 180px 200px 14px",
535
535
  alignItems: "center",
536
536
  gap: "var(--mantine-spacing-sm)"
537
537
  },
@@ -1,5 +1,5 @@
1
- import { useCyberColors } from './chunk-US4JUSI3.js';
2
- import { GlowDot } from './chunk-G25YWGUL.js';
1
+ import { useCyberColors } from './chunk-JHVKGZ2P.js';
2
+ import { GlowDot } from './chunk-MCA6LOGM.js';
3
3
  import { Graph_module_css_default, useDirectedChainHighlighting, useNodeSelection, useFitViewTrigger } from './chunk-F6RBK7NJ.js';
4
4
  import { STATUS_COLORS, getStatusIcon, formatDuration, getStatusColors, AGENT_CONSTANTS, shouldAnimateEdge, TIMELINE_CONSTANTS, calculateBarPosition, CONTAINER_CONSTANTS, useExecutionPath, useUnifiedWorkflowLayout, WORKFLOW_CONSTANTS, useReactFlowAgent } from './chunk-XA34RETF.js';
5
5
  import { glassBase } from './chunk-FEZZ3IDU.js';
@@ -1,10 +1,10 @@
1
1
  import { SubshellSidebarSection } from './chunk-AWT255UH.js';
2
2
  import { CustomModal, ConfirmationModal } from './chunk-GBMNCNHX.js';
3
- import { BaseNode, useGraphTheme, BaseEdge, GraphBackground, GraphLegend, GraphFitViewButton, GraphFitViewHandler } from './chunk-QNABH7YG.js';
4
- import { useCyberColors, CyberDonut } from './chunk-US4JUSI3.js';
5
- import { JsonViewer, CardHeader, PageTitleCaption, CollapsibleSection } from './chunk-G25YWGUL.js';
3
+ import { BaseNode, useGraphTheme, BaseEdge, GraphBackground, GraphLegend, GraphFitViewButton, GraphFitViewHandler } from './chunk-O4UB5DQQ.js';
4
+ import { useCyberColors, CyberDonut } from './chunk-JHVKGZ2P.js';
5
+ import { JsonViewer, CardHeader, PageTitleCaption, CollapsibleSection } from './chunk-MCA6LOGM.js';
6
6
  import { StyledMarkdown } from './chunk-3KMDHCAR.js';
7
- import { useCommandViewLayout, useErrorDetail, useExecution, useArchivedLogs, useDeleteExecution, useRetryExecution, useCancelExecution, useCommandQueueTotals, showApiErrorNotification, showSuccessNotification } from './chunk-GQCQDCLJ.js';
7
+ import { useCommandViewLayout, useErrorDetail, useExecution, useArchivedLogs, useDeleteExecution, useRetryExecution, useCancelExecution, useCommandQueueTotals, showApiErrorNotification, showSuccessNotification } from './chunk-ZVJKIJFG.js';
8
8
  import { Graph_module_css_default, useDirectedChainHighlighting, useNodeSelection, GRAPH_CONSTANTS, useGraphHighlighting, calculateGraphHeight } from './chunk-F6RBK7NJ.js';
9
9
  import { getResourceStatusColor } from './chunk-XA34RETF.js';
10
10
  import { ResourceStatusColors, toWorkflowLogMessages } from './chunk-ELJIFLCB.js';
@@ -1,9 +1,7 @@
1
- import { CredentialNameSchema, UuidSchema, useErrorNotification, showApiErrorNotification } from './chunk-GQCQDCLJ.js';
2
- import { useSupabase } from './chunk-NJJ3NQ7B.js';
1
+ import { CredentialNameSchema, UuidSchema, useErrorNotification, showApiErrorNotification } from './chunk-ZVJKIJFG.js';
3
2
  import { getTimeRangeDates } from './chunk-LXHZYSMQ.js';
4
3
  import { useNotificationAdapter } from './chunk-R7WLWGPO.js';
5
4
  import { GC_TIME_SHORT, STALE_TIME_MONITORING, GC_TIME_MEDIUM, STALE_TIME_DEFAULT } from './chunk-IOKL7BKE.js';
6
- import { useOrganization } from './chunk-DD3CCMCZ.js';
7
5
  import { useElevasisServices } from './chunk-QEPXAWE2.js';
8
6
  import { z } from 'zod';
9
7
  import { create } from 'zustand';
@@ -62,11 +60,6 @@ var ListMembershipsQuerySchema = z.object({
62
60
  message: "Either userId or organizationId must be provided"
63
61
  }
64
62
  );
65
-
66
- // ../core/src/supabase/helpers.ts
67
- function sanitizePostgrestValue(value) {
68
- return value.replace(/[,()]/g, "");
69
- }
70
63
  var CredentialTypeSchema = z.enum(["oauth", "api-key", "webhook-secret", "api-key-secret"]);
71
64
  var CredentialValueSchema = z.record(z.string(), z.unknown()).refine((val) => Object.keys(val).length > 0, { message: "Credential value must not be empty" }).refine((val) => Object.keys(val).length <= 50, { message: "Credential value has too many keys (max 50)" }).refine(
72
65
  (val) => {
@@ -1055,109 +1048,48 @@ var projectKeys = {
1055
1048
  detail: (id) => [...projectKeys.all, "detail", id]
1056
1049
  };
1057
1050
  function useProjects(filters = {}) {
1058
- const supabase = useSupabase();
1059
- const { currentSupabaseOrganizationId, isInitializing, isOrgRefreshing } = useOrganization();
1060
- const isReady = !!currentSupabaseOrganizationId && !isInitializing && !isOrgRefreshing;
1051
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
1061
1052
  return useQuery({
1062
- queryKey: projectKeys.list(currentSupabaseOrganizationId, filters),
1053
+ queryKey: projectKeys.list(organizationId, filters),
1063
1054
  queryFn: async () => {
1064
- if (!currentSupabaseOrganizationId) {
1065
- return [];
1066
- }
1067
- let query = supabase.from("prj_projects").select("*").eq("organization_id", currentSupabaseOrganizationId);
1068
- if (filters.status) {
1069
- query = query.eq("status", filters.status);
1070
- }
1071
- if (filters.kind) {
1072
- query = query.eq("kind", filters.kind);
1073
- }
1074
- if (filters.companyId) {
1075
- query = query.eq("company_id", filters.companyId);
1076
- }
1077
- if (filters.search) {
1078
- const search = sanitizePostgrestValue(filters.search);
1079
- query = query.ilike("name", `%${search}%`);
1080
- }
1081
- query = query.order("created_at", { ascending: false });
1082
- const { data: projects, error: projectsError } = await query;
1083
- if (projectsError) throw projectsError;
1084
- const { data: milestones, error: milestonesError } = await supabase.from("prj_milestones").select("project_id, status").eq("organization_id", currentSupabaseOrganizationId);
1085
- if (milestonesError) throw milestonesError;
1086
- const { data: tasks, error: tasksError } = await supabase.from("prj_tasks").select("project_id, status").eq("organization_id", currentSupabaseOrganizationId);
1087
- if (tasksError) throw tasksError;
1088
- const milestoneCountMap = /* @__PURE__ */ new Map();
1089
- const completedMilestoneCountMap = /* @__PURE__ */ new Map();
1090
- for (const milestone of milestones || []) {
1091
- milestoneCountMap.set(milestone.project_id, (milestoneCountMap.get(milestone.project_id) || 0) + 1);
1092
- if (milestone.status === "completed") {
1093
- completedMilestoneCountMap.set(
1094
- milestone.project_id,
1095
- (completedMilestoneCountMap.get(milestone.project_id) || 0) + 1
1096
- );
1097
- }
1098
- }
1099
- const taskCountMap = /* @__PURE__ */ new Map();
1100
- const completedTaskCountMap = /* @__PURE__ */ new Map();
1101
- for (const task of tasks || []) {
1102
- taskCountMap.set(task.project_id, (taskCountMap.get(task.project_id) || 0) + 1);
1103
- if (task.status === "approved") {
1104
- completedTaskCountMap.set(task.project_id, (completedTaskCountMap.get(task.project_id) || 0) + 1);
1105
- }
1106
- }
1107
- return (projects || []).map((project) => ({
1108
- ...project,
1109
- milestoneCount: milestoneCountMap.get(project.id) || 0,
1110
- taskCount: taskCountMap.get(project.id) || 0,
1111
- completedMilestones: completedMilestoneCountMap.get(project.id) || 0,
1112
- completedTasks: completedTaskCountMap.get(project.id) || 0
1113
- }));
1055
+ const params = new URLSearchParams();
1056
+ if (filters.kind) params.set("kind", filters.kind);
1057
+ const qs = params.toString();
1058
+ const path = qs ? `/projects?${qs}` : "/projects";
1059
+ const res = await apiRequest(path);
1060
+ return res.projects;
1114
1061
  },
1115
1062
  enabled: isReady
1116
1063
  });
1117
1064
  }
1118
1065
  function useProject(id) {
1119
- const supabase = useSupabase();
1120
- const { currentSupabaseOrganizationId, isInitializing, isOrgRefreshing } = useOrganization();
1121
- const isReady = !!currentSupabaseOrganizationId && !isInitializing && !isOrgRefreshing;
1066
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
1122
1067
  return useQuery({
1123
- queryKey: [...projectKeys.detail(id), currentSupabaseOrganizationId],
1068
+ queryKey: [...projectKeys.detail(id), organizationId],
1124
1069
  queryFn: async () => {
1125
- if (!currentSupabaseOrganizationId || !id) {
1126
- return null;
1127
- }
1128
- const { data, error } = await supabase.from("prj_projects").select(
1129
- `
1130
- *,
1131
- milestones:prj_milestones(*),
1132
- tasks:prj_tasks(*),
1133
- company:acq_companies(id, name, domain)
1134
- `
1135
- ).eq("id", id).eq("organization_id", currentSupabaseOrganizationId).order("sequence", { ascending: true, referencedTable: "prj_milestones" }).order("created_at", { ascending: false, referencedTable: "prj_tasks" }).single();
1136
- if (error) {
1137
- if (error.code === "PGRST116") return null;
1138
- throw error;
1070
+ try {
1071
+ const res = await apiRequest(`/projects/${id}`);
1072
+ return res.project;
1073
+ } catch (err) {
1074
+ if (err && typeof err === "object" && "statusCode" in err && err.statusCode === 404) {
1075
+ return null;
1076
+ }
1077
+ throw err;
1139
1078
  }
1140
- return data;
1141
1079
  },
1142
1080
  enabled: isReady && !!id
1143
1081
  });
1144
1082
  }
1145
1083
  function useCreateProject() {
1146
- const supabase = useSupabase();
1084
+ const { apiRequest } = useElevasisServices();
1147
1085
  const queryClient = useQueryClient();
1148
- const { currentSupabaseOrganizationId } = useOrganization();
1149
1086
  return useMutation({
1150
1087
  mutationFn: async (params) => {
1151
- if (!currentSupabaseOrganizationId) {
1152
- throw new Error("No organization selected");
1153
- }
1154
- const insert = {
1155
- ...params,
1156
- organization_id: currentSupabaseOrganizationId
1157
- };
1158
- const { data, error } = await supabase.from("prj_projects").insert(insert).select().single();
1159
- if (error) throw error;
1160
- return data;
1088
+ const res = await apiRequest("/projects", {
1089
+ method: "POST",
1090
+ body: JSON.stringify(params)
1091
+ });
1092
+ return res.project;
1161
1093
  },
1162
1094
  onSuccess: () => {
1163
1095
  queryClient.invalidateQueries({ queryKey: projectKeys.all });
@@ -1168,13 +1100,15 @@ function useCreateProject() {
1168
1100
  });
1169
1101
  }
1170
1102
  function useUpdateProject() {
1171
- const supabase = useSupabase();
1103
+ const { apiRequest } = useElevasisServices();
1172
1104
  const queryClient = useQueryClient();
1173
1105
  return useMutation({
1174
1106
  mutationFn: async (params) => {
1175
- const { data, error } = await supabase.from("prj_projects").update(params.updates).eq("id", params.id).select().single();
1176
- if (error) throw error;
1177
- return data;
1107
+ const res = await apiRequest(`/projects/${params.id}`, {
1108
+ method: "PATCH",
1109
+ body: JSON.stringify(params.updates)
1110
+ });
1111
+ return res.project;
1178
1112
  },
1179
1113
  onSuccess: (data) => {
1180
1114
  queryClient.invalidateQueries({ queryKey: projectKeys.all });
@@ -1186,12 +1120,13 @@ function useUpdateProject() {
1186
1120
  });
1187
1121
  }
1188
1122
  function useDeleteProject() {
1189
- const supabase = useSupabase();
1123
+ const { apiRequest } = useElevasisServices();
1190
1124
  const queryClient = useQueryClient();
1191
1125
  return useMutation({
1192
1126
  mutationFn: async (id) => {
1193
- const { error } = await supabase.from("prj_projects").delete().eq("id", id);
1194
- if (error) throw error;
1127
+ await apiRequest(`/projects/${id}`, {
1128
+ method: "DELETE"
1129
+ });
1195
1130
  },
1196
1131
  onSuccess: () => {
1197
1132
  queryClient.invalidateQueries({ queryKey: projectKeys.all });
@@ -1209,46 +1144,28 @@ var milestoneKeys = {
1209
1144
  detail: (id) => [...milestoneKeys.all, "detail", id]
1210
1145
  };
1211
1146
  function useMilestones(filters = {}) {
1212
- const supabase = useSupabase();
1213
- const { currentSupabaseOrganizationId, isInitializing, isOrgRefreshing } = useOrganization();
1214
- const isReady = !!currentSupabaseOrganizationId && !isInitializing && !isOrgRefreshing;
1147
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
1215
1148
  return useQuery({
1216
- queryKey: milestoneKeys.list(currentSupabaseOrganizationId, filters),
1149
+ queryKey: milestoneKeys.list(organizationId, filters),
1217
1150
  queryFn: async () => {
1218
- if (!currentSupabaseOrganizationId) {
1219
- return [];
1220
- }
1221
- let query = supabase.from("prj_milestones").select("*").eq("organization_id", currentSupabaseOrganizationId);
1222
- if (filters.projectId) {
1223
- query = query.eq("project_id", filters.projectId);
1224
- }
1225
- if (filters.status) {
1226
- query = query.eq("status", filters.status);
1227
- }
1228
- query = query.order("sequence", { ascending: true });
1229
- const { data, error } = await query;
1230
- if (error) throw error;
1231
- return data || [];
1151
+ const res = await apiRequest(`/projects/${filters.projectId}/milestones`);
1152
+ return res.milestones;
1232
1153
  },
1233
- enabled: isReady
1154
+ enabled: isReady && !!filters.projectId
1234
1155
  });
1235
1156
  }
1236
1157
  function useCreateMilestone() {
1237
- const supabase = useSupabase();
1158
+ const { apiRequest } = useElevasisServices();
1238
1159
  const queryClient = useQueryClient();
1239
- const { currentSupabaseOrganizationId } = useOrganization();
1240
1160
  return useMutation({
1241
1161
  mutationFn: async (params) => {
1242
- if (!currentSupabaseOrganizationId) {
1243
- throw new Error("No organization selected");
1244
- }
1245
- const insert = {
1246
- ...params,
1247
- organization_id: currentSupabaseOrganizationId
1248
- };
1249
- const { data, error } = await supabase.from("prj_milestones").insert(insert).select().single();
1250
- if (error) throw error;
1251
- return data;
1162
+ const { project_id, ...body } = params;
1163
+ if (!project_id) throw new Error("project_id is required to create a milestone");
1164
+ const res = await apiRequest(`/projects/${project_id}/milestones`, {
1165
+ method: "POST",
1166
+ body: JSON.stringify(body)
1167
+ });
1168
+ return res.milestone;
1252
1169
  },
1253
1170
  onSuccess: (data) => {
1254
1171
  queryClient.invalidateQueries({ queryKey: milestoneKeys.all });
@@ -1261,13 +1178,15 @@ function useCreateMilestone() {
1261
1178
  });
1262
1179
  }
1263
1180
  function useUpdateMilestone() {
1264
- const supabase = useSupabase();
1181
+ const { apiRequest } = useElevasisServices();
1265
1182
  const queryClient = useQueryClient();
1266
1183
  return useMutation({
1267
1184
  mutationFn: async (params) => {
1268
- const { data, error } = await supabase.from("prj_milestones").update(params.updates).eq("id", params.id).select().single();
1269
- if (error) throw error;
1270
- return data;
1185
+ const res = await apiRequest(`/milestones/${params.id}`, {
1186
+ method: "PATCH",
1187
+ body: JSON.stringify(params.updates)
1188
+ });
1189
+ return res.milestone;
1271
1190
  },
1272
1191
  onSuccess: (data) => {
1273
1192
  queryClient.invalidateQueries({ queryKey: milestoneKeys.all });
@@ -1280,12 +1199,13 @@ function useUpdateMilestone() {
1280
1199
  });
1281
1200
  }
1282
1201
  function useDeleteMilestone() {
1283
- const supabase = useSupabase();
1202
+ const { apiRequest } = useElevasisServices();
1284
1203
  const queryClient = useQueryClient();
1285
1204
  return useMutation({
1286
1205
  mutationFn: async (params) => {
1287
- const { error } = await supabase.from("prj_milestones").delete().eq("id", params.id);
1288
- if (error) throw error;
1206
+ await apiRequest(`/milestones/${params.id}`, {
1207
+ method: "DELETE"
1208
+ });
1289
1209
  },
1290
1210
  onSuccess: (_, params) => {
1291
1211
  queryClient.invalidateQueries({ queryKey: milestoneKeys.all });
@@ -1305,43 +1225,30 @@ var taskKeys = {
1305
1225
  detail: (id) => [...taskKeys.all, "detail", id]
1306
1226
  };
1307
1227
  function useTasks(filters = {}) {
1308
- const supabase = useSupabase();
1309
- const { currentSupabaseOrganizationId, isInitializing, isOrgRefreshing } = useOrganization();
1310
- const isReady = !!currentSupabaseOrganizationId && !isInitializing && !isOrgRefreshing;
1228
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
1311
1229
  return useQuery({
1312
- queryKey: taskKeys.list(currentSupabaseOrganizationId, filters),
1230
+ queryKey: taskKeys.list(organizationId, filters),
1313
1231
  queryFn: async () => {
1314
- if (!currentSupabaseOrganizationId) {
1315
- return [];
1316
- }
1317
- let query = supabase.from("prj_tasks").select("*").eq("organization_id", currentSupabaseOrganizationId);
1318
- if (filters.projectId) {
1319
- query = query.eq("project_id", filters.projectId);
1320
- }
1321
- if (filters.milestoneId) {
1322
- query = query.eq("milestone_id", filters.milestoneId);
1323
- }
1324
- if (filters.status) {
1325
- query = query.eq("status", filters.status);
1326
- }
1327
- if (filters.type) {
1328
- query = query.eq("type", filters.type);
1329
- }
1330
- query = query.order("created_at", { ascending: false });
1331
- const { data, error } = await query;
1332
- if (error) throw error;
1333
- return data || [];
1232
+ const params = new URLSearchParams();
1233
+ if (filters.status) params.set("status", filters.status);
1234
+ if (filters.milestoneId) params.set("milestone_id", filters.milestoneId);
1235
+ const qs = params.toString();
1236
+ const base = `/projects/${filters.projectId}/tasks`;
1237
+ const path = qs ? `${base}?${qs}` : base;
1238
+ const res = await apiRequest(path);
1239
+ return res.tasks;
1334
1240
  },
1335
- enabled: isReady
1241
+ enabled: isReady && !!filters.projectId
1336
1242
  });
1337
1243
  }
1338
1244
  function useDeleteTask() {
1339
- const supabase = useSupabase();
1245
+ const { apiRequest } = useElevasisServices();
1340
1246
  const queryClient = useQueryClient();
1341
1247
  return useMutation({
1342
1248
  mutationFn: async (params) => {
1343
- const { error } = await supabase.from("prj_tasks").delete().eq("id", params.id);
1344
- if (error) throw error;
1249
+ await apiRequest(`/project-tasks/${params.id}`, {
1250
+ method: "DELETE"
1251
+ });
1345
1252
  },
1346
1253
  onSuccess: (_, params) => {
1347
1254
  queryClient.invalidateQueries({ queryKey: taskKeys.all });
@@ -1361,46 +1268,26 @@ var noteKeys = {
1361
1268
  detail: (id) => [...noteKeys.all, "detail", id]
1362
1269
  };
1363
1270
  function useProjectNotes(filters = {}) {
1364
- const supabase = useSupabase();
1365
- const { currentSupabaseOrganizationId, isInitializing, isOrgRefreshing } = useOrganization();
1366
- const isReady = !!currentSupabaseOrganizationId && !isInitializing && !isOrgRefreshing;
1271
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
1367
1272
  return useQuery({
1368
- queryKey: noteKeys.list(currentSupabaseOrganizationId, filters),
1273
+ queryKey: noteKeys.list(organizationId, filters),
1369
1274
  queryFn: async () => {
1370
- if (!currentSupabaseOrganizationId) {
1371
- return [];
1372
- }
1373
- let query = supabase.from("prj_notes").select("*").eq("organization_id", currentSupabaseOrganizationId);
1374
- if (filters.projectId) {
1375
- query = query.eq("project_id", filters.projectId);
1376
- }
1377
- if (filters.type) {
1378
- query = query.eq("type", filters.type);
1379
- }
1380
- query = query.order("occurred_at", { ascending: false });
1381
- const { data, error } = await query;
1382
- if (error) throw error;
1383
- return data || [];
1275
+ const res = await apiRequest(`/projects/${filters.projectId}/notes`);
1276
+ return res.notes;
1384
1277
  },
1385
- enabled: isReady
1278
+ enabled: isReady && !!filters.projectId
1386
1279
  });
1387
1280
  }
1388
1281
  function useCreateNote() {
1389
- const supabase = useSupabase();
1282
+ const { apiRequest } = useElevasisServices();
1390
1283
  const queryClient = useQueryClient();
1391
- const { currentSupabaseOrganizationId } = useOrganization();
1392
1284
  return useMutation({
1393
1285
  mutationFn: async (params) => {
1394
- if (!currentSupabaseOrganizationId) {
1395
- throw new Error("No organization selected");
1396
- }
1397
- const insert = {
1398
- ...params,
1399
- organization_id: currentSupabaseOrganizationId
1400
- };
1401
- const { data, error } = await supabase.from("prj_notes").insert(insert).select().single();
1402
- if (error) throw error;
1403
- return data;
1286
+ const res = await apiRequest("/project-notes", {
1287
+ method: "POST",
1288
+ body: JSON.stringify(params)
1289
+ });
1290
+ return res.note;
1404
1291
  },
1405
1292
  onSuccess: (data) => {
1406
1293
  queryClient.invalidateQueries({ queryKey: noteKeys.all });