@elevasis/ui 2.38.1 → 2.39.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 (78) hide show
  1. package/dist/{CoreAuthKitInner-QC62UHTZ.js → CoreAuthKitInner-PSTKG4B3.js} +3 -1
  2. package/dist/api/index.js +4 -2
  3. package/dist/app/index.d.ts +12 -0
  4. package/dist/app/index.js +17 -14
  5. package/dist/auth/context.d.ts +7 -1
  6. package/dist/auth/index.d.ts +80 -74
  7. package/dist/auth/index.js +10 -7
  8. package/dist/charts/index.js +13 -10
  9. package/dist/{chunk-C6BDBZRO.js → chunk-23YQ2WH5.js} +2 -1
  10. package/dist/{chunk-KJ3QUBNU.js → chunk-2FTX4WO2.js} +2 -2
  11. package/dist/chunk-43ZU647H.js +612 -0
  12. package/dist/{chunk-4UCAUBOL.js → chunk-5GZVSTVH.js} +2 -2
  13. package/dist/{chunk-7ZWXTH5J.js → chunk-5JYKCULK.js} +1 -1
  14. package/dist/{chunk-533DUEQY.js → chunk-6DO4PE3O.js} +1 -1
  15. package/dist/{chunk-PGWANFNE.js → chunk-CXLDZSAQ.js} +6 -6
  16. package/dist/{chunk-Y3JQBSKQ.js → chunk-FAO7SWSL.js} +1 -1
  17. package/dist/{chunk-566XWGPP.js → chunk-GLBPGEDD.js} +53 -611
  18. package/dist/{chunk-P34FFSOX.js → chunk-HOAMD35V.js} +2 -1
  19. package/dist/{chunk-JXVNHVK7.js → chunk-K7E352VG.js} +1 -1
  20. package/dist/{chunk-H2MEFUQD.js → chunk-L2H5CIQF.js} +25 -22
  21. package/dist/chunk-MQZE7SUI.js +9 -0
  22. package/dist/{chunk-7GQFIWP4.js → chunk-O53S32QR.js} +3 -3
  23. package/dist/{chunk-LWDVD3XR.js → chunk-PVXM4O6V.js} +309 -187
  24. package/dist/{chunk-I53EX4VU.js → chunk-RG2S6NIU.js} +1 -1
  25. package/dist/{chunk-JBWJ6WHZ.js → chunk-SJHM4WDG.js} +1 -1
  26. package/dist/{chunk-M7Q4UBRY.js → chunk-SNDRAYMF.js} +1 -1
  27. package/dist/chunk-TVTSASST.js +28 -0
  28. package/dist/{chunk-2Q2JQSQO.js → chunk-W2SFTXMT.js} +1 -1
  29. package/dist/chunk-ZJ3FG7FE.js +801 -0
  30. package/dist/{chunk-YGUNUIME.js → chunk-ZRZYRDXX.js} +5 -4
  31. package/dist/components/index.d.ts +12 -0
  32. package/dist/components/index.js +20 -17
  33. package/dist/components/navigation/index.js +4 -3
  34. package/dist/features/auth/index.js +21 -18
  35. package/dist/features/clients/index.js +20 -17
  36. package/dist/features/crm/index.js +20 -17
  37. package/dist/features/dashboard/index.d.ts +12 -0
  38. package/dist/features/dashboard/index.js +20 -17
  39. package/dist/features/delivery/index.js +20 -17
  40. package/dist/features/knowledge/index.js +4 -3
  41. package/dist/features/lead-gen/index.d.ts +58 -12
  42. package/dist/features/lead-gen/index.js +20 -17
  43. package/dist/features/monitoring/index.js +20 -17
  44. package/dist/features/monitoring/requests/index.js +20 -17
  45. package/dist/features/notes/index.js +6 -4
  46. package/dist/features/operations/index.d.ts +12 -0
  47. package/dist/features/operations/index.js +20 -17
  48. package/dist/features/settings/index.js +20 -17
  49. package/dist/hooks/access/index.js +9 -6
  50. package/dist/hooks/delivery/index.js +20 -17
  51. package/dist/hooks/index.d.ts +260 -203
  52. package/dist/hooks/index.js +20 -17
  53. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +12 -0
  54. package/dist/hooks/published.d.ts +260 -203
  55. package/dist/hooks/published.js +20 -17
  56. package/dist/hooks/user-notes/index.js +4 -2
  57. package/dist/index.d.ts +147 -87
  58. package/dist/index.js +20 -17
  59. package/dist/initialization/index.js +6 -4
  60. package/dist/knowledge/index.d.ts +12 -0
  61. package/dist/knowledge/index.js +5 -4
  62. package/dist/organization/index.d.ts +50 -13
  63. package/dist/organization/index.js +20 -17
  64. package/dist/profile/index.js +4 -2
  65. package/dist/provider/ElevasisServiceContext.d.ts +13 -4
  66. package/dist/provider/ElevasisServiceContext.js +3 -1
  67. package/dist/provider/index.d.ts +25 -4
  68. package/dist/provider/index.js +16 -13
  69. package/dist/provider/published.d.ts +25 -4
  70. package/dist/provider/published.js +14 -11
  71. package/dist/test-utils/index.d.ts +13 -4
  72. package/dist/test-utils/index.js +6 -3
  73. package/dist/theme/index.js +1 -1
  74. package/dist/types/index.d.ts +12 -0
  75. package/dist/utils/index.d.ts +12 -0
  76. package/dist/utils/index.js +3 -1
  77. package/package.json +5 -5
  78. package/dist/chunk-X66MVMZT.js +0 -373
