@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
329 lines (327 loc) • 10.6 kB
TypeScript
import { InjectedIntl } from 'react-intl';
import { FieldId, FieldValidationErrors, Organization, VerificationService, FieldContent, ExtendedFieldId, InputSelectOnKeyDown, FormSelectChoice, Country, ProgramTheme, Locale, ViewModel, State, PendingResponse, DocUploadResponse, FieldDescription, FirstResponderStatus, MilitaryStatus, MedicalProfessionalStatus, LowIncomeStatus, AllStatuses, RecentMoverStatus, PersonalInfoFieldId, Options } from '../../types/types';
import { VerificationStepsEnum, MilitaryStatusDefaultMessagesEnum, FirstResponderStatusDefaultMessagesEnum, MedicalProfessionalStatusDefaultMessagesEnum, LowIncomeStatusDefaultMessagesEnum, RecentMoverStatusDefaultMessagesEnum } from '../../types/runtimeTypes';
export declare const updateViewModelOrganization: (organization: Organization, verificationService: VerificationService) => void;
export declare const populateViewModelFromQueryParams: (verificationService: VerificationService) => void;
export declare const updateFieldValidationErrors: (fieldValidationErrors: FieldValidationErrors, verificationService: VerificationService) => void;
export declare const updateFieldValidationErrorsByFieldId: (fieldId: FieldId | ExtendedFieldId, value: FieldContent, verificationService: VerificationService) => void;
export declare const shouldCollectAddressFields: (countryChoice: FormSelectChoice<Country, string>, countries: Country[]) => boolean;
export declare const getStatusLabel: (intl: InjectedIntl, status: FirstResponderStatus | MilitaryStatus | MedicalProfessionalStatus | LowIncomeStatus | RecentMoverStatus | AllStatuses | undefined, defaultMessages: typeof MilitaryStatusDefaultMessagesEnum | typeof FirstResponderStatusDefaultMessagesEnum | typeof MedicalProfessionalStatusDefaultMessagesEnum | typeof LowIncomeStatusDefaultMessagesEnum | typeof RecentMoverStatusDefaultMessagesEnum | undefined) => string;
export declare const getAvailableLowIncomeStatuses: (intl: InjectedIntl, availableStatusesResponse?: LowIncomeStatus[]) => FormSelectChoice[];
export declare const getAvailableMedicalStatuses: (intl: InjectedIntl, availableStatusesResponse: MedicalProfessionalStatus[]) => FormSelectChoice[];
export declare const getAvailableFirstResponderStatuses: (intl: InjectedIntl, availableStatusesResponse: FirstResponderStatus[]) => FormSelectChoice[];
export declare const getAvailableStatuses: (intl: InjectedIntl, availableStatusesResponse: AllStatuses[]) => FormSelectChoice[];
export declare const orgToOption: (org: Organization) => {
value: number;
label: string;
country: keyof {
AD: string;
AE: string;
AF: string;
AG: string;
AI: string;
AL: string;
AM: string;
AN: string;
AO: string;
AR: string;
AS: string;
AT: string;
AU: string;
AW: string;
AZ: string;
BA: string;
BB: string;
BD: string;
BE: string;
BF: string;
BG: string;
BH: string;
BI: string;
BJ: string;
BM: string;
BN: string;
BO: string;
BR: string;
BS: string;
BT: string;
BV: string;
BW: string;
BY: string;
BZ: string;
CA: string;
CD: string;
CF: string;
CG: string;
CH: string;
CI: string;
CK: string;
CL: string;
CM: string;
CN: string;
CO: string;
CR: string;
CU: string;
CV: string;
CW: string;
CY: string;
CZ: string;
DE: string;
DJ: string;
DK: string;
DM: string;
DO: string;
DZ: string;
EC: string;
EE: string;
EG: string;
EH: string;
ER: string;
ES: string;
ET: string;
FI: string;
FJ: string;
FK: string;
FM: string;
FO: string;
FR: string;
GA: string;
GB: string;
GD: string;
GE: string;
GF: string;
GH: string;
GI: string;
GL: string;
GM: string;
GN: string;
GP: string;
GQ: string;
GR: string;
GS: string;
GT: string;
GU: string;
GW: string;
GY: string;
HK: string;
HM: string;
HN: string;
HR: string;
HT: string;
HU: string;
ID: string;
IE: string;
IL: string;
IN: string;
IO: string;
IQ: string;
IR: string;
IS: string;
IT: string;
JM: string;
JO: string;
JP: string;
KE: string;
KG: string;
KH: string;
KI: string;
KM: string;
KN: string;
KP: string;
KR: string;
KW: string;
KY: string;
KZ: string;
LA: string;
LB: string;
LC: string;
LI: string;
LK: string;
LR: string;
LS: string;
LT: string;
LU: string;
LV: string;
LY: string;
MA: string;
MC: string;
MD: string;
ME: string;
MG: string;
MH: string;
MK: string;
ML: string;
MM: string;
MN: string;
MO: string;
MP: string;
MQ: string;
MR: string;
MS: string;
MT: string;
MU: string;
MV: string;
MW: string;
MX: string;
MY: string;
MZ: string;
NA: string;
NC: string;
NE: string;
NF: string;
NG: string;
NI: string;
NL: string;
NO: string;
NP: string;
NR: string;
NU: string;
NZ: string;
OM: string;
PA: string;
PE: string;
PF: string;
PG: string;
PH: string;
PK: string;
PL: string;
PM: string;
PN: string;
PR: string;
PS: string;
PT: string;
PW: string;
PY: string;
QA: string;
RE: string;
RO: string;
RS: string;
RU: string;
RW: string;
SA: string;
SB: string;
SC: string;
SD: string;
SE: string;
SG: string;
SH: string;
SI: string;
SK: string;
SL: string;
SM: string;
SN: string;
SO: string;
SR: string;
SS: string;
ST: string;
SV: string;
SY: string;
SZ: string;
TC: string;
TD: string;
TF: string;
TG: string;
TH: string;
TJ: string;
TK: string;
TL: string;
TM: string;
TN: string;
TO: string;
TR: string;
TT: string;
TV: string;
TW: string;
TZ: string;
UA: string;
UG: string;
UM: string;
US: string;
UY: string;
UZ: string;
VA: string;
VC: string;
VE: string;
VG: string;
VI: string;
VN: string;
VU: string;
WF: string;
WS: string;
XK: string;
YE: string;
YT: string;
ZA: string;
ZM: string;
ZW: string;
};
};
export declare const getAvailableMilitaryStatuses: (verificationService: VerificationService, intl: InjectedIntl) => FormSelectChoice[];
/**
* @private
*/
export declare const getFieldDisplayOrderFromRefs: () => FieldId[] | ExtendedFieldId[];
/**
* HD-638 - focus on year, rather than month (which is an open <select> that covers error msg)
*/
export declare const adjustFirstErroredFieldId: (firstErroredFieldId: FieldId | ExtendedFieldId) => FieldId | ExtendedFieldId;
/**
* @private
*/
export declare const getFirstErroredFieldId: (fieldDisplayOrder: FieldId[] | ExtendedFieldId[], fieldValidationErrors: FieldValidationErrors) => FieldId | ExtendedFieldId;
/**
* @private
*/
export declare const handleEmailOnKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
/**
* @deprecated Accessibility standards prevent setting focus without user keyboard interaction
*/
export declare const handleCountryOnKeyDown: InputSelectOnKeyDown;
/**
* @public
*/
export declare const submitForm: (viewModel: ViewModel, verificationService: VerificationService, step: VerificationStepsEnum, successCallback?: () => void) => void;
/**
* @public
* @description Help with commonly-accessed values. Returns the fully-resolved verbiage in the appropriate language.
* @return {Object}
*/
export declare const getEstAndMaxReviewTimes: (verificationResponse: DocUploadResponse | PendingResponse, programTheme: ProgramTheme, intl: any) => {
estReviewTime: string;
maxReviewTime: string;
};
/**
* @private
*/
export declare const getAvailableCountryChoices: (programTheme: ProgramTheme, intl: InjectedIntl) => FormSelectChoice<Country, string>[];
/**
* @private
*/
export declare const getSortedCountryChoices: (programTheme: ProgramTheme, intl: InjectedIntl, locale?: Locale) => FormSelectChoice<Country, string>[];
/**
* @private
*/
export declare const getSortedIdCheckCountryChoices: (countries: Country[], intl: InjectedIntl, locale?: Locale) => FormSelectChoice<Country, string>[];
export declare const getAvailableStateChoices: (programTheme: ProgramTheme, intl: InjectedIntl) => FormSelectChoice<State, string>[];
/**
* @deprecated Not used anywhere and performs a noop.
*/
export declare const produceDraftViewModelWithRequiredFields: <T extends ViewModel>(previousModel: T, newRequiredFields?: FieldDescription[], conditionalRequiredFieldKeys?: (keyof T)[]) => T;
export declare const produceDraftViewModelWithAllRequiredFields: <T extends ViewModel>(viewModel: T, newRequiredFields: FieldDescription[]) => T;
/**
* @private
*/
export declare const getAvailableLocaleChoices: (programTheme: ProgramTheme, intl: InjectedIntl) => FormSelectChoice<Locale, string>[];
/**
* @private
*/
export declare const getDefaultCountryChoice: (countryChoices: FormSelectChoice<Country, string>[]) => FormSelectChoice<Country, string>;
/**
* @private
*/
export declare const produceDraftViewModel: <T extends ViewModel>(previousModel: T, key: keyof T, value: any) => T;
/**
* @private
*/
export declare const getRememberMeRedirectDestination: (locale: Locale, programId: string, verificationId: string) => string;
export declare const getFieldConfigByFieldId: (fieldId: PersonalInfoFieldId, options?: Options) => import('../../types/types').FormFieldConfig;