@elevasis/ui 2.19.0 → 2.20.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 (65) hide show
  1. package/dist/{CoreAuthKitInner-I32JCNE7.js → CoreAuthKitInner-QC62UHTZ.js} +1 -0
  2. package/dist/api/index.js +1 -0
  3. package/dist/app/index.js +3 -2
  4. package/dist/auth/context.js +1 -0
  5. package/dist/auth/index.js +1 -0
  6. package/dist/charts/index.js +1 -0
  7. package/dist/{chunk-IBOX2M24.js → chunk-2CFOFSSG.js} +1 -1
  8. package/dist/chunk-7XKCG5CT.js +125 -0
  9. package/dist/chunk-DRQPEMJI.js +42 -0
  10. package/dist/{chunk-UU6PJ4EJ.js → chunk-FMFX4K6E.js} +1 -1
  11. package/dist/{chunk-Y7TDUZEH.js → chunk-GP3AFJYG.js} +1 -1
  12. package/dist/{chunk-46Z2VHY3.js → chunk-GTYUP7MB.js} +1 -1
  13. package/dist/chunk-HJ4CJIWN.js +38 -0
  14. package/dist/chunk-I2KLQ2HA.js +19 -0
  15. package/dist/{chunk-5SCVXZPM.js → chunk-JR5WNTLA.js} +1 -1
  16. package/dist/{chunk-YVAXWM3W.js → chunk-MZFJWCPH.js} +1 -1
  17. package/dist/{chunk-EUWBY43Z.js → chunk-OUYH2SBS.js} +1 -1
  18. package/dist/{chunk-TKEKYPZA.js → chunk-PJVG3ISO.js} +1 -1
  19. package/dist/{chunk-MJAKU2WA.js → chunk-TO7QXDBX.js} +1 -1
  20. package/dist/{chunk-JEQM67SO.js → chunk-YP6T426C.js} +3 -3
  21. package/dist/{chunk-LVCJ2H2T.js → chunk-ZE2KQSHL.js} +1 -1
  22. package/dist/components/chat/index.js +1 -0
  23. package/dist/components/index.js +14 -13
  24. package/dist/components/navigation/index.js +1 -0
  25. package/dist/execution/index.js +1 -0
  26. package/dist/features/auth/index.js +1 -0
  27. package/dist/features/crm/index.js +5 -4
  28. package/dist/features/dashboard/index.js +5 -4
  29. package/dist/features/delivery/index.js +5 -4
  30. package/dist/features/lead-gen/index.js +5 -4
  31. package/dist/features/monitoring/index.js +6 -5
  32. package/dist/features/monitoring/requests/index.js +4 -3
  33. package/dist/features/operations/index.js +7 -6
  34. package/dist/features/seo/index.js +1 -0
  35. package/dist/features/settings/index.js +5 -4
  36. package/dist/graph/index.js +1 -0
  37. package/dist/hooks/delivery/index.js +1 -0
  38. package/dist/hooks/index.js +4 -3
  39. package/dist/hooks/operations/command-view/utils/transformCommandViewData.js +1 -0
  40. package/dist/hooks/published.js +4 -3
  41. package/dist/index.js +4 -3
  42. package/dist/initialization/index.js +1 -0
  43. package/dist/layout/index.js +1 -0
  44. package/dist/organization/index.js +1 -0
  45. package/dist/profile/index.js +1 -0
  46. package/dist/provider/ElevasisServiceContext.js +1 -0
  47. package/dist/provider/index.js +3 -2
  48. package/dist/provider/published.js +2 -1
  49. package/dist/router/context.js +1 -0
  50. package/dist/router/index.js +1 -0
  51. package/dist/sse/index.js +1 -1
  52. package/dist/supabase/index.js +1 -0
  53. package/dist/test-utils/index.d.ts +117 -0
  54. package/dist/test-utils/index.js +136 -0
  55. package/dist/test-utils/setup-integration.d.ts +2 -0
  56. package/dist/test-utils/setup-integration.js +26 -0
  57. package/dist/test-utils/setup.d.ts +2 -0
  58. package/dist/test-utils/setup.js +47 -0
  59. package/dist/theme/index.js +1 -0
  60. package/dist/typeform/index.js +1 -0
  61. package/dist/typeform/schemas.js +1 -0
  62. package/dist/utils/index.js +1 -0
  63. package/dist/zustand/index.js +2 -0
  64. package/package.json +33 -5
  65. package/src/test-utils/README.md +5 -0
