@bcrumbs.net/bc-shared 0.0.5 → 0.0.6
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/index.esm.d.ts +1 -1
- package/index.esm.js +1305 -875
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/components/RoutesGaurd/PermissionGuard.d.ts +11 -0
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/config/routes.d.ts +2 -0
- package/src/lib/hooks/index.d.ts +1 -0
- package/src/lib/hooks/usePermissions.d.ts +6 -0
- package/src/lib/services/auth/index.d.ts +5 -2
- package/src/lib/types/index.d.ts +5 -0
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Permission } from '../../types';
|
|
3
|
+
interface PermissionGuardProps {
|
|
4
|
+
component: React.ComponentType<any>;
|
|
5
|
+
requiredPermissions?: Permission[];
|
|
6
|
+
fallbackRoute?: string;
|
|
7
|
+
path: string;
|
|
8
|
+
exact?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const PermissionGuard: React.FC<PermissionGuardProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './usePermissions';
|
|
@@ -77,7 +77,11 @@ export declare const auth: {
|
|
|
77
77
|
* @param {any} [userInfoKey='userInfo'] optionnal parameter to specify a token key
|
|
78
78
|
* @returns {string} token value
|
|
79
79
|
*/
|
|
80
|
-
getUserInfo(fromStorage?: Storage, userInfoKey?: UserInfoKey):
|
|
80
|
+
getUserInfo(fromStorage?: Storage, userInfoKey?: UserInfoKey): {
|
|
81
|
+
id: string;
|
|
82
|
+
username: string;
|
|
83
|
+
role: string;
|
|
84
|
+
} | null;
|
|
81
85
|
/**
|
|
82
86
|
* set the userInfo value into localstorage
|
|
83
87
|
*
|
|
@@ -87,7 +91,6 @@ export declare const auth: {
|
|
|
87
91
|
* @returns {boolean} success/failure flag
|
|
88
92
|
*/
|
|
89
93
|
setUserInfo(value: User, toStorage?: Storage, userInfoKey?: UserInfoKey): void;
|
|
90
|
-
updateUserInfo(value: User, toStorage?: Storage, userInfoKey?: UserInfoKey): any;
|
|
91
94
|
/**
|
|
92
95
|
* delete userInfo
|
|
93
96
|
*
|
package/src/lib/types/index.d.ts
CHANGED
|
@@ -5,3 +5,8 @@ export declare enum Loading {
|
|
|
5
5
|
ERROR = "error"
|
|
6
6
|
}
|
|
7
7
|
export type Awaited<T> = T extends PromiseLike<infer U> ? Awaited<U> : T;
|
|
8
|
+
export declare enum Permission {
|
|
9
|
+
MANAGE_WORKSPACE = "MANAGE_WORKSPACE",
|
|
10
|
+
MANAGE_CONVS = "MANAGE_CONVS",
|
|
11
|
+
MANAGE_CLIENTS = "MANAGE_CLIENTS"
|
|
12
|
+
}
|