@deix/rossini-identity-management 0.2.1 → 1.1.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.
- package/lib/components/AddItemDialog.d.ts.map +1 -1
- package/lib/components/DeleteConfirmationDialog.d.ts.map +1 -1
- package/lib/components/SearchField.d.ts.map +1 -1
- package/lib/components/groups/CreateGroupDialog.d.ts.map +1 -1
- package/lib/components/groups/GroupDetails.d.ts.map +1 -1
- package/lib/components/groups/GroupForm.d.ts.map +1 -1
- package/lib/components/groups/GroupTabs.d.ts.map +1 -1
- package/lib/components/groups/GroupUsers.d.ts.map +1 -1
- package/lib/components/groups/Groups.d.ts.map +1 -1
- package/lib/components/groups/GroupsTable.d.ts.map +1 -1
- package/lib/components/users/CreateUserDialog.d.ts +3 -1
- package/lib/components/users/CreateUserDialog.d.ts.map +1 -1
- package/lib/components/users/CreateUserDialog.js +9 -3
- package/lib/components/users/UserCredentials.d.ts.map +1 -1
- package/lib/components/users/UserDetails.d.ts +2 -1
- package/lib/components/users/UserDetails.d.ts.map +1 -1
- package/lib/components/users/UserDetails.js +2 -2
- package/lib/components/users/UserForm.d.ts +2 -1
- package/lib/components/users/UserForm.d.ts.map +1 -1
- package/lib/components/users/UserForm.js +6 -4
- package/lib/components/users/UserGroups.d.ts.map +1 -1
- package/lib/components/users/Users.d.ts +4 -1
- package/lib/components/users/Users.d.ts.map +1 -1
- package/lib/components/users/Users.js +5 -5
- package/lib/components/users/UsersTable.d.ts +2 -1
- package/lib/components/users/UsersTable.d.ts.map +1 -1
- package/lib/components/users/UsersTable.js +5 -3
- package/lib/components/users/UsersTabs.d.ts +3 -1
- package/lib/components/users/UsersTabs.d.ts.map +1 -1
- package/lib/components/users/UsersTabs.js +4 -4
- package/lib/config/index.d.ts.map +1 -1
- package/lib/config/palette.d.ts.map +1 -1
- package/lib/config/palette.js +0 -6
- package/lib/index.d.ts +6 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -0
- package/lib/lang/groups.d.ts.map +1 -1
- package/lib/lang/home.d.ts.map +1 -1
- package/lib/lang/users.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/hooks/groups.d.ts.map +1 -1
- package/lib/utils/hooks/useAPIClient.d.ts.map +1 -1
- package/lib/utils/hooks/users.d.ts +12 -2
- package/lib/utils/hooks/users.d.ts.map +1 -1
- package/lib/utils/hooks/users.js +26 -12
- package/package.json +54 -47
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/groups.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAUzC,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/groups.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAUzC,eAAO,MAAM,SAAS,GACpB,WAAW,aAAa,KACvB,cAAc,CAAC,KAAK,EAAE,GAAG,SAAS,EAAE,KAAK,CAM3C,CAAC;AAcF,eAAO,MAAM,WAAW,GACtB,aAAa,WAAW,EACxB,WAAW,aAAa,oDA6BzB,CAAC;AAiBF,eAAO,MAAM,cAAc,GACzB,aAAa,WAAW,EACxB,WAAW,aAAa,oDA8BzB,CAAC;AAgBF,eAAO,MAAM,cAAc,GACzB,aAAa,WAAW,EACxB,WAAW,aAAa,6EA6BzB,CAAC;AAgBF,eAAO,MAAM,aAAa,GACxB,IAAI,MAAM,GAAG,SAAS,EACtB,WAAW,aAAa,KACvB,cAAc,CAAC,IAAI,EAAE,GAAG,SAAS,EAAE,KAAK,CAM1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAPIClient.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useAPIClient.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAoC,MAAM,OAAO,CAAC;AAUzD,UAAU,sBAAsB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"useAPIClient.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useAPIClient.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAoC,MAAM,OAAO,CAAC;AAUzD,UAAU,sBAAsB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,GAAI,wBAG/B,sBAAsB,sBAaxB,CAAC;AAEF,eAAO,MAAM,YAAY,qBAA+B,CAAC"}
|
|
@@ -3,9 +3,19 @@ import { AxiosInstance } from 'axios';
|
|
|
3
3
|
import { User } from '../../types/users';
|
|
4
4
|
import { Group } from '../../types/groups';
|
|
5
5
|
import { UserFormFields } from '../../components/users/UserForm';
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const getUsers: (apiClient: AxiosInstance, username?: string, group?: string) => Promise<User[]>;
|
|
7
|
+
export declare const useUsers: (apiClient: AxiosInstance, group?: string) => UseQueryResult<User[] | undefined, Error>;
|
|
7
8
|
export declare const useUser: (id: string, apiClient: AxiosInstance) => UseQueryResult<User | undefined, Error>;
|
|
8
|
-
export declare const
|
|
9
|
+
export declare const addUser: ({ newUser, sendEmailOnCreation, apiClient, groups, }: {
|
|
10
|
+
newUser: User;
|
|
11
|
+
sendEmailOnCreation: boolean;
|
|
12
|
+
apiClient: AxiosInstance;
|
|
13
|
+
groups?: string[];
|
|
14
|
+
}) => Promise<null>;
|
|
15
|
+
export declare const useAddUser: (queryClient: QueryClient, apiClient: AxiosInstance) => UseMutationResult<null, Error, {
|
|
16
|
+
data: UserFormFields;
|
|
17
|
+
groups: string[] | undefined;
|
|
18
|
+
}, unknown>;
|
|
9
19
|
export declare const useUpdateUser: (queryClient: QueryClient, apiClient: AxiosInstance) => UseMutationResult<User, Error, User, unknown>;
|
|
10
20
|
export declare const useDeleteUser: (queryClient: QueryClient, apiClient: AxiosInstance) => UseMutationResult<User | undefined, Error, string | undefined, unknown>;
|
|
11
21
|
export declare const useUserGroups: (id: string | undefined, apiClient: AxiosInstance) => UseQueryResult<Group[] | undefined, Error>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/users.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/users.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAC/B,OAA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;WA8BtE,CAAC;AAmBF,eAAO,MAAM,sBAAsB,GACjC,aAAa,WAAW,EACxB,WAAW,aAAa;;;;YAIsB,MAAM;aAAW,MAAM;WA8BtE,CAAC;AAkBF,eAAO,MAAM,0BAA0B,GACrC,aAAa,WAAW,EACxB,WAAW,aAAa;;0BAoBzB,CAAC"}
|
package/lib/utils/hooks/users.js
CHANGED
|
@@ -3,16 +3,30 @@ import { enqueueSnackbar } from 'notistack';
|
|
|
3
3
|
import { useLocale } from '@deix/rossini-core';
|
|
4
4
|
import usersTranslations from '../../lang/users';
|
|
5
5
|
// Get list of users
|
|
6
|
-
const getUsers = async (apiClient, username) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export const getUsers = async (apiClient, username, group) => {
|
|
7
|
+
if (group) {
|
|
8
|
+
const { data: groupData } = await apiClient.get(`/groups`, {
|
|
9
|
+
params: { max: 1, search: group },
|
|
10
|
+
});
|
|
11
|
+
if (groupData.length === 1) {
|
|
12
|
+
const { data } = await apiClient.get(`/groups/${groupData[0].id}/members`);
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const { data } = await apiClient.get(`/users`, {
|
|
21
|
+
params: { max: 1000, username },
|
|
22
|
+
});
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
11
25
|
};
|
|
12
|
-
export const useUsers = (apiClient) => {
|
|
26
|
+
export const useUsers = (apiClient, group) => {
|
|
13
27
|
return useQuery({
|
|
14
|
-
queryKey: ['users'],
|
|
15
|
-
queryFn: () => getUsers(apiClient),
|
|
28
|
+
queryKey: ['users', `users-${JSON.stringify(group)}`],
|
|
29
|
+
queryFn: () => getUsers(apiClient, undefined, group),
|
|
16
30
|
staleTime: 0,
|
|
17
31
|
});
|
|
18
32
|
};
|
|
@@ -29,8 +43,8 @@ export const useUser = (id, apiClient) => {
|
|
|
29
43
|
});
|
|
30
44
|
};
|
|
31
45
|
// Add user
|
|
32
|
-
const addUser = async ({ newUser, sendEmailOnCreation, apiClient, }) => {
|
|
33
|
-
await apiClient.post(`/users`, newUser);
|
|
46
|
+
export const addUser = async ({ newUser, sendEmailOnCreation, apiClient, groups, }) => {
|
|
47
|
+
await apiClient.post(`/users`, { ...newUser, groups });
|
|
34
48
|
if (sendEmailOnCreation) {
|
|
35
49
|
// The POST does not return the newly created user, so we have to search for
|
|
36
50
|
// it in order to get its ID and send the email
|
|
@@ -44,9 +58,9 @@ const addUser = async ({ newUser, sendEmailOnCreation, apiClient, }) => {
|
|
|
44
58
|
export const useAddUser = (queryClient, apiClient) => {
|
|
45
59
|
const locale = useLocale();
|
|
46
60
|
return useMutation({
|
|
47
|
-
mutationFn: (data) => {
|
|
61
|
+
mutationFn: ({ data, groups, }) => {
|
|
48
62
|
const { sendEmailOnCreation, ...newUser } = data;
|
|
49
|
-
return addUser({ newUser, sendEmailOnCreation, apiClient });
|
|
63
|
+
return addUser({ newUser, sendEmailOnCreation, apiClient, groups });
|
|
50
64
|
},
|
|
51
65
|
onError: (error) => {
|
|
52
66
|
enqueueSnackbar(`${usersTranslations.addUserError[locale]}. ${error.message}`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deix/rossini-identity-management",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,60 +20,67 @@
|
|
|
20
20
|
"dev": "next dev"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@emotion/react": "^11.
|
|
24
|
-
"@emotion/styled": "^11.
|
|
25
|
-
"@fontsource/raleway": "^5.
|
|
26
|
-
"@mui/icons-material": "^
|
|
27
|
-
"@mui/material": "^
|
|
28
|
-
"@tanstack/react-query": "^5.
|
|
29
|
-
"@tanstack/react-query-devtools": "^5.
|
|
30
|
-
"@types/react": "^
|
|
31
|
-
"@types/react-dom": "^
|
|
32
|
-
"axios": "^1.
|
|
33
|
-
"next": "^
|
|
34
|
-
"react": "^
|
|
35
|
-
"react-dom": "^
|
|
23
|
+
"@emotion/react": "^11.14.0",
|
|
24
|
+
"@emotion/styled": "^11.14.0",
|
|
25
|
+
"@fontsource/raleway": "^5.1.1",
|
|
26
|
+
"@mui/icons-material": "^6.4.2",
|
|
27
|
+
"@mui/material": "^6.4.2",
|
|
28
|
+
"@tanstack/react-query": "^5.66.0",
|
|
29
|
+
"@tanstack/react-query-devtools": "^5.66.0",
|
|
30
|
+
"@types/react": "^19.0.10",
|
|
31
|
+
"@types/react-dom": "^19.0.4",
|
|
32
|
+
"axios": "^1.7.9",
|
|
33
|
+
"next": "^15.1.6",
|
|
34
|
+
"react": "^19.0.0",
|
|
35
|
+
"react-dom": "^19.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@babel/core": "^7.23.7",
|
|
39
|
-
"@
|
|
40
|
-
"@emotion/
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@storybook/
|
|
50
|
-
"@storybook/
|
|
51
|
-
"@storybook/
|
|
52
|
-
"@storybook/
|
|
53
|
-
"@storybook/
|
|
39
|
+
"@chromatic-com/storybook": "^3.2.2",
|
|
40
|
+
"@emotion/react": "^11.14.0",
|
|
41
|
+
"@emotion/styled": "^11.14.0",
|
|
42
|
+
"@eslint/js": "^9.15.0",
|
|
43
|
+
"@fontsource/raleway": "^5.1.1",
|
|
44
|
+
"@hipster/mdx2-issue-checker": "^0.0.7",
|
|
45
|
+
"@mdx-js/loader": "^3.1.0",
|
|
46
|
+
"@mdx-js/react": "^3.1.0",
|
|
47
|
+
"@mui/icons-material": "^6.4.2",
|
|
48
|
+
"@mui/material": "^6.4.2",
|
|
49
|
+
"@storybook/addon-docs": "^8.4.5",
|
|
50
|
+
"@storybook/addon-essentials": "^8.4.5",
|
|
51
|
+
"@storybook/addon-interactions": "^8.4.5",
|
|
52
|
+
"@storybook/addon-links": "^8.4.5",
|
|
53
|
+
"@storybook/addon-mdx-gfm": "^8.4.5",
|
|
54
|
+
"@storybook/addon-onboarding": "^8.4.5",
|
|
55
|
+
"@storybook/blocks": "^8.4.5",
|
|
56
|
+
"@storybook/manager-api": "^8.4.5",
|
|
57
|
+
"@storybook/mdx2-csf": "^1.1.0",
|
|
58
|
+
"@storybook/nextjs": "^8.4.5",
|
|
59
|
+
"@storybook/react": "^8.4.5",
|
|
60
|
+
"@storybook/test": "^8.4.5",
|
|
61
|
+
"@storybook/theming": "^8.4.5",
|
|
54
62
|
"@tanstack/react-query": "^5.17.12",
|
|
55
63
|
"@tanstack/react-query-devtools": "^5.17.12",
|
|
56
|
-
"@types/node": "^
|
|
57
|
-
"@types/react": "^
|
|
58
|
-
"@types/react-dom": "^
|
|
59
|
-
"
|
|
60
|
-
"axios": "^1.6.5",
|
|
64
|
+
"@types/node": "^22.13.0",
|
|
65
|
+
"@types/react": "^19.0.10",
|
|
66
|
+
"@types/react-dom": "^19.0.4",
|
|
67
|
+
"axios": "^1.7.9",
|
|
61
68
|
"babel-loader": "^9.1.3",
|
|
62
69
|
"commitizen": "^4.3.0",
|
|
63
70
|
"cz-conventional-changelog": "^3.3.0",
|
|
64
|
-
"eslint": "^
|
|
65
|
-
"eslint-config-
|
|
66
|
-
"eslint-
|
|
67
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
68
|
-
"eslint-plugin-storybook": "^0.6.15",
|
|
71
|
+
"eslint": "^9.19.0",
|
|
72
|
+
"eslint-config-prettier": "^10.0.1",
|
|
73
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
69
74
|
"json-server": "^1.0.0-alpha.21",
|
|
70
|
-
"next": "^
|
|
71
|
-
"react": "^
|
|
75
|
+
"next": "^15.1.6",
|
|
76
|
+
"react": "^19.0.0",
|
|
72
77
|
"react-docgen-typescript-plugin": "^1.0.5",
|
|
73
|
-
"react-dom": "^
|
|
74
|
-
"
|
|
78
|
+
"react-dom": "^19.0.0",
|
|
79
|
+
"remark-mdx": "^3.0.0",
|
|
80
|
+
"storybook": "^8.4.5",
|
|
75
81
|
"ts-loader": "^9.5.1",
|
|
76
|
-
"typescript": "^5.
|
|
82
|
+
"typescript": "^5.7.3",
|
|
83
|
+
"typescript-eslint": "^8.24.1"
|
|
77
84
|
},
|
|
78
85
|
"resolutions": {
|
|
79
86
|
"@storybook/react-docgen-typescript-plugin": "npm:react-docgen-typescript-plugin@1.0.2"
|
|
@@ -87,9 +94,9 @@
|
|
|
87
94
|
}
|
|
88
95
|
},
|
|
89
96
|
"dependencies": {
|
|
90
|
-
"@deix/rossini-core": "^
|
|
91
|
-
"@mui/icons-material": "^
|
|
92
|
-
"@mui/material": "^
|
|
97
|
+
"@deix/rossini-core": "^3.1.1",
|
|
98
|
+
"@mui/icons-material": "^6.4.2",
|
|
99
|
+
"@mui/material": "^6.3.2",
|
|
93
100
|
"notistack": "^3.0.1",
|
|
94
101
|
"react-hook-form": "^7.49.3"
|
|
95
102
|
}
|