@@ -0,0 +1,136 @@
1
+ import { server, handlers } from '../chunk-7XKCG5CT.js';
2
+ export { handlers, server } from '../chunk-7XKCG5CT.js';
3
+ import { mockWorkOSUser, mockUseAuth, mockUnauthenticatedUser, mockAuthenticatedUser, mockAuthLoading, createMockUseAuth } from '../chunk-DRQPEMJI.js';
4
+ export { createMockUseAuth, mockAuthLoading, mockAuthenticatedUser, mockUnauthenticatedUser, mockUseAuth, mockWorkOSUser } from '../chunk-DRQPEMJI.js';
5
+ import '../chunk-XCYKC6OZ.js';
6
+ import { ApiClientProvider } from '../chunk-R7OJCNL3.js';
7
+ import '../chunk-OD7GWIZS.js';
8
+ import '../chunk-KRWALB24.js';
9
+ import '../chunk-DD3CCMCZ.js';
10
+ import { __export, __reExport } from '../chunk-I2KLQ2HA.js';
11
+ import { MantineProvider } from '@mantine/core';
12
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
13
+ import * as react_star from '@testing-library/react';
14
+ import { render, renderHook } from '@testing-library/react';
15
+ import { jsx } from 'react/jsx-runtime';
16
+
17
+ // src/test-utils/index.ts
18
+ var test_utils_exports = {};
19
+ __export(test_utils_exports, {
20
+ TestProviders: () => TestProviders,
21
+ createMockUseAuth: () => createMockUseAuth,
22
+ createTestQueryClient: () => createTestQueryClient,
23
+ createTestWrapper: () => createTestWrapper,
24
+ handlers: () => handlers,
25
+ mockAuthLoading: () => mockAuthLoading,
26
+ mockAuthenticatedUser: () => mockAuthenticatedUser,
27
+ mockFeatureAccess: () => mockFeatureAccess,
28
+ mockUnauthenticatedUser: () => mockUnauthenticatedUser,
29
+ mockUseAuth: () => mockUseAuth,
30
+ mockWorkOSUser: () => mockWorkOSUser,
31
+ render: () => renderWithProviders,
32
+ renderHookWithProviders: () => renderHookWithProviders,
33
+ renderWithProviders: () => renderWithProviders,
34
+ server: () => server
35
+ });
36
+
37
+ // src/test-utils/render.tsx
38
+ var render_exports = {};
39
+ __export(render_exports, {
40
+ TestProviders: () => TestProviders,
41
+ createTestQueryClient: () => createTestQueryClient,
42
+ createTestWrapper: () => createTestWrapper,
43
+ render: () => renderWithProviders,
44
+ renderHookWithProviders: () => renderHookWithProviders,
45
+ renderWithProviders: () => renderWithProviders
46
+ });
47
+ __reExport(render_exports, react_star);
48
+ function createTestQueryClient() {
49
+ return new QueryClient({
50
+ defaultOptions: {
51
+ queries: {
52
+ retry: false,
53
+ gcTime: 0,
54
+ staleTime: 0
55
+ },
56
+ mutations: {
57
+ retry: false
58
+ }
59
+ }
60
+ });
61
+ }
62
+ var mockGetAccessToken = async () => "test-token";
63
+ function TestProviders({
64
+ children,
65
+ queryClient,
66
+ getAccessToken = mockGetAccessToken,
67
+ organizationId = "test-org-id",
68
+ isOrganizationReady = true
69
+ }) {
70
+ const client = queryClient ?? createTestQueryClient();
71
+ return /* @__PURE__ */ jsx(MantineProvider, { children: /* @__PURE__ */ jsx(QueryClientProvider, { client, children: /* @__PURE__ */ jsx(
72
+ ApiClientProvider,
73
+ {
74
+ getAccessToken,
75
+ getOrganizationId: () => organizationId ?? null,
76
+ organizationId,
77
+ isOrganizationReady,
78
+ children
79
+ }
80
+ ) }) });
81
+ }
82
+ function renderWithProviders(ui, options) {
83
+ const { queryClient, getAccessToken, organizationId, isOrganizationReady, ...renderOptions } = options ?? {};
84
+ return render(ui, {
85
+ wrapper: ({ children }) => /* @__PURE__ */ jsx(
86
+ TestProviders,
87
+ {
88
+ queryClient,
89
+ getAccessToken,
90
+ organizationId,
91
+ isOrganizationReady,
92
+ children
93
+ }
94
+ ),
95
+ ...renderOptions
96
+ });
97
+ }
98
+ function renderHookWithProviders(hook, options) {
99
+ const { queryClient, getAccessToken, organizationId, isOrganizationReady, ...renderHookOptions } = options ?? {};
100
+ return renderHook(hook, {
101
+ wrapper: ({ children }) => /* @__PURE__ */ jsx(
102
+ TestProviders,
103
+ {
104
+ queryClient,
105
+ getAccessToken,
106
+ organizationId,
107
+ isOrganizationReady,
108
+ children
109
+ }
110
+ ),
111
+ ...renderHookOptions
112
+ });
113
+ }
114
+ function createTestWrapper(options) {
115
+ return function Wrapper({ children }) {
116
+ return /* @__PURE__ */ jsx(TestProviders, { ...options, children });
117
+ };
118
+ }
119
+
120
+ // src/test-utils/index.ts
121
+ __reExport(test_utils_exports, render_exports);
122
+
123
+ // src/test-utils/mocks/feature-access.ts
124
+ function mockFeatureAccess({ allowed = true, restrictedBy } = {}) {
125
+ const result = {
126
+ allowed,
127
+ restrictedBy: restrictedBy ?? null
128
+ };
129
+ return {
130
+ isReady: true,
131
+ hasFeature: () => allowed,
132
+ checkFeature: () => result
133
+ };
134
+ }
135
+
136
+ export { TestProviders, createTestQueryClient, createTestWrapper, mockFeatureAccess, renderWithProviders as render, renderHookWithProviders, renderWithProviders };
@@ -0,0 +1,2 @@
1
+
2
+ export { };
@@ -0,0 +1,26 @@
1
+ import { setupBrowserMocks } from '../chunk-HJ4CJIWN.js';
2
+ import { mockUseAuth } from '../chunk-DRQPEMJI.js';
3
+ import '../chunk-I2KLQ2HA.js';
4
+ import '@testing-library/jest-dom/vitest';
5
+ import { cleanup } from '@testing-library/react';
6
+ import { vi, afterEach } from 'vitest';
7
+
8
+ setupBrowserMocks();
9
+ vi.mock("@workos-inc/authkit-react", () => ({
10
+ useAuth: () => mockUseAuth
11
+ }));
12
+ vi.mock("@elevasis/ui/auth/context", () => ({
13
+ useAuthContext: () => mockUseAuth,
14
+ AuthProvider: ({ children }) => children
15
+ }));
16
+ vi.mock("@elevasis/ui/router/context", () => ({
17
+ useRouterContext: () => ({
18
+ currentPath: "/",
19
+ navigate: vi.fn(),
20
+ Link: "a"
21
+ }),
22
+ RouterProvider: ({ children }) => children
23
+ }));
24
+ afterEach(() => {
25
+ cleanup();
26
+ });
@@ -0,0 +1,2 @@
1
+
2
+ export { };
@@ -0,0 +1,47 @@
1
+ import { server } from '../chunk-7XKCG5CT.js';
2
+ import { setupBrowserMocks } from '../chunk-HJ4CJIWN.js';
3
+ import { mockUseAuth } from '../chunk-DRQPEMJI.js';
4
+ import '../chunk-I2KLQ2HA.js';
5
+ import '@testing-library/jest-dom/vitest';
6
+ import { cleanup } from '@testing-library/react';
7
+ import { vi, beforeAll, afterEach, afterAll, expect } from 'vitest';
8
+
9
+ setupBrowserMocks();
10
+ vi.mock("@workos-inc/authkit-react", () => ({
11
+ useAuth: () => mockUseAuth
12
+ }));
13
+ vi.mock("@elevasis/ui/auth/context", () => ({
14
+ useAuthContext: () => mockUseAuth,
15
+ AuthProvider: ({ children }) => children
16
+ }));
17
+ vi.mock("@elevasis/ui/router/context", () => ({
18
+ useRouterContext: () => ({
19
+ currentPath: "/",
20
+ navigate: vi.fn(),
21
+ Link: "a"
22
+ }),
23
+ RouterProvider: ({ children }) => children
24
+ }));
25
+ var isIntegrationTest = () => {
26
+ try {
27
+ return expect.getState().testPath?.includes("integration.test") ?? false;
28
+ } catch {
29
+ return false;
30
+ }
31
+ };
32
+ if (!isIntegrationTest()) {
33
+ beforeAll(() => {
34
+ server.listen({ onUnhandledRequest: "warn" });
35
+ });
36
+ afterEach(() => {
37
+ cleanup();
38
+ server.resetHandlers();
39
+ });
40
+ afterAll(() => {
41
+ server.close();
42
+ });
43
+ } else {
44
+ afterEach(() => {
45
+ cleanup();
46
+ });
47
+ }
@@ -1,3 +1,4 @@
1
1
  export { useAvailablePresets } from '../chunk-TIIPYB2Z.js';