@@ -7,6 +7,12 @@ import * as vitest from 'vitest';
7
7
  import * as msw_node from 'msw/node';
8
8
  import * as msw from 'msw';
9
9
 
10
+ declare const workOsOrgIdBrand: unique symbol;
11
+ /** A WorkOS organization id (`org_...`) -- the auth identity for API/SSE/query keys. */
12
+ type WorkOsOrgId = string & {
13
+ readonly [workOsOrgIdBrand]: true;
14
+ };
15
+
10
16
  /**
11
17
  * Service context value exposed by ElevasisServiceProvider.
12
18
  * Provides a ready-to-use apiRequest function and organization state.
@@ -16,10 +22,13 @@ import * as msw from 'msw';
16
22
  */
17
23
  interface ElevasisServiceContextValue {
18
24
  apiRequest: <T>(endpoint: string, options?: RequestInit) => Promise<T>;
19
- /** Organization ID alias retained for existing query-key consumers. */
20
- organizationId: string | null;
21
- /** WorkOS `org_xxx` string for the current organization. */
22
- workOSOrganizationId: string | null;
25
+ /**
26
+ * @deprecated Alias of `workOSOrganizationId` retained for existing query-key consumers.
27
+ * Resolves to the WorkOS `org_xxx` id (NOT the Supabase UUID). Prefer `workOSOrganizationId`.
28
+ */
29
+ organizationId: WorkOsOrgId | null;
30
+ /** WorkOS `org_xxx` id for the current organization. */
31
+ workOSOrganizationId: WorkOsOrgId | null;
23
32
  isReady: boolean;
24
33
  }
25
34
 
@@ -3,12 +3,15 @@ export { handlers, server } from '../chunk-7XKCG5CT.js';
3
3
  import { mockWorkOSUser, mockUseAuth, mockUnauthenticatedUser, mockAuthenticatedUser, mockAuthLoading, createMockUseAuth } from '../chunk-DRQPEMJI.js';
4
4
  export { createMockUseAuth, mockAuthLoading, mockAuthenticatedUser, mockUnauthenticatedUser, mockUseAuth, mockWorkOSUser } from '../chunk-DRQPEMJI.js';
5
5
  import '../chunk-73EWE2EW.js';
6
- import { ApiClientProvider } from '../chunk-Y3JQBSKQ.js';
7
- import '../chunk-X66MVMZT.js';
6
+ import { ApiClientProvider } from '../chunk-FAO7SWSL.js';
7
+ import '../chunk-ZJ3FG7FE.js';
8
8
  import '../chunk-KRWALB24.js';
9
9
  import '../chunk-DD3CCMCZ.js';
10
10
  import '../chunk-6ROXVZ3L.js';
11
- import { ElevasisServiceProvider } from '../chunk-KJ3QUBNU.js';
11
+ import '../chunk-43ZU647H.js';
12
+ import { ElevasisServiceProvider } from '../chunk-2FTX4WO2.js';
13
+ import '../chunk-MQZE7SUI.js';
14
+ import '../chunk-TVTSASST.js';
12
15
  import { __export, __reExport } from '../chunk-I2KLQ2HA.js';
