@elevasis/ui 2.18.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 (93) hide show
  1. package/dist/{CoreAuthKitInner-I32JCNE7.js → CoreAuthKitInner-QC62UHTZ.js} +1 -0
  2. package/dist/api/index.js +3 -2
  3. package/dist/app/index.js +6 -5
  4. package/dist/auth/context.js +1 -0
  5. package/dist/auth/index.js +1 -0
  6. package/dist/charts/index.js +4 -3
  7. package/dist/{chunk-LT33DSMO.js → chunk-2CFOFSSG.js} +4 -4
  8. package/dist/chunk-3JCMO7SD.js +14 -0
  9. package/dist/chunk-7XKCG5CT.js +125 -0
  10. package/dist/{chunk-SQPM2QDH.js → chunk-BHR7IV72.js} +3 -2
  11. package/dist/{chunk-DDZMBNTY.js → chunk-CTTY6FUT.js} +2 -2
  12. package/dist/chunk-DRQPEMJI.js +42 -0
  13. package/dist/{chunk-EY322HXF.js → chunk-FMFX4K6E.js} +19 -6
  14. package/dist/{chunk-UA36WILN.js → chunk-GP3AFJYG.js} +145 -211
  15. package/dist/{chunk-P6TC4K7I.js → chunk-GTYUP7MB.js} +4 -4
  16. package/dist/chunk-HJ4CJIWN.js +38 -0
  17. package/dist/chunk-I2KLQ2HA.js +19 -0
  18. package/dist/{chunk-B6FIIEFO.js → chunk-JR5WNTLA.js} +128 -117
  19. package/dist/{chunk-A2AZY5SF.js → chunk-LR5CRY5A.js} +1 -1
  20. package/dist/{chunk-GRGRBWIO.js → chunk-M7W7CGPL.js} +1 -1
  21. package/dist/{chunk-SS2UVUSG.js → chunk-MZFJWCPH.js} +73 -121
  22. package/dist/{chunk-P3TFNFZS.js → chunk-OUYH2SBS.js} +3 -3
  23. package/dist/{chunk-66VY5EMV.js → chunk-PJVG3ISO.js} +5 -5
  24. package/dist/{chunk-I3LQGLUC.js → chunk-Q4QJOSVS.js} +1 -1
  25. package/dist/{chunk-R73EHHPN.js → chunk-Q5HC6ENG.js} +18 -2
  26. package/dist/{chunk-VDM6DQES.js → chunk-R7OJCNL3.js} +1 -1
  27. package/dist/{chunk-6RWMRQN5.js → chunk-TIIPYB2Z.js} +1 -1
  28. package/dist/{chunk-34NQLV2W.js → chunk-TO7QXDBX.js} +3 -3
  29. package/dist/{chunk-WP3IYOVJ.js → chunk-YP6T426C.js} +107 -56
  30. package/dist/{chunk-FM6LSZ45.js → chunk-ZE2KQSHL.js} +4 -4
  31. package/dist/components/chat/index.js +1 -0
  32. package/dist/components/index.d.ts +218 -2808
  33. package/dist/components/index.js +26 -25
  34. package/dist/components/navigation/index.js +1 -0
  35. package/dist/execution/index.js +1 -0
  36. package/dist/features/auth/index.js +1 -0
  37. package/dist/features/crm/index.d.ts +54 -53
  38. package/dist/features/crm/index.js +12 -11
  39. package/dist/features/dashboard/index.js +13 -12
  40. package/dist/features/delivery/index.d.ts +2642 -2605
  41. package/dist/features/delivery/index.js +12 -11
  42. package/dist/features/lead-gen/index.js +12 -22
  43. package/dist/features/monitoring/index.js +14 -13
  44. package/dist/features/monitoring/requests/index.d.ts +38 -27
  45. package/dist/features/monitoring/requests/index.js +213 -106
  46. package/dist/features/operations/index.d.ts +8 -26
  47. package/dist/features/operations/index.js +16 -15
  48. package/dist/features/seo/index.js +1 -0
  49. package/dist/features/settings/index.d.ts +36 -37
  50. package/dist/features/settings/index.js +13 -12
  51. package/dist/graph/index.js +1 -0
  52. package/dist/hooks/delivery/index.d.ts +2712 -2699
  53. package/dist/hooks/delivery/index.js +3 -2
  54. package/dist/hooks/index.d.ts +1674 -4617
  55. package/dist/hooks/index.js +11 -10
  56. package/dist/hooks/operations/command-view/utils/transformCommandViewData.js +1 -0
  57. package/dist/hooks/published.d.ts +1674 -4617
  58. package/dist/hooks/published.js +11 -10
  59. package/dist/index.d.ts +773 -3635
  60. package/dist/index.js +12 -11
  61. package/dist/initialization/index.js +1 -0
  62. package/dist/layout/index.d.ts +14 -2
  63. package/dist/layout/index.js +2 -1
  64. package/dist/organization/index.js +1 -0
  65. package/dist/profile/index.js +1 -0
  66. package/dist/provider/ElevasisServiceContext.js +1 -0
  67. package/dist/provider/index.d.ts +320 -249
  68. package/dist/provider/index.js +9 -8
  69. package/dist/provider/published.d.ts +320 -249
  70. package/dist/provider/published.js +6 -5
  71. package/dist/router/context.js +1 -0
  72. package/dist/router/index.js +1 -0
  73. package/dist/sse/index.d.ts +1 -6
  74. package/dist/sse/index.js +1 -1
  75. package/dist/supabase/index.js +1 -0
  76. package/dist/test-utils/index.d.ts +117 -0
  77. package/dist/test-utils/index.js +136 -0
  78. package/dist/test-utils/setup-integration.d.ts +2 -0
  79. package/dist/test-utils/setup-integration.js +26 -0
  80. package/dist/test-utils/setup.d.ts +2 -0
  81. package/dist/test-utils/setup.js +47 -0
  82. package/dist/theme/index.js +3 -2
  83. package/dist/typeform/index.js +1 -0
  84. package/dist/typeform/schemas.js +1 -0
  85. package/dist/types/index.d.ts +1604 -2489
  86. package/dist/utils/index.d.ts +32 -1
  87. package/dist/utils/index.js +2 -1
  88. package/dist/zustand/index.d.ts +4 -8
  89. package/dist/zustand/index.js +2 -0
  90. package/package.json +33 -5
  91. package/src/test-utils/README.md +5 -0
  92. package/dist/chunk-ADSSLKKP.js +0 -10
  93. /package/dist/{chunk-GCBWGGI6.js → chunk-OD7GWIZS.js} +0 -0
