react-toolkits 2.11.16 → 2.11.17

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 2.11.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 835be1b: chore: remove logoutRedirectUrl
8
+ - 1793289: alpha
9
+ - 1793289: refactor: create axios instance everytime ToolkitsProvider mounted
10
+
3
11
  ## 2.11.16
4
12
 
5
13
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import * as react from 'react';
2
- import { FC, PropsWithChildren, Key, ReactNode, ReactElement, Ref } from 'react';
2
+ import { FC, PropsWithChildren, Key, ReactNode, ReactElement, Ref, ComponentType } from 'react';
3
3
  import { ParagraphProps } from 'antd/es/typography/Paragraph';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { FormInstance, MenuProps, ButtonProps, ModalProps, FormProps } from 'antd';
6
6
  import { TableProps } from 'antd/es/table';
7
- import * as axios from 'axios';
8
- import { AxiosHeaderValue, InternalAxiosRequestConfig, AxiosResponse, AxiosInterceptorOptions, AxiosRequestConfig } from 'axios';
7
+ import { AxiosHeaderValue, AxiosInstance, InternalAxiosRequestConfig, AxiosResponse, AxiosInterceptorOptions } from 'axios';
9
8
  import { ItemType, SubMenuType, MenuItemGroupType, MenuItemType } from 'antd/es/menu/interface';
10
9
  import { Merge } from 'ts-essentials';
11
10
  import * as zustand_middleware from 'zustand/middleware';