13
16
  import { MantineProvider } from '@mantine/core';
14
17
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@@ -1,5 +1,5 @@
1
1
  export { useAvailablePresets } from '../chunk-B2DZLPDL.js';
2
- export { TOKEN_VAR_MAP, componentThemes, createCssVariablesResolver, mantineThemeOverride } from '../chunk-7ZWXTH5J.js';
2
+ export { TOKEN_VAR_MAP, componentThemes, createCssVariablesResolver, mantineThemeOverride } from '../chunk-5JYKCULK.js';
3
3
  export { PresetsProvider, usePresetsContext } from '../chunk-6D4LCJ52.js';
4
4
  export { generateShades, getPreset, PRESETS as presets } from '../chunk-WF7CONXF.js';
5
5
  import '../chunk-WLOQ4IBG.js';
@@ -4367,6 +4367,17 @@ declare const OntologyScopeSchema: z.ZodDefault<z.ZodObject<{
4367
4367
  }, z.core.$strip>>;
4368
4368
  type OntologyScope = z.infer<typeof OntologyScopeSchema>;
4369
4369
 
4370
+ declare const SystemApiInterfaceSchema: z.ZodObject<{
4371
+ lifecycle: z.ZodDefault<z.ZodEnum<{
4372
+ active: "active";
4373
+ deprecated: "deprecated";
4374
+ draft: "draft";
4375
+ archived: "archived";
4376
+ disabled: "disabled";
4377
+ }>>;
4378
+ readinessProfile: z.ZodOptional<z.ZodString>;
4379
+ resourceIds: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
4380
+ }, z.core.$strict>;
4370
4381
  type JsonPrimitive = string | number | boolean | null;
