UNPKG

@slashid/react

Version:

React SDK for the /id platform

30 lines 1.38 kB
import { Cancel, LogIn, MFA, Recover } from "../../../domain/types"; import { CreateFlowOptions, Observer, HistoryEntry } from "./flow.common"; /** * Flow API factory function. * * Responsible for creating the flow state machine and providing the flow API. * Internally it delegates event processing to the underlying state instances. * * When a transition is requested, this function will create a new state instance and notify subscribers. * It will not do any checks to see if the transition is valid as it is the responsibility of the state instances. * * The Flow API is not symetric - external code can interact with it using the fields and methods of the state object. * Internally the state object communicates with the flow using the send function, emitting events and letting the flow API orchestrate the state transitions. * * @param opts * @returns */ export declare function createAuthFlow(opts?: CreateFlowOptions): { history: HistoryEntry[]; unsubscribe: (observer: Observer) => void; subscribe: (observer: Observer) => void; setLogIn: (fn: LogIn | MFA) => void; setRecover: (fn: Recover) => void; setCancel: (fn: Cancel) => void; state: { entry?: (() => void) | undefined; } & import("./flow.common").InitialState; }; export type Flow = ReturnType<typeof createAuthFlow>; //# sourceMappingURL=auth-flow.d.ts.map