diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 8fcbb106268a..418db87cc25a 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -396,36 +396,35 @@ type AllOnyxKeys = DeepValueOf; type OnyxFormValuesMapping = { [ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM]: FormTypes.AddDebitCardForm; [ONYXKEYS.FORMS.WORKSPACE_SETTINGS_FORM]: FormTypes.WorkspaceSettingsForm; - [ONYXKEYS.FORMS.WORKSPACE_DESCRIPTION_FORM]: FormTypes.WorkspaceProfileDescriptionForm; [ONYXKEYS.FORMS.WORKSPACE_RATE_AND_UNIT_FORM]: FormTypes.WorkspaceRateAndUnitForm; [ONYXKEYS.FORMS.CLOSE_ACCOUNT_FORM]: FormTypes.CloseAccountForm; - [ONYXKEYS.FORMS.PROFILE_SETTINGS_FORM]: FormTypes.Form; + [ONYXKEYS.FORMS.PROFILE_SETTINGS_FORM]: FormTypes.ProfileSettingsForm; [ONYXKEYS.FORMS.DISPLAY_NAME_FORM]: FormTypes.DisplayNameForm; [ONYXKEYS.FORMS.ROOM_NAME_FORM]: FormTypes.RoomNameForm; - [ONYXKEYS.FORMS.REPORT_DESCRIPTION_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.LEGAL_NAME_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.WORKSPACE_INVITE_MESSAGE_FORM]: FormTypes.Form; + [ONYXKEYS.FORMS.REPORT_DESCRIPTION_FORM]: FormTypes.ReportDescriptionForm; + [ONYXKEYS.FORMS.LEGAL_NAME_FORM]: FormTypes.LegalNameForm; + [ONYXKEYS.FORMS.WORKSPACE_INVITE_MESSAGE_FORM]: FormTypes.WorkspaceInviteMessageForm; [ONYXKEYS.FORMS.DATE_OF_BIRTH_FORM]: FormTypes.DateOfBirthForm; - [ONYXKEYS.FORMS.HOME_ADDRESS_FORM]: FormTypes.Form; + [ONYXKEYS.FORMS.HOME_ADDRESS_FORM]: FormTypes.HomeAddressForm; [ONYXKEYS.FORMS.NEW_ROOM_FORM]: FormTypes.NewRoomForm; - [ONYXKEYS.FORMS.ROOM_SETTINGS_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.NEW_TASK_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.EDIT_TASK_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.MONEY_REQUEST_DESCRIPTION_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.MONEY_REQUEST_MERCHANT_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.MONEY_REQUEST_AMOUNT_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.MONEY_REQUEST_DATE_FORM]: FormTypes.Form; + [ONYXKEYS.FORMS.ROOM_SETTINGS_FORM]: FormTypes.RoomSettingsForm; + [ONYXKEYS.FORMS.NEW_TASK_FORM]: FormTypes.NewTaskForm; + [ONYXKEYS.FORMS.EDIT_TASK_FORM]: FormTypes.EditTaskForm; + [ONYXKEYS.FORMS.MONEY_REQUEST_DESCRIPTION_FORM]: FormTypes.MoneyRequestDescriptionForm; + [ONYXKEYS.FORMS.MONEY_REQUEST_MERCHANT_FORM]: FormTypes.MoneyRequestMerchantForm; + [ONYXKEYS.FORMS.MONEY_REQUEST_AMOUNT_FORM]: FormTypes.MoneyRequestAmountForm; + [ONYXKEYS.FORMS.MONEY_REQUEST_DATE_FORM]: FormTypes.MoneyRequestDateForm; [ONYXKEYS.FORMS.MONEY_REQUEST_HOLD_FORM]: FormTypes.MoneyRequestHoldReasonForm; [ONYXKEYS.FORMS.NEW_CONTACT_METHOD_FORM]: FormTypes.NewContactMethodForm; - [ONYXKEYS.FORMS.WAYPOINT_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.SETTINGS_STATUS_SET_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.SETTINGS_STATUS_CLEAR_DATE_FORM]: FormTypes.Form; - [ONYXKEYS.FORMS.SETTINGS_STATUS_SET_CLEAR_AFTER_FORM]: FormTypes.Form; + [ONYXKEYS.FORMS.WAYPOINT_FORM]: FormTypes.WaypointForm; + [ONYXKEYS.FORMS.SETTINGS_STATUS_SET_FORM]: FormTypes.SettingsStatusSetForm; + [ONYXKEYS.FORMS.SETTINGS_STATUS_CLEAR_DATE_FORM]: FormTypes.SettingsStatusClearDateForm; + [ONYXKEYS.FORMS.SETTINGS_STATUS_SET_CLEAR_AFTER_FORM]: FormTypes.SettingsStatusSetClearAfterForm; [ONYXKEYS.FORMS.PRIVATE_NOTES_FORM]: FormTypes.PrivateNotesForm; [ONYXKEYS.FORMS.I_KNOW_A_TEACHER_FORM]: FormTypes.IKnowTeacherForm; [ONYXKEYS.FORMS.INTRO_SCHOOL_PRINCIPAL_FORM]: FormTypes.IntroSchoolPrincipalForm; - [ONYXKEYS.FORMS.REPORT_VIRTUAL_CARD_FRAUD]: FormTypes.Form; - [ONYXKEYS.FORMS.REPORT_PHYSICAL_CARD_FORM]: FormTypes.Form; + [ONYXKEYS.FORMS.REPORT_VIRTUAL_CARD_FRAUD]: FormTypes.ReportVirtualCardFraudForm; + [ONYXKEYS.FORMS.REPORT_PHYSICAL_CARD_FORM]: FormTypes.ReportPhysicalCardForm; [ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM]: FormTypes.GetPhysicalCardForm; [ONYXKEYS.FORMS.REPORT_FIELD_EDIT_FORM]: FormTypes.ReportFieldEditForm; [ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM]: FormTypes.ReimbursementAccountForm; diff --git a/src/libs/API/parameters/UpdateBeneficialOwnersForBankAccountParams.ts b/src/libs/API/parameters/UpdateBeneficialOwnersForBankAccountParams.ts index f5cc3f664d12..dedc45d0365f 100644 --- a/src/libs/API/parameters/UpdateBeneficialOwnersForBankAccountParams.ts +++ b/src/libs/API/parameters/UpdateBeneficialOwnersForBankAccountParams.ts @@ -1,5 +1,5 @@ -import type {BeneficialOwnersStepProps} from '@src/types/form/ReimbursementAccountForm'; +import type {ACHContractStepProps} from '@src/types/form/ReimbursementAccountForm'; -type UpdateBeneficialOwnersForBankAccountParams = BeneficialOwnersStepProps & {bankAccountID: number; policyID: string; canUseNewVbbaFlow?: boolean}; +type UpdateBeneficialOwnersForBankAccountParams = Partial & {bankAccountID: number; policyID: string; canUseNewVbbaFlow?: boolean}; export default UpdateBeneficialOwnersForBankAccountParams; diff --git a/src/libs/API/parameters/UpdateCompanyInformationForBankAccountParams.ts b/src/libs/API/parameters/UpdateCompanyInformationForBankAccountParams.ts index 21ca49839aec..6421fe02f571 100644 --- a/src/libs/API/parameters/UpdateCompanyInformationForBankAccountParams.ts +++ b/src/libs/API/parameters/UpdateCompanyInformationForBankAccountParams.ts @@ -1,5 +1,7 @@ -import type {CompanyStepProps} from '@src/types/form/ReimbursementAccountForm'; +import type {BankAccountStepProps, CompanyStepProps, ReimbursementAccountProps} from '@src/types/form/ReimbursementAccountForm'; -type UpdateCompanyInformationForBankAccountParams = CompanyStepProps & {bankAccountID: number; policyID: string; canUseNewVbbaFlow?: boolean}; +type BankAccountCompanyInformation = BankAccountStepProps & CompanyStepProps & ReimbursementAccountProps; + +type UpdateCompanyInformationForBankAccountParams = Partial & {bankAccountID: number; policyID: string; canUseNewVbbaFlow?: boolean}; export default UpdateCompanyInformationForBankAccountParams; diff --git a/src/libs/FormUtils.ts b/src/libs/FormUtils.ts deleted file mode 100644 index 4d0571ada6f2..000000000000 --- a/src/libs/FormUtils.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type {OnyxFormDraftKey, OnyxFormKey} from '@src/ONYXKEYS'; - -function getDraftKey(formID: OnyxFormKey): OnyxFormDraftKey { - return `${formID}Draft`; -} - -export default {getDraftKey}; diff --git a/src/libs/GetPhysicalCardUtils.ts b/src/libs/GetPhysicalCardUtils.ts index 24437da48953..3f8a7d191f4b 100644 --- a/src/libs/GetPhysicalCardUtils.ts +++ b/src/libs/GetPhysicalCardUtils.ts @@ -54,7 +54,11 @@ function setCurrentRoute(currentRoute: string, domain: string, privatePersonalDe * @param privatePersonalDetails * @returns */ -function getUpdatedDraftValues(draftValues: OnyxEntry, privatePersonalDetails: OnyxEntry, loginList: OnyxEntry): GetPhysicalCardForm { +function getUpdatedDraftValues( + draftValues: OnyxEntry, + privatePersonalDetails: OnyxEntry, + loginList: OnyxEntry, +): Partial { const {address, legalFirstName, legalLastName, phoneNumber} = privatePersonalDetails ?? {}; return { diff --git a/src/libs/ValidationUtils.ts b/src/libs/ValidationUtils.ts index 02ae638a41d3..56cf1c475812 100644 --- a/src/libs/ValidationUtils.ts +++ b/src/libs/ValidationUtils.ts @@ -5,7 +5,7 @@ import isDate from 'lodash/isDate'; import isEmpty from 'lodash/isEmpty'; import isObject from 'lodash/isObject'; import type {OnyxCollection} from 'react-native-onyx'; -import type {FormInputErrors, FormOnyxKeys, FormOnyxValues} from '@components/Form/types'; +import type {FormInputErrors, FormOnyxKeys, FormOnyxValues, FormValue} from '@components/Form/types'; import CONST from '@src/CONST'; import type {OnyxFormKey} from '@src/ONYXKEYS'; import type {Report} from '@src/types/onyx'; @@ -77,7 +77,7 @@ function isValidPastDate(date: string | Date): boolean { * Used to validate a value that is "required". * @param value - field value */ -function isRequiredFulfilled(value?: string | boolean | Date): boolean { +function isRequiredFulfilled(value?: FormValue): boolean { if (!value) { return false; } @@ -103,7 +103,7 @@ function getFieldRequiredErrors(values: FormOnyxVal const errors: FormInputErrors = {}; requiredFields.forEach((fieldKey) => { - if (isRequiredFulfilled(values[fieldKey] as keyof FormOnyxValues)) { + if (isRequiredFulfilled(values[fieldKey] as FormValue)) { return; } diff --git a/src/libs/actions/BankAccounts.ts b/src/libs/actions/BankAccounts.ts index 30dd03b6e780..0f4e1aed36a7 100644 --- a/src/libs/actions/BankAccounts.ts +++ b/src/libs/actions/BankAccounts.ts @@ -366,7 +366,7 @@ function openReimbursementAccountPage(stepToOpen: ReimbursementAccountStep, subS * Updates the bank account in the database with the company step data * @param params - Business step form data */ -function updateCompanyInformationForBankAccount(bankAccountID: number, params: CompanyStepProps, policyID: string) { +function updateCompanyInformationForBankAccount(bankAccountID: number, params: Partial, policyID: string) { API.write( WRITE_COMMANDS.UPDATE_COMPANY_INFORMATION_FOR_BANK_ACCOUNT, { @@ -383,7 +383,7 @@ function updateCompanyInformationForBankAccount(bankAccountID: number, params: C * Add beneficial owners for the bank account and verify the accuracy of the information provided * @param params - Beneficial Owners step form params */ -function updateBeneficialOwnersForBankAccount(bankAccountID: number, params: BeneficialOwnersStepProps, policyID: string) { +function updateBeneficialOwnersForBankAccount(bankAccountID: number, params: Partial, policyID: string) { API.write( WRITE_COMMANDS.UPDATE_BENEFICIAL_OWNERS_FOR_BANK_ACCOUNT, { diff --git a/src/libs/actions/FormActions.ts b/src/libs/actions/FormActions.ts index 3a0bdb94d5f5..8207b78e8759 100644 --- a/src/libs/actions/FormActions.ts +++ b/src/libs/actions/FormActions.ts @@ -1,6 +1,5 @@ import Onyx from 'react-native-onyx'; import type {NullishDeep} from 'react-native-onyx'; -import FormUtils from '@libs/FormUtils'; import type {OnyxFormDraftKey, OnyxFormKey, OnyxValue} from '@src/ONYXKEYS'; import type * as OnyxCommon from '@src/types/onyx/OnyxCommon'; @@ -25,11 +24,11 @@ function clearErrorFields(formID: OnyxFormKey) { } function setDraftValues(formID: OnyxFormKey, draftValues: NullishDeep>) { - Onyx.merge(FormUtils.getDraftKey(formID), draftValues); + Onyx.merge(`${formID}Draft`, draftValues); } function clearDraftValues(formID: OnyxFormKey) { - Onyx.set(FormUtils.getDraftKey(formID), null); + Onyx.set(`${formID}Draft`, null); } export {setDraftValues, setErrorFields, setErrors, clearErrors, clearErrorFields, setIsLoading, clearDraftValues}; diff --git a/src/libs/actions/PaymentMethods.ts b/src/libs/actions/PaymentMethods.ts index ea675ff6b8f6..13e0a42e839f 100644 --- a/src/libs/actions/PaymentMethods.ts +++ b/src/libs/actions/PaymentMethods.ts @@ -12,6 +12,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {Route} from '@src/ROUTES'; +import INPUT_IDS from '@src/types/form/AddDebitCardForm'; import type {BankAccountList, FundList} from '@src/types/onyx'; import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage'; import type PaymentMethod from '@src/types/onyx/PaymentMethod'; @@ -205,7 +206,15 @@ function clearDebitCardFormErrorAndSubmit() { Onyx.set(ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM, { isLoading: false, errors: undefined, - setupComplete: false, + [INPUT_IDS.SETUP_COMPLETE]: false, + [INPUT_IDS.NAME_ON_CARD]: '', + [INPUT_IDS.CARD_NUMBER]: '', + [INPUT_IDS.EXPIRATION_DATE]: '', + [INPUT_IDS.SECURITY_CODE]: '', + [INPUT_IDS.ADDRESS_STREET]: '', + [INPUT_IDS.ADDRESS_ZIP_CODE]: '', + [INPUT_IDS.ADDRESS_STATE]: '', + [INPUT_IDS.ACCEPT_TERMS]: '', }); } diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 1276207e37c3..f29f8a4fbaab 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -67,6 +67,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; +import INPUT_IDS from '@src/types/form/NewRoomForm'; import type {PersonalDetails, PersonalDetailsList, PolicyReportField, RecentlyUsedReportFields, ReportActionReactions, ReportMetadata, ReportUserIsTyping} from '@src/types/onyx'; import type {Decision, OriginalMessageIOU} from '@src/types/onyx/OriginalMessage'; import type {NotificationPreference, RoomVisibility, WriteCapability} from '@src/types/onyx/Report'; @@ -2841,6 +2842,11 @@ function clearNewRoomFormError() { isLoading: false, errorFields: null, errors: null, + [INPUT_IDS.ROOM_NAME]: '', + [INPUT_IDS.REPORT_DESCRIPTION]: '', + [INPUT_IDS.POLICY_ID]: '', + [INPUT_IDS.WRITE_CAPABILITY]: '', + [INPUT_IDS.VISIBILITY]: '', }); } diff --git a/src/pages/iou/request/step/IOURequestStepDate.js b/src/pages/iou/request/step/IOURequestStepDate.js index e1d156572dc2..f7b8b1ca3869 100644 --- a/src/pages/iou/request/step/IOURequestStepDate.js +++ b/src/pages/iou/request/step/IOURequestStepDate.js @@ -19,7 +19,7 @@ import * as IOU from '@userActions/IOU'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import {policyPropTypes} from '@src/pages/workspace/withPolicy'; -import INPUT_IDS from '@src/types/form/MoneyRequestCreatedForm'; +import INPUT_IDS from '@src/types/form/MoneyRequestDateForm'; import IOURequestStepRoutePropTypes from './IOURequestStepRoutePropTypes'; import StepScreenWrapper from './StepScreenWrapper'; import withFullTransactionOrNotFound from './withFullTransactionOrNotFound'; diff --git a/src/pages/settings/Wallet/ExpensifyCardPage.js b/src/pages/settings/Wallet/ExpensifyCardPage.js index 38d8b5f13adb..4ff59ad1f9a1 100644 --- a/src/pages/settings/Wallet/ExpensifyCardPage.js +++ b/src/pages/settings/Wallet/ExpensifyCardPage.js @@ -17,7 +17,6 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as FormActions from '@libs/actions/FormActions'; import * as CardUtils from '@libs/CardUtils'; import * as CurrencyUtils from '@libs/CurrencyUtils'; -import FormUtils from '@libs/FormUtils'; import * as GetPhysicalCardUtils from '@libs/GetPhysicalCardUtils'; import {translatableTextPropTypes} from '@libs/Localize'; import Navigation from '@libs/Navigation/Navigation'; @@ -310,6 +309,6 @@ export default withOnyx({ key: ONYXKEYS.PRIVATE_PERSONAL_DETAILS, }, draftValues: { - key: FormUtils.getDraftKey(ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM), + key: ONYXKEYS.FORMS.GET_PHYSICAL_CARD_FORM_DRAFT, }, })(ExpensifyCardPage); diff --git a/src/types/form/AddDebitCardForm.ts b/src/types/form/AddDebitCardForm.ts index 4a73766fb8f1..b5badf0bb7f3 100644 --- a/src/types/form/AddDebitCardForm.ts +++ b/src/types/form/AddDebitCardForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -12,19 +13,23 @@ const INPUT_IDS = { ACCEPT_TERMS: 'acceptTerms', } as const; -type AddDebitCardForm = Form<{ - /** Whether the form has been submitted */ - [INPUT_IDS.SETUP_COMPLETE]: boolean; +type InputID = ValueOf; - [INPUT_IDS.NAME_ON_CARD]?: string; - [INPUT_IDS.CARD_NUMBER]?: string; - [INPUT_IDS.EXPIRATION_DATE]?: string; - [INPUT_IDS.SECURITY_CODE]?: string; - [INPUT_IDS.ADDRESS_STREET]?: string; - [INPUT_IDS.ADDRESS_ZIP_CODE]?: string; - [INPUT_IDS.ADDRESS_STATE]?: string; - [INPUT_IDS.ACCEPT_TERMS]?: string; -}>; +type AddDebitCardForm = Form< + InputID, + { + /** Whether the form has been submitted */ + [INPUT_IDS.SETUP_COMPLETE]: boolean; + [INPUT_IDS.NAME_ON_CARD]: string; + [INPUT_IDS.CARD_NUMBER]: string; + [INPUT_IDS.EXPIRATION_DATE]: string; + [INPUT_IDS.SECURITY_CODE]: string; + [INPUT_IDS.ADDRESS_STREET]: string; + [INPUT_IDS.ADDRESS_ZIP_CODE]: string; + [INPUT_IDS.ADDRESS_STATE]: string; + [INPUT_IDS.ACCEPT_TERMS]: string; + } +>; export type {AddDebitCardForm}; export default INPUT_IDS; diff --git a/src/types/form/CloseAccountForm.ts b/src/types/form/CloseAccountForm.ts index 054dcd71e442..dd852ded653f 100644 --- a/src/types/form/CloseAccountForm.ts +++ b/src/types/form/CloseAccountForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -6,11 +7,16 @@ const INPUT_IDS = { SUCCESS: 'success', } as const; -type CloseAccountForm = Form<{ - [INPUT_IDS.REASON_FOR_LEAVING]: string; - [INPUT_IDS.PHONE_OR_EMAIL]: string; - [INPUT_IDS.SUCCESS]: string; -}>; +type InputID = ValueOf; + +type CloseAccountForm = Form< + InputID, + { + [INPUT_IDS.REASON_FOR_LEAVING]: string; + [INPUT_IDS.PHONE_OR_EMAIL]: string; + [INPUT_IDS.SUCCESS]: string; + } +>; export type {CloseAccountForm}; export default INPUT_IDS; diff --git a/src/types/form/DateOfBirthForm.ts b/src/types/form/DateOfBirthForm.ts index 01678669f176..999b4e44459d 100644 --- a/src/types/form/DateOfBirthForm.ts +++ b/src/types/form/DateOfBirthForm.ts @@ -1,13 +1,19 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { DOB: 'dob', } as const; -type DateOfBirthForm = Form<{ - /** Date of birth */ - [INPUT_IDS.DOB]: string; -}>; +type InputID = ValueOf; + +type DateOfBirthForm = Form< + InputID, + { + /** Date of birth */ + [INPUT_IDS.DOB]: string; + } +>; export type {DateOfBirthForm}; export default INPUT_IDS; diff --git a/src/types/form/DisplayNameForm.ts b/src/types/form/DisplayNameForm.ts index 3f9738c45a34..ae40e6020fd7 100644 --- a/src/types/form/DisplayNameForm.ts +++ b/src/types/form/DisplayNameForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -5,10 +6,15 @@ const INPUT_IDS = { LAST_NAME: 'lastName', } as const; -type DisplayNameForm = Form<{ - [INPUT_IDS.FIRST_NAME]: string; - [INPUT_IDS.LAST_NAME]: string; -}>; +type InputID = ValueOf; + +type DisplayNameForm = Form< + InputID, + { + [INPUT_IDS.FIRST_NAME]: string; + [INPUT_IDS.LAST_NAME]: string; + } +>; export type {DisplayNameForm}; export default INPUT_IDS; diff --git a/src/types/form/EditTaskForm.ts b/src/types/form/EditTaskForm.ts index 05de0310c784..86a1c8198fec 100644 --- a/src/types/form/EditTaskForm.ts +++ b/src/types/form/EditTaskForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -5,10 +6,15 @@ const INPUT_IDS = { DESCRIPTION: 'description', } as const; -type EditTaskForm = Form<{ - [INPUT_IDS.TITLE]: string; - [INPUT_IDS.DESCRIPTION]: string; -}>; +type InputID = ValueOf; + +type EditTaskForm = Form< + InputID, + { + [INPUT_IDS.TITLE]: string; + [INPUT_IDS.DESCRIPTION]: string; + } +>; export type {EditTaskForm}; export default INPUT_IDS; diff --git a/src/types/form/Form.ts b/src/types/form/Form.ts index d80eb65f4215..cf35e84646b1 100644 --- a/src/types/form/Form.ts +++ b/src/types/form/Form.ts @@ -12,8 +12,8 @@ type BaseForm = { errorFields?: OnyxCommon.ErrorFields | null; }; -type FormValues = Record; -type Form = TFormValues & BaseForm; +type FormValues = Record; +type Form = FormValues> = TFormValues & BaseForm; export default Form; export type {BaseForm}; diff --git a/src/types/form/GetPhysicalCardForm.ts b/src/types/form/GetPhysicalCardForm.ts index 091113eb4763..c8fc6f3cce9e 100644 --- a/src/types/form/GetPhysicalCardForm.ts +++ b/src/types/form/GetPhysicalCardForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; import ADDRESS_INPUT_IDS from './HomeAddressForm'; @@ -8,17 +9,22 @@ const INPUT_IDS = { PHONE_NUMBER: 'phoneNumber', } as const; -type GetPhysicalCardForm = Form<{ - [INPUT_IDS.ADDRESS_LINE_1]?: string; - [INPUT_IDS.ADDRESS_LINE_2]?: string; - [INPUT_IDS.COUNTRY]?: string; - [INPUT_IDS.STATE]?: string; - [INPUT_IDS.CITY]?: string; - [INPUT_IDS.ZIP_POST_CODE]?: string; - [INPUT_IDS.LEGAL_FIRST_NAME]?: string; - [INPUT_IDS.LEGAL_LAST_NAME]?: string; - [INPUT_IDS.PHONE_NUMBER]?: string; -}>; +type InputID = ValueOf; + +type GetPhysicalCardForm = Form< + InputID, + { + [INPUT_IDS.ADDRESS_LINE_1]: string; + [INPUT_IDS.ADDRESS_LINE_2]: string; + [INPUT_IDS.COUNTRY]: string; + [INPUT_IDS.STATE]: string; + [INPUT_IDS.CITY]: string; + [INPUT_IDS.ZIP_POST_CODE]: string; + [INPUT_IDS.LEGAL_FIRST_NAME]: string; + [INPUT_IDS.LEGAL_LAST_NAME]: string; + [INPUT_IDS.PHONE_NUMBER]: string; + } +>; export type {GetPhysicalCardForm}; export default INPUT_IDS; diff --git a/src/types/form/HomeAddressForm.ts b/src/types/form/HomeAddressForm.ts index 4e819146faf7..6d9ef8580078 100644 --- a/src/types/form/HomeAddressForm.ts +++ b/src/types/form/HomeAddressForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -9,14 +10,19 @@ const INPUT_IDS = { ZIP_POST_CODE: 'zipPostCode', } as const; -type HomeAddressForm = Form<{ - [INPUT_IDS.ADDRESS_LINE_1]: string; - [INPUT_IDS.ADDRESS_LINE_2]: string; - [INPUT_IDS.COUNTRY]: string; - [INPUT_IDS.STATE]: string; - [INPUT_IDS.CITY]: string; - [INPUT_IDS.ZIP_POST_CODE]: string; -}>; +type InputID = ValueOf; + +type HomeAddressForm = Form< + InputID, + { + [INPUT_IDS.ADDRESS_LINE_1]: string; + [INPUT_IDS.ADDRESS_LINE_2]: string; + [INPUT_IDS.COUNTRY]: string; + [INPUT_IDS.STATE]: string; + [INPUT_IDS.CITY]: string; + [INPUT_IDS.ZIP_POST_CODE]: string; + } +>; export type {HomeAddressForm}; export default INPUT_IDS; diff --git a/src/types/form/IKnowTeacherForm.ts b/src/types/form/IKnowTeacherForm.ts index 7d6ba4b9079a..d406dd57de56 100644 --- a/src/types/form/IKnowTeacherForm.ts +++ b/src/types/form/IKnowTeacherForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -6,11 +7,16 @@ const INPUT_IDS = { PARTNER_USER_ID: 'partnerUserID', } as const; -type IKnowTeacherForm = Form<{ - [INPUT_IDS.FIRST_NAME]: string; - [INPUT_IDS.LAST_NAME]: string; - [INPUT_IDS.PARTNER_USER_ID]: string; -}>; +type InputID = ValueOf; + +type IKnowTeacherForm = Form< + InputID, + { + [INPUT_IDS.FIRST_NAME]: string; + [INPUT_IDS.LAST_NAME]: string; + [INPUT_IDS.PARTNER_USER_ID]: string; + } +>; export type {IKnowTeacherForm}; export default INPUT_IDS; diff --git a/src/types/form/IntroSchoolPrincipalForm.ts b/src/types/form/IntroSchoolPrincipalForm.ts index 61742a98c6fd..6cb4a74d0f7e 100644 --- a/src/types/form/IntroSchoolPrincipalForm.ts +++ b/src/types/form/IntroSchoolPrincipalForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -6,11 +7,16 @@ const INPUT_IDS = { PARTNER_USER_ID: 'partnerUserID', } as const; -type IntroSchoolPrincipalForm = Form<{ - [INPUT_IDS.FIRST_NAME]: string; - [INPUT_IDS.LAST_NAME]: string; - [INPUT_IDS.PARTNER_USER_ID]: string; -}>; +type InputID = ValueOf; + +type IntroSchoolPrincipalForm = Form< + InputID, + { + [INPUT_IDS.FIRST_NAME]: string; + [INPUT_IDS.LAST_NAME]: string; + [INPUT_IDS.PARTNER_USER_ID]: string; + } +>; export type {IntroSchoolPrincipalForm}; export default INPUT_IDS; diff --git a/src/types/form/LegalNameForm.ts b/src/types/form/LegalNameForm.ts index 8ca9e44a7754..808d3f68639a 100644 --- a/src/types/form/LegalNameForm.ts +++ b/src/types/form/LegalNameForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -5,10 +6,15 @@ const INPUT_IDS = { LEGAL_LAST_NAME: 'legalLastName', } as const; -type LegalNameForm = Form<{ - [INPUT_IDS.LEGAL_FIRST_NAME]: string; - [INPUT_IDS.LEGAL_LAST_NAME]: string; -}>; +type InputID = ValueOf; + +type LegalNameForm = Form< + InputID, + { + [INPUT_IDS.LEGAL_FIRST_NAME]: string; + [INPUT_IDS.LEGAL_LAST_NAME]: string; + } +>; export type {LegalNameForm}; export default INPUT_IDS; diff --git a/src/types/form/MoneyRequestCreatedForm.ts b/src/types/form/MoneyRequestCreatedForm.ts deleted file mode 100644 index b7df7362a888..000000000000 --- a/src/types/form/MoneyRequestCreatedForm.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type Form from './Form'; - -const INPUT_IDS = { - CREATED: 'created', - MONEY_REQUEST_CREATED: 'moneyRequestCreated', -} as const; - -type MoneyRequestCreatedForm = Form<{ - [INPUT_IDS.CREATED]: string; - [INPUT_IDS.MONEY_REQUEST_CREATED]: string; -}>; - -export type {MoneyRequestCreatedForm}; -export default INPUT_IDS; diff --git a/src/types/form/MoneyRequestDateForm.ts b/src/types/form/MoneyRequestDateForm.ts new file mode 100644 index 000000000000..64e9336d0659 --- /dev/null +++ b/src/types/form/MoneyRequestDateForm.ts @@ -0,0 +1,20 @@ +import type {ValueOf} from 'type-fest'; +import type Form from './Form'; + +const INPUT_IDS = { + CREATED: 'created', + MONEY_REQUEST_CREATED: 'moneyRequestCreated', +} as const; + +type InputID = ValueOf; + +type MoneyRequestDateForm = Form< + InputID, + { + [INPUT_IDS.CREATED]: string; + [INPUT_IDS.MONEY_REQUEST_CREATED]: string; + } +>; + +export type {MoneyRequestDateForm}; +export default INPUT_IDS; diff --git a/src/types/form/MoneyRequestDescriptionForm.ts b/src/types/form/MoneyRequestDescriptionForm.ts index df8ae5d225f3..e64e183c57b2 100644 --- a/src/types/form/MoneyRequestDescriptionForm.ts +++ b/src/types/form/MoneyRequestDescriptionForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -5,10 +6,15 @@ const INPUT_IDS = { MONEY_REQUEST_COMMENT: 'moneyRequestComment', } as const; -type MoneyRequestDescriptionForm = Form<{ - [INPUT_IDS.COMMENT]: string; - [INPUT_IDS.MONEY_REQUEST_COMMENT]: string; -}>; +type InputID = ValueOf; + +type MoneyRequestDescriptionForm = Form< + InputID, + { + [INPUT_IDS.COMMENT]: string; + [INPUT_IDS.MONEY_REQUEST_COMMENT]: string; + } +>; export type {MoneyRequestDescriptionForm}; export default INPUT_IDS; diff --git a/src/types/form/MoneyRequestHoldReasonForm.ts b/src/types/form/MoneyRequestHoldReasonForm.ts index 0d80810eaf69..26ce5e2a88a9 100644 --- a/src/types/form/MoneyRequestHoldReasonForm.ts +++ b/src/types/form/MoneyRequestHoldReasonForm.ts @@ -1,12 +1,18 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { COMMENT: 'comment', } as const; -type MoneyRequestHoldReasonForm = Form<{ - [INPUT_IDS.COMMENT]: string; -}>; +type InputID = ValueOf; + +type MoneyRequestHoldReasonForm = Form< + InputID, + { + [INPUT_IDS.COMMENT]: string; + } +>; export type {MoneyRequestHoldReasonForm}; export default INPUT_IDS; diff --git a/src/types/form/MoneyRequestMerchantForm.ts b/src/types/form/MoneyRequestMerchantForm.ts index 0dd194037b7d..589915e55694 100644 --- a/src/types/form/MoneyRequestMerchantForm.ts +++ b/src/types/form/MoneyRequestMerchantForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -5,10 +6,15 @@ const INPUT_IDS = { MONEY_REQUEST_MERCHANT: 'moneyRequestMerchant', } as const; -type MoneyRequestMerchantForm = Form<{ - [INPUT_IDS.MERCHANT]: string; - [INPUT_IDS.MONEY_REQUEST_MERCHANT]: string; -}>; +type InputID = ValueOf; + +type MoneyRequestMerchantForm = Form< + InputID, + { + [INPUT_IDS.MERCHANT]: string; + [INPUT_IDS.MONEY_REQUEST_MERCHANT]: string; + } +>; export type {MoneyRequestMerchantForm}; export default INPUT_IDS; diff --git a/src/types/form/NewContactMethodForm.ts b/src/types/form/NewContactMethodForm.ts index baa67cec1cbf..cea8ffad1992 100644 --- a/src/types/form/NewContactMethodForm.ts +++ b/src/types/form/NewContactMethodForm.ts @@ -1,12 +1,18 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { PHONE_OR_EMAIL: 'phoneOrEmail', } as const; -type NewContactMethodForm = Form<{ - [INPUT_IDS.PHONE_OR_EMAIL]: string; -}>; +type InputID = ValueOf; + +type NewContactMethodForm = Form< + InputID, + { + [INPUT_IDS.PHONE_OR_EMAIL]: string; + } +>; export type {NewContactMethodForm}; export default INPUT_IDS; diff --git a/src/types/form/NewRoomForm.ts b/src/types/form/NewRoomForm.ts index 8fe047f8a7e4..3e21e97140ef 100644 --- a/src/types/form/NewRoomForm.ts +++ b/src/types/form/NewRoomForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -8,13 +9,18 @@ const INPUT_IDS = { VISIBILITY: 'visibility', } as const; -type NewRoomForm = Form<{ - [INPUT_IDS.ROOM_NAME]?: string; - [INPUT_IDS.REPORT_DESCRIPTION]?: string; - [INPUT_IDS.POLICY_ID]?: string; - [INPUT_IDS.WRITE_CAPABILITY]?: string; - [INPUT_IDS.VISIBILITY]?: string; -}>; +type InputID = ValueOf; + +type NewRoomForm = Form< + InputID, + { + [INPUT_IDS.ROOM_NAME]: string; + [INPUT_IDS.REPORT_DESCRIPTION]: string; + [INPUT_IDS.POLICY_ID]: string; + [INPUT_IDS.WRITE_CAPABILITY]: string; + [INPUT_IDS.VISIBILITY]: string; + } +>; export type {NewRoomForm}; export default INPUT_IDS; diff --git a/src/types/form/NewTaskForm.ts b/src/types/form/NewTaskForm.ts index b281a79321fb..a9ef7155a9d1 100644 --- a/src/types/form/NewTaskForm.ts +++ b/src/types/form/NewTaskForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -5,10 +6,15 @@ const INPUT_IDS = { TASK_DESCRIPTION: 'taskDescription', } as const; -type NewTaskForm = Form<{ - [INPUT_IDS.TASK_TITLE]: string; - [INPUT_IDS.TASK_DESCRIPTION]: string; -}>; +type InputID = ValueOf; + +type NewTaskForm = Form< + InputID, + { + [INPUT_IDS.TASK_TITLE]: string; + [INPUT_IDS.TASK_DESCRIPTION]: string; + } +>; export type {NewTaskForm}; export default INPUT_IDS; diff --git a/src/types/form/PrivateNotesForm.ts b/src/types/form/PrivateNotesForm.ts index 2961b693ef6b..13fe312a1514 100644 --- a/src/types/form/PrivateNotesForm.ts +++ b/src/types/form/PrivateNotesForm.ts @@ -1,12 +1,18 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { PRIVATE_NOTES: 'privateNotes', } as const; -type PrivateNotesForm = Form<{ - [INPUT_IDS.PRIVATE_NOTES]: string; -}>; +type InputID = ValueOf; + +type PrivateNotesForm = Form< + InputID, + { + [INPUT_IDS.PRIVATE_NOTES]: string; + } +>; export type {PrivateNotesForm}; export default INPUT_IDS; diff --git a/src/types/form/ReimbursementAccountForm.ts b/src/types/form/ReimbursementAccountForm.ts index 7bc1c52e8025..7860d5a066f1 100644 --- a/src/types/form/ReimbursementAccountForm.ts +++ b/src/types/form/ReimbursementAccountForm.ts @@ -1,3 +1,4 @@ +import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type Form from './Form'; const INPUT_IDS = { @@ -50,73 +51,79 @@ const INPUT_IDS = { AMOUNT3: 'amount3', } as const; +type InputID = DeepValueOf; + +type BeneficialOwnersStepBaseProps = { + [INPUT_IDS.BENEFICIAL_OWNER_INFO_STEP.OWNS_MORE_THAN_25_PERCENT]: boolean; + [INPUT_IDS.BENEFICIAL_OWNER_INFO_STEP.HAS_OTHER_BENEFICIAL_OWNERS]: boolean; + [INPUT_IDS.BENEFICIAL_OWNER_INFO_STEP.BENEFICIAL_OWNERS]: string; +}; + // BeneficialOwnerDraftData is saved under dynamic key which consists of prefix, beneficial owner ID and input key type BeneficialOwnerDataKey = `beneficialOwner_${string}_${string}`; -type AdditionalDraftData = {selectedPlaidAccountID?: string; bankAccountID?: number}; +type ReimbursementAccountFormExtraProps = BeneficialOwnersStepExtraProps & {bankAccountID?: number}; + +type BeneficialOwnersStepExtraProps = { + [key: BeneficialOwnerDataKey]: string; + beneficialOwnerKeys?: string[]; +}; + +type BeneficialOwnersStepProps = BeneficialOwnersStepBaseProps & BeneficialOwnersStepExtraProps; type BankAccountStepProps = { - [INPUT_IDS.BANK_INFO_STEP.ACCOUNT_NUMBER]?: string; - [INPUT_IDS.BANK_INFO_STEP.ROUTING_NUMBER]?: string; - [INPUT_IDS.BANK_INFO_STEP.PLAID_ACCOUNT_ID]?: string; - [INPUT_IDS.BANK_INFO_STEP.PLAID_MASK]?: string; + [INPUT_IDS.BANK_INFO_STEP.ACCOUNT_NUMBER]: string; + [INPUT_IDS.BANK_INFO_STEP.ROUTING_NUMBER]: string; + [INPUT_IDS.BANK_INFO_STEP.PLAID_ACCOUNT_ID]: string; + [INPUT_IDS.BANK_INFO_STEP.PLAID_MASK]: string; }; type CompanyStepProps = { - [INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_NAME]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.STREET]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.CITY]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.STATE]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.ZIP_CODE]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_PHONE]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_WEBSITE]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_TAX_ID]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.INCORPORATION_TYPE]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.INCORPORATION_DATE]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.INCORPORATION_STATE]?: string; - [INPUT_IDS.BUSINESS_INFO_STEP.HAS_NO_CONNECTION_TO_CANNABIS]?: boolean; + [INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_NAME]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.STREET]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.CITY]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.STATE]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.ZIP_CODE]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_PHONE]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_WEBSITE]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.COMPANY_TAX_ID]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.INCORPORATION_TYPE]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.INCORPORATION_DATE]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.INCORPORATION_STATE]: string; + [INPUT_IDS.BUSINESS_INFO_STEP.HAS_NO_CONNECTION_TO_CANNABIS]: boolean; }; type RequestorStepProps = { - [INPUT_IDS.PERSONAL_INFO_STEP.FIRST_NAME]?: string; - [INPUT_IDS.PERSONAL_INFO_STEP.LAST_NAME]?: string; - [INPUT_IDS.PERSONAL_INFO_STEP.STREET]?: string; - [INPUT_IDS.PERSONAL_INFO_STEP.CITY]?: string; - [INPUT_IDS.PERSONAL_INFO_STEP.STATE]?: string; - [INPUT_IDS.PERSONAL_INFO_STEP.ZIP_CODE]?: string; - [INPUT_IDS.PERSONAL_INFO_STEP.DOB]?: string; - [INPUT_IDS.PERSONAL_INFO_STEP.SSN_LAST_4]?: string; -}; - -type BeneficialOwnersStepProps = { - [INPUT_IDS.BENEFICIAL_OWNER_INFO_STEP.OWNS_MORE_THAN_25_PERCENT]?: boolean; - [INPUT_IDS.BENEFICIAL_OWNER_INFO_STEP.HAS_OTHER_BENEFICIAL_OWNERS]?: boolean; - [INPUT_IDS.BENEFICIAL_OWNER_INFO_STEP.BENEFICIAL_OWNERS]?: string; - [key: BeneficialOwnerDataKey]: string; - beneficialOwnerKeys?: string[]; + [INPUT_IDS.PERSONAL_INFO_STEP.FIRST_NAME]: string; + [INPUT_IDS.PERSONAL_INFO_STEP.LAST_NAME]: string; + [INPUT_IDS.PERSONAL_INFO_STEP.STREET]: string; + [INPUT_IDS.PERSONAL_INFO_STEP.CITY]: string; + [INPUT_IDS.PERSONAL_INFO_STEP.STATE]: string; + [INPUT_IDS.PERSONAL_INFO_STEP.ZIP_CODE]: string; + [INPUT_IDS.PERSONAL_INFO_STEP.DOB]: string; + [INPUT_IDS.PERSONAL_INFO_STEP.SSN_LAST_4]: string; }; type ACHContractStepProps = { - [INPUT_IDS.COMPLETE_VERIFICATION.ACCEPT_TERMS_AND_CONDITIONS]?: boolean; - [INPUT_IDS.COMPLETE_VERIFICATION.CERTIFY_TRUE_INFORMATION]?: boolean; - [INPUT_IDS.COMPLETE_VERIFICATION.IS_AUTHORIZED_TO_USE_BANK_ACCOUNT]?: boolean; + [INPUT_IDS.COMPLETE_VERIFICATION.ACCEPT_TERMS_AND_CONDITIONS]: boolean; + [INPUT_IDS.COMPLETE_VERIFICATION.CERTIFY_TRUE_INFORMATION]: boolean; + [INPUT_IDS.COMPLETE_VERIFICATION.IS_AUTHORIZED_TO_USE_BANK_ACCOUNT]: boolean; }; type ReimbursementAccountProps = { - [INPUT_IDS.BANK_INFO_STEP.IS_SAVINGS]?: boolean; - [INPUT_IDS.BANK_INFO_STEP.BANK_NAME]?: string; - [INPUT_IDS.BANK_INFO_STEP.PLAID_ACCESS_TOKEN]?: string; - [INPUT_IDS.AMOUNT1]?: string; - [INPUT_IDS.AMOUNT2]?: string; - [INPUT_IDS.AMOUNT3]?: string; + [INPUT_IDS.BANK_INFO_STEP.IS_SAVINGS]: boolean; + [INPUT_IDS.BANK_INFO_STEP.BANK_NAME]: string; + [INPUT_IDS.BANK_INFO_STEP.PLAID_ACCESS_TOKEN]: string; + [INPUT_IDS.BANK_INFO_STEP.SELECTED_PLAID_ACCOUNT_ID]: string; + [INPUT_IDS.AMOUNT1]: string; + [INPUT_IDS.AMOUNT2]: string; + [INPUT_IDS.AMOUNT3]: string; }; -type ReimbursementAccountForm = AdditionalDraftData & - BeneficialOwnersStepProps & - Form; +type ReimbursementAccountForm = ReimbursementAccountFormExtraProps & + Form; export type { ReimbursementAccountForm, - AdditionalDraftData, BeneficialOwnerDataKey, BankAccountStepProps, CompanyStepProps, diff --git a/src/types/form/ReportDescriptionForm.ts b/src/types/form/ReportDescriptionForm.ts index 18f42ad80182..b3300051d90c 100644 --- a/src/types/form/ReportDescriptionForm.ts +++ b/src/types/form/ReportDescriptionForm.ts @@ -1,12 +1,18 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { REPORT_DESCRIPTION: 'reportDescription', } as const; -type ReportDescriptionForm = Form<{ - [INPUT_IDS.REPORT_DESCRIPTION]: string; -}>; +type InputID = ValueOf; + +type ReportDescriptionForm = Form< + InputID, + { + [INPUT_IDS.REPORT_DESCRIPTION]: string; + } +>; export type {ReportDescriptionForm}; export default INPUT_IDS; diff --git a/src/types/form/ReportFieldEditForm.ts b/src/types/form/ReportFieldEditForm.ts index 3dce5456875c..7befa2cb6502 100644 --- a/src/types/form/ReportFieldEditForm.ts +++ b/src/types/form/ReportFieldEditForm.ts @@ -1,6 +1,6 @@ import type Form from './Form'; -type ReportFieldEditForm = Form>; +type ReportFieldEditForm = Form>; // eslint-disable-next-line import/prefer-default-export export type {ReportFieldEditForm}; diff --git a/src/types/form/ReportPhysicalCardForm.ts b/src/types/form/ReportPhysicalCardForm.ts new file mode 100644 index 000000000000..2daafb974c2c --- /dev/null +++ b/src/types/form/ReportPhysicalCardForm.ts @@ -0,0 +1,6 @@ +import type Form from './Form'; + +type ReportPhysicalCardForm = Form; + +// eslint-disable-next-line import/prefer-default-export +export type {ReportPhysicalCardForm}; diff --git a/src/types/form/RoomNameForm.ts b/src/types/form/RoomNameForm.ts index 0a128d2c175f..b9fb996986b9 100644 --- a/src/types/form/RoomNameForm.ts +++ b/src/types/form/RoomNameForm.ts @@ -1,12 +1,18 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { ROOM_NAME: 'roomName', } as const; -type RoomNameForm = Form<{ - [INPUT_IDS.ROOM_NAME]: string; -}>; +type InputID = ValueOf; + +type RoomNameForm = Form< + InputID, + { + [INPUT_IDS.ROOM_NAME]: string; + } +>; export type {RoomNameForm}; export default INPUT_IDS; diff --git a/src/types/form/SettingsStatusClearDateForm.ts b/src/types/form/SettingsStatusClearDateForm.ts index fdb191cb4bc5..65f2e046d272 100644 --- a/src/types/form/SettingsStatusClearDateForm.ts +++ b/src/types/form/SettingsStatusClearDateForm.ts @@ -1,12 +1,18 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { DATE_TIME: 'dateTime', } as const; -type SettingsStatusClearDateForm = Form<{ - [INPUT_IDS.DATE_TIME]: string; -}>; +type InputID = ValueOf; + +type SettingsStatusClearDateForm = Form< + InputID, + { + [INPUT_IDS.DATE_TIME]: string; + } +>; export type {SettingsStatusClearDateForm}; export default INPUT_IDS; diff --git a/src/types/form/WorkspaceDescriptionForm.ts b/src/types/form/WorkspaceDescriptionForm.ts index b06a37abf36b..e6f9596e79a1 100644 --- a/src/types/form/WorkspaceDescriptionForm.ts +++ b/src/types/form/WorkspaceDescriptionForm.ts @@ -1,12 +1,18 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { DESCRIPTION: 'description', } as const; -type WorkspaceDescriptionForm = Form<{ - [INPUT_IDS.DESCRIPTION]: string; -}>; +type InputID = ValueOf; + +type WorkspaceDescriptionForm = Form< + InputID, + { + [INPUT_IDS.DESCRIPTION]: string; + } +>; export type {WorkspaceDescriptionForm}; export default INPUT_IDS; diff --git a/src/types/form/WorkspaceInviteMessageForm.ts b/src/types/form/WorkspaceInviteMessageForm.ts index 268e29224f35..7f36b3281703 100644 --- a/src/types/form/WorkspaceInviteMessageForm.ts +++ b/src/types/form/WorkspaceInviteMessageForm.ts @@ -1,12 +1,18 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { WELCOME_MESSAGE: 'welcomeMessage', } as const; -type WorkspaceInviteMessageForm = Form<{ - [INPUT_IDS.WELCOME_MESSAGE]: string; -}>; +type InputID = ValueOf; + +type WorkspaceInviteMessageForm = Form< + InputID, + { + [INPUT_IDS.WELCOME_MESSAGE]: string; + } +>; export type {WorkspaceInviteMessageForm}; export default INPUT_IDS; diff --git a/src/types/form/WorkspaceProfileDescriptionForm.ts b/src/types/form/WorkspaceProfileDescriptionForm.ts deleted file mode 100644 index 2fc84334c03e..000000000000 --- a/src/types/form/WorkspaceProfileDescriptionForm.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type Form from './Form'; - -const INPUT_IDS = { - DESCRIPTION: 'description', -} as const; - -type WorkspaceProfileDescriptionForm = Form<{ - [INPUT_IDS.DESCRIPTION]: string; -}>; - -export type {WorkspaceProfileDescriptionForm}; -export default INPUT_IDS; diff --git a/src/types/form/WorkspaceRateAndUnitForm.ts b/src/types/form/WorkspaceRateAndUnitForm.ts index 52f13d3a1415..566f10df9d9d 100644 --- a/src/types/form/WorkspaceRateAndUnitForm.ts +++ b/src/types/form/WorkspaceRateAndUnitForm.ts @@ -1,3 +1,4 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { @@ -5,10 +6,15 @@ const INPUT_IDS = { UNIT: 'unit', } as const; -type WorkspaceRateAndUnitForm = Form<{ - [INPUT_IDS.RATE]: string; - [INPUT_IDS.UNIT]: string; -}>; +type InputID = ValueOf; + +type WorkspaceRateAndUnitForm = Form< + InputID, + { + [INPUT_IDS.RATE]: string; + [INPUT_IDS.UNIT]: string; + } +>; export type {WorkspaceRateAndUnitForm}; export default INPUT_IDS; diff --git a/src/types/form/WorkspaceSettingsForm.ts b/src/types/form/WorkspaceSettingsForm.ts index a3714583477a..8e2f580942c9 100644 --- a/src/types/form/WorkspaceSettingsForm.ts +++ b/src/types/form/WorkspaceSettingsForm.ts @@ -1,12 +1,18 @@ +import type {ValueOf} from 'type-fest'; import type Form from './Form'; const INPUT_IDS = { NAME: 'name', } as const; -type WorkspaceSettingsForm = Form<{ - [INPUT_IDS.NAME]: string; -}>; +type InputID = ValueOf; + +type WorkspaceSettingsForm = Form< + InputID, + { + [INPUT_IDS.NAME]: string; + } +>; export type {WorkspaceSettingsForm}; export default INPUT_IDS; diff --git a/src/types/form/index.ts b/src/types/form/index.ts index f188dee6ab4f..aa21aeb274fc 100644 --- a/src/types/form/index.ts +++ b/src/types/form/index.ts @@ -9,7 +9,7 @@ export type {IKnowTeacherForm} from './IKnowTeacherForm'; export type {IntroSchoolPrincipalForm} from './IntroSchoolPrincipalForm'; export type {LegalNameForm} from './LegalNameForm'; export type {MoneyRequestAmountForm} from './MoneyRequestAmountForm'; -export type {MoneyRequestCreatedForm} from './MoneyRequestCreatedForm'; +export type {MoneyRequestDateForm} from './MoneyRequestDateForm'; export type {MoneyRequestDescriptionForm} from './MoneyRequestDescriptionForm'; export type {MoneyRequestMerchantForm} from './MoneyRequestMerchantForm'; export type {MoneyRequestHoldReasonForm} from './MoneyRequestHoldReasonForm'; @@ -33,6 +33,6 @@ export type {WaypointForm} from './WaypointForm'; export type {WorkspaceInviteMessageForm} from './WorkspaceInviteMessageForm'; export type {WorkspaceRateAndUnitForm} from './WorkspaceRateAndUnitForm'; export type {WorkspaceSettingsForm} from './WorkspaceSettingsForm'; +export type {ReportPhysicalCardForm} from './ReportPhysicalCardForm'; export type {WorkspaceDescriptionForm} from './WorkspaceDescriptionForm'; -export type {WorkspaceProfileDescriptionForm} from './WorkspaceProfileDescriptionForm'; export type {default as Form} from './Form'; diff --git a/src/types/onyx/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts index 173200ba681a..5b16d15bf5cc 100644 --- a/src/types/onyx/ReimbursementAccount.ts +++ b/src/types/onyx/ReimbursementAccount.ts @@ -8,37 +8,34 @@ type BankAccountStep = ValueOf; type BankAccountSubStep = ValueOf; -type ACHData = BeneficialOwnersStepProps & - CompanyStepProps & - RequestorStepProps & - ACHContractStepProps & { - /** Step of the setup flow that we are on. Determines which view is presented. */ - currentStep?: BankAccountStep; +type ACHData = Partial & { + /** Step of the setup flow that we are on. Determines which view is presented. */ + currentStep?: BankAccountStep; - /** Optional subStep we would like the user to start back on */ - subStep?: BankAccountSubStep; + /** Optional subStep we would like the user to start back on */ + subStep?: BankAccountSubStep; - /** Bank account state */ - state?: string; + /** Bank account state */ + state?: string; - /** Bank account ID of the VBA that we are validating is required */ - bankAccountID?: number; + /** Bank account ID of the VBA that we are validating is required */ + bankAccountID?: number; - /** Bank account routing number */ - routingNumber?: string; + /** Bank account routing number */ + routingNumber?: string; - /** Bank account number */ - accountNumber?: string; + /** Bank account number */ + accountNumber?: string; - /** Bank account name */ - bankName?: BankName; + /** Bank account name */ + bankName?: BankName; - /** Bank account owner name */ - addressName?: string; + /** Bank account owner name */ + addressName?: string; - /** Policy ID of the workspace the bank account is being set up on */ - policyID?: string; - }; + /** Policy ID of the workspace the bank account is being set up on */ + policyID?: string; +}; type ReimbursementAccount = { /** Whether we are loading the data via the API */