4371
4382
  type JsonValue = JsonPrimitive | JsonValue[] | {
4372
4383
  [key: string]: JsonValue;
@@ -4395,6 +4406,7 @@ interface SystemEntry {
4395
4406
  }[];
4396
4407
  policies?: string[];
4397
4408
  drivesGoals?: string[];
4409
+ apiInterface?: z.infer<typeof SystemApiInterfaceSchema>;
4398
4410
  /** @deprecated Use lifecycle. Accepted for one publish cycle. */
4399
4411
  status?: 'active' | 'deprecated' | 'archived';
4400
4412
  path?: string;
@@ -180,6 +180,17 @@ declare const OntologyScopeSchema: z.ZodDefault<z.ZodObject<{
180
180
  }, z.core.$strip>>;
181
181
  type OntologyScope = z.infer<typeof OntologyScopeSchema>;
182
182
 
183
+ declare const SystemApiInterfaceSchema: z.ZodObject<{
184
+ lifecycle: z.ZodDefault<z.ZodEnum<{
185
+ active: "active";
186
+ deprecated: "deprecated";
187
+ draft: "draft";
188
+ archived: "archived";
189
+ disabled: "disabled";
190
+ }>>;
191
+ readinessProfile: z.ZodOptional<z.ZodString>;
192
+ resourceIds: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
193
+ }, z.core.$strict>;
183
194
  type JsonPrimitive = string | number | boolean | null;
184
195
  type JsonValue = JsonPrimitive | JsonValue[] | {
185
196
  [key: string]: JsonValue;
@@ -208,6 +219,7 @@ interface SystemEntry {
208
219
  }[];
209
220
  policies?: string[];
210
221
  drivesGoals?: string[];
222
+ apiInterface?: z.infer<typeof SystemApiInterfaceSchema>;
211
223
  /** @deprecated Use lifecycle. Accepted for one publish cycle. */
212
224
  status?: 'active' | 'deprecated' | 'archived';
213
225
  path?: string;
@@ -1,4 +1,6 @@
1
- export { APIClientError, API_URL, DEBOUNCE_FILTER, DEBOUNCE_SLIDER, LIMIT_ACTIVITY_FEED, OAUTH_FLOW_TIMEOUT, PAGE_SIZE_DEFAULT, 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, formatChartAxisDate, formatDate, formatDateTime, formatErrorMessage, formatRelativeTime, formatTimeAgo, getErrorInfo, getErrorTitle, getResourceColor, getResourceIcon, getTimeRangeDates, getTimeRangeLabel, isAPIClientError, restoreConsole, setupBrowserMocks, suppressKnownWarnings, validateEmail } from '../chunk-X66MVMZT.js';
1
+ export { APIClientError, API_URL, DEBOUNCE_FILTER, DEBOUNCE_SLIDER, LIMIT_ACTIVITY_FEED, OAUTH_FLOW_TIMEOUT, PAGE_SIZE_DEFAULT, 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, formatChartAxisDate, formatDate, formatDateTime, formatErrorMessage, formatRelativeTime, formatTimeAgo, getErrorInfo, getErrorTitle, getResourceColor, getResourceIcon, getTimeRangeDates, getTimeRangeLabel, isAPIClientError, restoreConsole, setupBrowserMocks, suppressKnownWarnings, validateEmail } from '../chunk-ZJ3FG7FE.js';
2
2
  export { ResourceStatusColors } from '../chunk-KRWALB24.js';
3
3
  export { GC_TIME_LONG, GC_TIME_MEDIUM, GC_TIME_SHORT, STALE_TIME_ADMIN, STALE_TIME_DEFAULT, STALE_TIME_MONITORING } from '../chunk-6ROXVZ3L.js';
4
+ import '../chunk-43ZU647H.js';
5
+ import '../chunk-TVTSASST.js';
4
6
  import '../chunk-I2KLQ2HA.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/ui",
3
- "version": "2.38.1",
3
+ "version": "2.39.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",
@@ -269,11 +269,11 @@
269
269
  "typescript": "5.9.2",
270
270
  "vite": "^7.0.0",
271
271
  "vitest": "^3.2.4",
272
- "@elevasis/sdk": "1.26.1",
272
+ "@elevasis/sdk": "1.27.1",
273
+ "@repo/core": "0.35.0",
274
+ "@repo/elevasis-core": "1.0.0",
273
275
  "@repo/eslint-config": "0.0.0",
274
- "@repo/typescript-config": "0.0.0",
275
- "@repo/core": "0.33.0",
276
- "@repo/elevasis-core": "1.0.0"
276
+ "@repo/typescript-config": "0.0.0"
277
277
  },
278
278
  "dependencies": {
279
279
  "@dagrejs/dagre": "^1.1.4",
@@ -1,373 +0,0 @@
1
- import { formatDistanceToNow } from 'date-fns';
2
- import { IconUser, IconExternalLink, IconPlug, IconBolt, IconGitBranch, IconBrain } from '@tabler/icons-react';
3
- import { z } from 'zod';
4
-
5
- // src/utils/dateFormatters.ts
6
- function formatDateTime(dateString) {
7
- if (!dateString) return "Never";
8
- const date = new Date(dateString);
9
- return date.toLocaleDateString("en-US", {
10
- year: "numeric",
11
- month: "short",
12
- day: "numeric",
13
- hour: "2-digit",
14
- minute: "2-digit"
15
- });
16
- }
17
- function formatDate(dateString) {
18
- if (!dateString) return "Never";
19
- const date = new Date(dateString);
20
- return date.toLocaleDateString("en-US", {
21
- year: "numeric",
22
- month: "short",
23
- day: "numeric"
24
- });
25
- }
26
- function formatChartAxisDate(dateString) {
27
- if (!dateString) return "";
28
- const date = new Date(dateString);
29
- const month = date.getMonth() + 1;
30
- const day = date.getDate();
31
- const hour = date.getHours();
32
- const period = hour >= 12 ? "PM" : "AM";
33
- const hour12 = hour % 12 || 12;
34
- return `${month}/${day}, ${hour12}${period}`;
35
- }
36
- function formatRelativeTime(date) {
37
- if (!date) return "N/A";
38
- const dateObj = typeof date === "string" ? new Date(date) : date;
39
- return formatDistanceToNow(dateObj, { addSuffix: true });
40
- }
41
- function formatTimeAgo(date) {
42
- if (!date) return "-";
43
- const dateObj = typeof date === "string" ? new Date(date) : date;
44
- const diffMs = Date.now() - dateObj.getTime();
45
- const diffMinutes = Math.floor(diffMs / (1e3 * 60));
46
- const diffHours = Math.floor(diffMs / (1e3 * 60 * 60));
47
- const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
48
- if (diffMinutes < 1) return "Just now";
49
- if (diffHours < 1) return `${diffMinutes}m ago`;
50
- if (diffDays < 1) return `${diffHours}h ago`;
51
- if (diffDays === 1) return "1d ago";
52
- return `${diffDays}d ago`;
53
- }
54
-
55
- // src/utils/validateEmail.ts
56
- var validateEmail = (email) => {
57
- return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+$/.test(email);
58
- };
59
-
60
- // src/utils/error-utils.ts
61
- var APIClientError = class extends Error {
62
- statusCode;
63
- code;
64
- requestId;
65
- fields;
66
- retryAfter;
67
- constructor(message, code, statusCode, requestId, fields, retryAfter) {
68
- super(message);
69
- this.name = "APIClientError";
70
- this.code = code;
71
- this.statusCode = statusCode;
72
- this.requestId = requestId;
73
- this.fields = fields;
74
- this.retryAfter = retryAfter;
75
- }
76
- };
77
- function isAPIClientError(error) {
78
- return error instanceof APIClientError;
79
- }
80
- function getErrorInfo(error) {
81
- if (isAPIClientError(error)) {
82
- return {
83
- message: error.message,
84
- code: error.code,
85
- requestId: error.requestId,
86
- statusCode: error.statusCode,
87
- fields: error.fields,
88
- retryAfter: error.retryAfter
89
- };
90
- }
91
- if (error instanceof Error) {
92
- return {
93
- message: error.message
94
- };
95
- }
96
- return {
97
- message: String(error)
98
- };
99
- }
100
- function getErrorTitle(code) {
101
- if (!code) return "Error";
102
- switch (code) {
103
- case "VALIDATION_ERROR":
104
- return "Validation Error";
105
- case "AUTHENTICATION_FAILED":
106
- return "Authentication Required";
107
- case "FORBIDDEN":
108
- return "Access Denied";
109
- case "NOT_FOUND":
110
- return "Not Found";
111
- case "CONFLICT":
112
- return "Conflict";
113
- case "RATE_LIMIT_EXCEEDED":
114
- return "Rate Limit Exceeded";
115
- case "INTERNAL_SERVER_ERROR":
116
- return "Server Error";
117
- case "SERVICE_UNAVAILABLE":
118
- return "Service Temporarily Unavailable";
119
- default:
120
- return "Error";
121
- }
122
- }
123
- function formatErrorMessage(message, requestId, fields, retryAfter) {
124
- let formatted = message;
125
- if (fields && Object.keys(fields).length > 0) {
126
- const fieldErrors = [];
127
- for (const [field, errors] of Object.entries(fields)) {
128
- const fieldName = field === "root" || field === "_root" ? "Request" : field;
129
- errors.forEach((error) => {
130
- fieldErrors.push(`\u2022 ${fieldName}: ${error}`);
131
- });
132
- }
133
- if (fieldErrors.length > 0) {
134
- formatted = fieldErrors.join("\n");
135
- }
136
- }
137
- if (retryAfter) {
138
- formatted += `
139
-
140
- Please wait ${retryAfter} seconds before retrying.`;
141
- }
142
- if (requestId) {
143
- formatted += `
144
-
145
- Request ID: ${requestId}`;
146
- }
147
- return formatted;
148
- }
149
-
150
- // ../core/src/platform/utils/debounce.ts
151
- function debounce(fn, wait) {
152
- let timeoutId = null;
153
- const debounced = (...args) => {
154
- if (timeoutId !== null) {
155
- clearTimeout(timeoutId);
156
- }
157
- timeoutId = setTimeout(() => {
158
- fn(...args);
159
- timeoutId = null;
160
- }, wait);
161
- };
162
- debounced.cancel = () => {
163
- if (timeoutId !== null) {
164
- clearTimeout(timeoutId);
165
- timeoutId = null;
166
- }
167
- };
168
- return debounced;
169
- }
170
- var UuidSchema = z.string().uuid();
171
- var NonEmptyStringSchema = z.string().trim().min(1).max(1e3);
172
- var ResourceTypeSchema = z.enum(["agent", "workflow"]);
173
- var OriginResourceTypeSchema = z.enum(["agent", "workflow", "scheduler", "api"]);
174
- var CredentialNameSchema = z.string().trim().toLowerCase().min(1, "Credential name required").max(100, "Credential name too long (max 100 chars)").regex(
175
- /^[a-z0-9]+(-[a-z0-9]+)+$/,
176
- "Credential name must be lowercase letters, numbers, and hyphens in format: service-environment (e.g., gmail-prod, attio-dev)"
177
- );
178
- z.enum(["google-sheets", "google-calendar", "dropbox"]);
179
- z.string().min(10, "Authorization code too short").max(1e3, "Authorization code too long");
180
- z.string().min(10, "State parameter too short").max(2048, "State parameter too long");
181
- z.string().trim().transform((str) => str.replace(/[<>'"]/g, ""));
182
- z.string().email();
183
- z.string().url();
184
- z.object({
185
- limit: z.coerce.number().int().min(1).max(100).default(20),
186
- offset: z.coerce.number().int().min(0).default(0)
187
- });
188
- z.string().datetime();
189
- z.object({
190
- startDate: z.string().datetime(),
191
- endDate: z.string().datetime()
192
- });
193
-
194
- // ../core/src/platform/registry/resource-metadata.ts
195
- var resourceTypeIconNames = {
196
- agent: "IconBrain",
197
- workflow: "IconGitBranch",
198
- trigger: "IconBolt",
199
- integration: "IconPlug",
200
- external: "IconExternalLink",
201
- human: "IconUser"
202
- };
203
- var resourceTypeColors = {
204
- agent: "violet",
205
- workflow: "blue",
206
- trigger: "orange",
207
- integration: "teal",
208
- external: "gray",
209
- human: "yellow"
210
- };
211
- function getResourceIconName(type) {
212
- return resourceTypeIconNames[type];
213
- }
214
- function getResourceColor(type) {
215
- return resourceTypeColors[type];
216
- }
217
-
218
- // ../core/src/operations/observability/utils.ts
219
- function getTimeRangeDates(range) {
220
- const end = /* @__PURE__ */ new Date();
221
- const start = /* @__PURE__ */ new Date();
222
- switch (range) {
223
- case "1h":
224
- start.setHours(start.getHours() - 1);
225
- break;
226
- case "24h":
227
- start.setHours(start.getHours() - 24);
228
- break;
229
- case "7d":
230
- start.setDate(start.getDate() - 7);
231
- break;
232
- case "30d":
233
- start.setDate(start.getDate() - 30);
234
- break;
235
- }
236
- return {
237
- startDate: start.toISOString(),
238
- endDate: end.toISOString()
239
- };
240
- }
241
- function getTimeRangeLabel(range) {
242
- switch (range) {
243
- case "1h":
244
- return "Last 1 hour";
245
- case "24h":
246
- return "Last 24 hours";
247
- case "7d":
248
- return "Last 7 days";
249
- case "30d":
250
- return "Last 30 days";
251
- }
252
- }
253
- function formatBucketTime(timestamp, granularity) {
254
- const date = new Date(timestamp);
255
- if (granularity === "hour") {
256
- return date.toLocaleTimeString("en-US", {
257
- hour: "2-digit",
258
- minute: "2-digit",
259
- hour12: false
260
- });
261
- }
262
- return date.toLocaleDateString("en-US", {
263
- month: "short",
264
- day: "numeric"
265
- });
266
- }
267
-
268
- // src/utils/resource-icons.tsx
269
- var iconNameToComponent = {
270
- IconBrain,
271
- IconGitBranch,
272
- IconBolt,
273
- IconPlug,
274
- IconExternalLink,
275
- IconUser
276
- };
277
- function getResourceIcon(type) {
278
- const iconName = getResourceIconName(type);
279
- return iconNameToComponent[iconName];
280
- }
281
-
282
- // src/utils/constants/api.ts
283
- var API_URL = import.meta.env.PROD ? "https://api.elevasis.io" : "http://localhost:5170";
284
-
285
- // src/utils/constants/polling.ts
286
- var REFETCH_INTERVAL_DASHBOARD = 6e4;
287
- var REFETCH_INTERVAL_REALTIME = 3e4;
288
- var REFETCH_INTERVAL_RUNNING = 2e3;
289
- var REFETCH_INTERVAL_RUNNING_FAST = 1e3;
290
-
291
- // src/utils/constants/reconnection.ts
292
- var SSE_TOKEN_REFRESH_DELAY = 2e3;
293
- var SSE_CLOSE_GRACE_PERIOD = 5e3;
294
- var WS_RECONNECT_BASE_DELAY = 1e3;
295
- var WS_RECONNECT_MAX_DELAY = 3e4;
296
- var WS_MAX_RETRIES_BEFORE_ERROR = 3;
297
-
298
- // src/utils/constants/ui.ts
299
- var PAGE_SIZE_DEFAULT = 20;
300
- var LIMIT_ACTIVITY_FEED = 50;
301
- var DEBOUNCE_FILTER = 150;
302
- var DEBOUNCE_SLIDER = 500;
303
- var OAUTH_FLOW_TIMEOUT = 3e5;
304
-
305
- // src/utils/suppress-warnings.ts
306
- var SUPPRESSED_WARNINGS = [
307
- // Mantine SegmentedControl data-orientation deprecation warnings
308
- /Unsupported style property.*data-orientation/i,
309
- /Did you mean.*dataOrientation/i,
310
- // Recharts/Mantine Charts dimension warnings (charts work fine after layout completes)
311
- /The width\(-1\) and height\(-1\) of chart should be greater than 0/i
312
- ];
313
- var originalConsoleError = console.error;
314
- var originalConsoleWarn = console.warn;
315
- function suppressKnownWarnings() {
316
- console.error = (...args) => {
317
- const message = args.join(" ");
318
- const shouldSuppress = SUPPRESSED_WARNINGS.some((pattern) => pattern.test(message));
319
- if (!shouldSuppress) {
320
- originalConsoleError(...args);
321
- }
322
- };
323
- console.warn = (...args) => {
324
- const message = args.join(" ");
325
- const shouldSuppress = SUPPRESSED_WARNINGS.some((pattern) => pattern.test(message));
326
- if (!shouldSuppress) {
327
- originalConsoleWarn(...args);
328
- }
329
- };
330
- }
331
- function restoreConsole() {
332
- console.error = originalConsoleError;
333
- console.warn = originalConsoleWarn;
334
- }
335
-
336
- // src/utils/browser-mocks.ts
337
- function setupMatchMedia() {
338
- const win = globalThis.window;
339
- if (typeof win === "undefined") return;
340
- Object.defineProperty(win, "matchMedia", {
341
- writable: true,
342
- value: (query) => ({
343
- matches: false,
344
- media: query,
345
- onchange: null,
346
- addListener: () => {
347
- },
348
- removeListener: () => {
349
- },
350
- addEventListener: () => {
351
- },
352
- removeEventListener: () => {
353
- },
354
- dispatchEvent: () => true
355
- })
356
- });
357
- }
358
- function setupResizeObserver() {
359
- globalThis.ResizeObserver = class ResizeObserver {
360
- observe() {
361
- }
362
- unobserve() {
363
- }
364
- disconnect() {
365
- }
366
- };
367
- }
368
- function setupBrowserMocks() {
369
- setupMatchMedia();
370
- setupResizeObserver();
371
- }
372
-
373
- export { APIClientError, API_URL, CredentialNameSchema, DEBOUNCE_FILTER, DEBOUNCE_SLIDER, LIMIT_ACTIVITY_FEED, NonEmptyStringSchema, OAUTH_FLOW_TIMEOUT, OriginResourceTypeSchema, PAGE_SIZE_DEFAULT, REFETCH_INTERVAL_DASHBOARD, REFETCH_INTERVAL_REALTIME, REFETCH_INTERVAL_RUNNING, REFETCH_INTERVAL_RUNNING_FAST, ResourceTypeSchema, SSE_CLOSE_GRACE_PERIOD, SSE_TOKEN_REFRESH_DELAY, UuidSchema, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, debounce, formatBucketTime, formatChartAxisDate, formatDate, formatDateTime, formatErrorMessage, formatRelativeTime, formatTimeAgo, getErrorInfo, getErrorTitle, getResourceColor, getResourceIcon, getTimeRangeDates, getTimeRangeLabel, isAPIClientError, restoreConsole, setupBrowserMocks, suppressKnownWarnings, validateEmail };