@flow97/react-toolkit 0.0.5 → 0.0.7
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/CHANGELOG.md +12 -0
- package/lib/index.d.ts +63 -22
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/locale/hooks.js +4 -1
- package/locale/index.js +4 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# react-toolkits
|
|
2
2
|
|
|
3
|
+
## 0.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bdee80d: refactor: add CheckEndpoint enum to enhance permission validation
|
|
8
|
+
|
|
9
|
+
## 0.0.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 5fc6012: refactor: integrate AuthConfig for improved authentication handling
|
|
14
|
+
|
|
3
15
|
## 0.0.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -811,18 +811,35 @@ declare const SSO_URL = "https://idaas.ifunplus.cn/enduser/api/application/plugi
|
|
|
811
811
|
declare const APP_ID_HEADER = "App-ID";
|
|
812
812
|
declare const FRONTEND_ROUTE_PREFIX = "/console/";
|
|
813
813
|
/**
|
|
814
|
-
*
|
|
815
|
-
* -
|
|
816
|
-
* -
|
|
817
|
-
|
|
814
|
+
* 权限校验接口版本
|
|
815
|
+
* - CHECK: `/api/usystem/user/check`
|
|
816
|
+
* - CHECK_V2: `/api/usystem/user/checkV2`
|
|
817
|
+
*/
|
|
818
|
+
declare enum CheckEndpoint {
|
|
819
|
+
CHECK = "check",
|
|
820
|
+
CHECK_V2 = "check_v2"
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* 认证模式枚举:合并了用户配置和角色配置的所有有效组合
|
|
818
824
|
*/
|
|
819
825
|
declare enum AuthMode {
|
|
820
|
-
/**
|
|
826
|
+
/** 直接角色模式(不带游戏):直接将角色分配给用户,角色权限不包含游戏信息 */
|
|
827
|
+
DIRECT_ROLE = "direct_role",
|
|
828
|
+
/** 直接角色模式(带游戏):直接将角色分配给用户,角色权限包含游戏信息 */
|
|
829
|
+
DIRECT_ROLE_WITH_GAME = "direct_role_with_game",
|
|
830
|
+
/** 游戏范围模式:按游戏分配角色,角色权限不包含游戏信息 */
|
|
821
831
|
GAME_SCOPED = "game_scoped",
|
|
822
|
-
/**
|
|
823
|
-
GROUP_BASED = "group_based"
|
|
824
|
-
|
|
825
|
-
|
|
832
|
+
/** 项目组模式:按项目组-游戏-角色分配,角色权限不包含游戏信息 */
|
|
833
|
+
GROUP_BASED = "group_based"
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* 认证配置:直接使用 AuthMode
|
|
837
|
+
*/
|
|
838
|
+
interface AuthConfig {
|
|
839
|
+
/** 认证模式 */
|
|
840
|
+
mode: AuthMode;
|
|
841
|
+
/** 权限校验接口版本 */
|
|
842
|
+
checkEndpoint: CheckEndpoint;
|
|
826
843
|
}
|
|
827
844
|
declare const WILDCARD = "*";
|
|
828
845
|
|
|
@@ -917,16 +934,6 @@ type Locale = {
|
|
|
917
934
|
};
|
|
918
935
|
};
|
|
919
936
|
|
|
920
|
-
/**
|
|
921
|
-
* JWT Token 解密后的用户信息
|
|
922
|
-
*/
|
|
923
|
-
interface UserInfo {
|
|
924
|
-
authorityId: string;
|
|
925
|
-
exp: number;
|
|
926
|
-
}
|
|
927
|
-
/**
|
|
928
|
-
* Context 配置接口
|
|
929
|
-
*/
|
|
930
937
|
interface ContextSlice {
|
|
931
938
|
/** 是否使用游戏 API V2 版本 */
|
|
932
939
|
useGameApiV2: boolean;
|
|
@@ -944,9 +951,18 @@ interface ContextSlice {
|
|
|
944
951
|
gameScoped?: boolean;
|
|
945
952
|
/** 本地化语言包 */
|
|
946
953
|
locale: Locale;
|
|
947
|
-
/**
|
|
948
|
-
|
|
954
|
+
/** 认证配置 */
|
|
955
|
+
authConfig: AuthConfig;
|
|
949
956
|
}
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* JWT Token 解密后的用户信息
|
|
960
|
+
*/
|
|
961
|
+
interface UserInfo {
|
|
962
|
+
authorityId: string;
|
|
963
|
+
exp: number;
|
|
964
|
+
}
|
|
965
|
+
|
|
950
966
|
/**
|
|
951
967
|
* Token 状态接口
|
|
952
968
|
*/
|
|
@@ -1227,6 +1243,31 @@ declare function useFormModal<Values extends AnyObject = AnyObject, ExtraValues
|
|
|
1227
1243
|
*/
|
|
1228
1244
|
declare function useModalStore(): VisibilityState;
|
|
1229
1245
|
|
|
1246
|
+
/**
|
|
1247
|
+
* 获取当前有效的认证配置
|
|
1248
|
+
*/
|
|
1249
|
+
declare function useAuthConfig(): AuthConfig;
|
|
1250
|
+
/**
|
|
1251
|
+
* 获取当前认证模式
|
|
1252
|
+
*/
|
|
1253
|
+
declare function useAuthMode(): AuthMode;
|
|
1254
|
+
/**
|
|
1255
|
+
* 判断是否为直接角色模式
|
|
1256
|
+
*/
|
|
1257
|
+
declare function useIsDirectRole(): boolean;
|
|
1258
|
+
/**
|
|
1259
|
+
* 判断是否为游戏范围模式
|
|
1260
|
+
*/
|
|
1261
|
+
declare function useIsGameScoped(): boolean;
|
|
1262
|
+
/**
|
|
1263
|
+
* 判断是否为项目组模式
|
|
1264
|
+
*/
|
|
1265
|
+
declare function useIsGroupBased(): boolean;
|
|
1266
|
+
/**
|
|
1267
|
+
* 判断角色是否包含游戏信息
|
|
1268
|
+
*/
|
|
1269
|
+
declare function useIsRoleWithGame(): boolean;
|
|
1270
|
+
|
|
1230
1271
|
interface NotFoundProps {
|
|
1231
1272
|
redirectUrl?: string;
|
|
1232
1273
|
}
|
|
@@ -1467,4 +1508,4 @@ declare function useAuth(code?: string | string[], config?: RequestOptions): {
|
|
|
1467
1508
|
declare function useMenuList(): _tanstack_react_query.UseQueryResult<MenuListItem[], Error>;
|
|
1468
1509
|
declare const useGames: () => _tanstack_react_query.UseQueryResult<Game[], Error>;
|
|
1469
1510
|
|
|
1470
|
-
export { APP_ID_HEADER, AuthButton, type AuthButtonProps, AuthMode, DynamicTags, type DynamicTagsProps, ExpandableParagraph, type ExpandableParagraphProps, FRONTEND_ROUTE_PREFIX, FilterFormWrapper, type FilterFormWrapperProps, type Game, type GameSelectConfig, type GameSelectProps, type HeaderExtra, type HeaderExtraConfig, Highlight, type HighlightProps, InfiniteList, type InfiniteListDataAdapter, type InfiniteListPayload, type InfiniteListProps, type InfiniteListRef, type InfiniteListRequestConfig, type InfiniteListRequestConfigType, type JsonResponse, KeepAlive, type KeepAliveCacheItem, KeepAliveOutlet, type KeepAliveOutletProps, type KeepAliveProps, KeepAliveProvider, type KeepAliveProviderProps, Layout, type LayoutProps, Logo, type LogoProps, type MenuListItem, type NavItem, type NavMenuItemGroupType, type NavMenuItemType, type NavSubMenuType, type NavigationConfig, NotFound, OperationLogList, type PageParam, type Permission, QueryList, QueryListAction, type QueryListPayload, type QueryListProps, type QueryListRef, type RecursivePartial, RequireAuth, type RequireAuthProps, RequireGame, type RouteMatchRule, SSO_URL, SelectAll, type SelectAllProps, type ShowFormOptions$1 as ShowFormDrawerOptions, type ShowFormOptions as ShowFormModalOptions, SignIn, ToolkitProvider, type ToolkitProviderProps, type UseDrawerOperation, type UseDrawerProps, type UseFormDrawerProps, type UseFormDrawerReturn, type UseFormModalProps, type UseFormModalReturn, type UseKeepAliveReturn, type UseModalOperation, type UseModalProps, UserDropdown, type VisibilityState, WILDCARD, createVisibilityStoreConfig, generateId, _default$1 as menuRoutes, mixedStorage, _default as permissionRoutes, toolkitStore, useAuth, useDrawer, useDrawerStore, useFormDrawer, useFormModal, useGames, useInfiniteListStore, useKeepAlive, useKeepAliveContext, useMenuList, useModal, useModalStore, useQueryListStore, useToolkitStore };
|
|
1511
|
+
export { APP_ID_HEADER, AuthButton, type AuthButtonProps, type AuthConfig, AuthMode, CheckEndpoint, DynamicTags, type DynamicTagsProps, ExpandableParagraph, type ExpandableParagraphProps, FRONTEND_ROUTE_PREFIX, FilterFormWrapper, type FilterFormWrapperProps, type Game, type GameSelectConfig, type GameSelectProps, type HeaderExtra, type HeaderExtraConfig, Highlight, type HighlightProps, InfiniteList, type InfiniteListDataAdapter, type InfiniteListPayload, type InfiniteListProps, type InfiniteListRef, type InfiniteListRequestConfig, type InfiniteListRequestConfigType, type JsonResponse, KeepAlive, type KeepAliveCacheItem, KeepAliveOutlet, type KeepAliveOutletProps, type KeepAliveProps, KeepAliveProvider, type KeepAliveProviderProps, Layout, type LayoutProps, Logo, type LogoProps, type MenuListItem, type NavItem, type NavMenuItemGroupType, type NavMenuItemType, type NavSubMenuType, type NavigationConfig, NotFound, OperationLogList, type PageParam, type Permission, QueryList, QueryListAction, type QueryListPayload, type QueryListProps, type QueryListRef, type RecursivePartial, RequireAuth, type RequireAuthProps, RequireGame, type RouteMatchRule, SSO_URL, SelectAll, type SelectAllProps, type ShowFormOptions$1 as ShowFormDrawerOptions, type ShowFormOptions as ShowFormModalOptions, SignIn, ToolkitProvider, type ToolkitProviderProps, type UseDrawerOperation, type UseDrawerProps, type UseFormDrawerProps, type UseFormDrawerReturn, type UseFormModalProps, type UseFormModalReturn, type UseKeepAliveReturn, type UseModalOperation, type UseModalProps, UserDropdown, type VisibilityState, WILDCARD, createVisibilityStoreConfig, generateId, _default$1 as menuRoutes, mixedStorage, _default as permissionRoutes, toolkitStore, useAuth, useAuthConfig, useAuthMode, useDrawer, useDrawerStore, useFormDrawer, useFormModal, useGames, useInfiniteListStore, useIsDirectRole, useIsGameScoped, useIsGroupBased, useIsRoleWithGame, useKeepAlive, useKeepAliveContext, useMenuList, useModal, useModalStore, useQueryListStore, useToolkitStore };
|