@open-kingdom/shared-frontend-feature-user-management 0.0.2-13 → 0.0.2-16
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.
- package/README.md +136 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +293 -167
- package/dist/lib/components/invitations/InvitationList.component.d.ts +2 -0
- package/dist/lib/components/invitations/InvitationList.component.d.ts.map +1 -0
- package/dist/lib/components/invitations/index.d.ts +1 -0
- package/dist/lib/components/invitations/index.d.ts.map +1 -1
- package/dist/lib/components/shared/StatusBadge.component.d.ts +7 -0
- package/dist/lib/components/shared/StatusBadge.component.d.ts.map +1 -0
- package/dist/lib/components/users/UserList.component.d.ts.map +1 -1
- package/dist/lib/styles.d.ts +1 -0
- package/dist/lib/styles.d.ts.map +1 -1
- package/dist/lib/types.d.ts +10 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +6 -1
- package/.babelrc +0 -12
- package/jest.config.cts +0 -14
- package/src/index.ts +0 -4
- package/src/lib/components/invitations/AcceptInvitation.component.spec.tsx +0 -154
- package/src/lib/components/invitations/AcceptInvitation.component.tsx +0 -197
- package/src/lib/components/invitations/InviteUserModal.component.spec.tsx +0 -79
- package/src/lib/components/invitations/InviteUserModal.component.tsx +0 -121
- package/src/lib/components/invitations/index.ts +0 -2
- package/src/lib/components/shared/ConfirmDialog.component.spec.tsx +0 -45
- package/src/lib/components/shared/ConfirmDialog.component.tsx +0 -58
- package/src/lib/components/shared/FormField.component.spec.tsx +0 -50
- package/src/lib/components/shared/FormField.component.tsx +0 -34
- package/src/lib/components/shared/ModalOverlay.component.spec.tsx +0 -81
- package/src/lib/components/shared/ModalOverlay.component.tsx +0 -45
- package/src/lib/components/shared/RoleBadge.component.spec.tsx +0 -20
- package/src/lib/components/shared/RoleBadge.component.tsx +0 -25
- package/src/lib/components/shared/StatusCard.component.spec.tsx +0 -44
- package/src/lib/components/shared/StatusCard.component.tsx +0 -47
- package/src/lib/components/users/UserList.component.spec.tsx +0 -216
- package/src/lib/components/users/UserList.component.tsx +0 -153
- package/src/lib/styles.ts +0 -19
- package/src/lib/types.ts +0 -9
- package/tsconfig.json +0 -13
- package/tsconfig.lib.json +0 -47
- package/tsconfig.spec.json +0 -27
- package/vite.config.mts +0 -58
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
|
2
|
-
import '@testing-library/jest-dom';
|
|
3
|
-
import { Provider } from 'react-redux';
|
|
4
|
-
import { configureStore } from '@reduxjs/toolkit';
|
|
5
|
-
import type { ColDef } from 'ag-grid-community';
|
|
6
|
-
import { UserList } from './UserList.component';
|
|
7
|
-
|
|
8
|
-
const mockFindAllQuery = jest.fn();
|
|
9
|
-
const mockDeleteUser = jest.fn();
|
|
10
|
-
|
|
11
|
-
jest.mock('@open-kingdom/shared-frontend-data-access-api-client', () => ({
|
|
12
|
-
useUsersControllerFindAllQuery: () => mockFindAllQuery(),
|
|
13
|
-
useUsersControllerDeleteMutation: () => [
|
|
14
|
-
mockDeleteUser,
|
|
15
|
-
{ isLoading: false },
|
|
16
|
-
],
|
|
17
|
-
useInvitationsControllerInviteMutation: () => [
|
|
18
|
-
jest.fn(),
|
|
19
|
-
{ isLoading: false, error: null },
|
|
20
|
-
],
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
jest.mock('@open-kingdom/shared-frontend-data-access-notifications', () => ({
|
|
24
|
-
showSuccessNotification: jest.fn((msg: string) => ({
|
|
25
|
-
type: 'notify',
|
|
26
|
-
payload: msg,
|
|
27
|
-
})),
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
jest.mock('@open-kingdom/shared-frontend-ui-theme', () => ({
|
|
31
|
-
__esModule: true,
|
|
32
|
-
useTheme: () => ({ theme: {}, mode: 'light' }),
|
|
33
|
-
}));
|
|
34
|
-
|
|
35
|
-
let capturedColumnDefs: ColDef[] = [];
|
|
36
|
-
jest.mock('@open-kingdom/shared-frontend-ui-datagrid', () => ({
|
|
37
|
-
__esModule: true,
|
|
38
|
-
DataGrid: ({
|
|
39
|
-
rowData,
|
|
40
|
-
loading,
|
|
41
|
-
columnDefs,
|
|
42
|
-
}: {
|
|
43
|
-
rowData: Record<string, unknown>[];
|
|
44
|
-
loading: boolean;
|
|
45
|
-
columnDefs: ColDef[];
|
|
46
|
-
}) => {
|
|
47
|
-
capturedColumnDefs = columnDefs;
|
|
48
|
-
const rows = rowData ?? [];
|
|
49
|
-
return (
|
|
50
|
-
<div data-testid="data-grid">
|
|
51
|
-
{loading && <span>Loading...</span>}
|
|
52
|
-
{!loading &&
|
|
53
|
-
rows.map((row, i) => (
|
|
54
|
-
<div key={i} data-testid="grid-row">
|
|
55
|
-
{columnDefs.map((col, j) => {
|
|
56
|
-
const value = col.valueGetter
|
|
57
|
-
? (col.valueGetter as CallableFunction)({ data: row })
|
|
58
|
-
: (row as Record<string, unknown>)[col.field as string];
|
|
59
|
-
const rendered = col.cellRenderer
|
|
60
|
-
? (col.cellRenderer as CallableFunction)({ data: row })
|
|
61
|
-
: value;
|
|
62
|
-
return <span key={j}>{rendered}</span>;
|
|
63
|
-
})}
|
|
64
|
-
</div>
|
|
65
|
-
))}
|
|
66
|
-
</div>
|
|
67
|
-
);
|
|
68
|
-
},
|
|
69
|
-
}));
|
|
70
|
-
|
|
71
|
-
jest.mock('../shared/ConfirmDialog.component', () => ({
|
|
72
|
-
__esModule: true,
|
|
73
|
-
ConfirmDialog: ({
|
|
74
|
-
isOpen,
|
|
75
|
-
title,
|
|
76
|
-
onConfirm,
|
|
77
|
-
onCancel,
|
|
78
|
-
}: {
|
|
79
|
-
isOpen: boolean;
|
|
80
|
-
title: string;
|
|
81
|
-
message: string;
|
|
82
|
-
confirmLabel: string;
|
|
83
|
-
onConfirm: () => void;
|
|
84
|
-
onCancel: () => void;
|
|
85
|
-
isLoading: boolean;
|
|
86
|
-
}) =>
|
|
87
|
-
isOpen ? (
|
|
88
|
-
<div data-testid="confirm-dialog">
|
|
89
|
-
<span>{title}</span>
|
|
90
|
-
<button onClick={onConfirm}>Confirm</button>
|
|
91
|
-
<button onClick={onCancel}>Cancel</button>
|
|
92
|
-
</div>
|
|
93
|
-
) : null,
|
|
94
|
-
}));
|
|
95
|
-
|
|
96
|
-
jest.mock('../shared/RoleBadge.component', () => ({
|
|
97
|
-
__esModule: true,
|
|
98
|
-
RoleBadge: ({ role }: { role: string }) => (
|
|
99
|
-
<span data-testid="role-badge">{role}</span>
|
|
100
|
-
),
|
|
101
|
-
}));
|
|
102
|
-
|
|
103
|
-
jest.mock('../invitations', () => ({
|
|
104
|
-
__esModule: true,
|
|
105
|
-
InviteUserModal: () => null,
|
|
106
|
-
}));
|
|
107
|
-
|
|
108
|
-
const store = configureStore({ reducer: {} });
|
|
109
|
-
|
|
110
|
-
function renderWithProviders(ui: React.ReactElement) {
|
|
111
|
-
return render(<Provider store={store}>{ui}</Provider>);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const mockUsers = [
|
|
115
|
-
{
|
|
116
|
-
id: 1,
|
|
117
|
-
email: 'admin@test.com',
|
|
118
|
-
firstName: 'Admin',
|
|
119
|
-
lastName: 'User',
|
|
120
|
-
role: 'admin',
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: 2,
|
|
124
|
-
email: 'guest@test.com',
|
|
125
|
-
firstName: null,
|
|
126
|
-
lastName: null,
|
|
127
|
-
role: 'guest',
|
|
128
|
-
},
|
|
129
|
-
];
|
|
130
|
-
|
|
131
|
-
describe('UserList', () => {
|
|
132
|
-
beforeEach(() => {
|
|
133
|
-
mockDeleteUser.mockReset();
|
|
134
|
-
mockDeleteUser.mockReturnValue({ unwrap: () => Promise.resolve() });
|
|
135
|
-
capturedColumnDefs = [];
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it('shows a loading indicator while fetching users', () => {
|
|
139
|
-
mockFindAllQuery.mockReturnValue({
|
|
140
|
-
data: undefined,
|
|
141
|
-
isLoading: true,
|
|
142
|
-
error: null,
|
|
143
|
-
refetch: jest.fn(),
|
|
144
|
-
});
|
|
145
|
-
renderWithProviders(<UserList />);
|
|
146
|
-
expect(screen.getByText('Loading...')).toBeInTheDocument();
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('shows the user list with an invite button', () => {
|
|
150
|
-
mockFindAllQuery.mockReturnValue({
|
|
151
|
-
data: mockUsers,
|
|
152
|
-
isLoading: false,
|
|
153
|
-
error: null,
|
|
154
|
-
refetch: jest.fn(),
|
|
155
|
-
});
|
|
156
|
-
renderWithProviders(<UserList />);
|
|
157
|
-
expect(screen.getByText('Users')).toBeInTheDocument();
|
|
158
|
-
expect(screen.getByText('Invite User')).toBeInTheDocument();
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('shows an error with a retry option when loading fails', () => {
|
|
162
|
-
mockFindAllQuery.mockReturnValue({
|
|
163
|
-
data: undefined,
|
|
164
|
-
isLoading: false,
|
|
165
|
-
error: { status: 500 },
|
|
166
|
-
refetch: jest.fn(),
|
|
167
|
-
});
|
|
168
|
-
renderWithProviders(<UserList />);
|
|
169
|
-
expect(screen.getByText('Failed to load users.')).toBeInTheDocument();
|
|
170
|
-
expect(screen.getByText('Try again')).toBeInTheDocument();
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('retries loading users when clicking "Try again"', () => {
|
|
174
|
-
const refetch = jest.fn();
|
|
175
|
-
mockFindAllQuery.mockReturnValue({
|
|
176
|
-
data: undefined,
|
|
177
|
-
isLoading: false,
|
|
178
|
-
error: { status: 500 },
|
|
179
|
-
refetch,
|
|
180
|
-
});
|
|
181
|
-
renderWithProviders(<UserList />);
|
|
182
|
-
fireEvent.click(screen.getByText('Try again'));
|
|
183
|
-
expect(refetch).toHaveBeenCalled();
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
it('asks for confirmation before deleting a user', async () => {
|
|
187
|
-
mockFindAllQuery.mockReturnValue({
|
|
188
|
-
data: mockUsers,
|
|
189
|
-
isLoading: false,
|
|
190
|
-
error: null,
|
|
191
|
-
refetch: jest.fn(),
|
|
192
|
-
});
|
|
193
|
-
renderWithProviders(<UserList currentUserId={1} />);
|
|
194
|
-
|
|
195
|
-
const actionsCol = capturedColumnDefs.find(
|
|
196
|
-
(c) => c.headerName === 'Actions'
|
|
197
|
-
);
|
|
198
|
-
const { container } = render(
|
|
199
|
-
<Provider store={store}>
|
|
200
|
-
{(actionsCol?.cellRenderer as CallableFunction)({ data: mockUsers[1] })}
|
|
201
|
-
</Provider>
|
|
202
|
-
);
|
|
203
|
-
const deleteBtn = container.querySelector('button');
|
|
204
|
-
expect(deleteBtn).toBeTruthy();
|
|
205
|
-
fireEvent.click(deleteBtn as HTMLElement);
|
|
206
|
-
|
|
207
|
-
await waitFor(() => {
|
|
208
|
-
expect(screen.getByTestId('confirm-dialog')).toBeInTheDocument();
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
fireEvent.click(screen.getByText('Confirm'));
|
|
212
|
-
await waitFor(() => {
|
|
213
|
-
expect(mockDeleteUser).toHaveBeenCalledWith({ id: 2 });
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
});
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { useState, useMemo, useCallback } from 'react';
|
|
2
|
-
import { useDispatch } from 'react-redux';
|
|
3
|
-
import type { ColDef, ICellRendererParams } from 'ag-grid-community';
|
|
4
|
-
import {
|
|
5
|
-
useUsersControllerFindAllQuery,
|
|
6
|
-
useUsersControllerDeleteMutation,
|
|
7
|
-
} from '@open-kingdom/shared-frontend-data-access-api-client';
|
|
8
|
-
import { showSuccessNotification } from '@open-kingdom/shared-frontend-data-access-notifications';
|
|
9
|
-
import {
|
|
10
|
-
DataGrid,
|
|
11
|
-
type DataGridTheme,
|
|
12
|
-
} from '@open-kingdom/shared-frontend-ui-datagrid';
|
|
13
|
-
import { useTheme } from '@open-kingdom/shared-frontend-ui-theme';
|
|
14
|
-
import { ConfirmDialog } from '../shared/ConfirmDialog.component';
|
|
15
|
-
import { RoleBadge } from '../shared/RoleBadge.component';
|
|
16
|
-
import { InviteUserModal } from '../invitations';
|
|
17
|
-
import { buttonPrimaryStyles } from '../../styles';
|
|
18
|
-
import type { User } from '../../types';
|
|
19
|
-
|
|
20
|
-
interface UserListProps {
|
|
21
|
-
currentUserId?: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function UserList({ currentUserId }: UserListProps) {
|
|
25
|
-
const dispatch = useDispatch();
|
|
26
|
-
const { theme, mode } = useTheme();
|
|
27
|
-
const { data, isLoading, error, refetch } = useUsersControllerFindAllQuery();
|
|
28
|
-
const [deleteUser, { isLoading: isDeleting }] =
|
|
29
|
-
useUsersControllerDeleteMutation();
|
|
30
|
-
|
|
31
|
-
const [showInviteModal, setShowInviteModal] = useState(false);
|
|
32
|
-
const [userToDelete, setUserToDelete] = useState<User | null>(null);
|
|
33
|
-
|
|
34
|
-
const users = (data as User[] | undefined) ?? [];
|
|
35
|
-
|
|
36
|
-
const handleDeleteConfirm = useCallback(async () => {
|
|
37
|
-
if (!userToDelete) return;
|
|
38
|
-
try {
|
|
39
|
-
await deleteUser({ id: userToDelete.id }).unwrap();
|
|
40
|
-
dispatch(showSuccessNotification('User deleted successfully'));
|
|
41
|
-
} catch {
|
|
42
|
-
// Error notification handled by RTK error middleware
|
|
43
|
-
} finally {
|
|
44
|
-
setUserToDelete(null);
|
|
45
|
-
}
|
|
46
|
-
}, [userToDelete, deleteUser, dispatch]);
|
|
47
|
-
|
|
48
|
-
const columnDefs = useMemo<ColDef<User>[]>(
|
|
49
|
-
() => [
|
|
50
|
-
{ field: 'email', headerName: 'Email', flex: 2 },
|
|
51
|
-
{
|
|
52
|
-
headerName: 'Name',
|
|
53
|
-
flex: 2,
|
|
54
|
-
valueGetter: (params) => {
|
|
55
|
-
const { firstName, lastName } = params.data ?? {};
|
|
56
|
-
return [firstName, lastName].filter(Boolean).join(' ') || '—';
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
field: 'role',
|
|
61
|
-
headerName: 'Role',
|
|
62
|
-
flex: 1,
|
|
63
|
-
cellRenderer: (params: ICellRendererParams<User>) =>
|
|
64
|
-
params.data ? <RoleBadge role={params.data.role} /> : null,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
headerName: 'Actions',
|
|
68
|
-
flex: 1,
|
|
69
|
-
sortable: false,
|
|
70
|
-
filter: false,
|
|
71
|
-
cellRenderer: (params: ICellRendererParams<User>) => {
|
|
72
|
-
if (!params.data) return null;
|
|
73
|
-
const isSelf = params.data.id === currentUserId;
|
|
74
|
-
return (
|
|
75
|
-
<button
|
|
76
|
-
onClick={() => params.data && setUserToDelete(params.data)}
|
|
77
|
-
disabled={isSelf}
|
|
78
|
-
title={isSelf ? 'Cannot delete your own account' : 'Delete user'}
|
|
79
|
-
className="rounded px-2 py-1 text-xs font-medium text-error-600 transition-colors hover:bg-error-50 disabled:cursor-not-allowed disabled:opacity-40 dark:text-error-400 dark:hover:bg-error-900/20"
|
|
80
|
-
>
|
|
81
|
-
Delete
|
|
82
|
-
</button>
|
|
83
|
-
);
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
[currentUserId]
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
if (error) {
|
|
91
|
-
return (
|
|
92
|
-
<div
|
|
93
|
-
data-testid="users-error"
|
|
94
|
-
className="rounded-lg bg-error-50 p-6 text-center dark:bg-error-900/20"
|
|
95
|
-
role="alert"
|
|
96
|
-
>
|
|
97
|
-
<p className="text-error-700 dark:text-error-300">
|
|
98
|
-
Failed to load users.
|
|
99
|
-
</p>
|
|
100
|
-
<button
|
|
101
|
-
data-testid="users-retry-btn"
|
|
102
|
-
onClick={refetch}
|
|
103
|
-
className="mt-2 text-sm font-medium text-primary-600 hover:underline dark:text-primary-400"
|
|
104
|
-
>
|
|
105
|
-
Try again
|
|
106
|
-
</button>
|
|
107
|
-
</div>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return (
|
|
112
|
-
<div>
|
|
113
|
-
<div className="mb-4 flex items-center justify-between">
|
|
114
|
-
<h2
|
|
115
|
-
data-testid="users-heading"
|
|
116
|
-
className="text-xl font-semibold text-neutral-900 dark:text-neutral-100"
|
|
117
|
-
>
|
|
118
|
-
Users
|
|
119
|
-
</h2>
|
|
120
|
-
<button
|
|
121
|
-
data-testid="invite-user-btn"
|
|
122
|
-
onClick={() => setShowInviteModal(true)}
|
|
123
|
-
className={buttonPrimaryStyles}
|
|
124
|
-
>
|
|
125
|
-
Invite User
|
|
126
|
-
</button>
|
|
127
|
-
</div>
|
|
128
|
-
|
|
129
|
-
<DataGrid
|
|
130
|
-
rowData={users}
|
|
131
|
-
columnDefs={columnDefs}
|
|
132
|
-
mode={mode}
|
|
133
|
-
theme={theme as DataGridTheme}
|
|
134
|
-
loading={isLoading}
|
|
135
|
-
/>
|
|
136
|
-
|
|
137
|
-
<InviteUserModal
|
|
138
|
-
isOpen={showInviteModal}
|
|
139
|
-
onClose={() => setShowInviteModal(false)}
|
|
140
|
-
/>
|
|
141
|
-
|
|
142
|
-
<ConfirmDialog
|
|
143
|
-
isOpen={!!userToDelete}
|
|
144
|
-
title="Delete User"
|
|
145
|
-
message={`Are you sure you want to delete ${userToDelete?.email}? This action cannot be undone.`}
|
|
146
|
-
confirmLabel={isDeleting ? 'Deleting...' : 'Delete'}
|
|
147
|
-
onConfirm={handleDeleteConfirm}
|
|
148
|
-
onCancel={() => setUserToDelete(null)}
|
|
149
|
-
isLoading={isDeleting}
|
|
150
|
-
/>
|
|
151
|
-
</div>
|
|
152
|
-
);
|
|
153
|
-
}
|
package/src/lib/styles.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const inputStyles =
|
|
2
|
-
'w-full px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md bg-white dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100';
|
|
3
|
-
|
|
4
|
-
export const labelStyles =
|
|
5
|
-
'block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-1';
|
|
6
|
-
|
|
7
|
-
export const cardStyles =
|
|
8
|
-
'max-w-md mx-auto mt-8 p-6 bg-white dark:bg-neutral-800 rounded-lg shadow-lg';
|
|
9
|
-
|
|
10
|
-
export const bodyTextStyles = 'text-neutral-600 dark:text-neutral-400';
|
|
11
|
-
|
|
12
|
-
const buttonBaseStyles =
|
|
13
|
-
'rounded-md px-4 py-2 text-sm font-medium transition-colors';
|
|
14
|
-
|
|
15
|
-
export const buttonPrimaryStyles = `${buttonBaseStyles} bg-primary-500 text-white hover:bg-primary-600 disabled:opacity-50`;
|
|
16
|
-
|
|
17
|
-
export const buttonSecondaryStyles = `${buttonBaseStyles} border border-neutral-300 text-neutral-700 hover:bg-neutral-50 dark:border-neutral-600 dark:text-neutral-300 dark:hover:bg-neutral-700`;
|
|
18
|
-
|
|
19
|
-
export const buttonDangerStyles = `${buttonBaseStyles} bg-error-500 text-white hover:bg-error-600 disabled:opacity-50`;
|
package/src/lib/types.ts
DELETED
package/tsconfig.json
DELETED
package/tsconfig.lib.json
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "dist",
|
|
5
|
-
"types": [
|
|
6
|
-
"node",
|
|
7
|
-
"@nx/react/typings/cssmodule.d.ts",
|
|
8
|
-
"@nx/react/typings/image.d.ts",
|
|
9
|
-
"vite/client"
|
|
10
|
-
],
|
|
11
|
-
"rootDir": "src",
|
|
12
|
-
"jsx": "react-jsx",
|
|
13
|
-
"tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo",
|
|
14
|
-
"lib": ["dom", "dom.iterable", "es2022"]
|
|
15
|
-
},
|
|
16
|
-
"exclude": [
|
|
17
|
-
"out-tsc",
|
|
18
|
-
"dist",
|
|
19
|
-
"**/*.spec.ts",
|
|
20
|
-
"**/*.test.ts",
|
|
21
|
-
"**/*.spec.tsx",
|
|
22
|
-
"**/*.test.tsx",
|
|
23
|
-
"**/*.spec.js",
|
|
24
|
-
"**/*.test.js",
|
|
25
|
-
"**/*.spec.jsx",
|
|
26
|
-
"**/*.test.jsx",
|
|
27
|
-
"jest.config.ts",
|
|
28
|
-
"jest.config.cts",
|
|
29
|
-
"src/**/*.spec.ts",
|
|
30
|
-
"src/**/*.test.ts"
|
|
31
|
-
],
|
|
32
|
-
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"],
|
|
33
|
-
"references": [
|
|
34
|
-
{
|
|
35
|
-
"path": "../ui-theme/tsconfig.lib.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../ui-datagrid/tsconfig.lib.json"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"path": "../data-access-notifications/tsconfig.lib.json"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"path": "../data-access-api-client/tsconfig.lib.json"
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "./out-tsc/jest",
|
|
5
|
-
"lib": ["es2022", "dom"],
|
|
6
|
-
"jsx": "react-jsx",
|
|
7
|
-
"types": ["jest", "node"]
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"jest.config.ts",
|
|
11
|
-
"jest.config.cts",
|
|
12
|
-
"src/**/*.test.ts",
|
|
13
|
-
"src/**/*.spec.ts",
|
|
14
|
-
"src/**/*.test.tsx",
|
|
15
|
-
"src/**/*.spec.tsx",
|
|
16
|
-
"src/**/*.test.js",
|
|
17
|
-
"src/**/*.spec.js",
|
|
18
|
-
"src/**/*.test.jsx",
|
|
19
|
-
"src/**/*.spec.jsx",
|
|
20
|
-
"src/**/*.d.ts"
|
|
21
|
-
],
|
|
22
|
-
"references": [
|
|
23
|
-
{
|
|
24
|
-
"path": "./tsconfig.lib.json"
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
package/vite.config.mts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/// <reference types='vitest' />
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
import react from '@vitejs/plugin-react';
|
|
4
|
-
import dts from 'vite-plugin-dts';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
|
|
7
|
-
export default defineConfig(() => ({
|
|
8
|
-
root: import.meta.dirname,
|
|
9
|
-
cacheDir:
|
|
10
|
-
'../../../../node_modules/.vite/libs/shared/frontend/feature-user-management',
|
|
11
|
-
plugins: [
|
|
12
|
-
react(),
|
|
13
|
-
dts({
|
|
14
|
-
entryRoot: 'src',
|
|
15
|
-
tsconfigPath: path.join(import.meta.dirname, 'tsconfig.lib.json'),
|
|
16
|
-
}),
|
|
17
|
-
],
|
|
18
|
-
// Uncomment this if you are using workers.
|
|
19
|
-
// worker: {
|
|
20
|
-
// plugins: [],
|
|
21
|
-
// },
|
|
22
|
-
// Configuration for building your library.
|
|
23
|
-
// See: https://vite.dev/guide/build.html#library-mode
|
|
24
|
-
build: {
|
|
25
|
-
outDir: './dist',
|
|
26
|
-
emptyOutDir: true,
|
|
27
|
-
reportCompressedSize: true,
|
|
28
|
-
commonjsOptions: {
|
|
29
|
-
transformMixedEsModules: true,
|
|
30
|
-
},
|
|
31
|
-
lib: {
|
|
32
|
-
// Could also be a dictionary or array of multiple entry points.
|
|
33
|
-
entry: 'src/index.ts',
|
|
34
|
-
name: '@open-kingdom/feature-user-management',
|
|
35
|
-
fileName: 'index',
|
|
36
|
-
// Change this to the formats you want to support.
|
|
37
|
-
// Don't forget to update your package.json as well.
|
|
38
|
-
formats: ['es' as const],
|
|
39
|
-
},
|
|
40
|
-
rollupOptions: {
|
|
41
|
-
// External packages that should not be bundled into your library.
|
|
42
|
-
external: [
|
|
43
|
-
'react',
|
|
44
|
-
'react-dom',
|
|
45
|
-
'react/jsx-runtime',
|
|
46
|
-
'react-redux',
|
|
47
|
-
'@reduxjs/toolkit',
|
|
48
|
-
'react-hook-form',
|
|
49
|
-
/^@hookform\/resolvers\/.*/,
|
|
50
|
-
'zod',
|
|
51
|
-
'ag-grid-community',
|
|
52
|
-
/^ag-grid-community\/.*/,
|
|
53
|
-
'@react-hookz/web',
|
|
54
|
-
/^@open-kingdom\/.*/,
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
}));
|