synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
33 lines • 1.82 kB
TypeScript
import { PropsWithChildren } from 'react';
import { TwoFactorAuthErrorResponse } from '@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse';
import { TermsOfServiceStatus, TwoFactorAuthStatus } from '@sage-bionetworks/synapse-types';
export type ApplicationSessionContextType = {
token?: string;
/** The realm of the current user. */
realmId?: string;
/** The user ID of the current user. */
userId?: string;
isAuthenticated: boolean;
termsOfServiceStatus?: TermsOfServiceStatus;
twoFactorStatus?: TwoFactorAuthStatus;
hasInitializedSession: boolean;
refreshSession: () => Promise<void>;
twoFactorAuthSSOErrorResponse?: TwoFactorAuthErrorResponse;
/**
* Signs the user out and updates this context. After clearing the session, the page will be reloaded.
* @param onBeforeReload Optionally synchronous callback that will be executed just before reloading.
*/
clearSession: (onBeforeReload?: () => void) => Promise<void>;
/** Whether detection of a single-sign-on (SSO) event is pending.
* For example, detecting an authorization code passed by an external identity provider via the user's browser.
* A reload may be forced before this completes.
*/
isLoadingSSO: boolean;
};
export type ApplicationSessionContextProviderProps = PropsWithChildren<{
context: ApplicationSessionContextType;
}>;
export declare function ApplicationSessionContextProvider(props: ApplicationSessionContextProviderProps): import("react/jsx-runtime").JSX.Element;
export declare const ApplicationSessionContextConsumer: import("react").Consumer<ApplicationSessionContextType | undefined>;
export declare function useApplicationSessionContext(): ApplicationSessionContextType;
//# sourceMappingURL=ApplicationSessionContext.d.ts.map