UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

41 lines 2 kB
import { KeyFactory } from '@/synapse-queries/KeyFactory'; import { SynapseClient } from '@sage-bionetworks/synapse-client/SynapseClient'; import { PropsWithChildren } from 'react'; export type SynapseContextType = { /** The user's access token. If undefined, the user is not logged in */ accessToken: string | undefined; /** Whether the user is authenticated */ isAuthenticated: boolean; /** If the user has enabled experimental mode */ isInExperimentalMode: boolean; /** If the user prefers time to be displayed in UTC format */ utcTime: boolean; /** Whether to wrap all children of this context in an error boundary. Useful if this context wraps just one component. */ withErrorBoundary: boolean; /** The URL of the download cart page in the current app. Used to properly link components */ downloadCartPageUrl: string; /** The URL of the people search page in the current app */ peopleSearchPageUrl?: string; /** The key factory to use for react-query. Generated automatically. */ keyFactory: KeyFactory; /** The appId identifying the product. Used to brand the Synapse account management site, aka OneSage. */ appId?: string; synapseClient: SynapseClient; }; /** * This must be exported to use the context in class components. */ export declare const SynapseContext: import("react").Context<SynapseContextType>; export type SynapseContextProviderProps = PropsWithChildren<{ synapseContext?: Partial<SynapseContextType>; }>; /** * Provides context necessary for most components in SRC. * * The SynapseContextProvider must be wrapped in a react-query QueryClientProvider. * @returns */ export declare function SynapseContextProvider(props: SynapseContextProviderProps): import("react/jsx-runtime").JSX.Element; export declare const SynapseContextConsumer: import("react").Consumer<SynapseContextType>; export declare function useSynapseContext(): SynapseContextType; //# sourceMappingURL=SynapseContext.d.ts.map