From 4544b2fe1bff2577b0ed628c872d8c22be1beb15 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 19 Jun 2025 15:20:15 +0700 Subject: [PATCH] fix: Can use the legal name Concierge or Expensify --- src/components/SubStepForms/FullNameStep.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/SubStepForms/FullNameStep.tsx b/src/components/SubStepForms/FullNameStep.tsx index 6d7404ab81c9..8f98f284d47d 100644 --- a/src/components/SubStepForms/FullNameStep.tsx +++ b/src/components/SubStepForms/FullNameStep.tsx @@ -8,7 +8,7 @@ import TextInput from '@components/TextInput'; import useLocalize from '@hooks/useLocalize'; import type {SubStepProps} from '@hooks/useSubStep/types'; import useThemeStyles from '@hooks/useThemeStyles'; -import {getFieldRequiredErrors, isRequiredFulfilled, isValidLegalName} from '@libs/ValidationUtils'; +import {doesContainReservedWord, getFieldRequiredErrors, isRequiredFulfilled, isValidLegalName} from '@libs/ValidationUtils'; import HelpLinks from '@pages/ReimbursementAccount/USD/Requestor/PersonalInfo/HelpLinks'; import CONST from '@src/CONST'; import type {OnyxFormValuesMapping} from '@src/ONYXKEYS'; @@ -87,6 +87,11 @@ function FullNameStep({ }); } + if (doesContainReservedWord(firstName, CONST.DISPLAY_NAME.RESERVED_NAMES)) { + // @ts-expect-error type mismatch to be fixed + errors[firstNameInputID] = translate('personalDetails.error.containsReservedWord'); + } + const lastName = values[lastNameInputID as keyof FormOnyxValues] as string; if (!isRequiredFulfilled(lastName)) { // @ts-expect-error type mismatch to be fixed @@ -101,6 +106,11 @@ function FullNameStep({ limit: CONST.LEGAL_NAME.MAX_LENGTH, }); } + + if (doesContainReservedWord(lastName, CONST.DISPLAY_NAME.RESERVED_NAMES)) { + // @ts-expect-error type mismatch to be fixed + errors[lastNameInputID] = translate('personalDetails.error.containsReservedWord'); + } return errors; }, [firstNameInputID, lastNameInputID, stepFields, translate],