@atomsolution/sdk-merchant 1.0.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/dist/components/role/index.d.ts +2 -0
- package/dist/constants/permission.d.ts +293 -0
- package/dist/index.cjs +307 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +307 -56
- package/dist/index.esm.js.map +1 -1
- package/dist/services/roleService.d.ts +43 -0
- package/dist/types/permission.d.ts +7 -0
- package/dist/utils/permission.d.ts +4 -0
- package/dist/utils/useRouterNavigate.d.ts +4 -0
- package/package.json +2 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ApiRolePayload, RoleFormData } from '../types/role';
|
|
2
|
+
export interface RoleListResponse {
|
|
3
|
+
data: TRole[];
|
|
4
|
+
errors: string | null;
|
|
5
|
+
error_code: string | null;
|
|
6
|
+
msg: string | null;
|
|
7
|
+
}
|
|
8
|
+
export interface TRole {
|
|
9
|
+
id: number;
|
|
10
|
+
name: string;
|
|
11
|
+
role?: {
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
description?: string;
|
|
15
|
+
permissions?: any[];
|
|
16
|
+
module_number: string;
|
|
17
|
+
staff_number: string;
|
|
18
|
+
created_at: string;
|
|
19
|
+
updated_at: string;
|
|
20
|
+
created_by: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface TCreateRolePayload extends ApiRolePayload {
|
|
23
|
+
}
|
|
24
|
+
export interface TUpdateRolePayload extends ApiRolePayload {
|
|
25
|
+
id: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const createRoleService: (axiosClientPortal: any) => {
|
|
28
|
+
getAll: (params: {
|
|
29
|
+
page: number;
|
|
30
|
+
page_size: number;
|
|
31
|
+
}) => Promise<RoleListResponse>;
|
|
32
|
+
getRoleById: (role_id: number) => Promise<TRole>;
|
|
33
|
+
create: (data: TCreateRolePayload) => Promise<TRole>;
|
|
34
|
+
update: (role_id: number, data: TUpdateRolePayload) => Promise<TRole>;
|
|
35
|
+
delete: (roleId: number) => Promise<{
|
|
36
|
+
success: boolean;
|
|
37
|
+
message?: string;
|
|
38
|
+
}>;
|
|
39
|
+
validateRoleData: (data: RoleFormData) => {
|
|
40
|
+
isValid: boolean;
|
|
41
|
+
errors: string[];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Permission } from '../types/permission';
|
|
2
|
+
export declare const findPermission: (permissions: Permission[], permissionCode: string) => Permission | null;
|
|
3
|
+
export declare const hasPermission: (permissions: Permission[], permissionCode: string) => boolean;
|
|
4
|
+
export declare const getAllSubPermissions: (permissions: Permission[]) => any[];
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.0
|
|
6
|
+
"version": "1.1.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.cjs",
|
|
9
9
|
"module": "dist/index.esm.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=16.14.0",
|
|
33
33
|
"react-dom": ">=16.14.0",
|
|
34
|
-
"react-router-dom": "
|
|
34
|
+
"react-router-dom": ">=5.2.0 <7.0.0",
|
|
35
35
|
"react-toastify": "^8.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|