@capsitech/react-utilities 0.1.4 → 0.1.5
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/SuspenseRoute.d.ts +7 -7
- package/lib/Components/SuspenseRoute.js +29 -29
- package/lib/Components/index.d.ts +1 -1
- package/lib/Components/index.js +1 -1
- package/lib/Hooks/index.d.ts +45 -45
- package/lib/Hooks/index.js +98 -98
- package/lib/Hooks/useInfiniteScroll.d.ts +7 -7
- package/lib/Hooks/useInfiniteScroll.js +22 -22
- package/lib/Hooks/useNetworkState.d.ts +67 -67
- package/lib/Hooks/useNetworkState.js +41 -41
- package/lib/Hooks/useShortcuts.d.ts +4 -4
- package/lib/Hooks/useShortcuts.js +91 -91
- package/lib/Utilities/ApiUtility.axios.d.ts +60 -60
- package/lib/Utilities/ApiUtility.axios.js +305 -305
- package/lib/Utilities/BrowserInfo.d.ts +74 -74
- package/lib/Utilities/BrowserInfo.js +153 -153
- package/lib/Utilities/Countries.d.ts +14 -14
- package/lib/Utilities/Countries.js +290 -290
- package/lib/Utilities/CustomEventEmitter.d.ts +12 -12
- package/lib/Utilities/CustomEventEmitter.js +30 -30
- package/lib/Utilities/FastCompare.d.ts +1 -1
- package/lib/Utilities/FastCompare.js +128 -128
- package/lib/Utilities/HideablePromise.d.ts +5 -5
- package/lib/Utilities/HideablePromise.js +10 -10
- package/lib/Utilities/LoadScripts.d.ts +9 -9
- package/lib/Utilities/LoadScripts.js +51 -51
- package/lib/Utilities/MTDFraudPrevention.d.ts +28 -28
- package/lib/Utilities/MTDFraudPrevention.js +157 -157
- package/lib/Utilities/Nationalities.d.ts +5 -5
- package/lib/Utilities/Nationalities.js +245 -245
- package/lib/Utilities/RouteUtils.d.ts +129 -120
- package/lib/Utilities/RouteUtils.js +223 -206
- package/lib/Utilities/TimeZones.d.ts +10 -10
- package/lib/Utilities/TimeZones.js +1069 -1069
- package/lib/Utilities/Types.d.ts +19 -19
- package/lib/Utilities/Types.js +1 -1
- package/lib/Utilities/Utils.d.ts +174 -174
- package/lib/Utilities/Utils.js +331 -331
- package/lib/Utilities/dayjs.d.ts +18 -18
- package/lib/Utilities/dayjs.js +56 -56
- package/lib/Utilities/index.d.ts +14 -14
- package/lib/Utilities/index.js +14 -14
- package/lib/index.d.ts +3 -3
- package/lib/index.js +3 -3
- package/package.json +12 -25
|
@@ -1,120 +1,129 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
private
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare enum FeatureStatus {
|
|
3
|
+
placeholder = 0,
|
|
4
|
+
alpha = 1,
|
|
5
|
+
beta = 2,
|
|
6
|
+
release = 3
|
|
7
|
+
}
|
|
8
|
+
export interface IRouteProps {
|
|
9
|
+
name?: string;
|
|
10
|
+
path?: string;
|
|
11
|
+
url?: string;
|
|
12
|
+
key?: string | number;
|
|
13
|
+
icon?: string;
|
|
14
|
+
isCategory?: boolean;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* The component to render for this route's content (or a loading placeholder if `getComponent` is provided).
|
|
18
|
+
*/
|
|
19
|
+
component?: any;
|
|
20
|
+
/**
|
|
21
|
+
* Function that loads the component asynchronously.
|
|
22
|
+
* Notify when loading has finished using `cb`.
|
|
23
|
+
* If `component` is provided, it will be rendered while waiting for the callback.
|
|
24
|
+
*/
|
|
25
|
+
getComponent?: (cb: (component: any) => void) => void;
|
|
26
|
+
/**
|
|
27
|
+
* User roles to check for route rendering
|
|
28
|
+
*/
|
|
29
|
+
roles?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* User permissions to check for route rendering
|
|
32
|
+
*/
|
|
33
|
+
permissions?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Practice features to check for route rendering
|
|
36
|
+
*/
|
|
37
|
+
features?: number[];
|
|
38
|
+
/**
|
|
39
|
+
* Business types to check for route rendering
|
|
40
|
+
*/
|
|
41
|
+
businessTypes?: number[];
|
|
42
|
+
/**
|
|
43
|
+
* User config/tags to check for route rendering
|
|
44
|
+
*/
|
|
45
|
+
userConfig?: string[];
|
|
46
|
+
/**
|
|
47
|
+
* User params to check for route rendering
|
|
48
|
+
*/
|
|
49
|
+
userParams?: string[];
|
|
50
|
+
/**
|
|
51
|
+
* Other tags to check for route rendering
|
|
52
|
+
*/
|
|
53
|
+
tags?: string[];
|
|
54
|
+
/**
|
|
55
|
+
* Sub/inner links
|
|
56
|
+
*/
|
|
57
|
+
links?: IRouteProps[];
|
|
58
|
+
/**
|
|
59
|
+
* Other URL to show this link as active
|
|
60
|
+
*/
|
|
61
|
+
activeUrl?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Other URLs to show this link as active
|
|
64
|
+
*/
|
|
65
|
+
activeUrls?: string[];
|
|
66
|
+
/**
|
|
67
|
+
* Default expanded or collapsed
|
|
68
|
+
*/
|
|
69
|
+
isExpanded?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Feature status (to show bedge on link)
|
|
72
|
+
*/
|
|
73
|
+
status?: FeatureStatus;
|
|
74
|
+
}
|
|
75
|
+
export interface IRouteGroupProps {
|
|
76
|
+
/**
|
|
77
|
+
* Links to render within this group
|
|
78
|
+
*/
|
|
79
|
+
links: IRouteProps[];
|
|
80
|
+
/**
|
|
81
|
+
* User roles to check for route rendering
|
|
82
|
+
*/
|
|
83
|
+
roles?: string[];
|
|
84
|
+
/**
|
|
85
|
+
* User permissions to check for route rendering
|
|
86
|
+
*/
|
|
87
|
+
permissions?: string[];
|
|
88
|
+
/**
|
|
89
|
+
* Practice features to check for route rendering
|
|
90
|
+
*/
|
|
91
|
+
features?: number[];
|
|
92
|
+
/**
|
|
93
|
+
* User config/tags to check for route rendering
|
|
94
|
+
*/
|
|
95
|
+
userConfig?: string[];
|
|
96
|
+
/**
|
|
97
|
+
* Other tags to check for route rendering
|
|
98
|
+
*/
|
|
99
|
+
tags?: string[];
|
|
100
|
+
/**
|
|
101
|
+
* Other URL to show this link as active
|
|
102
|
+
*/
|
|
103
|
+
activeUrls?: string[];
|
|
104
|
+
/**
|
|
105
|
+
* Default expanded or collapsed
|
|
106
|
+
*/
|
|
107
|
+
isExpanded?: boolean;
|
|
108
|
+
}
|
|
109
|
+
declare class RouteUtilsBase {
|
|
110
|
+
private hasValidRole;
|
|
111
|
+
private hasValidPermission;
|
|
112
|
+
private hasValidRoleOrPermission;
|
|
113
|
+
private hasValidFeatures;
|
|
114
|
+
private hasValidBusinessType;
|
|
115
|
+
private hasValidUserConfig;
|
|
116
|
+
private hasValidUserParam;
|
|
117
|
+
private hasValidTags;
|
|
118
|
+
private isValidLink;
|
|
119
|
+
private getPath;
|
|
120
|
+
getRoutesFromGroups: (groups: IRouteGroupProps[], SecureRoute: any, userRoles?: string[], userPermissions?: string[], features?: number[], businessType?: number, userConfig?: any, userParams?: any, tags?: any, trimUrl?: string) => any[];
|
|
121
|
+
getRoutesFromGroup: (links: IRouteProps[], SecureRoute: any, userRoles?: string[], userPermissions?: string[], features?: number[], businessType?: number, userConfig?: any, userParams?: any, tags?: any, trimUrl?: string) => any[];
|
|
122
|
+
getLinksFromGroups: (links: IRouteGroupProps[], userRoles?: string[], userPermissions?: string[], features?: number[], businessType?: number, userConfig?: any, userParams?: any, currentPath?: string, params?: any, tags?: any) => IRouteGroupProps[];
|
|
123
|
+
getLinksFromGroup: (links: IRouteProps[], userRoles?: string[], userPermissions?: string[], features?: number[], businessType?: number, userConfig?: any, userParams?: any, currentPath?: string, params?: any, tags?: any) => IRouteProps[];
|
|
124
|
+
getRoutesFromLinks: (links: IRouteProps[], SecureRoute: any, userRoles?: string[], userPermissions?: string[], features?: number[], businessType?: number, userConfig?: any, userParams?: any, tags?: any, trimUrl?: string) => any[];
|
|
125
|
+
getLinksFromLinks: (links: IRouteProps[], userRoles?: string[], userPermissions?: string[], features?: number[], businessType?: number, userConfig?: any, userParams?: any, currentPath?: string, params?: any, tags?: any) => IRouteProps[];
|
|
126
|
+
getSelectedNavKey: (pagesGroup: IRouteGroupProps[], currentPath: string) => string | number | undefined;
|
|
127
|
+
}
|
|
128
|
+
export declare const RouteUtils: RouteUtilsBase;
|
|
129
|
+
export {};
|