import * as React from 'react'; import { UserProfile } from '@oneblink/types/typescript/misc'; export type AuthContextValue = { /** `true` if the current user is logged in */ isLoggedIn: boolean; /** * See * [auth-service.getUserProfile()](https://oneblink.github.io/apps/modules/authService.html#getUserProfile) */ userProfile: UserProfile | null; /** * See * [auth-service.getUserFriendlyName()](https://oneblink.github.io/apps/modules/authService.html#getUserFriendlyName) */ userFriendlyName: string | undefined; /** * `true` if [``](#AuthContextProvider) was passed the * `formsKeyToken` prop */ isUsingFormsKey: boolean; }; /** * `` is a React Component that provides the context for * the `useAuth()` hook to be used by components further down your component * tree. **It should only be included in your component tree once and ideally at * the root of the application.** * * #### Example * * ```jsx * import * as React from 'react' * import { AuthContextProvider, useAuth } from '@oneblink/apps-react' * * function Component() { * const auth = useAuth() * // use auth here * } * * function App() { * return ( * * * * ) * } * * const root = document.getElementById('root') * if (root) { * ReactDOM.render(, root) * } * ``` * * @param props * @returns * @group Components */ export declare function AuthContextProvider({ children, formsKeyToken, userToken, }: { /** Your application components */ children: React.ReactNode; /** * A Forms Key token being used to make requests to the OneBlink API on behalf * of the user */ formsKeyToken?: string; /** * An encrypted user token that will be used included in the submission on * behalf of the user */ userToken?: string; }): import("react/jsx-runtime").JSX.Element; /** * A React hook for containing state associated the current user. **This hook * requires [``](./AuthContextProvider.html) to be * present in your component tree.** * * Example * * ```js * import { useAuth } from '@oneblink/apps-react' * * function Component() { * const { isLoggedIn, userProfile, userFriendlyName, isUsingFormsKey } = * useAuth() * } * ``` * * @returns * @group Hooks */ export default function useAuth(): AuthContextValue;