Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Card Settings] fix card lost/damaged flow #34098

Merged
merged 6 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2014,9 +2014,11 @@ export default {
cardDamaged: 'My card was damaged',
cardLostOrStolen: 'My card was lost or stolen',
confirmAddressTitle: "Please confirm the address below is where you'd like us to send your new card.",
currentCardInfo: 'Your current card will be permanently deactivated as soon as your order is placed. Most cards arrive in a few business days.',
cardDamagedInfo: 'Your new card will arrive in 2-3 business days, and your existing card will continue to work until you activate your new one.',
cardLostOrStolenInfo: 'Your current card will be permanently deactivated as soon as your order is placed. Most cards arrive in a few business days.',
address: 'Address',
deactivateCardButton: 'Deactivate card',
shipNewCardButton: 'Ship new card',
addressError: 'Address is required',
reasonError: 'Reason is required',
},
Expand Down
4 changes: 3 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2501,9 +2501,11 @@ export default {
cardDamaged: 'Mi tarjeta está dañada',
cardLostOrStolen: 'He perdido o me han robado la tarjeta',
confirmAddressTitle: 'Confirma que la dirección que aparece a continuación es a la que deseas que te enviemos tu nueva tarjeta.',
currentCardInfo: 'La tarjeta actual se desactivará permanentemente en cuanto se realice el pedido. La mayoría de las tarjetas llegan en unos pocos días laborables.',
cardDamagedInfo: 'Su nueva tarjeta llegará en 2-3 días laborables, y su tarjeta actual seguirá funcionando hasta que active la nueva.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanna double check, where did you get those copies in Spain?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got them from deepl, I will ask on Slack to confirm they're correct 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the question!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like we got a copy in Spain, didn't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I updated it

cardLostOrStolenInfo: 'La tarjeta actual se desactivará permanentemente en cuanto se realice el pedido. La mayoría de las tarjetas llegan en unos pocos días laborables.',
address: 'Dirección',
deactivateCardButton: 'Desactivar tarjeta',
shipNewCardButton: 'Enviar tarjeta nueva',
addressError: 'La dirección es obligatoria',
reasonError: 'Se requiere justificación',
},
Expand Down
21 changes: 16 additions & 5 deletions src/pages/settings/Wallet/ReportCardLostPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@ import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import assignedCardPropTypes from './assignedCardPropTypes';

const OPTIONS_LABELS = {
DAMAGED: 'damaged',
STOLEN: 'stolen',
};

/** Options for reason selector */
const OPTIONS = [
{
key: 'damaged',
key: OPTIONS_LABELS.DAMAGED,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it OPTIONS_KEYS or OPTIONS_LABELS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it 😄

label: 'reportCardLostOrDamaged.cardDamaged',
},
{
key: 'stolen',
key: OPTIONS_LABELS.STOLEN,
label: 'reportCardLostOrDamaged.cardLostOrStolen',
},
];
Expand Down Expand Up @@ -107,7 +112,7 @@ function ReportCardLostPage({
return;
}

Navigation.navigate(ROUTES.SETTINGS_WALLET_DOMAINCARDS.getRoute(domain));
Navigation.navigate(ROUTES.SETTINGS_WALLET_DOMAINCARD.getRoute(domain));
}, [domain, formData.isLoading, prevIsLoading, physicalCard.errors]);

useEffect(() => {
Expand Down Expand Up @@ -156,6 +161,8 @@ function ReportCardLostPage({
Navigation.goBack(ROUTES.SETTINGS_WALLET);
};

const isDamaged = reason && reason.key === OPTIONS_LABELS.DAMAGED;

return (
<ScreenWrapper
includeSafeAreaPaddingBottom
Expand All @@ -178,14 +185,18 @@ function ReportCardLostPage({
onPress={() => Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS)}
numberOfLinesTitle={2}
/>
<Text style={[styles.mt3, styles.mh5]}>{translate('reportCardLostOrDamaged.currentCardInfo')}</Text>
{isDamaged ? (
<Text style={[styles.mt3, styles.mh5]}>{translate('reportCardLostOrDamaged.cardDamagedInfo')}</Text>
) : (
<Text style={[styles.mt3, styles.mh5]}>{translate('reportCardLostOrDamaged.cardLostOrStolenInfo')}</Text>
)}
</View>
<FormAlertWithSubmitButton
isAlertVisible={shouldShowAddressError}
onSubmit={handleSubmitSecondStep}
message={translate('reportCardLostOrDamaged.addressError')}
isLoading={formData.isLoading}
buttonText={translate('reportCardLostOrDamaged.deactivateCardButton')}
buttonText={isDamaged ? translate('reportCardLostOrDamaged.shipNewCardButton') : translate('reportCardLostOrDamaged.deactivateCardButton')}
/>
</>
) : (
Expand Down
Loading