Skip to content

Commit

Permalink
feat: [PE-805] CGN update cta on card remove action (#6423)
Browse files Browse the repository at this point in the history
## Short description
The changes focus on updating the text for deactivating the `Carta
Giovani Nazionale`

## List of changes proposed in this pull request
- Update localizations
- Update alert render view

## How to test
- Add CGN to the wallet
- Check the remove button text
- Try to remove the CGN card
- Check the alert text and then continue
- Check the toast message in both positive and negative case
  • Loading branch information
LeleDallas authored Nov 20, 2024
1 parent fb54e48 commit ffabede
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 26 deletions.
6 changes: 3 additions & 3 deletions locales/de/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2307,7 +2307,7 @@ bonus:
cta:
activeBonus: Attiva Carta Giovani Nazionale
back: Non ora
deactivateBonus: "Die Karte deaktivieren"
deactivateBonus: "Aus Wallet entfernen"
goToDetail: Usa la Carta
detail:
cta:
Expand Down Expand Up @@ -2374,10 +2374,10 @@ bonus:
title: "Geschafft!"
body: "Deine Nationale Jugendkarte ist aktiv."
deactivate:
toast: "Die Anfrage zur Deaktivierung war erfolgreich"
toast: "Zahlungsmethode von deinem Konto entfernt!"
alert:
title: "Karte deaktivieren"
message: "Vuoi davvero disattivare la tua Carta Giovani Nazionale? Se confermi, non potrai più accedere alle opportunità e la carta scomparirà dal Portafoglio."
message: "La Carta verrà disattivata e non potrai più accedere alle opportunità disponibili."
expired: Elimina Carta Giovani Nazionale
otp:
error: "Aufgrund eines technischen Problems war es uns nicht möglich, einen Rabattcode zu generieren. Bitte versuche es erneut."
Expand Down
8 changes: 4 additions & 4 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2790,7 +2790,7 @@ bonus:
cta:
activeBonus: Activate Carta Giovani Nazionale
back: Not now
deactivateBonus: Deactivate Carta Giovani Nazionale
deactivateBonus: Remove from Wallet
goToDetail: Use the card
detail:
cta:
Expand Down Expand Up @@ -2859,10 +2859,10 @@ bonus:
title: "Congratulation!"
body: "Your Carta Giovani Nazionale is active"
deactivate:
toast: "The request to deactivate the card has been successfully executed"
toast: "Method removed!"
alert:
title: "Deactivate card"
message: "Do you really want to deactivate your Carta Giovani Nazionale? If you confirm, you will no longer be able to access the opportunities and the card will disappear from your Wallet."
title: "Do you want to remove Carta Giovani from the Wallet?"
message: "The card will be deactivated and you will no longer be able to access the available opportunities."
expired: Delete Carta Giovani Nazionale
otp:
error: "Due to a technical problem we were unable to generate a discount code. Please try again."
Expand Down
8 changes: 4 additions & 4 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2791,7 +2791,7 @@ bonus:
cta:
activeBonus: Attiva Carta Giovani Nazionale
back: Non ora
deactivateBonus: Disattiva Carta Giovani Nazionale
deactivateBonus: Rimuovi dal Portafoglio
goToDetail: Usa la Carta
detail:
cta:
Expand Down Expand Up @@ -2860,10 +2860,10 @@ bonus:
title: "Fatto!"
body: "La tua Carta Giovani Nazionale è attiva."
deactivate:
toast: "La richiesta di disattivazione è avvenuta correttamente"
toast: "Metodo rimosso!"
alert:
title: "Disattiva carta"
message: "Vuoi davvero disattivare la tua Carta Giovani Nazionale? Se confermi, non potrai più accedere alle opportunità e la carta scomparirà dal Portafoglio."
title: "Vuoi rimuovere Carta Giovani dal Portafoglio?"
message: "La Carta verrà disattivata e non potrai più accedere alle opportunità disponibili."
expired: Elimina Carta Giovani Nazionale
otp:
error: "Per un problema tecnico non siamo riusciti a generare un codice sconto. Ti chiediamo di riprovare."
Expand Down
21 changes: 13 additions & 8 deletions ts/features/bonus/cgn/components/CgnServiceCTA.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useRef } from "react";
import { Alert } from "react-native";
import { Alert, Platform } from "react-native";
import { ButtonSolid, IOToast } from "@pagopa/io-app-design-system";
import { constNull } from "fp-ts/lib/function";
import * as pot from "@pagopa/ts-commons/lib/pot";
Expand Down Expand Up @@ -51,7 +51,7 @@ export const CgnServiceCta = ({ serviceId }: CgnServiceCtaProps) => {
IOToast.success(I18n.t("bonus.cgn.activation.deactivate.toast"));
dispatch(loadServicePreference.request(serviceId));
},
() => IOToast.error(I18n.t("global.genericError"))
() => IOToast.error(I18n.t("wallet.delete.failed"))
);
}
// eslint-disable-next-line functional/immutable-data
Expand All @@ -65,20 +65,25 @@ export const CgnServiceCta = ({ serviceId }: CgnServiceCtaProps) => {
I18n.t("bonus.cgn.activation.deactivate.alert.message"),
[
{
text: I18n.t("global.buttons.cancel"),
style: "cancel"
},
{
text: I18n.t("global.buttons.deactivate"),
text:
Platform.OS === "ios"
? I18n.t(`wallet.delete.ios.confirm`)
: I18n.t(`wallet.delete.android.confirm`),
style: "destructive",
onPress: () => {
analytics.trackSpecialServiceStatusChanged({
is_active: false,
service_id: serviceId
});
dispatch(cgnUnsubscribe.request());
}
},
{
text: I18n.t("global.buttons.cancel"),
style: "default"
}
]
],
{ cancelable: false }
),
[dispatch, serviceId]
);
Expand Down
19 changes: 12 additions & 7 deletions ts/features/bonus/cgn/hooks/useCgnUnsubscribe.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useRef } from "react";
import { Alert } from "react-native";
import { Alert, Platform } from "react-native";
import { IOToast } from "@pagopa/io-app-design-system";
import { useIODispatch, useIOSelector } from "../../../../store/hooks";
import { cgnUnsubscribeSelector } from "../store/reducers/unsubscribe";
Expand All @@ -20,14 +20,19 @@ export function useCgnUnsubscribe() {
I18n.t("bonus.cgn.activation.deactivate.alert.message"),
[
{
text: I18n.t("global.buttons.cancel"),
style: "cancel"
text:
Platform.OS === "ios"
? I18n.t(`wallet.delete.ios.confirm`)
: I18n.t(`wallet.delete.android.confirm`),
style: "destructive",
onPress: () => dispatch(cgnUnsubscribe.request())
},
{
text: I18n.t("global.buttons.deactivate"),
onPress: () => dispatch(cgnUnsubscribe.request())
text: I18n.t("global.buttons.cancel"),
style: "default"
}
]
],
{ cancelable: false }
);
};

Expand All @@ -37,7 +42,7 @@ export function useCgnUnsubscribe() {
IOToast.success(I18n.t("bonus.cgn.activation.deactivate.toast"));
}
if (isError(unsubscriptionStatus) && !isFirstRender.current) {
IOToast.error(I18n.t("global.genericError"));
IOToast.error(I18n.t("wallet.delete.failed"));
}

// eslint-disable-next-line functional/immutable-data
Expand Down

0 comments on commit ffabede

Please sign in to comment.