/**
* Copyright (c) 2018-present, heineiuo.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
///
export type Tokens = {
accessToken: string;
accessTokenExpire: number;
refreshToken: string;
refreshTokenExpire: number;
};
export type SessionState = {
iat: number;
userId: string | null;
username: string | null;
};
export type GlobalContextState = SessionState & {
/**
* 通过app的名称获取hostname
* app的名称: webpack module federation配置的module name
* hostname: youkuohao deploy发布的域名
*/
getAppOrigin: (moduleName: string) => Promise;
isLoginModalOpen: boolean;
setLoginModalOpen: (open: boolean) => void;
pending: boolean;
enableAppleLoginOpen: boolean;
logged: boolean;
globalOrigin: string;
setTokens: (tokens: Tokens) => void;
removeTokens: () => void;
getAccessToken: (scopes?: string[]) => Promise;
modalVisible: boolean;
initialModalRouteName: string;
setShowModal: (visible: boolean) => void;
modalOptions: Record;
openModal: (options: {
name: string;
width?: number;
height?: number;
options?: Record;
}) => void;
closeModal: (options?: Record) => void;
applist: any[];
};
export declare const GlobalContext: import("react").Context;
export declare function useGlobal(): GlobalContextState;
export declare const useSession: typeof useGlobal;