@@ -116,9 +115,7 @@ interface LayoutProps extends Pick<GameSelectProps, 'filter' | 'onGameChange'> {
116
115
  isMenuLoading?: boolean;
117
116
  title?: ReactNode;
118
117
  items?: NavMenuItem[];
119
- hideGameSelect?: boolean;
120
118
  navWidth?: string | number;
121
- logoutRedirectUrl: string;
122
119
  headerExtra?: {
123
120
  left?: HeaderExtra[];
124
121
  right?: HeaderExtra[];
@@ -145,9 +142,6 @@ declare const useLayoutStore: zustand.UseBoundStore<Omit<zustand.StoreApi<Layout
145
142
  interface PermissionButtonProps extends ButtonProps {
146
143
  code?: string | string[];
147
144
  showLoading?: boolean;
148
- headers?: {
149
- [key: string]: AxiosHeaderValue;
150
- };
151
145
  }
152
146
  declare const PermissionButton: FC<PropsWithChildren<PermissionButtonProps>>;
153
147
 
@@ -179,7 +173,6 @@ interface QueryListProps<Item extends AnyObject = AnyObject, Values = AnyObject,
179
173
  refreshInterval?: number;
180
174
  onePage?: boolean;
181
175
  defaultSize?: number;
182
- isGlobal?: boolean;
183
176
  body?: FormData | Record<string | number, any> | ((payload: QueryListPayload<Values>) => FormData | Record<string | number, any>);
184
177
  params?: Record<string | number, any> | ((payload: QueryListPayload<Values>) => Record<string | number, any>);
185
178
  tableExtra?: ReactNode | ((form: FormInstance<Values>, data?: Data) => ReactNode);
@@ -212,14 +205,15 @@ interface QueryListState {
212
205
  }
213
206
  declare const useQueryListStore: zustand.UseBoundStore<zustand.StoreApi<QueryListState>>;
214
207
 
215
- declare const RequireGame: FC<PropsWithChildren>;
216
-
217
208
  interface RequirePermissionProps {
218
209
  code: string;
219
- isGlobal?: boolean;
220
210
  }
221
211
  declare const RequirePermission: FC<PropsWithChildren<RequirePermissionProps>>;
222
212
 
213
+ interface AxiosSlice {
214
+ axios: AxiosInstance;
215
+ }
216
+
223
217
  type Locale = {
224
218
  global: {
225
219
  noEntitlement: string;
@@ -316,6 +310,7 @@ interface ContextSlice {
316
310
  signInPath: string;
317
311
  isGlobal: boolean;
318
312
  unregistered?: boolean;
313
+ hideGame?: boolean;
319
314
  interceptors?: {
320
315
  request?: [(config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>];
321
316
  response?: [
@@ -348,7 +343,7 @@ interface GameSlice {
348
343
  }) => Promise<Game[] | undefined>;
349
344
  }
350
345
 
351
- type ToolkitsState = TokenSlice & GameSlice & ContextSlice & {
346
+ type ToolkitsState = TokenSlice & GameSlice & ContextSlice & AxiosSlice & {
352
347
  setContext: (props: Partial<ContextSlice>) => void;
353
348
  clearToken: () => void;
354
349
  setUnregistered: () => void;
@@ -370,11 +365,9 @@ declare function useToolkitsStore<T>(selector: (state: ToolkitsState) => T): T;
370
365
  type ToolkitsProviderProps = PropsWithChildren<Partial<ContextSlice>>;
371
366
  declare let toolkitsStore: ToolkitsStore;
372
367
  declare const ToolkitsProvider: FC<ToolkitsProviderProps>;
368
+ declare const withContext: (Component: ComponentType, providerProps: Omit<ToolkitsProviderProps, "children">) => (props: any) => react_jsx_runtime.JSX.Element;
373
369
 
374
- interface UserWidgetProps {
375
- logoutRedirectUrl: string;
376
- }
377
- declare const UserWidget: FC<UserWidgetProps>;
370
+ declare const UserWidget: FC;
378
371
 
379
372
  declare const SSO_URL = "https://idaas.ifunplus.cn/enduser/api/application/plugin_FunPlus/sso/v1";
380
373
  declare const APP_ID_HEADER = "App-ID";
@@ -446,27 +439,27 @@ declare function useFormModal<Values extends AnyObject = AnyObject, ExtraValues
446
439
  type PermissionCheckResult = {
447
440
  has_all: true;
448
441
  } | Record<string, boolean>;
449
- declare function usePermissions(codes?: string[], config?: Omit<AxiosRequestConfig, 'method' | 'data' | 'url'>): {
442
+ declare function usePermissions(codes?: string[]): {
450
443
  data: Record<string, boolean>;
451
444
  error: any;
452
445
  mutate: swr.KeyedMutator<PermissionCheckResult>;
453
446
  isValidating: boolean;
454
447
  isLoading: boolean;
455
448
  };
456
- declare function usePermission(code?: string, config?: Omit<AxiosRequestConfig, 'method' | 'data' | 'url'>): {
449
+ declare function usePermission(code?: string): {
457
450
  accessible: boolean;
458
451
  isValidating: boolean;
459
452
  isLoading: boolean;
460
453
  };
461
454
 
462
- declare const _default$1: react_jsx_runtime.JSX.Element;
455
+ declare const _default$2: react_jsx_runtime.JSX.Element;
463
456
 
464
457
  interface NotFoundProps {
465
458
  redirectUrl?: string;
466
459
  }
467
460
  declare const NotFound: FC<NotFoundProps>;
468
461
 
469
- declare const OperationLogList: FC;
462
+ declare const _default$1: (props: any) => react_jsx_runtime.JSX.Element;
470
463
 
471
464
  declare const _default: react_jsx_runtime.JSX.Element;
472
465
 
@@ -477,7 +470,6 @@ interface SignInProps {
477
470
  }
478
471
  declare const SignIn: FC<SignInProps>;
479
472
 
480
- declare const axiosInstance: axios.AxiosInstance;
481
473
  type JsonData<T = any> = {
482
474
  code?: number;
483
475
  status?: number;
@@ -485,10 +477,7 @@ type JsonData<T = any> = {
485
477
  data: T;
486
478
  msg: string;
487
479
  };
488
- declare const Interceptor: ({ children }: {
489
- children?: ReactNode;
490
- }) => ReactNode;
491
480
 
492
481
  declare const mixedStorage: StateStorage;
493
482
 
494
- export { APP_ID_HEADER, DynamicTags, type DynamicTagsProps, ExpandableParagraph, type ExpandableParagraphProps, FRONTEND_ROUTE_PREFIX, FilterFormWrapper, type FilterFormWrapperProps, type Game, Highlight, type HighlightProps, InfiniteList, type InfiniteListProps, Interceptor, type JsonData, Layout, type LayoutState, NavMenu, type NavMenuItem, NotFound, OperationLogList, PermissionButton, type PermissionButtonProps, QueryList, QueryListAction, type QueryListPayload, type QueryListProps, type QueryListRef, RequireGame, RequirePermission, type RequirePermissionProps, SSO_URL, SignIn, ToolkitsProvider, type ToolkitsProviderProps, type UseFormModalProps, type UseModalOperation, type UseModalProps, UserWidget, type UserWidgetProps, axiosInstance, _default$1 as menuRoutes, mixedStorage, _default as permissionRoutes, toolkitsStore, useFormModal, useLayoutStore, useMenuList, useModal, useModalStore, usePermission, usePermissions, useQueryListStore, useToolkitsStore };
483
+ export { APP_ID_HEADER, DynamicTags, type DynamicTagsProps, ExpandableParagraph, type ExpandableParagraphProps, FRONTEND_ROUTE_PREFIX, FilterFormWrapper, type FilterFormWrapperProps, type Game, Highlight, type HighlightProps, InfiniteList, type InfiniteListProps, type JsonData, Layout, type LayoutState, NavMenu, type NavMenuItem, NotFound, _default$1 as OperationLogList, PermissionButton, type PermissionButtonProps, QueryList, QueryListAction, type QueryListPayload, type QueryListProps, type QueryListRef, RequirePermission, type RequirePermissionProps, SSO_URL, SignIn, ToolkitsProvider, type ToolkitsProviderProps, type UseFormModalProps, type UseModalOperation, type UseModalProps, UserWidget, _default$2 as menuRoutes, mixedStorage, _default as permissionRoutes, toolkitsStore, useFormModal, useLayoutStore, useMenuList, useModal, useModalStore, usePermission, usePermissions, useQueryListStore, useToolkitsStore, withContext };