2
2
  export { PresetsProvider, TOKEN_VAR_MAP, componentThemes, createCssVariablesResolver, generateShades, getPreset, mantineThemeOverride, PRESETS as presets, usePresetsContext } from '../chunk-Q5HC6ENG.js';
3
3
  import '../chunk-WLOQ4IBG.js';
4
+ import '../chunk-I2KLQ2HA.js';
@@ -1,4 +1,5 @@
1
1
  export { answerValueSchema, checkboxWithOtherSchema, multiAnswerValueSchema, radioWithOtherSchema } from '../chunk-6M6OLGQY.js';
2
+ import '../chunk-I2KLQ2HA.js';
2
3
  import { createContext, useMemo, useState, useCallback, useEffect, useContext, useRef } from 'react';
3
4
  import { Box, Progress, Text, Group, Button, Kbd, Modal, Stack, Transition, Title, UnstyledButton, TextInput, Textarea, Center, Alert, Card, ActionIcon, Paper } from '@mantine/core';
4
5
  import { IconArrowLeft, IconCheck, IconArrowRight, IconPlus, IconPencil, IconTrash, IconX } from '@tabler/icons-react';
@@ -1 +1,2 @@
1
1
  export { answerValueSchema, checkboxWithOtherSchema, multiAnswerValueSchema, radioWithOtherSchema } from '../chunk-6M6OLGQY.js';
