UNPKG

matrix-react-sdk

Version:
59 lines (58 loc) 2.19 kB
import React from "react"; import { AuthType, IAuthData, AuthDict, IInputs, IStageStatus } from "matrix-js-sdk/src/interactive-auth"; import { MatrixClient } from "matrix-js-sdk/src/matrix"; import { ContinueKind, CustomAuthType } from "../views/auth/InteractiveAuthEntryComponents"; export declare const ERROR_USER_CANCELLED: Error; type InteractiveAuthCallbackSuccess<T> = (success: true, response: T, extra?: { emailSid?: string; clientSecret?: string; }) => Promise<void>; type InteractiveAuthCallbackFailure = (success: false, response: IAuthData | Error) => Promise<void>; export type InteractiveAuthCallback<T> = InteractiveAuthCallbackSuccess<T> & InteractiveAuthCallbackFailure; export interface InteractiveAuthProps<T> { matrixClient: MatrixClient; authData?: IAuthData; inputs?: IInputs; sessionId?: string; clientSecret?: string; emailSid?: string; poll?: boolean; continueIsManaged?: boolean; continueText?: string; continueKind?: ContinueKind; makeRequest(auth: AuthDict | null): Promise<T>; onAuthFinished: InteractiveAuthCallback<T>; requestEmailToken?(email: string, secret: string, attempt: number, session: string): Promise<{ sid: string; }>; onStagePhaseChange?(stage: AuthType | CustomAuthType | null, phase: number): void; } interface IState { authStage?: CustomAuthType | AuthType; stageState?: IStageStatus; busy: boolean; errorText?: string; errorCode?: string; submitButtonEnabled: boolean; } export default class InteractiveAuthComponent<T> extends React.Component<InteractiveAuthProps<T>, IState> { private readonly authLogic; private readonly intervalId; private readonly stageComponent; private unmounted; constructor(props: InteractiveAuthProps<T>); componentDidMount(): void; componentWillUnmount(): void; private requestEmailToken; private authStateUpdated; private requestCallback; private onBusyChanged; private setFocus; private submitAuthDict; private onPhaseChange; private onStageCancel; private onAuthStageFailed; private setEmailSid; render(): React.ReactNode; } export {};