import { AccountFormOnResponse, ApiVersion, BaseSelect, ELMAResponse } from '../../main'; import { AccountProduct, AccountApplication, AccountApplicationUtm, AccountFormEventPayloadsMap, AccountFormEvent, AccountFormListener, AccountApplicationFormValidation, AccountApplicationFieldBlurResult, AccountApplicationFormValidationResult, AccountFormOnRequest, AccountApplicationForm } from '../../shared/types/account.types.ts'; import { FieldName, InnFieldMaskKey } from '../../shared/types/field-configs.types.ts'; import { AccountFormEl } from "./account-form.types"; import { type InputMask } from 'imask'; import CommonFormSelectors from '../../shared/utils/common-form-selectors'; import EventEmitter from '../../shared/utils/event-emitter'; import { ApiResponse } from '../../shared/types/api.types.ts'; export default class AccountForm extends CommonFormSelectors { apiUrl: string; apiVersion: ApiVersion | undefined; autoShowAlert: boolean; autoReset: boolean; onRequest: AccountFormOnRequest | null; onResponse: AccountFormOnResponse | null; protected formWrapperEl: HTMLElement | null; protected formEl: AccountFormEl | null; protected formButtonEl: HTMLButtonElement | null; protected formErrorEl: HTMLElement | null; protected formSuccessEl: HTMLElement | null; protected formErrorTextEl: HTMLElement | null; protected hideTINOrPINFL: HTMLInputElement | null; protected acceptCheckbox: HTMLInputElement | null; protected readonly formErrorSelector: string; protected readonly formSuccessSelector: string; protected readonly formErrorTextSelector: string; protected readonly formFieldInputSelector: string; protected readonly formSelector: string; protected readonly fieldSelector: string; protected readonly fieldControlSelector: string; protected readonly fieldErrorSelector: string; protected readonly productSelector: string; protected readonly inactiveClassName: string; protected readonly errorClassName: string; protected readonly loadingClassName: string; protected readonly phoneMask: string; protected readonly innMask: string; protected readonly pinflMask: string; protected phoneMaskInstance: InputMask<{}> | null; protected innMaskInstance: InputMask<{}> | null; protected source: number; protected maskPluginDefinitions: { '#': RegExp; }; protected readonly fieldsForValidate: FieldName[]; protected readonly utmFields: (keyof AccountApplicationUtm)[]; protected product: BaseSelect | null; lastFormData: AccountApplication | null; protected defaultFields: Partial; protected hideFieldKeys: (keyof AccountApplicationForm)[]; protected eventEmitter: EventEmitter; constructor(selectorOrEl: string | HTMLElement); protected getFormControlSelector(fieldKey: keyof AccountApplicationForm): string; toggleTINOrPINFL(event: HTMLInputElement): void; defineFormWrapperEl(selectorOrEl: string | HTMLElement): this; getFormTemplate(): string; handleSuccessTemplate(): this; renderSuccessTemplate(): this; handleErrorTemplate(errorMessage: string): this; renderErrorTemplate(errorMessage: string): this; renderFormTemplate(): this; initFormElements(): this; initFormWrapperListeners(): this; initFormListeners(): this; initInnFieldConfigs(maskKey?: InnFieldMaskKey): this; initPhoneFieldConfigs(): this; initFieldConfigs(): this; initSource(): this; initLang(): this; init(selectorOrEl: string | HTMLElement): this; handleFormInputValue(el: HTMLInputElement): void; handleFormInputFocus(method: 'add' | 'remove', el: HTMLInputElement): void; showFields(...fieldKeys: (keyof AccountApplicationForm)[]): this; hideFields(...fieldKeys: (keyof AccountApplicationForm)[]): this; findFieldElements(...fieldKeys: (keyof AccountApplicationForm)[]): HTMLElement[]; isHiddenFieldKey(fieldKey: keyof AccountApplicationForm): boolean; excludeHiddenFieldKeys(formData: AccountApplicationForm): AccountApplicationForm; setDefaultFields(fields: Partial): this; getFieldValidationResult(): AccountApplicationFormValidationResult; getFieldBlurResult(triggeredField: keyof AccountApplicationForm): AccountApplicationFieldBlurResult; toggleFormInputClassByEvent(method: 'add' | 'remove', className: string, el: HTMLInputElement): void; toggleFieldError(el: HTMLInputElement, errorMessage?: string): void; validateFormData(application: AccountApplicationForm): AccountApplicationFormValidation; renderFieldMessages(validationResult: AccountApplicationFormValidation): this | null; validateForm(): this | null; getRequestData(): AccountApplication; getFormData(): AccountApplicationForm; getUtmData(): AccountApplicationUtm; resetForm(): this; requestOnly(): Promise | string | undefined>; protected request(): Promise; submit(): Promise; handleSuccessResponse(): this; handleErrorResponse(errorMessage: string): this; handleResponse(errorMessage?: string | null): this; addListener(event: K, listener: AccountFormListener): this; removeListener(event: K, listener: AccountFormListener): this; removeAllListeners(): this; setSource(value: number): this; protected setElementLocale(field: HTMLElement, key: string): this; setSendButtonLocale(text: string): this; setInnFieldLocale(key: string): this; withPinfl(): this; withoutPinfl(): this; get buttonLoading(): boolean; set buttonLoading(value: boolean); get productValue(): AccountProduct | null; set productValue(value: AccountProduct | null); get lang(): string; set lang(value: string); get acceptChecked(): boolean; get hideTINOrPINFLChecked(): boolean; }