@@ -0,0 +1,117 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { QueryClient } from '@tanstack/react-query';
3
+ import { RenderHookOptions, RenderOptions, render, renderHook } from '@testing-library/react';
4
+ export * from '@testing-library/react';
5
+ import { ReactNode, ReactElement } from 'react';
6
+ import * as vitest from 'vitest';
7
+ import * as msw_node from 'msw/node';
8
+ import * as msw from 'msw';
9
+
10
+ declare function createTestQueryClient(): QueryClient;
11
+ interface TestProvidersProps {
12
+ children: ReactNode;
13
+ queryClient?: QueryClient;
14
+ getAccessToken?: () => Promise<string | undefined>;
15
+ organizationId?: string | null;
16
+ isOrganizationReady?: boolean;
17
+ }
18
+ declare function TestProviders({ children, queryClient, getAccessToken, organizationId, isOrganizationReady }: TestProvidersProps): react_jsx_runtime.JSX.Element;
19
+ interface CustomRenderOptions extends Omit<RenderOptions, 'wrapper'> {
20
+ queryClient?: QueryClient;
21
+ getAccessToken?: () => Promise<string | undefined>;
22
+ organizationId?: string | null;
23
+ isOrganizationReady?: boolean;
24
+ }
25
+ declare function renderWithProviders(ui: ReactElement, options?: CustomRenderOptions): ReturnType<typeof render>;
26
+ interface CustomRenderHookOptions<TProps> extends Omit<RenderHookOptions<TProps>, 'wrapper'> {
27
+ queryClient?: QueryClient;
28
+ getAccessToken?: () => Promise<string | undefined>;
29
+ organizationId?: string | null;
30
+ isOrganizationReady?: boolean;
31
+ }
32
+ declare function renderHookWithProviders<TResult, TProps>(hook: (props: TProps) => TResult, options?: CustomRenderHookOptions<TProps>): ReturnType<typeof renderHook<TResult, TProps>>;
33
+ declare function createTestWrapper(options?: Omit<TestProvidersProps, 'children'>): ({ children }: {
34
+ children: ReactNode;
35
+ }) => react_jsx_runtime.JSX.Element;
36
+
37
+ declare const mockWorkOSUser: {
38
+ id: string;
39
+ email: string;
40
+ firstName: string;
41
+ lastName: string;
42
+ emailVerified: boolean;
43
+ profilePictureUrl: null;
44
+ createdAt: string;
45
+ updatedAt: string;
46
+ };
47
+ declare const mockUseAuth: {
48
+ user: typeof mockWorkOSUser | null;
49
+ isLoading: boolean;
50
+ signIn: vitest.Mock<(...args: any[]) => any>;
51
+ signOut: vitest.Mock<(...args: any[]) => any>;
52
+ getAccessToken: vitest.Mock<(...args: any[]) => any>;
53
+ organizationId: string;
54
+ canRecover: vitest.Mock<() => boolean>;
55
+ };
56
+ declare function createMockUseAuth(overrides?: Partial<typeof mockUseAuth>): {
57
+ user: typeof mockWorkOSUser | null;
58
+ isLoading: boolean;
59
+ signIn: vitest.Mock<(...args: any[]) => any>;
60
+ signOut: vitest.Mock<(...args: any[]) => any>;
61
+ getAccessToken: vitest.Mock<(...args: any[]) => any>;
62
+ organizationId: string;
63
+ canRecover: vitest.Mock<() => boolean>;
64
+ };
65
+ declare const mockAuthenticatedUser: () => {
66
+ user: typeof mockWorkOSUser | null;
67
+ isLoading: boolean;
68
+ signIn: vitest.Mock<(...args: any[]) => any>;
69
+ signOut: vitest.Mock<(...args: any[]) => any>;
70
+ getAccessToken: vitest.Mock<(...args: any[]) => any>;
71
+ organizationId: string;
72
+ canRecover: vitest.Mock<() => boolean>;
73
+ };
74
+ declare const mockUnauthenticatedUser: () => {
75
+ user: typeof mockWorkOSUser | null;
76
+ isLoading: boolean;
77
+ signIn: vitest.Mock<(...args: any[]) => any>;
78
+ signOut: vitest.Mock<(...args: any[]) => any>;
79
+ getAccessToken: vitest.Mock<(...args: any[]) => any>;
80
+ organizationId: string;
81
+ canRecover: vitest.Mock<() => boolean>;
82
+ };
83
+ declare const mockAuthLoading: () => {
84
+ user: typeof mockWorkOSUser | null;
85
+ isLoading: boolean;
86
+ signIn: vitest.Mock<(...args: any[]) => any>;
87
+ signOut: vitest.Mock<(...args: any[]) => any>;
88
+ getAccessToken: vitest.Mock<(...args: any[]) => any>;
89
+ organizationId: string;
90
+ canRecover: vitest.Mock<() => boolean>;
91
+ };
92
+
93
+ declare const server: msw_node.SetupServerApi;
94
+
95
+ declare const handlers: msw.HttpHandler[];
96
+
97
+ type RestrictionSource = 'membership' | null;
98
+ interface FeatureAccessResult {
99
+ allowed: boolean;
100
+ restrictedBy: RestrictionSource;
101
+ }
102
+
103
+ type MockFeatureAccessOptions = {
104
+ allowed?: boolean;
105
+ restrictedBy?: FeatureAccessResult['restrictedBy'];
106
+ };
107
+ declare function mockFeatureAccess({ allowed, restrictedBy }?: MockFeatureAccessOptions): {
108
+ isReady: boolean;
109
+ hasFeature: () => boolean;
110
+ checkFeature: () => {
111
+ allowed: boolean;
112
+ restrictedBy: "membership" | null;
113
+ };
114
+ };
115
+
116
+ export { TestProviders, createMockUseAuth, createTestQueryClient, createTestWrapper, handlers, mockAuthLoading, mockAuthenticatedUser, mockFeatureAccess, mockUnauthenticatedUser, mockUseAuth, mockWorkOSUser, renderWithProviders as render, renderHookWithProviders, renderWithProviders, server };
117
+ export type { CustomRenderHookOptions, CustomRenderOptions, MockFeatureAccessOptions, TestProvidersProps };
@@ -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
- export { useAvailablePresets } from '../chunk-6RWMRQN5.js';
2
- export { PresetsProvider, TOKEN_VAR_MAP, componentThemes, createCssVariablesResolver, generateShades, getPreset, mantineThemeOverride, PRESETS as presets, usePresetsContext } from '../chunk-R73EHHPN.js';
1
+ export { useAvailablePresets } from '../chunk-TIIPYB2Z.js';
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';