Skip to content

Commit

Permalink
Merge pull request #52442 from Expensify/nikk-validateCode-modal
Browse files Browse the repository at this point in the history
Update copy for ValidateCodeActionModal
  • Loading branch information
lakchote authored Nov 13, 2024
2 parents 4df913e + b8ac6eb commit b723852
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 21 deletions.
6 changes: 4 additions & 2 deletions src/components/ValidateCodeActionModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import type {ValidateCodeFormHandle} from './ValidateCodeForm/BaseValidateCodeFo
function ValidateCodeActionModal({
isVisible,
title,
description,
descriptionPrimary,
descriptionSecondary,
onClose,
onModalHide,
validatePendingAction,
Expand Down Expand Up @@ -71,7 +72,8 @@ function ValidateCodeActionModal({
/>

<View style={[themeStyles.ph5, themeStyles.mt3, themeStyles.mb7, themeStyles.flex1]}>
<Text style={[themeStyles.mb3]}>{description}</Text>
<Text style={[themeStyles.mb3]}>{descriptionPrimary}</Text>
{!!descriptionSecondary && <Text style={[themeStyles.mb3]}>{descriptionSecondary}</Text>}
<ValidateCodeForm
validateCodeAction={validateCodeAction}
validatePendingAction={validatePendingAction}
Expand Down
7 changes: 5 additions & 2 deletions src/components/ValidateCodeActionModal/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ type ValidateCodeActionModalProps = {
/** Title of the modal */
title: string;

/** Description of the modal */
description: string;
/** Primary description of the modal */
descriptionPrimary: string;

/** Secondary description of the modal */
descriptionSecondary?: string | null;

/** Function to call when the user closes the modal */
onClose: () => void;
Expand Down
6 changes: 3 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ const translations = {
helpTextAfterEmail: ' from multiple email addresses.',
pleaseVerify: 'Please verify this contact method',
getInTouch: "Whenever we need to get in touch with you, we'll use this contact method.",
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `Please enter the magic code sent to ${contactMethod}`,
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `Please enter the magic code sent to ${contactMethod}. It should arrive within a minute or two.`,
setAsDefault: 'Set as default',
yourDefaultContactMethod: "This is your current default contact method. Before you can delete it, you'll need to choose another contact method and click “Set as default”.",
removeContactMethod: 'Remove contact method',
Expand Down Expand Up @@ -1455,7 +1455,7 @@ const translations = {
},
cardDetailsLoadingFailure: 'An error occurred while loading the card details. Please check your internet connection and try again.',
validateCardTitle: "Let's make sure it's you",
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `Please enter the magic code sent to ${contactMethod} to view your card details`,
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `Please enter the magic code sent to ${contactMethod} to view your card details. It should arrive within a minute or two.`,
},
workflowsPage: {
workflowTitle: 'Spend',
Expand Down Expand Up @@ -5180,7 +5180,7 @@ const translations = {
removeCopilotConfirmation: 'Are you sure you want to remove this copilot?',
changeAccessLevel: 'Change access level',
makeSureItIsYou: "Let's make sure it's you",
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `Please enter the magic code sent to ${contactMethod} to add a copilot.`,
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `Please enter the magic code sent to ${contactMethod} to add a copilot. It should arrive within a minute or two.`,
enterMagicCodeUpdate: ({contactMethod}: EnterMagicCodeParams) => `Please enter the magic code sent to ${contactMethod} to update your copilot.`,
notAllowed: 'Not so fast...',
notAllowedMessageStart: ({accountOwnerEmail}: AccountOwnerParams) => `You don't have permission to take this action for ${accountOwnerEmail} as a`,
Expand Down
8 changes: 5 additions & 3 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ const translations = {
helpTextAfterEmail: ' desde varias direcciones de correo electrónico.',
pleaseVerify: 'Por favor, verifica este método de contacto',
getInTouch: 'Utilizaremos este método de contacto cuando necesitemos contactarte.',
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `Por favor, introduce el código mágico enviado a ${contactMethod}`,
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `Por favor, introduce el código mágico enviado a ${contactMethod}. Debería llegar en un par de minutos.`,
setAsDefault: 'Establecer como predeterminado',
yourDefaultContactMethod:
'Este es tu método de contacto predeterminado. Antes de poder eliminarlo, tendrás que elegir otro método de contacto y haz clic en "Establecer como predeterminado".',
Expand Down Expand Up @@ -1454,7 +1454,8 @@ const translations = {
},
cardDetailsLoadingFailure: 'Se ha producido un error al cargar los datos de la tarjeta. Comprueba tu conexión a Internet e inténtalo de nuevo.',
validateCardTitle: 'Asegurémonos de que eres tú',
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `Introduzca el código mágico enviado a ${contactMethod} para ver los datos de su tarjeta`,
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) =>
`Introduzca el código mágico enviado a ${contactMethod} para ver los datos de su tarjeta. Debería llegar en un par de minutos.`,
},
workflowsPage: {
workflowTitle: 'Gasto',
Expand Down Expand Up @@ -5696,7 +5697,8 @@ const translations = {
removeCopilotConfirmation: '¿Estás seguro de que quieres eliminar este copiloto?',
changeAccessLevel: 'Cambiar nivel de acceso',
makeSureItIsYou: 'Vamos a asegurarnos de que eres tú',
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) => `Por favor, introduce el código mágico enviado a ${contactMethod} para agregar un copiloto.`,
enterMagicCode: ({contactMethod}: EnterMagicCodeParams) =>
`Por favor, introduce el código mágico enviado a ${contactMethod} para agregar un copiloto. Debería llegar en un par de minutos.`,
enterMagicCodeUpdate: ({contactMethod}: EnterMagicCodeParams) =>
`Por favor, introduce el código mágico enviado a ${contactMethod} para actualizar el nivel de acceso de tu copiloto.`,
notAllowed: 'No tan rápido...',
Expand Down
3 changes: 2 additions & 1 deletion src/pages/ReimbursementAccount/BankAccountStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ function BankAccountStep({
</PressableWithoutFeedback>
<ValidateCodeActionModal
title={translate('contacts.validateAccount')}
description={translate('contacts.featureRequiresValidate')}
descriptionPrimary={translate('contacts.featureRequiresValidate')}
descriptionSecondary={translate('contacts.enterMagicCode', {contactMethod})}
isVisible={!!isValidateCodeActionModalVisible}
hasMagicCodeBeenSent={hasMagicCodeBeenSent}
validatePendingAction={loginData?.pendingFields?.validateCodeSent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function ContactMethodDetailsPage({route}: ContactMethodDetailsPageProps) {
setIsValidateCodeActionModalVisible(false);
}}
sendValidateCode={() => User.requestContactMethodValidateCode(contactMethod)}
description={translate('contacts.enterMagicCode', {contactMethod})}
descriptionPrimary={translate('contacts.enterMagicCode', {contactMethod})}
/>

{!isValidateCodeActionModalVisible && getMenuItems()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function NewContactMethodPage({route}: NewContactMethodPageProps) {
hasMagicCodeBeenSent={!!loginData?.validateCodeSent}
title={translate('delegate.makeSureItIsYou')}
sendValidateCode={() => User.requestValidateCodeAction()}
description={translate('contacts.enterMagicCode', {contactMethod})}
descriptionPrimary={translate('contacts.enterMagicCode', {contactMethod})}
/>
</ScreenWrapper>
</AccessOrNotFoundWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function DelegateMagicCodeModal({login, role, onClose, isValidateCodeActionModal
sendValidateCode={() => User.requestValidateCodeAction()}
hasMagicCodeBeenSent={!!currentDelegate?.validateCodeSent}
handleSubmitForm={(validateCode) => Delegate.addDelegate(login, role, validateCode)}
description={translate('delegate.enterMagicCode', {contactMethod: account?.primaryLogin ?? ''})}
descriptionPrimary={translate('delegate.enterMagicCode', {contactMethod: account?.primaryLogin ?? ''})}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ function CodesStep({backTo}: CodesStepProps) {
</FixedFooter>
<ValidateCodeActionModal
title={translate('contacts.validateAccount')}
description={translate('contacts.featureRequiresValidate')}
descriptionPrimary={translate('contacts.featureRequiresValidate')}
descriptionSecondary={translate('contacts.enterMagicCode', {contactMethod})}
isVisible={!isUserValidated}
hasMagicCodeBeenSent={hasMagicCodeBeenSent}
validatePendingAction={loginData?.pendingFields?.validateCodeSent}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Wallet/ExpensifyCardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ function ExpensifyCardPage({
isVisible={isValidateCodeActionModalVisible}
hasMagicCodeBeenSent={!!loginData?.validateCodeSent}
title={translate('cardPage.validateCardTitle')}
description={translate('cardPage.enterMagicCode', {contactMethod: account?.primaryLogin ?? ''})}
descriptionPrimary={translate('cardPage.enterMagicCode', {contactMethod: primaryLogin})}
/>
</>
)}
Expand Down
5 changes: 2 additions & 3 deletions src/pages/settings/Wallet/ReportCardLostPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function ReportCardLostPage({
const {paddingBottom} = useStyledSafeAreaInsets();

const formattedAddress = PersonalDetailsUtils.getFormattedAddress(privatePersonalDetails ?? {});
const primaryLogin = account?.primaryLogin ?? '';

useEffect(() => {
if (!isEmptyObject(physicalCard?.errors) || !(prevIsLoading && !formData?.isLoading)) {
Expand Down Expand Up @@ -132,8 +133,6 @@ function ReportCardLostPage({
};

const sendValidateCode = () => {
const primaryLogin = account?.primaryLogin ?? '';

if (loginList?.[primaryLogin]?.validateCodeSent) {
return;
}
Expand Down Expand Up @@ -201,7 +200,7 @@ function ReportCardLostPage({
onClose={() => setIsValidateCodeActionModalVisible(false)}
isVisible={isValidateCodeActionModalVisible}
title={translate('cardPage.validateCardTitle')}
description={translate('cardPage.enterMagicCode', {contactMethod: account?.primaryLogin ?? ''})}
descriptionPrimary={translate('cardPage.enterMagicCode', {contactMethod: primaryLogin})}
/>
</>
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Wallet/ReportVirtualCardFraudPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function ReportVirtualCardFraudPage({
onClose={() => setIsValidateCodeActionModalVisible(false)}
isVisible={isValidateCodeActionModalVisible}
title={translate('cardPage.validateCardTitle')}
description={translate('cardPage.enterMagicCode', {contactMethod: account?.primaryLogin ?? ''})}
descriptionPrimary={translate('cardPage.enterMagicCode', {contactMethod: primaryLogin})}
hasMagicCodeBeenSent={!!loginData?.validateCodeSent}
/>
</View>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/settings/Wallet/VerifyAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ function VerifyAccountPage({route}: VerifyAccountPageProps) {
hasMagicCodeBeenSent={!!loginData?.validateCodeSent}
isVisible={isValidateCodeActionModalVisible}
title={translate('contacts.validateAccount')}
description={translate('contacts.featureRequiresValidate')}
descriptionPrimary={translate('contacts.featureRequiresValidate')}
descriptionSecondary={translate('contacts.enterMagicCode', {contactMethod})}
onClose={() => setIsValidateCodeActionModalVisible(false)}
clearError={clearError}
/>
Expand Down

0 comments on commit b723852

Please sign in to comment.