UNPKG

@sumsub/websdk

Version:

SumSub WebSdk

202 lines (201 loc) 5.81 kB
export type NavigationUiControlsState = { previousScreenButton: 'normal' | 'disabled' | null; closeModalButton: 'normal' | null; }; export type WebSDKEvents = { ['idCheck.onReady']: {}; ['idCheck.onInitialized']: {}; ['idCheck.onStepInitiated']: { idDocSetType: string; types: string[]; videoRequired?: string; }; ['idCheck.stepCompleted']: { idDocSetType: string; }; ['idCheck.onStepCompleted']: { idDocSetType: string; }; ['idCheck.onApplicantLoaded']: { applicantId: string; }; ['idCheck.onApplicantSubmitted']: {}; ['idCheck.applicantStatus']: { reprocessing: boolean; levelName: string; creationDate: string; expireDate: string; reviewStatus: string; autoChecked: boolean; }; ['idCheck.onApplicantStatusChanged']: { reprocessing: boolean; levelName: string; creationDate: string; expireDate: string; reviewStatus: string; autoChecked: boolean; }; ['idCheck.onApplicantResubmitted']: {}; ['idCheck.onActionSubmitted']: {}; ['idCheck.actionCompleted']: { applicantActionId: string; }; ['idCheck.onActionCompleted']: { applicantActionId: string; }; ['idCheck.moduleResultPresented']: { answer: string; }; ['idCheck.onModuleResultPresented']: { answer: string; }; ['idCheck.onResize']: { height: number; }; ['idCheck.onVideoIdentCallStarted']: {}; ['idCheck.onVideoIdentModeratorJoined']: {}; ['idCheck.onVideoIdentCompleted']: {}; ['idCheck.onUploadError']: SnsError; ['idCheck.onUploadWarning']: SnsError; ['idCheck.onError']: SnsError; ['idCheck.onNavigationUiControlsStateChanged']: NavigationUiControlsState; ['idCheck.onApplicantReviewComplete']: { authCode: string; redirectUrl: string; }; ['idCheck.applicantReviewComplete']: { authCode: string; redirectUrl: string; checkResult: boolean; }; ['idCheck.onLanguageChanged']: { language: string; }; ['idCheck.onAgreementSigned']: { residency: string; }; ['idCheck.scrollTo']: { top: number; }; ['idCheck.onApplicantLevelChanged']: { levelName: string; }; ['idCheck.onApplicantVerificationCompleted']: { reprocessing: boolean; levelName: string; creationDate: string; expireDate: string; reviewStatus: string; autoChecked: boolean; }; ['idCheck.onLivenessCompleted']: { answer: string; allowContinuing: boolean; }; ['idCheck.onUserAction']: { action: string; }; ['idCheck.onApplicantActionLoaded']: { applicantActionId: string; }; ['idCheck.onApplicantActionSubmitted']: {}; ['idCheck.onApplicantActionResubmitted']: {}; ['idCheck.onApplicantActionStatusChanged']: { reprocessing: boolean; levelName: string; creationDate: string; expireDate: string; reviewStatus: string; autoChecked: boolean; }; ['idCheck.onApplicantActionCompleted']: { action: string; applicantActionId: string; answer: string; }; ['idCheck.applicantBeneficiariesVerified']: {}; }; export type AnyEventName = keyof WebSDKEvents; export type EventPayload<EventType extends AnyEventName> = WebSDKEvents[EventType]; export type AnyEventPayload = EventPayload<AnyEventName>; export interface SnsWebSdkOptions { addViewportTag?: boolean; adaptIframeHeight?: boolean; debug?: boolean; enableScrollIntoView?: boolean; } export type LegacyExpirationHandler = (updateAccessToken: (newToken: string) => void) => void; export type PromisedTokenExpirationHandler = () => Promise<string>; export type TokenExpirationHandler = { legacy: true; handler: LegacyExpirationHandler; } | { legacy: false; handler: PromisedTokenExpirationHandler; }; export type MessageHandler = <EventType extends AnyEventName>(type: EventType, payload: EventPayload<EventType>) => void; export type ErrorHandler = (error: SnsError) => void; export interface SnsWebSdkCallbacks { expirationHandler: TokenExpirationHandler; onError?: ErrorHandler; onMessage?: MessageHandler; } export interface SnsError { code: string; error: string; reason?: string; } export interface I18NDictionary { [key: string]: I18NValue; } export type I18NArray = I18NValue[]; export type I18NValue = string | I18NDictionary | I18NArray; export interface SnsWebSdkBaseConfig { version?: number; theme?: string; customizationName?: string; translationName?: string; lang?: string; /** * @deprecated Provide this field to the accessToken instead. */ email?: string; /** * @deprecated Provide this field to the accessToken instead. */ phone?: string; country?: string; uiConf?: UIConf; i18n?: I18NDictionary; documentsByCountries?: DocsByCountries; documentDefinitions?: DocDefinitions; singleStep?: string; autoSelectDocumentDefinitions?: boolean; controlledNavigationBack?: boolean; preferredCameras?: PreferredCameras; } export interface DocDefinitions { [key: string]: { country: string; idDocType: string; }; } export interface DocsByCountries { [key: string]: { [key: string]: { supported: boolean; doubleSided: boolean; }; }; } export interface UIConf { customCss?: string; customCssStr?: string; customBodyClass?: string | string[]; scrollIntoView?: boolean; } export interface PreferredCameras { IDENTITY?: string; SELFIE?: string; }