2
+ import '../chunk-I2KLQ2HA.js';
@@ -1,2 +1,3 @@
1
1
  export { APIClientError, API_URL, DEBOUNCE_FILTER, DEBOUNCE_SLIDER, DOMAIN_MAP, GC_TIME_LONG, GC_TIME_MEDIUM, GC_TIME_SHORT, LIMIT_ACTIVITY_FEED, OAUTH_FLOW_TIMEOUT, OAUTH_POPUP_CHECK_INTERVAL, PAGE_SIZE_DEFAULT, REFETCH_INTERVAL_DASHBOARD, REFETCH_INTERVAL_REALTIME, REFETCH_INTERVAL_RUNNING, REFETCH_INTERVAL_RUNNING_FAST, SSE_CLOSE_GRACE_PERIOD, SSE_TOKEN_REFRESH_DELAY, STALE_TIME_ADMIN, STALE_TIME_DEFAULT, STALE_TIME_MONITORING, 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-OD7GWIZS.js';
2
2
  export { ResourceStatusColors } from '../chunk-KRWALB24.js';
3
+ import '../chunk-I2KLQ2HA.js';
@@ -1,3 +1,5 @@
1
+ import '../chunk-I2KLQ2HA.js';
2
+
1
3
  // src/zustand/slices/sse.ts
2
4
  function resetSSEState(state) {
3
5
  state.sse.notificationCount = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/ui",
3
- "version": "2.19.0",
3
+ "version": "2.20.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",
@@ -162,6 +162,18 @@
162
162
  "./hooks/operations/command-view/utils/transformCommandViewData": {
163
163
  "types": "./dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts",
164
164
  "import": "./dist/hooks/operations/command-view/utils/transformCommandViewData.js"
165
+ },
166
+ "./test-utils": {
167
+ "types": "./dist/test-utils/index.d.ts",
168
+ "import": "./dist/test-utils/index.js"
169
+ },
170
+ "./test-utils/setup": {
171
+ "types": "./dist/test-utils/setup.d.ts",
172
+ "import": "./dist/test-utils/setup.js"
173
+ },
174
+ "./test-utils/setup-integration": {
175
+ "types": "./dist/test-utils/setup-integration.d.ts",
176
+ "import": "./dist/test-utils/setup-integration.js"
165
177
  }
166
178
  },
167
179
  "peerDependencies": {
@@ -185,7 +197,10 @@
185
197
  "@tabler/icons-react": "^3.27.0",
186
198
  "@xyflow/react": "^12.8.5",
187
199
  "recharts": "^3.2.1",
188
- "date-fns": "^4.1.0"
200
+ "date-fns": "^4.1.0",
201
+ "@testing-library/react": "^16.3.0",
202
+ "@testing-library/jest-dom": "^6.9.1",
203
+ "msw": "^2.11.0"
189
204
  },
190
205
  "devDependencies": {
191
206
  "@mantine/charts": "8.2.7",
@@ -206,9 +221,13 @@
206
221
  "tsup": "^8.0.0",
207
222
  "typescript": "5.9.2",
208
223
  "vite": "^7.0.0",
209
- "@repo/core": "0.9.0",
210
- "@repo/eslint-config": "0.0.0",
211
- "@repo/typescript-config": "0.0.0"
224
+ "@testing-library/react": "^16.3.0",
225
+ "@testing-library/jest-dom": "^6.9.1",
226
+ "msw": "^2.11.0",
227
+ "vitest": "^3.2.4",
228
+ "@repo/core": "0.10.0",
229
+ "@repo/typescript-config": "0.0.0",
230
+ "@repo/eslint-config": "0.0.0"
212
231
  },
213
232
  "dependencies": {
214
233
  "@dagrejs/dagre": "^1.1.4",
@@ -260,6 +279,15 @@
260
279
  },
261
280
  "@tiptap/starter-kit": {
262
281
  "optional": true
282
+ },
283
+ "@testing-library/react": {
284
+ "optional": true
285
+ },
286
+ "@testing-library/jest-dom": {
287
+ "optional": true
288
+ },
289
+ "msw": {
290
+ "optional": true
263
291
  }
264
292
  },
265
293
  "scripts": {
@@ -0,0 +1,5 @@
1
+ # UI Test Utilities
2
+
3
+ Published test helpers for consumers that test Elevasis UI composition.
4
+
5
+ Use `@elevasis/ui/test-utils` for provider-aware React rendering, WorkOS auth mocks, MSW handlers, and test query clients. Use `@elevasis/ui/test-utils/setup` or `@elevasis/ui/test-utils/setup-integration` from Vitest `setupFiles` when a consumer wants the shared browser and auth mocks.