From 28bb25ea7c3a6553f876744cdbd8a163e951dcd7 Mon Sep 17 00:00:00 2001 From: fabriziofff Date: Fri, 5 Feb 2021 12:02:02 +0100 Subject: [PATCH] feat(Bonus Pagamenti Digitali): [#176738620] Choose card type before starting the co-badge onboarding workflow (#2766) * [#176738620] add choosetype screen * [#176738620] rename action * [#176738620] remove back from KO screens * [#176738620] add legacy support to navigation * [#176738620] add choosetype screen * [#176738620] rename action * [#176738620] remove back from KO screens * [#176738620] add legacy support to navigation * [#176738620] fix eslint * Update ts/features/wallet/component/NewMethodAddedNotifier.tsx Co-authored-by: Simone Co-authored-by: Matteo Boschi --- .../bancomat/screen/BancomatDetailScreen.tsx | 10 ++- .../component/NewMethodAddedNotifier.tsx | 6 +- .../onboarding/cobadge/navigation/action.ts | 9 ++ .../cobadge/navigation/navigator.ts | 4 + .../onboarding/cobadge/navigation/routes.ts | 2 + .../saga/orchestration/addCoBadgeToWallet.ts | 7 +- .../cobadge/screens/CoBadgeChooseType.tsx | 90 +++++++++++++++++++ .../onboarding/cobadge/screens/placeholder | 0 .../screens/search/ko/CoBadgeKoNotFound.tsx | 8 +- .../search/ko/CoBadgeKoServiceError.tsx | 8 +- .../search/ko/CoBadgeKoSingleBankNotFound.tsx | 9 +- .../screens/search/ko/CoBadgeKoTimeout.tsx | 7 +- .../start/ko/CoBadgeStartKoDisabled.tsx | 45 ++++++---- .../start/ko/CoBadgeStartKoUnavailable.tsx | 33 ++++--- .../onboarding/cobadge/store/actions/index.ts | 13 +-- .../cobadge/store/reducers/abiSelected.ts | 12 +-- .../cobadge/store/reducers/addedCoBadge.ts | 7 +- .../cobadge/store/reducers/addingCoBadge.ts | 7 +- .../store/reducers/searchCoBadgeRequestId.ts | 7 +- ts/sagas/wallet.ts | 7 +- 20 files changed, 206 insertions(+), 85 deletions(-) create mode 100644 ts/features/wallet/onboarding/cobadge/screens/CoBadgeChooseType.tsx delete mode 100644 ts/features/wallet/onboarding/cobadge/screens/placeholder diff --git a/ts/features/wallet/bancomat/screen/BancomatDetailScreen.tsx b/ts/features/wallet/bancomat/screen/BancomatDetailScreen.tsx index 7bcf5674a72..98ccaddb319 100644 --- a/ts/features/wallet/bancomat/screen/BancomatDetailScreen.tsx +++ b/ts/features/wallet/bancomat/screen/BancomatDetailScreen.tsx @@ -17,7 +17,7 @@ import { BancomatPaymentMethod } from "../../../../types/pagopa"; import { showToast } from "../../../../utils/showToast"; import PaymentMethodCapabilities from "../../component/PaymentMethodCapabilities"; import { useRemovePaymentMethodBottomSheet } from "../../component/RemovePaymentMethod"; -import { walletAddCoBadgeFromBancomatStart } from "../../onboarding/cobadge/store/actions"; +import { navigateToOnboardingCoBadgeChooseTypeStartScreen } from "../../onboarding/cobadge/navigation/action"; import BancomatCard from "../component/bancomatCard/BancomatCard"; import pagoBancomatImage from "../../../../../img/wallet/cards-icons/pagobancomat.png"; import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp"; @@ -131,7 +131,13 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ } }) ), - addCoBadge: (abi: string) => dispatch(walletAddCoBadgeFromBancomatStart(abi)) + addCoBadge: (abi: string) => + dispatch( + navigateToOnboardingCoBadgeChooseTypeStartScreen({ + abi, + legacyAddCreditCardBack: 1 + }) + ) }); const mapStateToProps = (_: GlobalState) => ({}); diff --git a/ts/features/wallet/component/NewMethodAddedNotifier.tsx b/ts/features/wallet/component/NewMethodAddedNotifier.tsx index 5cfba6b689e..c4b81d9f22a 100644 --- a/ts/features/wallet/component/NewMethodAddedNotifier.tsx +++ b/ts/features/wallet/component/NewMethodAddedNotifier.tsx @@ -11,7 +11,7 @@ import { import { useActionOnFocus } from "../../../utils/hooks/useOnFocus"; import BancomatInformation from "../bancomat/screen/BancomatInformation"; import { onboardingBancomatAddedPansSelector } from "../onboarding/bancomat/store/reducers/addedPans"; -import { walletAddCoBadgeFromBancomatStart } from "../onboarding/cobadge/store/actions"; +import { navigateToOnboardingCoBadgeChooseTypeStartScreen } from "../onboarding/cobadge/navigation/action"; type Props = ReturnType & ReturnType; @@ -67,7 +67,9 @@ const NewPaymentMethodAddedNotifier = (props: Props) => { const mapDispatchToProps = (dispatch: Dispatch) => ({ startCoBadgeOnboarding: () => - dispatch(walletAddCoBadgeFromBancomatStart(undefined)) + dispatch( + navigateToOnboardingCoBadgeChooseTypeStartScreen({}) + ) }); const mapStateToProps = (state: GlobalState) => ({ diff --git a/ts/features/wallet/onboarding/cobadge/navigation/action.ts b/ts/features/wallet/onboarding/cobadge/navigation/action.ts index 88eea45efa7..5c6b8940464 100644 --- a/ts/features/wallet/onboarding/cobadge/navigation/action.ts +++ b/ts/features/wallet/onboarding/cobadge/navigation/action.ts @@ -1,6 +1,15 @@ import { NavigationActions } from "react-navigation"; +import { CoBadgeChooseTypeNavigationProps } from "../screens/CoBadgeChooseType"; import WALLET_ONBOARDING_COBADGE_ROUTES from "./routes"; +export const navigateToOnboardingCoBadgeChooseTypeStartScreen = ( + navigationParams: CoBadgeChooseTypeNavigationProps +) => + NavigationActions.navigate({ + routeName: WALLET_ONBOARDING_COBADGE_ROUTES.CHOOSE_TYPE, + params: navigationParams + }); + export const navigateToOnboardingCoBadgeSearchStartScreen = () => NavigationActions.navigate({ routeName: WALLET_ONBOARDING_COBADGE_ROUTES.START diff --git a/ts/features/wallet/onboarding/cobadge/navigation/navigator.ts b/ts/features/wallet/onboarding/cobadge/navigation/navigator.ts index 3d5a1945a0f..834d0833480 100644 --- a/ts/features/wallet/onboarding/cobadge/navigation/navigator.ts +++ b/ts/features/wallet/onboarding/cobadge/navigation/navigator.ts @@ -1,12 +1,16 @@ import { createStackNavigator } from "react-navigation"; import ActivateBpdOnNewCoBadgeScreen from "../screens/ActivateBpdOnNewCoBadgeScreen"; import AddCoBadgeScreen from "../screens/add-account/AddCoBadgeScreen"; +import CoBadgeChooseType from "../screens/CoBadgeChooseType"; import SearchAvailableCoBadgeScreen from "../screens/search/SearchAvailableCoBadgeScreen"; import CoBadgeStartScreen from "../screens/start/CoBadgeStartScreen"; import WALLET_ONBOARDING_COBADGE_ROUTES from "./routes"; const PaymentMethodOnboardingCoBadgeNavigator = createStackNavigator( { + [WALLET_ONBOARDING_COBADGE_ROUTES.CHOOSE_TYPE]: { + screen: CoBadgeChooseType + }, [WALLET_ONBOARDING_COBADGE_ROUTES.START]: { screen: CoBadgeStartScreen }, diff --git a/ts/features/wallet/onboarding/cobadge/navigation/routes.ts b/ts/features/wallet/onboarding/cobadge/navigation/routes.ts index ba3b7beda11..d4b348033f2 100644 --- a/ts/features/wallet/onboarding/cobadge/navigation/routes.ts +++ b/ts/features/wallet/onboarding/cobadge/navigation/routes.ts @@ -1,6 +1,8 @@ const WALLET_ONBOARDING_COBADGE_ROUTES = { MAIN: "WALLET_ONBOARDING_COBADGE_MAIN", + CHOOSE_TYPE: "WALLET_ONBOARDING_COBADGE_CHOOSE_TYPE", + START: "WALLET_ONBOARDING_COBADGE_START", SEARCH_AVAILABLE: "WALLET_ONBOARDING_COBADGE_SEARCH_AVAILABLE", diff --git a/ts/features/wallet/onboarding/cobadge/saga/orchestration/addCoBadgeToWallet.ts b/ts/features/wallet/onboarding/cobadge/saga/orchestration/addCoBadgeToWallet.ts index 9f48db003f5..4198d498086 100644 --- a/ts/features/wallet/onboarding/cobadge/saga/orchestration/addCoBadgeToWallet.ts +++ b/ts/features/wallet/onboarding/cobadge/saga/orchestration/addCoBadgeToWallet.ts @@ -61,7 +61,7 @@ export function* addCoBadgeToWalletAndActivateBpd() { coBadgeWorkUnit ); if (res !== "back") { - // If the addition starts from "WALLET_ADD_DIGITAL_PAYMENT_METHOD", remove from stack + // If the addition starts from "WALLET_ONBOARDING_COBADGE_CHOOSE_TYPE", remove from stack // This shouldn't happens if all the workflow will use the executeWorkUnit const currentRoute: ReturnType = yield select( navigationCurrentRouteSelector @@ -69,9 +69,12 @@ export function* addCoBadgeToWalletAndActivateBpd() { if ( currentRoute.isSome() && - currentRoute.value === "WALLET_BANCOMAT_DETAIL" + currentRoute.value === "WALLET_ONBOARDING_COBADGE_CHOOSE_TYPE" ) { yield put(NavigationActions.back()); + if (res === "completed") { + yield put(NavigationActions.back()); + } } } diff --git a/ts/features/wallet/onboarding/cobadge/screens/CoBadgeChooseType.tsx b/ts/features/wallet/onboarding/cobadge/screens/CoBadgeChooseType.tsx new file mode 100644 index 00000000000..ea9cbd0dffe --- /dev/null +++ b/ts/features/wallet/onboarding/cobadge/screens/CoBadgeChooseType.tsx @@ -0,0 +1,90 @@ +import { none } from "fp-ts/lib/Option"; +import { Button, Content, View } from "native-base"; +import * as React from "react"; +import { SafeAreaView } from "react-native"; +import { NavigationActions, NavigationInjectedProps } from "react-navigation"; +import { connect } from "react-redux"; +import { Dispatch } from "redux"; +import { H1 } from "../../../../../components/core/typography/H1"; +import { IOStyles } from "../../../../../components/core/variables/IOStyles"; +import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent"; +import FooterWithButtons from "../../../../../components/ui/FooterWithButtons"; +import I18n from "../../../../../i18n"; +import { navigateToWalletAddCreditCard } from "../../../../../store/actions/navigation"; +import { GlobalState } from "../../../../../store/reducers/types"; +import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; +import { cancelButtonProps } from "../../../../bonus/bonusVacanze/components/buttons/ButtonConfigurations"; +import { walletAddCoBadgeStart } from "../store/actions"; + +type Props = ReturnType & + ReturnType & + NavigationInjectedProps; + +export type CoBadgeChooseTypeNavigationProps = { + abi?: string; + // Added for backward compatibility, in order to return back after add credit card workflow. + // Number of screens that need to be removed from the stack + legacyAddCreditCardBack?: number; +}; + +/** + * This screen allows the user to choose the exact type of card he intends to add + * @param props + * @constructor + */ +const CoBadgeChooseType = (props: Props): React.ReactElement => { + const abi = props.navigation.getParam("abi"); + const legacyAddCreditCardBack = props.navigation.getParam( + "legacyAddCreditCardBack" + ); + return ( + + + +

TMP CoBadgeChooseType

+ + + +
+ +
+
+ ); +}; + +const navigateBack = (n: number, dispatch: Dispatch) => { + if (n <= 0) { + return; + } + dispatch(NavigationActions.back()); + navigateBack(n - 1, dispatch); +}; + +const mapDispatchToProps = (dispatch: Dispatch) => ({ + back: () => dispatch(NavigationActions.back()), + addCoBadge: (abi: string | undefined) => dispatch(walletAddCoBadgeStart(abi)), + addCreditCard: (popScreenNumber: number = 0) => { + navigateBack(popScreenNumber, dispatch); + + dispatch( + navigateToWalletAddCreditCard({ + inPayment: none + }) + ); + } +}); + +const mapStateToProps = (_: GlobalState) => ({}); + +export default connect(mapStateToProps, mapDispatchToProps)(CoBadgeChooseType); diff --git a/ts/features/wallet/onboarding/cobadge/screens/placeholder b/ts/features/wallet/onboarding/cobadge/screens/placeholder deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoNotFound.tsx b/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoNotFound.tsx index 5a32377f8d5..fac6bd5fd1f 100644 --- a/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoNotFound.tsx +++ b/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoNotFound.tsx @@ -8,8 +8,10 @@ import { renderInfoRasterImage } from "../../../../../../../components/infoScree import { InfoScreenComponent } from "../../../../../../../components/infoScreen/InfoScreenComponent"; import BaseScreenComponent from "../../../../../../../components/screens/BaseScreenComponent"; import FooterWithButtons from "../../../../../../../components/ui/FooterWithButtons"; +import View from "../../../../../../../components/ui/TextWithIcon"; import { GlobalState } from "../../../../../../../store/reducers/types"; import { cancelButtonProps } from "../../../../../../bonus/bonusVacanze/components/buttons/ButtonConfigurations"; +import { useHardwareBackButton } from "../../../../../../bonus/bonusVacanze/components/hooks/useHardwareBackButton"; import { walletAddCoBadgeCancel } from "../../../store/actions"; export type Props = ReturnType & @@ -29,10 +31,12 @@ const loadLocales = () => ({ */ const CoBadgeKoNotFound = (props: Props): React.ReactElement => { const { headerTitle, title, body } = loadLocales(); - + // disable hardware back + useHardwareBackButton(() => true); return ( } headerTitle={headerTitle} contextualHelp={props.contextualHelp} > diff --git a/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoServiceError.tsx b/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoServiceError.tsx index 385002d822b..aa28ee67b09 100644 --- a/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoServiceError.tsx +++ b/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoServiceError.tsx @@ -8,8 +8,10 @@ import { InfoScreenComponent } from "../../../../../../../components/infoScreen/ import BaseScreenComponent from "../../../../../../../components/screens/BaseScreenComponent"; import FooterWithButtons from "../../../../../../../components/ui/FooterWithButtons"; import image from "../../../../../../../../img/servicesStatus/error-detail-icon.png"; +import View from "../../../../../../../components/ui/TextWithIcon"; import { GlobalState } from "../../../../../../../store/reducers/types"; import { cancelButtonProps } from "../../../../../../bonus/bonusVacanze/components/buttons/ButtonConfigurations"; +import { useHardwareBackButton } from "../../../../../../bonus/bonusVacanze/components/hooks/useHardwareBackButton"; import { walletAddCoBadgeCancel } from "../../../store/actions"; export type Props = ReturnType & @@ -30,10 +32,12 @@ const loadLocales = () => ({ */ const CoBadgeKoServiceError: React.FunctionComponent = props => { const { headerTitle, title, body } = loadLocales(); - + // disable hardware back + useHardwareBackButton(() => true); return ( } headerTitle={headerTitle} contextualHelp={props.contextualHelp} > diff --git a/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoSingleBankNotFound.tsx b/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoSingleBankNotFound.tsx index c4276acc961..3147e2569c7 100644 --- a/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoSingleBankNotFound.tsx +++ b/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoSingleBankNotFound.tsx @@ -8,6 +8,7 @@ import { renderInfoRasterImage } from "../../../../../../../components/infoScree import { InfoScreenComponent } from "../../../../../../../components/infoScreen/InfoScreenComponent"; import BaseScreenComponent from "../../../../../../../components/screens/BaseScreenComponent"; import FooterWithButtons from "../../../../../../../components/ui/FooterWithButtons"; +import View from "../../../../../../../components/ui/TextWithIcon"; import I18n from "../../../../../../../i18n"; import image from "../../../../../../../../img/servicesStatus/error-detail-icon.png"; @@ -16,6 +17,7 @@ import { cancelButtonProps, confirmButtonProps } from "../../../../../../bonus/bonusVacanze/components/buttons/ButtonConfigurations"; +import { useHardwareBackButton } from "../../../../../../bonus/bonusVacanze/components/hooks/useHardwareBackButton"; import { searchUserCoBadge, walletAddCoBadgeCancel @@ -42,9 +44,14 @@ const CoBadgeKoSingleBankNotFound: React.FunctionComponent = props => { const { headerTitle, title, body, searchAll } = loadLocales(); const onSearchAll = () => props.searchAll(); + + // disable hardware back + useHardwareBackButton(() => true); + return ( } headerTitle={headerTitle} contextualHelp={props.contextualHelp} > diff --git a/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoTimeout.tsx b/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoTimeout.tsx index df56de0ddd0..5e7ee7ce975 100644 --- a/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoTimeout.tsx +++ b/ts/features/wallet/onboarding/cobadge/screens/search/ko/CoBadgeKoTimeout.tsx @@ -7,8 +7,10 @@ import { IOStyles } from "../../../../../../../components/core/variables/IOStyle import { renderInfoRasterImage } from "../../../../../../../components/infoScreen/imageRendering"; import { InfoScreenComponent } from "../../../../../../../components/infoScreen/InfoScreenComponent"; import BaseScreenComponent from "../../../../../../../components/screens/BaseScreenComponent"; +import View from "../../../../../../../components/ui/TextWithIcon"; import I18n from "../../../../../../../i18n"; import { GlobalState } from "../../../../../../../store/reducers/types"; +import { useHardwareBackButton } from "../../../../../../bonus/bonusVacanze/components/hooks/useHardwareBackButton"; import { FooterTwoButtons } from "../../../../../../bonus/bonusVacanze/components/markdown/FooterTwoButtons"; import { searchUserCoBadge, @@ -35,9 +37,12 @@ const loadLocales = () => ({ */ const CoBadgeKoTimeout = (props: Props): React.ReactElement => { const { headerTitle, title, body, cancel, retry } = loadLocales(); + // disable hardware back + useHardwareBackButton(() => true); return ( } headerTitle={headerTitle} contextualHelp={props.contextualHelp} > diff --git a/ts/features/wallet/onboarding/cobadge/screens/start/ko/CoBadgeStartKoDisabled.tsx b/ts/features/wallet/onboarding/cobadge/screens/start/ko/CoBadgeStartKoDisabled.tsx index 428b6b50338..b23f00f4826 100644 --- a/ts/features/wallet/onboarding/cobadge/screens/start/ko/CoBadgeStartKoDisabled.tsx +++ b/ts/features/wallet/onboarding/cobadge/screens/start/ko/CoBadgeStartKoDisabled.tsx @@ -1,4 +1,4 @@ -import { Content } from "native-base"; +import { Button, Content } from "native-base"; import * as React from "react"; import { SafeAreaView } from "react-native"; import { connect } from "react-redux"; @@ -6,33 +6,46 @@ import { Dispatch } from "redux"; import { H1 } from "../../../../../../../components/core/typography/H1"; import { IOStyles } from "../../../../../../../components/core/variables/IOStyles"; import BaseScreenComponent from "../../../../../../../components/screens/BaseScreenComponent"; +import View from "../../../../../../../components/ui/TextWithIcon"; import I18n from "../../../../../../../i18n"; import { GlobalState } from "../../../../../../../store/reducers/types"; import { emptyContextualHelp } from "../../../../../../../utils/emptyContextualHelp"; +import { useHardwareBackButton } from "../../../../../../bonus/bonusVacanze/components/hooks/useHardwareBackButton"; +import { walletAddCoBadgeCancel } from "../../../store/actions"; type Props = ReturnType & ReturnType; /** * The co-badge workflow is not yet available for the selected bank - * @param _ * @constructor + * @param props */ -const CoBadgeStartKoDisabled = (_: Props): React.ReactElement => ( - - - -

CoBadgeStartKoDisabled

-
-
-
-); +const CoBadgeStartKoDisabled = (props: Props): React.ReactElement => { + // disable hardware back + useHardwareBackButton(() => true); + return ( + } + headerTitle={I18n.t("wallet.onboarding.coBadge.headerTitle")} + contextualHelp={emptyContextualHelp} + > + + +

TMP CoBadgeStartKoDisabled

+ +
+
+
+ ); +}; -const mapDispatchToProps = (_: Dispatch) => ({}); +const mapDispatchToProps = (dispatch: Dispatch) => ({ + cancel: () => dispatch(walletAddCoBadgeCancel()) +}); const mapStateToProps = (_: GlobalState) => ({}); diff --git a/ts/features/wallet/onboarding/cobadge/screens/start/ko/CoBadgeStartKoUnavailable.tsx b/ts/features/wallet/onboarding/cobadge/screens/start/ko/CoBadgeStartKoUnavailable.tsx index ce932412b54..dfdbf170606 100644 --- a/ts/features/wallet/onboarding/cobadge/screens/start/ko/CoBadgeStartKoUnavailable.tsx +++ b/ts/features/wallet/onboarding/cobadge/screens/start/ko/CoBadgeStartKoUnavailable.tsx @@ -6,9 +6,11 @@ import { Dispatch } from "redux"; import { H1 } from "../../../../../../../components/core/typography/H1"; import { IOStyles } from "../../../../../../../components/core/variables/IOStyles"; import BaseScreenComponent from "../../../../../../../components/screens/BaseScreenComponent"; +import View from "../../../../../../../components/ui/TextWithIcon"; import I18n from "../../../../../../../i18n"; import { GlobalState } from "../../../../../../../store/reducers/types"; import { emptyContextualHelp } from "../../../../../../../utils/emptyContextualHelp"; +import { useHardwareBackButton } from "../../../../../../bonus/bonusVacanze/components/hooks/useHardwareBackButton"; type Props = ReturnType & ReturnType; @@ -18,19 +20,24 @@ type Props = ReturnType & * @param _ * @constructor */ -const CoBadgeStartKoUnavailable = (_: Props): React.ReactElement => ( - - - -

CoBadgeStartKoUnavailable

-
-
-
-); +const CoBadgeStartKoUnavailable = (_: Props): React.ReactElement => { + // disable hardware back + useHardwareBackButton(() => true); + return ( + } + headerTitle={I18n.t("wallet.onboarding.coBadge.headerTitle")} + contextualHelp={emptyContextualHelp} + > + + +

CoBadgeStartKoUnavailable

+
+
+
+ ); +}; const mapDispatchToProps = (_: Dispatch) => ({}); diff --git a/ts/features/wallet/onboarding/cobadge/store/actions/index.ts b/ts/features/wallet/onboarding/cobadge/store/actions/index.ts index 5255c246394..76e008174ab 100644 --- a/ts/features/wallet/onboarding/cobadge/store/actions/index.ts +++ b/ts/features/wallet/onboarding/cobadge/store/actions/index.ts @@ -3,11 +3,11 @@ import { createAsyncAction, createStandardAction } from "typesafe-actions"; +import { CoBadgeServices } from "../../../../../../../definitions/pagopa/cobadge/configuration/CoBadgeServices"; +import { CobadgeResponse } from "../../../../../../../definitions/pagopa/walletv2/CobadgeResponse"; import { PaymentInstrument } from "../../../../../../../definitions/pagopa/walletv2/PaymentInstrument"; import { RawCreditCardPaymentMethod } from "../../../../../../types/pagopa"; import { NetworkError } from "../../../../../../utils/errors"; -import { CoBadgeServices } from "../../../../../../../definitions/pagopa/cobadge/configuration/CoBadgeServices"; -import { CobadgeResponse } from "../../../../../../../definitions/pagopa/walletv2/CobadgeResponse"; /** * Search for user's cobadge cards @@ -41,14 +41,6 @@ export const loadCoBadgeAbiConfiguration = createAsyncAction( */ export const walletAddCoBadgeStart = createStandardAction( "WALLET_ONBOARDING_COBADGE_START" -)(); - -/** - * The user chooses to start the workflow to add a new cobadge from a bancomat (have a special handling) - * TODO: Remove - */ -export const walletAddCoBadgeFromBancomatStart = createStandardAction( - "WALLET_ONBOARDING_COBADGE_START_FROM_BANCOMAT" )(); /** @@ -78,7 +70,6 @@ export type CoBadgeActions = | ActionType | ActionType | ActionType - | ActionType | ActionType | ActionType | ActionType; diff --git a/ts/features/wallet/onboarding/cobadge/store/reducers/abiSelected.ts b/ts/features/wallet/onboarding/cobadge/store/reducers/abiSelected.ts index 23dd53af23f..0228b38297a 100644 --- a/ts/features/wallet/onboarding/cobadge/store/reducers/abiSelected.ts +++ b/ts/features/wallet/onboarding/cobadge/store/reducers/abiSelected.ts @@ -1,11 +1,7 @@ import { getType } from "typesafe-actions"; import { Action } from "../../../../../../store/actions/types"; import { GlobalState } from "../../../../../../store/reducers/types"; -import { - searchUserCoBadge, - walletAddCoBadgeFromBancomatStart, - walletAddCoBadgeStart -} from "../actions"; +import { searchUserCoBadge, walletAddCoBadgeStart } from "../actions"; export type AbiSelected = string | null; @@ -15,12 +11,8 @@ const abiSelectedReducer = ( ): AbiSelected => { switch (action.type) { case getType(searchUserCoBadge.request): - return action.payload ?? null; - case getType(walletAddCoBadgeFromBancomatStart): - return action.payload ?? null; - // reset at the start case getType(walletAddCoBadgeStart): - return null; + return action.payload ?? null; } return state; }; diff --git a/ts/features/wallet/onboarding/cobadge/store/reducers/addedCoBadge.ts b/ts/features/wallet/onboarding/cobadge/store/reducers/addedCoBadge.ts index a5785256e22..22c4fea155d 100644 --- a/ts/features/wallet/onboarding/cobadge/store/reducers/addedCoBadge.ts +++ b/ts/features/wallet/onboarding/cobadge/store/reducers/addedCoBadge.ts @@ -8,11 +8,7 @@ import { import { enhanceCreditCard } from "../../../../../../utils/paymentMethod"; import { getValueOrElse } from "../../../../../bonus/bpd/model/RemoteValue"; import { abiSelector } from "../../../store/abi"; -import { - addCoBadgeToWallet, - walletAddCoBadgeFromBancomatStart, - walletAddCoBadgeStart -} from "../actions"; +import { addCoBadgeToWallet, walletAddCoBadgeStart } from "../actions"; const addedCoBadgeReducer = ( state: ReadonlyArray = [], @@ -24,7 +20,6 @@ const addedCoBadgeReducer = ( return [...state, action.payload]; // Reset the state when starting a new Cobadge onboarding workflow case getType(walletAddCoBadgeStart): - case getType(walletAddCoBadgeFromBancomatStart): return []; } return state; diff --git a/ts/features/wallet/onboarding/cobadge/store/reducers/addingCoBadge.ts b/ts/features/wallet/onboarding/cobadge/store/reducers/addingCoBadge.ts index b0039ea1b23..70258355bc1 100644 --- a/ts/features/wallet/onboarding/cobadge/store/reducers/addingCoBadge.ts +++ b/ts/features/wallet/onboarding/cobadge/store/reducers/addingCoBadge.ts @@ -11,11 +11,7 @@ import { remoteUndefined, RemoteValue } from "../../../../../bonus/bpd/model/RemoteValue"; -import { - addCoBadgeToWallet, - walletAddCoBadgeFromBancomatStart, - walletAddCoBadgeStart -} from "../actions"; +import { addCoBadgeToWallet, walletAddCoBadgeStart } from "../actions"; export type AddingCoBadgeState = { addingResult: RemoteValue; @@ -47,7 +43,6 @@ const addingCoBadgeReducer = ( addingResult: remoteError(action.payload) }; case getType(walletAddCoBadgeStart): - case getType(walletAddCoBadgeFromBancomatStart): return initialState; } return state; diff --git a/ts/features/wallet/onboarding/cobadge/store/reducers/searchCoBadgeRequestId.ts b/ts/features/wallet/onboarding/cobadge/store/reducers/searchCoBadgeRequestId.ts index 6bec599c4d0..72b227b0e30 100644 --- a/ts/features/wallet/onboarding/cobadge/store/reducers/searchCoBadgeRequestId.ts +++ b/ts/features/wallet/onboarding/cobadge/store/reducers/searchCoBadgeRequestId.ts @@ -1,11 +1,7 @@ import { getType } from "typesafe-actions"; import { fromNullable } from "fp-ts/lib/Option"; import { Action } from "../../../../../../store/actions/types"; -import { - searchUserCoBadge, - walletAddCoBadgeFromBancomatStart, - walletAddCoBadgeStart -} from "../actions"; +import { searchUserCoBadge, walletAddCoBadgeStart } from "../actions"; import { GlobalState } from "../../../../../../store/reducers/types"; import { CobadgeResponse } from "../../../../../../../definitions/pagopa/walletv2/CobadgeResponse"; import { ExecutionStatusEnum } from "../../../../../../../definitions/pagopa/walletv2/SearchRequestMetadata"; @@ -34,7 +30,6 @@ const reducer = ( : null; // reset at the start case getType(walletAddCoBadgeStart): - case getType(walletAddCoBadgeFromBancomatStart): return null; } return state; diff --git a/ts/sagas/wallet.ts b/ts/sagas/wallet.ts index a28091fa649..2cc48b53ad1 100644 --- a/ts/sagas/wallet.ts +++ b/ts/sagas/wallet.ts @@ -70,7 +70,7 @@ import { addCoBadgeToWallet, loadCoBadgeAbiConfiguration, searchUserCoBadge, - walletAddCoBadgeFromBancomatStart + walletAddCoBadgeStart } from "../features/wallet/onboarding/cobadge/store/actions"; import { handleAddUserSatispayToWallet, @@ -947,10 +947,7 @@ export function* watchWalletSaga( ); // watch for add co-badge to Wallet workflow - yield takeLatest( - walletAddCoBadgeFromBancomatStart, - addCoBadgeToWalletAndActivateBpd - ); + yield takeLatest(walletAddCoBadgeStart, addCoBadgeToWalletAndActivateBpd); } yield fork(paymentsDeleteUncompletedSaga);