jslib-nightly
Version:
SheerID JavaScript Library
1,315 lines (1,313 loc) • 60.6 kB
TypeScript
import { Dispatch, Store } from 'redux';
import { InjectedIntl } from 'react-intl';
declare global {
interface String {
insertAt: any;
}
}
/**
* SheerID Javascript Library types and interfaces
*/
/**
* The interface exposed on the window object
*/
export interface SheerIdJsApi {
getMetadata(): Metadata;
setMetadata(metadata: Metadata): void;
resetMetadata(): void;
setOptions(options: Options): void;
resetOptions(): void;
BirthdateField: new (element: HTMLElement) => DiscreteField;
StudentTypeaheadField: new (element: HTMLElement) => DiscreteField;
VerificationForm: new (element: HTMLElement, programId: DatabaseId) => void;
addHook(hook: Hook): RegisteredHooks;
hooks: Hook[];
conversion: Conversion;
setViewModel(viewModel: ViewModel | {}): void;
resetViewModel(): void;
overrideComponent: (componentName: OverrideableComponentName, newComponent: StepComponent) => void;
resetOverriddenComponents: () => void;
loadInModal(url: VerificationUrl, userConfig: IframeUserConfiguration): void;
loadInlineIframe(containerElement: HTMLElement, url: VerificationUrl, userConfig: IframeUserConfiguration): void;
postVerificationSizeUpdates(options: PostMessagesOptions): void;
getMessages(locale: Locale, programThemeMessages?: ProgramThemeMessages, segment?: Segment): Promise<StringMap>;
}
export interface RequestOrganizationApi {
RequestOrganizationForm: new (element: HTMLElement, programId: DatabaseId) => void;
setOptions(options: Options): void;
}
/**
* @description Require only properties of type T
* @private
* Example:
type A = { foo: string }
function bar(newObject: PropertiesOf<A>) {...}
bar({ foo: 'baz' }) // valid
bar({ otherProp: 'stuff' }) // invalid
*/
export declare type PropertiesOf<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
[K in Keys]-?: Required<Pick<T, K>>;
}[Keys];
/**
* @private
*/
export declare type StringMap = {
[a: string]: string;
};
/**
* @example 5bbd127d9781852f68e14ddc
* @template 24 digit hexadecimal
*/
export declare type DatabaseId = string;
/**
* @example { 'someKey': 'someValue' }
*/
export declare type Metadata = {
[key: string]: string | boolean;
};
/**
* @description Configurable options that can be passed when initializing this library.
*/
export declare type Options = {
restApi?: RestApiOptions;
logLevel?: LogLevel;
mockStep?: MockStep;
mockSubSegment?: SubSegment;
mockErrorId?: ErrorId;
mockPreviousStep?: VerificationStep;
doFetchTheme?: boolean;
locale?: Locale;
messages?: object;
messagesWithLocale?: object;
urlStudentFaq?: string;
urlSeniorFaq?: string;
urlAgeFaq?: string;
urlMilitaryFaq?: string;
urlTeacherFaq?: string;
urlMemberFaq?: string;
urlFirstResponderFaq?: string;
urlMedicalFaq?: string;
urlEmploymentFaq?: string;
urlIdentityFaq?: string;
urlLicensedProfessionalFaq?: string;
urlAddSchoolFaq?: string;
urlAddSchoolForm?: string;
customCss?: ProgramTheme['customCss'];
logoUrl?: ProgramTheme['logoUrl'];
privacyPolicyUrl?: ProgramTheme['privacyPolicyUrl'];
cookies?: CookieOptions;
useFingerprinting?: boolean;
marketConsent?: MarketConsentOptions;
customMetadata?: MetadataConfig;
verificationId?: string;
minimumOrganizationSearchLength?: number;
httpRequestTimeout?: number;
};
export declare type RestApiOptions = {
serviceUrl: string;
resources: RestResources;
};
/**
* @description Control how cookies behave
* @field `expires` Number of days for cookie to expire in. Use 0 to expire in same browser session.
* @field `secure` Whether the cookie is set securely.
*/
export declare type CookieOptions = {
expires: number;
secure: boolean;
enabled: boolean;
path?: string;
domain?: string;
sameSite?: 'lax' | 'strict' | 'none';
};
export declare type MarketConsentOptions = {
enabled: boolean;
required: boolean;
message: string;
};
export declare type MetadataConfig = {
enabled: boolean;
keys: string[];
};
export declare type RestResources = {
verification: string;
program: ProgramResources;
conversion: ConversionResources;
};
export declare type ProgramResources = {
base: string;
theme: string;
organization: string;
};
/**
* @description Configuration for a verification being displayed on an iframe.
*/
export declare type IframeUserConfiguration = {
closeButtonText?: string;
mobileRedirect?: boolean;
mobileThreshold?: string | number;
stopPropagation?: boolean;
};
/**
* @description URL of a verification to be displayed.
*/
export declare type VerificationUrl = string;
/**
* @description Options for the message events send by a verification loaded on an iframe.
* These event are used to resize a modal containing a verification.
*/
export declare type PostMessagesOptions = {
origin: VerificationUrl;
interval: number;
};
/**
* @description URLs related to conversion endpoints.
*/
export declare type ConversionResources = {
base: string;
};
export declare type LogLevel = 'info' | 'log' | 'warn' | 'error';
/**
* @description Interface for individual field instances, such as BirthdateField
* @example new sheerid.BirthdateField().setValue('2000-01-01');
*/
export interface DiscreteField {
getValue(): any;
setValue(value: any): void;
onChange(callback: Function): void;
setIsErrored(value: boolean): void;
render(): void;
}
/**
* @todo document constraints here
*/
export declare type Email = string;
/**
* @example (111) 222-3333 | 1112223333 | 111-222-3333
* TODO - Update this when PhoneNumberValidator regex changes.
*/
export declare type PhoneNumber = string;
/**
* @example 2013-03-06
* @template ISO-8601 'YYYY-MM-DD'
*/
export declare type BirthDate = string;
/**
* @example 1234567 | A01205257
*/
export declare type MemberId = string;
/**
* @description TODO
*/
export declare type DischargeDate = string;
/**
* @description TODO
*/
export declare type MilitaryStatus = 'ACTIVE_DUTY' | 'VETERAN' | 'RESERVIST' | 'MILITARY_RETIREE' | 'MILITARY_FAMILY';
/**
* @description TODO
*/
export declare type FirstResponderStatus = 'FIREFIGHTER' | 'EMT' | 'POLICE';
export declare type MedicalProfessionalStatus = 'NURSE' | 'DOCTOR' | 'OTHER_HEALTH_WORKER';
export declare type LicensedProfessionalStatus = string;
/**
* @description TODO
*/
export declare type OrganizationId = number;
/**
* @description TODO
*/
export declare type OrganizationName = string;
/**
* @description All possible fields
*/
export declare type FieldId = 'firstName' | 'lastName' | 'memberId' | 'organization' | 'birthDate' | 'email' | 'phoneNumber' | 'postalCode' | 'address1' | 'city' | 'state' | 'dischargeDate' | 'status' | 'statuses' | 'docUpload' | 'country' | 'smsCode' | 'socialSecurityNumber' | 'marketConsentValue' | 'carrierConsentValue' | 'driverLicenseNumber';
export declare type FormValidationOptions = {
minAge?: number;
maxAge?: number;
smsLoopEnabled?: boolean;
currentStep?: VerificationStep;
viewModel?: ViewModel;
};
/**
* @description TODO
*/
export declare type ExtendedFieldId = FieldId | string;
/**
* @description The object that contains all possible field ids for setting & displaying field errors, if any
*/
export declare type FieldValidationErrors = {
[P in FieldId]: ErrorId;
};
/**
* @description TODO
*/
export declare type ExtendedFieldValidationErrors = StringMap;
/**
* @description TODO
*/
export declare type FieldContent = string | number | File | FormSelectChoice<Country, string> | Organization | boolean;
/**
* @private
*/
export declare type Organization = {
id: OrganizationId;
name: OrganizationName;
country?: Country;
type?: OrganizationType;
idExtended?: string;
source?: OrganizationRemoteSource;
};
/**
* @private
*/
export declare type OrganizationRemoteSource = 'EMPLOYER';
/**
* @private
*/
export declare type OrganizationSearchResp = Organization[];
/**
* @description A model to back many of this library's `<select>` elements.
* For compatibility, a default for value of `string` or `number` is allowed.
* Made generic to allow arbitrary types (e.g. `FormSelectChoice<Locale, string>`)
*/
export declare type FormSelectChoice<v = string | number, l = string> = {
value: v;
label: l;
};
export declare type InputSelectOnKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => void;
export interface FormFieldComponentProps<T = any> {
onChange: Function;
value: T;
intl?: InjectedIntl;
autoFocus?: boolean;
isErrored?: boolean;
errorId?: ErrorId;
isRequired?: boolean;
onKeyDown?: Function;
placeholder?: string;
verificationService?: VerificationService;
}
/**
* @description Configurable refs that can be defined when rendering FormField components.
*/
export declare type FieldRef = {
fieldId: FieldId | ExtendedFieldId;
ref: HTMLElement;
};
export interface VerificationServiceProps {
verificationService: VerificationService;
}
export interface InputSelectComponentProps {
onChange: Function;
options: FormSelectChoice[];
value: any;
isErrored?: boolean;
isRequired?: boolean;
onKeyDown?: InputSelectOnKeyDown;
placeholder?: string;
label?: string | JSX.Element;
intl: InjectedIntl;
}
export declare type ErrorId = 'apiRateLimitExceeded' | 'dischargeDateBeforeBirthDate' | 'docReviewLimitExceeded' | 'inactiveProgram' | 'expiredProgram' | 'expiredEmailLoopToken' | 'expiredSMSCode' | 'expiredVerification' | 'fraudRulesReject' | 'futureBirthDate' | 'futureDischargeDate' | 'internalServerError' | 'invalidAddress' | 'invalidApiToken' | 'invalidBirthDate' | 'invalidCity' | 'invalidCountry' | 'invalidDischargeDate' | 'invalidDocUploadToken' | 'invalidEmail' | 'invalidFileSizeEmpty' | 'invalidFileSizeMax' | 'invalidFirstName' | 'invalidFirstResponderStatus' | 'invalidLastName' | 'invalidMemberId' | 'invalidMilitaryStatus' | 'invalidNumberOfFiles' | 'invalidOptIn' | 'invalidOrganization' | 'invalidPhoneNumber' | 'invalidPostalCode' | 'invalidProgram' | 'invalidRequest' | 'invalidSMSCode' | 'invalidSocialSecurityNumber' | 'invalidState' | 'invalidStatus' | 'invalidStatuses' | 'invalidDriverLicenseNumber' | 'invalidStep' | 'marketConsentRequired' | 'maxMetadataLengthExceeded' | 'maxMetadataValuesExceeded' | 'maxSMSCodeLimitExceeded' | 'incorrectSMSCodeAttemptLimitExceeded' | 'noProgram' | 'noRemainingRewardCodes' | 'notApproved' | 'notFound' | 'noValidFiles' | 'noVerification' | 'outsideAgePerson' | 'simulatedError' | 'unauthorizedDomain' | 'underagePerson' | 'unknownError' | 'unsupportedDocMimeType' | 'verificationLimitExceeded' | 'invalidEmailLoopToken' | NetworkErrorId;
export declare type NetworkErrorId = 'failedToFetch' | 'requestTimeout';
export declare type ExtendedErrorId = string | undefined;
export declare type RejectionReasons = 'DOCUMENT_UNREADABLE' | 'DOCUMENT_PASSWORD_PROTECTED' | 'DOCUMENT_LIKELY_FRAUD' | 'DOCUMENT_UNSUPPORTED' | 'DOCUMENT_HANDWRITTEN' | 'MISSING_INFORMATION' | 'MISSING_INFORMATION_PERSON_NAME' | 'MISSING_INFORMATION_ORGANIZATION_NAME' | 'DOCUMENT_EXPIRED' | 'DOCUMENT_OUTDATED' | 'MISMATCH_PERSON_NAME' | 'MISMATCH_ORGANIZATION' | 'MISMATCH_STATUS' | 'INELIGIBLE_ORGANIZATION' | 'MISSING_INFORMATION_UNIVERSITY_ENROLLMENT' | 'INELIGIBLE_PERSON_HIGH_SCHOOL_STUDENT' | 'MISSING_INFORMATION_AFFILIATION_US_ARMED_FORCES' | 'MISMATCH_COMPANY_NAME_OR_ADDRESS' | 'PAYSTUB_OUTDATED_LAST_30_DAYS' | 'MISSING_INFORMATION_BIRTHDATE' | 'MISMATCH_BIRTHDATE' | 'DOCUMENT_OUTDATED_FACULTY' | 'MISSING_OR_MISMATCH_JOB_TITLE' | 'OTHER_CONTACT_US';
export declare type VerificationStep = 'collectStudentPersonalInfo' | 'collectTeacherPersonalInfo' | 'collectMemberPersonalInfo' | 'collectMilitaryStatus' | 'collectActiveMilitaryPersonalInfo' | 'collectInactiveMilitaryPersonalInfo' | 'collectSeniorPersonalInfo' | 'collectAgePersonalInfo' | 'collectFirstResponderPersonalInfo' | 'collectMedicalProfessionalPersonalInfo' | 'collectEmployeePersonalInfo' | 'collectDriverLicensePersonalInfo' | 'collectGeneralIdentityPersonalInfo' | 'collectHybridIdentityPersonalInfo' | 'collectLicensedProfessionalPersonalInfo' | 'collectSocialSecurityNumber' | 'cancelSocialSecurityNumber' | 'docUpload' | 'pending' | 'docReviewLimitExceeded' | 'success' | 'error' | 'sso' | 'smsLoop' | 'emailLoop' | 'cancelEmailLoop';
export declare type VerificationStepMap<T> = {
[P in VerificationStep]: T;
};
export declare type MockStep = VerificationStep | 'loading';
export declare type OverrideableComponentName = 'StepStudentPersonalInfoComponent' | 'StepSeniorPersonalInfoComponent' | 'StepAgePersonalInfoComponent' | 'StepTeacherPersonalInfoComponent' | 'StepMemberPersonalInfoComponent' | 'StepCollectMilitaryStatusComponent' | 'StepActiveMilitaryPersonalInfoComponent' | 'StepInactiveMilitaryPersonalInfoComponent' | 'StepFirstResponderPersonalInfoComponent' | 'StepMedicalProfessionalPersonalInfoComponent' | 'StepEmploymentPersonalInfoComponent' | 'StepDriverLicensePersonalInfoComponent' | 'StepGeneralIdentityPersonalInfoComponent' | 'StepHybridIdentityPersonalInfoComponent' | 'StepLicensedProfessionalPersonalInfoComponent' | 'StepSuccessComponent' | 'StepDocUploadComponent' | 'StepPendingComponent' | 'StepPendingEmailLoopComponent' | 'StepErrorComponent' | 'StepSSOComponent' | 'StepSMSLoopComponent' | 'StepEmailLoopComponent' | 'StepSocialSecurity' | 'RequestOrganizationSuccessComponent' | 'RequestOrganizationErrorComponent' | 'RequestOrganizationSearchComponent';
export declare type StepComponent = React.FunctionComponent<{
verificationService: VerificationService;
}>;
export declare type Segment = 'student' | 'military' | 'teacher' | 'member' | 'senior' | 'age' | 'firstResponder' | 'medical' | 'employment' | 'identity' | 'licensedProfessional';
export declare type SubSegment = 'college' | 'highSchool' | 'activeDuty' | 'reservist' | 'veteran' | 'retiree' | 'militaryFamily' | 'police' | 'emt' | 'fireFighter' | 'nurse' | 'doctor' | 'driverLicense' | 'generalIdentity' | 'hybridIdentity' | 'licensedCosmetologists' | 'licensedRealState';
export declare type OrganizationType = 'UNIVERSITY' | 'POST_SECONDARY' | 'MEMBERSHIP' | 'MILITARY' | 'FIRST_RESPONDER' | 'MEDICAL' | 'NON_PROFIT' | 'CORPORATE' | 'K12' | 'AGE_ID' | 'HIGH_SCHOOL' | 'NONE';
export declare type NewVerificationRequest = {
programId: DatabaseId;
trackingId?: string;
};
/**
* @description The request to submit when verification is on the step "collectStudentPersonalInfo"
*/
export declare type StudentPersonalInfoRequest = {
birthDate: BirthDate;
} & WithOrganization & WithCoreFields;
export declare type StudentPersonalInfoViewModel = StudentPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "collectSeniorPersonalInfo"
*/
export declare type SeniorPersonalInfoRequest = {
birthDate: BirthDate;
postalCode: string;
} & WithCoreFields;
export declare type SeniorPersonalInfoViewModel = SeniorPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "collectAgePersonalInfo"
*/
export declare type AgePersonalInfoRequest = {
birthDate: BirthDate;
postalCode: string;
phoneNumber: PhoneNumber;
country: Country;
} & WithCoreFields;
export declare type AgePersonalInfoViewModel = AgePersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "collectMilitaryStatus"
*/
export declare type MilitaryStatusRequest = {
status: MilitaryStatus;
};
/**
* @description The request to submit when verification is on the step "collectActiveMilitaryPersonalInfo"
*/
export declare type ActiveMilitaryPersonalInfoRequest = {
birthDate: BirthDate;
country?: Country;
} & WithOrganization & WithCoreFields;
export declare type ActiveMilitaryPersonalInfoViewModel = {
status: MilitaryStatus;
} & ActiveMilitaryPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "collectInactiveMilitaryPersonalInfo"
*/
export declare type InactiveMilitaryPersonalInfoRequest = {
birthDate: BirthDate;
dischargeDate: DischargeDate;
country?: Country;
} & WithOrganization & WithCoreFields;
export declare type InactiveMilitaryPersonalInfoViewModel = {
status: MilitaryStatus;
} & InactiveMilitaryPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "collectTeacherPersonalInfo"
*/
export declare type TeacherPersonalInfoRequest = {
birthDate?: BirthDate;
postalCode?: string;
} & WithOrganization & WithCoreFields;
export declare type TeacherPersonalInfoViewModel = TeacherPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "collectMemberPersonalInfo"
*/
export declare type MemberPersonalInfoRequest = {
memberId?: MemberId;
birthDate?: BirthDate;
phoneNumber?: PhoneNumber;
} & WithOrganization & WithCoreFields;
export declare type MemberPersonalInfoViewModel = MemberPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "collectFirstResponderPersonalInfo"
* Provide postalCode when organization.id = 0 for better verification results.
*/
export declare type FirstResponderPersonalInfoRequest = {
birthDate: BirthDate;
status: FirstResponderStatus;
postalCode?: string;
country?: Country;
} & WithOrganization & WithCoreFields;
export declare type FirstResponderPersonalInfoViewModel = FirstResponderPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
export declare type MedicalStatusRequest = {
status: MedicalProfessionalStatus;
};
/**
* @description The request to submit when verification is on the step "collectMedicalProfessionalPersonalInfo"
*/
export declare type MedicalProfessionalPersonalInfoRequest = {
birthDate: BirthDate;
postalCode: string;
status: MedicalProfessionalStatus;
country: Country;
} & WithOrganization & WithCoreFields;
export declare type MedicalProfessionalPersonalInfoViewModel = MedicalProfessionalPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "collectEmployeePersonalInfo"
*/
export declare type EmploymentPersonalInfoRequest = {
postalCode: string;
phoneNumber?: PhoneNumber;
shouldCollectAddress?: Boolean;
} & WithAddress & WithOrganization & WithCoreFields;
export declare type SMSLoopVerificationRequest = {
smsCode: string;
deviceFingerprintHash?: string;
};
export declare type EmailLoopVerificationRequest = {
emailToken: string;
deviceFingerprintHash?: string;
};
export declare type EmploymentPersonalInfoViewModel = EmploymentPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "collectDriverLicensePersonalInfo"
*/
export declare type DriverLicensePersonalInfoRequest = {
driverLicenseNumber: string;
state: string;
} & WithCoreFields;
export declare type DriverLicensePersonalInfoViewModel = DriverLicensePersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
export declare type GeneralIdentityPersonalInfoRequest = {
birthDate: BirthDate;
postalCode: string;
} & WithAddress & WithCoreFields;
export declare type GeneralIdentityPersonalInfoViewModel = GeneralIdentityPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
export declare type HybridIdentityPersonalInfoRequest = {
birthDate: BirthDate;
postalCode: string;
driverLicenseNumber: string;
} & WithAddress & WithCoreFields;
export declare type HybridIdentityPersonalInfoViewModel = HybridIdentityPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "collectLicensedProfessionalPersonalInfo"
*/
export declare type LicensedProfessionalPersonalInfoRequest = {
birthDate: BirthDate;
postalCode: string;
statuses: LicensedProfessionalStatus[];
} & WithCoreFields & WithOrganization;
export declare type LicensedProfessionalPersonalInfoViewModel = LicensedProfessionalPersonalInfoRequest & WithLocaleAndCountry & WithFieldsToSkipValidation;
export declare type SocialSecurityRequest = {
socialSecurityNumber: number;
};
export declare type SocialSecurityResponse = {
verificationId: DatabaseId;
submissionUrl: string;
cancelUrl: string;
currentStep: 'collectSocialSecurityNumber';
errorIds?: [ErrorId];
} & WithLocaleAndSegment;
export declare type SocialSecurityViewModel = {
socialSecurityNumber: string;
metadata?: Metadata;
} & WithLocaleAndCountry & WithFieldsToSkipValidation;
/**
* @description The request to submit when verification is on the step "docUpload"
*/
export declare type DocUploadRequest = {
file1: File;
file2?: File;
file3?: File;
metadata?: Metadata;
};
export declare type DocUploadViewModel = DocUploadRequest & {
erroredFileNames?: string[];
} & WithLocaleAndCountry & WithFieldsToSkipValidation;
export declare type SSOViewModel = {
isSSOActive: boolean;
metadata?: Metadata;
} & WithLocaleAndCountry & WithFieldsToSkipValidation;
export declare type SMSLoopViewModel = {
smsCode: string;
phoneNumber: string;
metadata?: Metadata;
deviceFingerprintHash?: string;
} & WithLocaleAndCountry & WithFieldsToSkipValidation;
export declare type EmailLoopViewModel = {
emailToken: string;
metadata?: Metadata;
deviceFingerprintHash?: string;
} & WithLocaleAndCountry & WithFieldsToSkipValidation;
export declare type RequestOrganizationViewModel = {
localeChoice: FormSelectChoice<Locale, string>;
countryChoice: FormSelectChoice<Country, string>;
orgDomain: string;
orgName: string;
firstName: string;
lastName: string;
email: string;
displayResults: boolean;
searchByOrgName: boolean;
completeRequest: boolean;
eligibleOrgs: Organization[];
ineligibleOrgs: Organization[];
orgCountryError: string;
orgDomainError: string;
orgNameError: string;
firstNameError: string;
lastNameError: string;
emailError: string;
isSearching: boolean;
};
export declare type VerificationRequest = StudentPersonalInfoRequest | AgePersonalInfoRequest | SeniorPersonalInfoRequest | TeacherPersonalInfoRequest | MemberPersonalInfoRequest | MilitaryStatusRequest | ActiveMilitaryPersonalInfoRequest | InactiveMilitaryPersonalInfoRequest | DocUploadRequest | FirstResponderPersonalInfoRequest | MedicalProfessionalPersonalInfoRequest | EmploymentPersonalInfoRequest | SocialSecurityRequest | SMSLoopVerificationRequest | EmailLoopVerificationRequest | DriverLicensePersonalInfoRequest | GeneralIdentityPersonalInfoRequest | HybridIdentityPersonalInfoRequest | LicensedProfessionalPersonalInfoRequest;
export declare type ViewModel = StudentPersonalInfoViewModel | SeniorPersonalInfoViewModel | AgePersonalInfoViewModel | TeacherPersonalInfoViewModel | MemberPersonalInfoViewModel | ActiveMilitaryPersonalInfoViewModel | InactiveMilitaryPersonalInfoViewModel | DocUploadViewModel | SSOViewModel | FirstResponderPersonalInfoViewModel | MedicalProfessionalPersonalInfoViewModel | EmploymentPersonalInfoViewModel | SocialSecurityViewModel | SMSLoopViewModel | EmailLoopViewModel | DriverLicensePersonalInfoViewModel | GeneralIdentityPersonalInfoViewModel | HybridIdentityPersonalInfoViewModel | LicensedProfessionalPersonalInfoViewModel;
export declare type PersonalInfoViewModel = StudentPersonalInfoViewModel | SeniorPersonalInfoViewModel | AgePersonalInfoViewModel | TeacherPersonalInfoViewModel | MemberPersonalInfoViewModel | ActiveMilitaryPersonalInfoViewModel | InactiveMilitaryPersonalInfoViewModel | FirstResponderPersonalInfoViewModel | MedicalProfessionalPersonalInfoViewModel | EmploymentPersonalInfoViewModel | DriverLicensePersonalInfoViewModel | GeneralIdentityPersonalInfoViewModel | HybridIdentityPersonalInfoViewModel | LicensedProfessionalPersonalInfoViewModel;
export declare type WithOrganization = {
organization: Organization;
};
export declare type WithAddress = {
address1: string;
city: string;
state: string;
};
export declare type WithCoreFields = {
firstName: string;
lastName: string;
email: Email;
phoneNumber?: PhoneNumber;
metadata?: Metadata;
deviceFingerprintHash?: string;
locale?: Locale;
};
export declare type WithFieldsToSkipValidation = {
fieldsToSkipValidation?: FieldId[];
};
export declare type WithLocaleAndCountry = {
countryChoice: FormSelectChoice<Country, string>;
localeChoice: FormSelectChoice<Locale, string>;
};
export declare type AddSchoolRequestViewModel = {
programId: string;
firstName: string;
lastName: string;
email: string;
schoolCountry: Country;
schoolName: string;
schoolDomain: string;
trackingId?: string;
};
export declare type WithLocaleAndSegment = {
segment: Segment;
subSegment: SubSegment;
locale: Locale;
};
/**
* @description Base type for all responses
*/
export declare type VerificationResponse = {
verificationId: DatabaseId;
currentStep: VerificationStep;
errorIds?: ErrorId[];
maxAge?: number;
minAge?: number;
} & WithLocaleAndSegment;
/**
* @description Intersection type for all *PersonalInfo responses
*/
export declare type PersonalInfoResponse = StudentPersonalInfoResponse | SeniorPersonalInfoResponse | AgePersonalInfoResponse | TeacherPersonalInfoResponse | MemberPersonalInfoResponse | ActiveMilitaryPersonalInfoResponse | InactiveMilitaryPersonalInfoResponse | FirstResponderPersonalInfoResponse | MedicalProfessionalPersonalInfoResponse | EmploymentPersonalInfoResponse | DriverLicensePersonalInfoResponse | GeneralIdentityPersonalInfoResponse | HybridIdentityPersonalInfoResponse | LicensedProfessionalPersonalInfoResponse;
export declare type AllResponseTypes = PersonalInfoResponse | SSOResponse | DocUploadResponse | SMSLoopResponse | EmailLoopResponse | SuccessResponse | ErrorResponse | PendingResponse | SocialSecurityResponse | MilitaryStatusResponse;
/**
* @description Response from REST API indicating that StudentPersonalInfoViewModel is expected to be submitted next.
*/
export declare type StudentPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectStudentPersonalInfo';
segment: 'student';
subSegment: null;
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
/**
* @description Response from REST API indicating that SeniorPersonalInfoViewModel is expected to be submitted next.
*/
export declare type SeniorPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectSeniorPersonalInfo';
segment: 'senior';
subSegment: null;
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
/**
* @description Response from REST API indicating that AgePersonalInfoViewModel is expected to be submitted next.
*/
export declare type AgePersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectAgePersonalInfo';
segment: 'age';
subSegment: null;
errorIds?: [ErrorId];
instantMatchAttempts?: number;
minAge?: number;
maxAge?: number;
} & VerificationResponse;
/**
* @description Response from REST API indicating that TeacherPersonalInfoViewModel is expected to be submitted next.
*/
export declare type TeacherPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectTeacherPersonalInfo';
segment: 'teacher';
subSegment: null;
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
export declare type MemberPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectMemberPersonalInfo';
segment: 'member';
subSegment: null;
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
/**
* @description Response from REST API indicating that StudentPersonalInfoViewModel is expected to be submitted next.
*/
export declare type MilitaryStatusResponse = {
submissionUrl: string;
currentStep: 'collectMilitaryStatus';
segment: 'military';
errorIds?: [ErrorId];
availableStatuses?: [MilitaryStatus];
} & VerificationResponse;
/**
* @description Response from REST API indicating that StudentPersonalInfoViewModel is expected to be submitted next.
*/
export declare type ActiveMilitaryPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectActiveMilitaryPersonalInfo';
segment: 'military';
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
/**
* @description Response from REST API indicating that StudentPersonalInfoViewModel is expected to be submitted next.
*/
export declare type InactiveMilitaryPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectInactiveMilitaryPersonalInfo';
segment: 'military';
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
export declare type FirstResponderPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectFirstResponderPersonalInfo';
segment: 'firstResponder';
errorIds?: [ErrorId];
availableStatuses?: [FirstResponderStatus];
instantMatchAttempts?: number;
} & VerificationResponse;
export declare type MedicalProfessionalPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectMedicalProfessionalPersonalInfo';
segment: 'medical';
errorIds?: [ErrorId];
availableStatuses?: [MedicalProfessionalStatus];
instantMatchAttempts?: number;
} & VerificationResponse;
export declare type EmploymentPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectEmployeePersonalInfo';
segment: 'employment';
subSegment: null;
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
/**
* @description Response from REST API indicating that DriverLicensePersonalInfoViewModel is expected to be submitted next.
*/
export declare type DriverLicensePersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectDriverLicensePersonalInfo';
segment: 'identity';
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
export declare type GeneralIdentityPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectGeneralIdentityPersonalInfo';
segment: 'identity';
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
export declare type HybridIdentityPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectHybridIdentityPersonalInfo';
segment: 'identity';
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
export declare type LicensedProfessionalPersonalInfoResponse = {
submissionUrl: string;
currentStep: 'collectLicensedProfessionalPersonalInfo';
segment: 'licensedProfessional';
availableStatuses?: LicensedProfessionalStatus[];
errorIds?: [ErrorId];
instantMatchAttempts?: number;
} & VerificationResponse;
/**
* @description Response from REST API indicating that DocUploadRequest is expected to be submitted next.
*/
export declare type DocUploadResponse = {
verificationId: DatabaseId;
submissionUrl: string;
currentStep: 'docUpload';
errorIds?: [ErrorId];
rejectionReasons?: RejectionReasons[];
maxReviewTime?: MaxReviewTime;
estimatedReviewTime?: EstimatedReviewTime;
} & WithLocaleAndSegment;
/**
* @description Response from REST API indicating that SSO is expected to be submitted next.
*/
export declare type SSOResponse = {
verificationId: DatabaseId;
loginUrl: string;
cancelUrl: string;
currentStep: 'sso';
errorIds?: [ErrorId];
} & WithLocaleAndSegment;
export declare type SMSLoopResponse = {
verificationId: DatabaseId;
submissionUrl: string;
errorIds?: [ErrorId];
currentStep: 'smsLoop';
} & WithLocaleAndSegment;
export declare type EmailLoopResponse = {
verificationId: DatabaseId;
submissionUrl: string;
errorIds?: [ErrorId];
currentStep: 'emailLoop';
canResendEmailLoop: boolean;
cancelUrl: string;
} & WithLocaleAndSegment;
/**
* @description Response from REST API. No further requests are expected.
*/
export declare type SuccessResponse = {
verificationId: DatabaseId;
currentStep: 'success';
rewardCode: string;
redirectUrl?: string;
} & WithLocaleAndSegment;
/**
* @description Response from REST API. Unrecoverable error. No further requests are expected. Recommend starting over.
*/
export declare type ErrorResponse = {
verificationId: DatabaseId;
currentStep: 'error';
subSegment: SubSegment | null;
errorIds: [ErrorId];
redirectUrl: string | null;
} & WithLocaleAndSegment;
/**
* @description Response from REST API. Poll statusUrl for updates while document is reviewed.
*/
export declare type PendingResponse = {
verificationId: DatabaseId;
currentStep: 'pending';
statusUrl: string;
maxReviewTime?: MaxReviewTime;
estimatedReviewTime?: EstimatedReviewTime;
} & WithLocaleAndSegment;
/**
* @description Theme information about the Program that was created at my.sheerid.com
*/
export declare type ProgramTheme = {
intl: {
locale: Locale;
messages: ProgramThemeMessages;
};
customCss: string;
logoUrl?: string;
privacyPolicyUrl?: string;
isTestMode?: boolean;
openOrgSearchEnabled?: boolean;
isSmsNotifierConfigured?: boolean;
remainingRewardCodes?: number | null;
smsLoopEnabled?: boolean;
threatMetrixEnabled?: boolean;
idCheckAddOnEnabled?: boolean;
config: {
countries: Country[];
states?: State[];
locales: Locale[];
maxReviewTime: MaxReviewTime;
estimatedReviewTime: EstimatedReviewTime;
marketConsent: MarketConsentOptions;
customFaqLink: FaqUrl;
customMetadata: MetadataConfig;
orgSearchUrl: string;
orgRemoteSource?: OrganizationRemoteSource;
orgTypes: OrganizationType[];
excludedOrganizationIds: number[];
orgSearchCountryTags?: {
[country in Country]?: string[];
};
offerType: 'noCode' | 'staticCode' | 'rewardPool' | undefined;
};
};
export declare type EstimatedReviewTime = 'A_FEW_MINUTES' | 'A_HALF_HOUR' | 'A_FEW_HOURS' | 'A_FEW_DAYS';
export declare type MaxReviewTime = '2_MIN' | '20_MIN' | '2_HRS' | '24_HRS' | '2_DAY' | '3_DAY';
export declare type FaqUrl = string;
/**
* @description List of countries supported by SheerID
*/
export declare type Country = keyof Countries;
export declare type State = keyof States;
export declare type Messages = DefaultMessages & ProgramThemeMessages & SegmentSpecificMessages;
export interface MessagesModule {
defaultMessages: DefaultMessages;
pluralizationsAndDateLocaleData: any;
segmentMessages: {
[S in Segment]: SegmentSpecificMessages;
};
requestOrganizationMessages: RequestOrganizationMessages;
}
/**
* @description These strings are set by a user editing your program in my.sheerid.com
*/
export declare type ProgramThemeMessages = {
companyName: string;
errorId: {
verificationLimitExceeded: string;
noRemainingRewardCodes: string;
};
lowRewardPool: string | null;
step: {
personalInfo: {
title: string;
};
success: {
redirectUrl: string;
redirectButtonText: string;
subtitle: string;
title: string;
};
docUpload: {
title: string;
subtitle: string;
};
error: {
errorId: {
verificationLimitExceeded: {
title: string;
};
noRemainingRewardCodes: {
title: string;
buttonText: string;
};
expiredProgram: {
title: string;
buttonText: string;
};
inactiveProgram: {
title: string;
buttonText: string;
};
};
};
};
};
/**
* @description These strings vary by program segment
*/
export declare type SegmentSpecificMessages = {
emailExplanation: string;
schoolName?: string;
step: {
personalInfo: {
title: string;
subtitle: string;
howDoesVerifyingWorkDetails: string;
tryAgain: {
title: string;
subtitle: string;
};
};
docUpload: {
howDoesVerifyingWorkDetails: string;
uploadInstructions: string;
title: string;
subtitle: string;
};
success: {
title: string;
subtitle: string;
redirectButtonText: string;
};
sso?: {
title?: string;
subtitle?: string;
subtitle2?: string;
login?: string;
cancel?: string;
};
};
};
/**
* @description These strings are provided by default
*/
export declare type DefaultMessages = {
address: string;
addressPlaceholder: string;
birthDate: string;
branchOfService: string;
branchOfServicePlaceholder: string;
changeLanguage: string;
city: string;
cityPlaceholder: string;
company: string;
companyPlaceholder: string;
copied: string;
country: string;
countryPlaceholder: string;
countries: Countries;
dateTime: DateTimeMessages;
dischargeDate: string;
driverLicenseNumber: string;
driverLicenseNumberPlaceholder: string;
driverLicenseState: string;
emailAddress: string;
emailAddressPlaceholder: string;
error: string;
errorId: {
[P in ErrorId]: string;
};
firstName: string;
firstNamePlaceholder: string;
howDoesReviewWork: string;
howDoesVerifyingWork: string;
informationTransferredToUS: string;
lastName: string;
lastNamePlaceholder: string;
limitExceededError: string;
memberId: string;
memberIdPlaceholder: string;
optional: string;
loading: string;
locales: {
[P in Locale]: string;
};
militaryStatus: string;
noOptions: string;
lowRewardPool: string;
organization: string;
organizationPlaceholder: string;
personalInformation: any;
personalOrSchoolIsFine: string;
phoneNumber: string;
phoneNumberExplanation: string;
phoneNumberWarnMessage1: string;
phoneNumberWarnMessage2: string;
phoneUsPlaceholder: string;
postalCode: string;
postalCodeExplanation: string;
postalCodePlaceholder: string;
poweredBy: string;
proceed: string;
requestSchool: string;
requiredFields: string;
school: string;
schoolName: string;
schoolNamePlaceholder: string;
sheeridFaqs: string;
privacyPolicy: string;
smsCodePlaceholder: string;
state: string;
statePlaceholder: string;
states: States;
status: string;
statusPlaceholder: string;
step: {
success: {
copyCouponCode: string;
emailNotification: string;
verificationOnly: string;
};
pending: {
titleCountdown: string;
titleReview: string;
subtitle: string;
subtitleAlt: string;
docDiffLang: string;
turnaroundTime: string;
subtitle2: string;
subtitle3: string;
subtitleCountdown: string;
};
docUpload: {
acceptableUploadExamples: string;
acceptedTypes: string;
addFile: string;
cancelButtonLabel: string;
fileInstructions: string;
rejectionReasons: {};
submitButtonLabel: string;
rejectedSubtitle: string;
nameChanged: string;
uploadInfo: {
affiliation: string;
fullName: string;
organization: string;
student: {
school: string;
enrollmentDate: string;
};
teacher: {
school: string;
currentSchoolYear: string;
};
military: {
serviceBranch: string;
dischargeDate: string;
currentAffiliation: string;
uploadInstructionsDependent: string;
};
senior: {
birthDate: string;
};
age: {
birthDate: string;
};
firstResponder: {
organization: string;
currentAffiliation: string;
license: string;
};
medical: {
status: string;
validDate: string;
};
employment: {
company: string;
currentAffiliation: string;
};
identity: {
validDate: string;
};
licensedProfessional: {
licenseStatus: string;
validDate: string;
};
};
acceptableUploads: {
student: {
idCard: string;
classSchedule: string;
tuitionReceipt: string;
};
teacher: {
idCard: string;
payStub: string;
};
member: {
idCard: string;
payStub: string;
};
senior: {
birthCertificate: string;
driversLicense: string;
passport: string;
stateId: string;
};
age: {
birthCertificate: string;
driversLicense: string;
passport: string;
stateId: string;
};
military: {
activeDuty: string;
veteran: string;
reservistA: string;
retiree: string;
dependent: string;
};
medical: {
licenseCertificate: string;
idCard: string;
photoPayStub: string;
};
employment: {
employeeIdCard: string;
payStub: string;
officialLetter: string;
};
firstResponder: {
idCard: string;
payStub: string;
letter: string;
};
licensedProfessional: {
license: string;
};
};
};
sso: {
title: string;
subtitle: string;
subtitle2: string;
cancel: string;
login: string;
};
collectSocialSecurityNumber: {
selectOption: string;
title: string;
uploadDoc: string;
uploadInstead: string;
useSsn: string;
};
smsLoop: {
titleWithNumber: string;
titleWithoutNumber: string;
verificationCode: string;
errors: {
codeVerification: string;
codeExpired: string;
codeResendLimit: string;
resend: string;
};
successResend: string;
incorrectNumber: {
incorrectNumber1: string;
incorrectNumber2: string;
incorrectNumber3: string;
};
resendButton: string;
submitButton: string;
};
emailLoop: {
title: string;
subtitleWithEmail: string;
subtitleWithoutEmail: string;
subtitle2: string;
successResend: string;
resendButton: string;
errors: {
resend: string;
};
skipEmail: string;
skipEmail2: string;
skipEmailCTA: string;
};
error: ProgramThemeMessages['step']['error'];
};
ssn: string;
ssnPlaceholder: string;
universityName: string;
verificationPurposesOnly: string;
verifyAndContinue: string;
verifyMyStudentStatus: string;
verifyMyTeacherStatus: string;
verifyMyMembershipStatus: string;
verifyMyMilitaryStatus: string;
verifyMyIdentityStatus: string;
verifyMyMedicalProfessionalStatus: string;
verifyMyEmploymentStatus: string;
verifyMyLicensedProfessionalStatus: string;
FIREFIGHTER: string;
POLICE: string;
EMT: string;
verifyMyFirstResponderStatus: string;
VETERAN: string;
MILITARY_RETIREE: string;
RESERVIST: string;
ACTIVE_DUTY: string;
MILITARY_FAMILY: string;
DOCTOR: string;
NURSE: string;
OTHER_HEALTH_WORKER: string;
tryAgain: string;
infoShared1: string;
infoShared2: string;
studentInfoShared: string;
militaryInfoShared: string;
firstResponderInfoShared: string;
};
declare type DateTimeMessages = {
january: string;
february: string;
march: string;
april: string;
may: string;
june: string;
july: string;
august: string;
september: string;
october: string;
november: string;
december: string;
month: string;
day: string;
year: string;
'2_MIN': string;
'20_MIN': string;
'2_HRS': string;
'24_HRS': string;
'2_DAY': string;
'3_DAY': string;
'A_FEW_MINUTES': string;
'A_HALF_HOUR': string;
'A_FEW_HOURS': string;
'A_FEW_DAYS': string;
};
/**
* @description These strings are provided for the Request Organization Form
*/
export declare type RequestOrganizationMessages = {
title: string;
description: string;
noCountry: string;
searchByOrgName: string;
completeRequest: string;
submit: string;
eligibleOrgs: string;
ineligibleOrgs: string;
none: string;
changeLanguage?: DefaultMessages['changeLanguage'];
poweredBy?: DefaultMessages['poweredBy'];
country?: DefaultMessages['country'];
countries?: DefaultMessages['countries'];
locales?: DefaultMessages['locales'];
copied: string;
fields: {
countryPlaceholder: string;
domainLabel: string;
domainPlaceholder: string;
orgNameLabel: string;
orgNamePlaceholder: string;
};
step: {
success: {
title: string;
description: string;
};
error: {
title: string;
description: string;
seeingProblem: string;
contactUs: string;
};
};
errorId: {
invalidCountry: DefaultMessages['errorId']['invalidCountry'];
invalidEmail: DefaultMessages['errorId']['invalidEmail'];
invalidFirstName: DefaultMessages['errorId']['invalidFirstName'];
invalidLastName: DefaultMessages['errorId']['invalidLastName'];
requiredField: string;
invalidField: string;
invalidUrl: string;
tooManyResults: string;
};
faq: string;
};
/**
* @description View-Model Verification Service
* @private
*/
export interface VerificationService extends VerificationServiceValues, VerificationServiceFunctions {
}
export interface VerificationServiceValues {
readonly isLoading: boolean;
readonly isErrored: boolean;
readonly fieldValidationErrors: FieldValidationErrors;
readonly messages: Messages;
readonly verificationResponse: VerificationResponse;
readonly viewModel: ViewModel;
readonly programTheme: ProgramTheme;
readonly previousViewModel: ViewModel;
readonly previousVerificationResponse: VerificationResponse;
readonly programId: DatabaseId;
readonly orgList: Organization[];
readonly formValidationOptions?: FormValidationOptions;
}
export interface VerificationServiceFunctions {
readonly fetchNewVerificationRequest: (programId: DatabaseId, segment: Segment, previousViewModel: ViewModel, trackingId?: string, forceNewVerificationRequest?: boolean) => Promise<void>;
readonly fetchExistingVerificationRequest: (programId: DatabaseId, verificationId: string, previousVerificationResponse?: VerificationResponse, previousViewModel?: ViewModel, needsLoading?: boolean) => Promise<void>;
readonly updateViewModel: (viewModel: ViewModel) => void;
readonly updateProgramTheme: (programTheme: ProgramTheme) => void;
readonly updateFieldValidationErrors: (fieldValidationErrors: FieldValidationErrors) => void;
readonly submitStep: (stepName: VerificationStep, viewModel: ViewModel, previousResponse: VerificationResponse) => Promise<void>;
readonly updateLocale: (viewModel: View