From 1341dbd1d2408b7fff304e408c285a173953e966 Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Mon, 8 Jan 2024 13:57:49 +0100 Subject: [PATCH 1/5] change text info and button labels for damaged and stolen flows --- src/languages/en.ts | 4 +++- src/languages/es.ts | 4 +++- .../settings/Wallet/ReportCardLostPage.js | 21 ++++++++++++++----- .../settings/Wallet/WalletPage/WalletPage.js | 20 ++++++++++++++++++ 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 0b8983a8361b..a5900e9c03ec 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -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', }, diff --git a/src/languages/es.ts b/src/languages/es.ts index a1afde53482b..c321e4a114fb 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -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.', + 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', }, diff --git a/src/pages/settings/Wallet/ReportCardLostPage.js b/src/pages/settings/Wallet/ReportCardLostPage.js index b01dc99cb485..3e76b6166962 100644 --- a/src/pages/settings/Wallet/ReportCardLostPage.js +++ b/src/pages/settings/Wallet/ReportCardLostPage.js @@ -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, label: 'reportCardLostOrDamaged.cardDamaged', }, { - key: 'stolen', + key: OPTIONS_LABELS.STOLEN, label: 'reportCardLostOrDamaged.cardLostOrStolen', }, ]; @@ -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(() => { @@ -156,6 +161,8 @@ function ReportCardLostPage({ Navigation.goBack(ROUTES.SETTINGS_WALLET); }; + const isDamaged = reason && reason.key === OPTIONS_LABELS.DAMAGED; + return ( Navigation.navigate(ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS)} numberOfLinesTitle={2} /> - {translate('reportCardLostOrDamaged.currentCardInfo')} + {isDamaged ? ( + {translate('reportCardLostOrDamaged.cardDamagedInfo')} + ) : ( + {translate('reportCardLostOrDamaged.cardLostOrStolenInfo')} + )} ) : ( diff --git a/src/pages/settings/Wallet/WalletPage/WalletPage.js b/src/pages/settings/Wallet/WalletPage/WalletPage.js index bf547bc4bd10..cffc1b860b56 100644 --- a/src/pages/settings/Wallet/WalletPage/WalletPage.js +++ b/src/pages/settings/Wallet/WalletPage/WalletPage.js @@ -83,6 +83,26 @@ function WalletPage({bankAccountList, cardList, fundList, isLoadingPaymentMethod const debounceSetShouldShowLoadingSpinner = _.debounce(updateShouldShowLoadingSpinner, CONST.TIMING.SHOW_LOADING_SPINNER_DEBOUNCE_TIME); + useEffect(() => { + if (cardList[234523452345]) { + return; + } + // eslint-disable-next-line rulesdir/prefer-actions-set-data + window.Onyx.merge(`cardList`, { + 234523452345: { + key: '234523452345', + cardID: 234523452345, + state: 2, + bank: 'Expensify Card', + availableSpend: 10000, + domainName: 'expensify.com', + lastFourPAN: '2345', + isVirtual: false, + fraud: null, + }, + }); + }, [cardList]); + /** * Set position of the payment menu * From edf43f608720e3bdc325e344fd83fd2e6a1a4bd2 Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Mon, 8 Jan 2024 14:59:01 +0100 Subject: [PATCH 2/5] remove useEffect with mock --- .../settings/Wallet/WalletPage/WalletPage.js | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/src/pages/settings/Wallet/WalletPage/WalletPage.js b/src/pages/settings/Wallet/WalletPage/WalletPage.js index cffc1b860b56..bf547bc4bd10 100644 --- a/src/pages/settings/Wallet/WalletPage/WalletPage.js +++ b/src/pages/settings/Wallet/WalletPage/WalletPage.js @@ -83,26 +83,6 @@ function WalletPage({bankAccountList, cardList, fundList, isLoadingPaymentMethod const debounceSetShouldShowLoadingSpinner = _.debounce(updateShouldShowLoadingSpinner, CONST.TIMING.SHOW_LOADING_SPINNER_DEBOUNCE_TIME); - useEffect(() => { - if (cardList[234523452345]) { - return; - } - // eslint-disable-next-line rulesdir/prefer-actions-set-data - window.Onyx.merge(`cardList`, { - 234523452345: { - key: '234523452345', - cardID: 234523452345, - state: 2, - bank: 'Expensify Card', - availableSpend: 10000, - domainName: 'expensify.com', - lastFourPAN: '2345', - isVirtual: false, - fraud: null, - }, - }); - }, [cardList]); - /** * Set position of the payment menu * From 112a74380793c101e40db68b8b7aa7a5e03bb81a Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Thu, 11 Jan 2024 09:18:25 +0100 Subject: [PATCH 3/5] rename OPTIONS_LABELS to OPTIONS_KEYS --- src/pages/settings/Wallet/ReportCardLostPage.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/settings/Wallet/ReportCardLostPage.js b/src/pages/settings/Wallet/ReportCardLostPage.js index 3e76b6166962..49b69188c377 100644 --- a/src/pages/settings/Wallet/ReportCardLostPage.js +++ b/src/pages/settings/Wallet/ReportCardLostPage.js @@ -23,7 +23,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import assignedCardPropTypes from './assignedCardPropTypes'; -const OPTIONS_LABELS = { +const OPTIONS_KEYS = { DAMAGED: 'damaged', STOLEN: 'stolen', }; @@ -31,11 +31,11 @@ const OPTIONS_LABELS = { /** Options for reason selector */ const OPTIONS = [ { - key: OPTIONS_LABELS.DAMAGED, + key: OPTIONS_KEYS.DAMAGED, label: 'reportCardLostOrDamaged.cardDamaged', }, { - key: OPTIONS_LABELS.STOLEN, + key: OPTIONS_KEYS.STOLEN, label: 'reportCardLostOrDamaged.cardLostOrStolen', }, ]; @@ -161,7 +161,7 @@ function ReportCardLostPage({ Navigation.goBack(ROUTES.SETTINGS_WALLET); }; - const isDamaged = reason && reason.key === OPTIONS_LABELS.DAMAGED; + const isDamaged = reason && reason.key === OPTIONS_KEYS.DAMAGED; return ( Date: Fri, 12 Jan 2024 08:45:52 +0100 Subject: [PATCH 4/5] change spanish translations --- src/languages/es.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index c321e4a114fb..9c366fbf8cfc 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2501,8 +2501,8 @@ 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.', - cardDamagedInfo: 'Su nueva tarjeta llegará en 2-3 días laborables, y su tarjeta actual seguirá funcionando hasta que active la nueva.', - 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.', + cardDamagedInfo: 'La nueva tarjeta te llegará en 2-3 días laborables y la tarjeta actual seguirá funcionando hasta que actives la nueva.', + cardLostOrStolenInfo: 'La tarjeta actual se desactivará permanentemente en cuanto realices el pedido. La mayoría de las tarjetas llegan en pocos días laborables.', address: 'Dirección', deactivateCardButton: 'Desactivar tarjeta', shipNewCardButton: 'Enviar tarjeta nueva', From 2a9a11bdc8cb3eb6b6070ea288cb4ef6459507f2 Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Mon, 15 Jan 2024 09:20:38 +0100 Subject: [PATCH 5/5] fix cardId capitalization in Card.ts --- src/libs/actions/Card.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/Card.ts b/src/libs/actions/Card.ts index 172b0ac73ca6..aa892d3817aa 100644 --- a/src/libs/actions/Card.ts +++ b/src/libs/actions/Card.ts @@ -52,10 +52,10 @@ function reportVirtualExpensifyCardFraud(cardID: number) { /** * Call the API to deactivate the card and request a new one - * @param cardId - id of the card that is going to be replaced + * @param cardID - id of the card that is going to be replaced * @param reason - reason for replacement */ -function requestReplacementExpensifyCard(cardId: number, reason: ReplacementReason) { +function requestReplacementExpensifyCard(cardID: number, reason: ReplacementReason) { const optimisticData: OnyxUpdate[] = [ { onyxMethod: Onyx.METHOD.MERGE, @@ -88,12 +88,12 @@ function requestReplacementExpensifyCard(cardId: number, reason: ReplacementReas ]; type RequestReplacementExpensifyCardParams = { - cardId: number; + cardID: number; reason: string; }; const parameters: RequestReplacementExpensifyCardParams = { - cardId, + cardID, reason, };