@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
68 lines (67 loc) • 3.28 kB
TypeScript
import { Dispatch } from 'redux';
import { DatabaseId, VerificationResponse, ViewModel, BoundAction, BoundActionCreator, ProgramTheme, Segment } from '../types/types';
/**
* @description Start a new verification "flow"
* @param dispatch Redux action dispatch
*/
export declare const createFetchNewVerificationRequest: (dispatch: Dispatch) => <T extends ViewModel = ViewModel>(programId: DatabaseId, segment: Segment, previousViewModel?: T, trackingId?: string, forceNewVerificationRequest?: boolean) => Promise<any>;
/**
* @description Provided with a verificationId, continue verifying someone.
* @param dispatch Redux action dispatch
*/
export declare const createFetchExistingVerificationRequest: BoundActionCreator;
export declare const segmentChanged: (currentSegment: Segment, nextSegment: Segment) => boolean;
export declare const currentStepChanged: (previousVerificationResponse: VerificationResponse, verificationResponse: VerificationResponse) => boolean;
/**
* @description Await several items (new/existing verification request, program theme, etc) then update central state (redux).
* Timing and order is very important within this function as it is bootstrapping most of the application.
*
* @param dispatch Redux action dispatch
* @param verificationResponsePromise Either a new or existing verification server request.
* @param programId
* @param previousViewModel Optional
* @private
*/
export declare const createFetchVerificationRequest: ({ dispatch, verificationResponsePromise, programId, segment, previousViewModel, previousVerificationResponse, verificationId, }: {
dispatch: Dispatch;
programId: DatabaseId;
verificationResponsePromise: Promise<VerificationResponse>;
segment?: Segment;
previousViewModel?: ViewModel;
previousVerificationResponse?: VerificationResponse;
verificationId?: string;
}) => Promise<any>;
/**
* @description Action creator to update the view model in redux.
* @param dispatch
*/
export declare const createUpdateViewModel: BoundActionCreator;
type CreateUpdateProps = (dispatch: Dispatch, programId: DatabaseId) => BoundAction;
export declare const createUpdateLocale: CreateUpdateProps;
/**
* @description Action creator to update the program theme in redux.
* @param dispatch
*/
export declare const createUpdateProgramTheme: BoundActionCreator;
/**
* @description Perform a full reset of the in-memory state
* Useful to fully reset the form and start over again, similar to a page refresh.
*/
export declare const createResetState: (dispatch: Dispatch) => BoundAction;
/**
* @description Action creator to update the field validation errors, which are those that are shown to a user as they fill-in the HTML form.
* @param dispatch
*/
export declare const createUpdateFieldValidationErrors: BoundActionCreator;
/**
* @description Action creator to submit a step to the backend REST API
* @param dispatch
*/
type CreateSubmitStepProps = (dispatch: Dispatch, programTheme: ProgramTheme) => BoundAction;
export declare const createSubmitStep: CreateSubmitStepProps;
/**
* Perform the actual viewModel reset actions
* @private
*/
export declare const doViewModelReset: (dispatch: Dispatch) => (verificationResponse: VerificationResponse) => Promise<any>;
export {};