From 76b3c2b5ba98a53afc5ffee009f6b8ea8563c5d0 Mon Sep 17 00:00:00 2001 From: forrest57 Date: Wed, 31 Jan 2024 15:30:05 +0100 Subject: [PATCH 1/3] removed SiciliaVola folder and references --- locales/de/index.yml | 11 - locales/en/index.yml | 435 ------------------ locales/it/index.yml | 435 ------------------ .../bonus/common/store/actions/index.ts | 7 +- .../bonus/common/store/reducers/index.ts | 3 - .../bonus/siciliaVola/analytics/placeholder | 0 .../siciliaVola/api/backendSiciliaVola.ts | 234 ---------- .../components/AcceptTosComponent.tsx | 86 ---- .../components/CheckIncomeComponent.tsx | 113 ----- .../components/CheckResidenceComponent.tsx | 91 ---- .../components/DestinationSelector.tsx | 141 ------ .../components/SvVoucherListFilters.tsx | 232 ---------- .../components/VoucherDetailBottomsheet.tsx | 26 -- .../VoucherInformationComponent.tsx | 92 ---- .../WrappedMunicipalityFlatList.tsx | 106 ----- .../CheckResidenceComponent.test.tsx | 69 --- ts/features/bonus/siciliaVola/saga/index.ts | 156 ------- .../networking/handleGetAeroportAmmessi.ts | 73 --- .../networking/handleGetDettaglioVoucher.ts | 42 -- .../handleGetListaComuniBySiglaProvincia.ts | 72 --- .../saga/networking/handleGetStampaVoucher.ts | 75 --- .../saga/networking/handleGetStatiUE.ts | 67 --- .../handleGetVoucherBeneficiario.ts | 89 ---- .../saga/networking/handleGetVoucherStati.ts | 55 --- .../networking/handlePostAggiungiVoucher.ts | 48 -- .../saga/networking/handleSvAcceptTos.ts | 16 - .../saga/networking/handleSvServiceAlive.ts | 16 - .../saga/networking/handleSvTosAccepted.ts | 16 - .../networking/handleVoucherRevocation.ts | 53 --- .../saga/orchestration/voucherGeneration.ts | 55 --- .../bonus/siciliaVola/saga/placeholder | 0 .../CheckStatusRouterScreen.tsx | 115 ----- .../DisabledAdditionalInfoScreen.tsx | 102 ---- .../SelectBeneficiaryCategoryScreen.tsx | 137 ------ .../SelectFlightsDateScreen.tsx | 151 ------ .../SickCheckIncomeScreen.tsx | 40 -- .../SickSelectDestinationScreen.tsx | 91 ---- .../StudentSelectDestinationScreen.tsx | 93 ---- .../voucherGeneration/SummaryScreen.tsx | 245 ---------- .../VoucherGeneratedScreen.tsx | 170 ------- .../WorkerCheckIncomeScreen.tsx | 34 -- .../WorkerSelectDestinationScreen.tsx | 93 ---- .../ko/SvCheckIncomeKoScreen.tsx | 43 -- .../ko/SvCheckResidenceKoScreen.tsx | 43 -- .../ko/SvGeneratedVoucherTimeoutScreen.tsx | 42 -- .../SvSelectBeneficiaryCategoryKoScreen.tsx | 47 -- .../voucherList/VoucherDetailsScreen.tsx | 327 ------------- .../screens/voucherList/VoucherListScreen.tsx | 268 ----------- .../siciliaVola/store/actions/activation.ts | 34 -- .../bonus/siciliaVola/store/actions/index.ts | 8 - .../store/actions/voucherGeneration.ts | 173 ------- .../siciliaVola/store/actions/voucherList.ts | 66 --- .../__test__/availableDestinations.test.ts | 69 --- .../__test__/availableMunicipalities.test.ts | 73 --- .../reducers/__test__/availableStates.test.ts | 69 --- .../__test__/voucherGenerated.test.ts | 80 ---- .../reducers/__test__/voucherRequest.test.ts | 229 --------- .../store/reducers/__test__/vouchers.test.ts | 80 ---- .../siciliaVola/store/reducers/activation.ts | 85 ---- .../bonus/siciliaVola/store/reducers/index.ts | 27 -- .../store/reducers/selectedVoucher.ts | 97 ---- .../availableDestinations.ts | 52 --- .../availableMunicipalities.ts | 60 --- .../voucherGeneration/availableStates.ts | 51 -- .../voucherGeneration/voucherGenerated.ts | 48 -- .../voucherGeneration/voucherGeneration.ts | 37 -- .../voucherGeneration/voucherRequest.ts | 171 ------- .../store/reducers/voucherList/filters.ts | 40 -- .../voucherList/possibleVoucherState.ts | 46 -- .../store/reducers/voucherList/ui.ts | 69 --- .../store/reducers/voucherList/voucherList.ts | 24 - .../store/reducers/voucherList/vouchers.ts | 51 -- .../bonus/siciliaVola/types/SvVoucher.ts | 26 -- .../siciliaVola/types/SvVoucherRequest.ts | 89 ---- .../siciliaVola/types/SvVoucherResponse.ts | 31 -- ts/features/bonus/siciliaVola/utils.ts | 109 ----- ts/store/reducers/backoffErrorConfig.ts | 10 +- 77 files changed, 2 insertions(+), 6957 deletions(-) delete mode 100644 ts/features/bonus/siciliaVola/analytics/placeholder delete mode 100644 ts/features/bonus/siciliaVola/api/backendSiciliaVola.ts delete mode 100644 ts/features/bonus/siciliaVola/components/AcceptTosComponent.tsx delete mode 100644 ts/features/bonus/siciliaVola/components/CheckIncomeComponent.tsx delete mode 100644 ts/features/bonus/siciliaVola/components/CheckResidenceComponent.tsx delete mode 100644 ts/features/bonus/siciliaVola/components/DestinationSelector.tsx delete mode 100644 ts/features/bonus/siciliaVola/components/SvVoucherListFilters.tsx delete mode 100644 ts/features/bonus/siciliaVola/components/VoucherDetailBottomsheet.tsx delete mode 100644 ts/features/bonus/siciliaVola/components/VoucherInformationComponent.tsx delete mode 100644 ts/features/bonus/siciliaVola/components/WrappedMunicipalityFlatList.tsx delete mode 100644 ts/features/bonus/siciliaVola/components/__tests__/CheckResidenceComponent.test.tsx delete mode 100644 ts/features/bonus/siciliaVola/saga/index.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleGetAeroportAmmessi.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleGetDettaglioVoucher.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleGetListaComuniBySiglaProvincia.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleGetStampaVoucher.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleGetStatiUE.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleGetVoucherBeneficiario.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleGetVoucherStati.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handlePostAggiungiVoucher.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleSvAcceptTos.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleSvServiceAlive.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleSvTosAccepted.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/networking/handleVoucherRevocation.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/orchestration/voucherGeneration.ts delete mode 100644 ts/features/bonus/siciliaVola/saga/placeholder delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/CheckStatusRouterScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/DisabledAdditionalInfoScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/SelectBeneficiaryCategoryScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/SelectFlightsDateScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/SickCheckIncomeScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/SickSelectDestinationScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/StudentSelectDestinationScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/SummaryScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/VoucherGeneratedScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/WorkerCheckIncomeScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/WorkerSelectDestinationScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvCheckIncomeKoScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvCheckResidenceKoScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvGeneratedVoucherTimeoutScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvSelectBeneficiaryCategoryKoScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherList/VoucherDetailsScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/screens/voucherList/VoucherListScreen.tsx delete mode 100644 ts/features/bonus/siciliaVola/store/actions/activation.ts delete mode 100644 ts/features/bonus/siciliaVola/store/actions/index.ts delete mode 100644 ts/features/bonus/siciliaVola/store/actions/voucherGeneration.ts delete mode 100644 ts/features/bonus/siciliaVola/store/actions/voucherList.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/__test__/availableDestinations.test.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/__test__/availableMunicipalities.test.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/__test__/availableStates.test.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/__test__/voucherGenerated.test.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/__test__/voucherRequest.test.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/__test__/vouchers.test.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/activation.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/index.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/selectedVoucher.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableDestinations.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableMunicipalities.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableStates.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherGenerated.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherGeneration.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherRequest.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherList/filters.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherList/possibleVoucherState.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherList/ui.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherList/voucherList.ts delete mode 100644 ts/features/bonus/siciliaVola/store/reducers/voucherList/vouchers.ts delete mode 100644 ts/features/bonus/siciliaVola/types/SvVoucher.ts delete mode 100644 ts/features/bonus/siciliaVola/types/SvVoucherRequest.ts delete mode 100644 ts/features/bonus/siciliaVola/types/SvVoucherResponse.ts delete mode 100644 ts/features/bonus/siciliaVola/utils.ts diff --git a/locales/de/index.yml b/locales/de/index.yml index 7002712991e..15ec89626fc 100644 --- a/locales/de/index.yml +++ b/locales/de/index.yml @@ -691,7 +691,6 @@ authentication: error_1001: "Zugang verweigert: Du hast nicht das Mindestalter für die Nutzung von IO" expiredSessionBanner: title: "Sicherheitshinweis" - message: "Um deine privaten Daten zu schützen, melde dich bitte erneut mit deinen SPID-Anmeldedaten an, danke!" unlock: title: "Zugang entsperren" subtitlel2: "Um die App nutzen zu können, müsst du zunächst den Zugang zu IO entsperren." @@ -2436,16 +2435,6 @@ fastLogin: whatsNew: title: "Wir haben den Zugang zu IO verbessert!" subtitle: "Du musst dich jetzt nur noch einmal im Jahr mit deinem SPID oder deiner CIE authentifizieren. Danach brauchst du dich nur noch mit deinem Entsperrcode oder biometrischen Merkmalen anmelden." - changes: - first: - title: "Einfacher" - description: "Zugang nur durch Eingabe des Entsperrcodes der App oder mit biometrischen Merkmalen." - second: - title: "Schneller" - description: "Wir werden dich nur einmal im Jahr oder wenn du dich aus der App ausloggst auffordern, dich mit SPID oder CIE zu authentifizieren." - third: - title: "Sicherer" - description: "Jedes Mal, wenn du dich erneut mit SPID oder CIE anmeldest, senden wir dir eine E-Mail." whatsNew: title: "Was ändert sich?" bonusCard: diff --git a/locales/en/index.yml b/locales/en/index.yml index f53eb1064e6..53fea7df488 100644 --- a/locales/en/index.yml +++ b/locales/en/index.yml @@ -728,7 +728,6 @@ authentication: error_1001: "Access Denied: You are not of the minimum age required to use IO" expiredSessionBanner: title: Security notice - message: To keep your private information safe, please login again with your SPID credentials, thanks! unlock: title: Unlock access subtitlel2: In order to use the app, you must first unlock access to IO. @@ -2358,8 +2357,6 @@ bonus: caption: "concluded" description: "This initiative has ended and can no longer be requested" bonusVacanze: - accessibility: - card: Your Bonus Vacanze with code {{code}} worth up to {{value}} euro is {{status}} multipleBonus: Two or more bonuses requested and activated by you. Make sure you use the correct DSU to prevent the bonus user from incurring subsequent recovery actions. usableAmount: Expendable at the accommodation facility taxBenefit: Deductible in tax return @@ -2414,265 +2411,11 @@ bonus: title: Information on the processing of personal data content: !include bonus/bonusVacanze/bonus_tos.md bpd: - accessibility: - card: - preview: "Cashback, period from {{startDate}} to {{endDate}}. Earned amount € {{amount}}" title: Cashback name: Cashback description: "Get a refund on in-store purchases when paying with this method" cta: activeBonus: Request cashback - unsubscribe: - cta: "Quit cashback" - title: "Cashback opt-out" - body1: "Are you sure you want to quit Cashback?" - body2: "By continuing you will no longer be able to collect transactions or compete for the Super Cashback, and **you will not be able to collect any refund**, if you had the right to claim one. This opt-out will affect **also the other channels** you used to activate it (e.g.: Home Banking, app, etc.) nIf you activate Cashback again later **you will restart from zero transactions**." - confirmCta: "Quit" - loading: "We are processing your request" - success: "Cashback has been removed" - failure: "We were unable to remove, please try again" - earned: Total Collected - onboarding: - alert: - title: Cashback is already active - body: You can find more details in your Wallet. - cancel: Close - confirm: Go back - loadingActivationStatus: - title: Loading activation status - declaration: - header: In order to activate the cashback you must declare - cta: "I declare" - conditions: - age: to be of legal age - resident: to reside in Italy - owner: - normal: "to activate for Cashback " - bold: "only payment methods of which you are the owner" - personal_use: - normal: "that you will use the payment instruments on which the cashback is active only for purchases made for personal purposes, " - bold: "made outside the exercise of business, art or profession" - disclaimer: - normal1: "This self-declaration is made pursuant to " - link: "dpr 28 December 2000 n. 445 art 46 and 47" - normal2: " is aware of the penal sanctions and the loss of the right to reimbursement in the event of a false declaration" - loadingActivateBpd: - title: "We are activating the cashback" - body: "Please wait." - noPaymentMethod: - title: "Add at least one payment method" - body: "To start collecting valid transactions, add your favorite payment methods in your Wallet: we currently support the main payment cards and several mobile payment apps.\n\n In the future, we'll support other methods: you can add new payment methods into your wallet anytime and start collecting cashback!" - enrollPaymentMethod: - title: "Choose which payment methods to activate" - body1: "Enable Cashback on your saved methods and start collecting valid transactions." - body2: "You can later add other payment methods to your wallet and activate Cashback on them." - errorPaymentMethod: - title: "Almost there, activate Cashback on your payment methods!" - body: "Enable Cashback on methods already in your wallet or add new ones." - cta: "Activate payment methods" - suggestActivation: - title: "Do you want to activate Cashback?" - body: "You have added payment methods compatible with Cashback, the initiative promoted by the Presidency of the Council of Ministers and the Ministry of Economy and Finance, to promote the use of electronic money in Italy.\n\n You can get a money refund when you shop using your cards and apps." - skip: "No, thanks" - confirm: "Info and activation" - activateOnNewMethods: - title: "Do you want to activate Cashback?" - body1: "Turn on your methods saved into your wallet and start collecting cashback on your valid transactions." - body2: "If you prefer, you can activate cashback on these methods later as well." - skip: "Maybe later" - iban: - bpdCompletedMessage: "This initiative has ended and it is no longer possible to change the IBAN" - cta: - bpdNotActiveTitle: "attention" - bpdNotActiveMessage: "you are not registered for cashback, sign up and try again." - noActivePeriodTitle: "attention" - noActivePeriodMessage: "there is no active cashback at this time." - iban: "IBAN" - edit: "Change IBAN" - verify: "Check IBAN" - insertion: - title: "IBAN for transfer" - body1: "To receive any refunds, enter your " - body1Bold: "IBAN code without spaces" - body2: "The IBAN will be checked to make sure it's registered to you. You can also add your IBAN later." - koWrong: - title: "Incorrect IBAN" - text1: "The IBAN you entered" - text2: "is not correct: please check it!" - koCannotVerify: - title: "Your IBAN could not be verified" - text1: "If you are sure the IBAN" - text2: "identify the account on which you want to receive credit, you can proceed." - koNotOwned: - title: "Check the IBAN entered" - text1: "IBAN" - text2: "is not registered to" - loading: "We are verifying your IBAN\n\nPlease wait." - success: "IBAN successfully entered" - details: - howItWorks: - title: "Christmas Extra Cashback" - body: "1. The Cashback program is divided into several phases. The current one begins on **{{startDate}} and ends on {{endDate}}**. **Collect valid transactions** within each phase using the **payment methods you enrolled**.\n\n2. During this phase, if you reach **{{minTransactionNumber}} transactions**, you will receive a {{cashbackPercentage}}% cashback, up to a maximum of **€{{maxTransactionCashback}}** per transaction and a maximum refund of **€{{maxPeriodCashback}}** in the whole phase.\n\n3. At the end of the phase, you'll get your refund on the IBAN chosen by you.\n\n‎" - components: - iban: - title: "IBAN for transfer" - noIbanBody: "Set your IBAN in order to receive the collected cashback" - button: "Set IBAN" - transactionsCountOverview: - title: "Your transactions" - of: "out of" - closedPeriodKOBody: "You have not reached the {{transactions}} transactions necessary to get a refund: you would have received € {{amount}}. Try again during the next phase!" - currentPeriodKOBody: - one: "You must have reached at least" - two: " {{transactions}} transactions" - three: " to unlock the cashback collected so far!" - currentPeriodUnlockBody: "Congratulations {{name}}! You have reached the threshold of {{transactions}} transactions and unlocked your Cashback!" - currentPeriodMaxAmount: "Congratulations {{name}}! You have reached the maximum amount expected!" - currentPeriodSuperCashback: "Right now you would be eligible for {{superCashbackAmount}} € Super Cashback! Keep up the good work to stay on the leaderboard." - gracePeriodBody: "This Cashback period ended on {{date}}. We are waiting to receive the latest transactions to calculate refunds. You will receive a message when the operation is completed." - closedPeriodOKBody: "Congratulations {{name}}! \nYou are entitled to a refund of € {{amount}}" - closedPeriodMaxAmount: ", the highest refund possible" - closedPeriodSuperCashback: ", including € {{amount}} of Super Cashback" - moneyTransfer: "You will receive a message when the transfer will be performed on the IBAN you entered." - inactivePeriodBody: "You will be able to start collecting valid transactions starting from {{date}}" - label: - one: "1 valid transaction" - other: "{{transactions}} valid transactions" - ranking: - title: "Your position" - notReady: - title: "When will you see the Super Cashback ranking?" - body: "The ranking is based on the **number of transactions** made with the payment methods on which you have Cashback enabled.\n\n We will show your ranking **when the distribution of participants will be more meaningful**. Currently, many users collected the same number of transactions.\n\n Once published, the ranking will **continue to change** depending on the number of transactions among all participants, until the end of the 6 months." - transaction: - label: - one: "1 transaction" - other: "{{transactions}} transactions" - title: "Your transactions" - goToButton: "Transactions detail" - loading: "We're retrieving your transactions\n\nPlease hold on..." - error: - title: "Systems are taking longer than expected" - body: "We're currently unable to retrieve your transactions. Don't worry! The list will be available again soon." - pageLoading: "We're unable to retrieve your transactions, please try again." - noPaymentMethod: - text1: "You must activate " - text2: "at least one payment method " - text3: "at Cashback to start collecting necessary transactions" - detail: - empty: - text1: "There are no valid transactions yet." - text2: "Check back in the next few days!" - summary: - bottomSheet: - title: "When will you find your transactions?" - body: "**Still not seeing your transaction?**\n\n- Check if your bank has already **recorded** the transaction: data are sent to IO app within 5 working days from the recording.\n\n- Payments made using Google Pay, Apple Pay, and Samsung Pay are not supported yet. We are working with your bank to support these transactions as well.\n\n- The transaction may have been handled with the POS of a company (acquirer) **not affiliated yet.**" - readMore: "Read more" - calendarBlock: - text1: "Please note that before you'll see the transaction on IO," - text2: "it usually takes up to 3 working days" - text3: "." - lastUpdated: "Latest update: " - link: Anything missing? - body: - text1: "During the phase " - text2: "you have totalized " - text3: - one: "1 valid transaction " - other: "{{transactions}} valid transactions " - text4: "and collected " - text5: "a refund of " - milestone: - title: "Congratulation, you reached {{cashbackValue}}" - body: "You have reached the maximum amount for this phase. Keep collecting valid transactions to climb the ranking!" - title: "Transaction details" - paymentCircuit: "Payment circuit" - transactionAmount: "Transaction amount" - cashbackAmount: "Cashback amount" - acquirerId: "Acquirer transaction ID" - issuerId: "Issuer transaction ID" - maxCashbackWarning: "For each transaction you can get a maximum cashback of € {{amount}}." - maxCashbackForPeriodWarning: "You have already reached the maximum refund for this phase." - canceledOperationWarning: "This transaction is a write-off, meaning it cancels a transaction that was previously made." - canceled: "Write-off" - paymentMethods: - add: - cta: "Add a method to Cashback" - alertBody: "The payment method you are adding will be saved in the IO app wallet and, if compatible, can also be used for any payments within the app." - noPaymentMethods: "You must add at least one payment method to start collecting valid transactions" - noActiveMethod: "You must have activated at least one payment method to collect valid transactions" - error: "We’re experiencing issues loading your methods, but we’ll collect all the valid transactions done with your methods already enrolled on Cashback." - activateOnOthersChannel: - text1: "Enrolled on " - text2: "other channels" - title: "Methods added by other channels" - body: "You have added these payment methods to the cashback directly from the channels made available by your bank or payments app. You can activate or deactivate the collection of transactions of these methods also from IO. \n If you want to use some of these methods to pay via IO as well, add them to your wallet! " - addWallet: "Add to wallet" - whyOtherCards: - title: "Why am I seeing cards that I don't recognize?" - body: "Don't worry, these are virtual versions of your cards that Apple, Google and Samsung use to protect your purchases made through their 'wallets'. We are working with those involved in the initiative to improve the display on the app IO of this type of cards. " - cta: "Find out more" - notActivable: - header: "Not available or incompatible" - title: "Method not available" - body: "Someone else already has cashback on this payment method active at this time: cashback can only be activated by one user at a time for each payment method." - notCompatible: - title: "Method not compatible" - body: "The payment method is not compatible with Cashback because the bank has not activated support for these features yet. Please contact your bank for more details." - activate: - title: "Enable cashback on this payment method?" - body: "This will start **tomorrow**, so any transaction occurred today will not be collected. " - disclaimer: "Choosing {{activate}}, you declare that you are the owner of this payment method." - deactivate: - title: "Disable cashback on this method?" - body: "By continuing, transactions made using this payment method will be no longer collected. This will be effective **from tomorrow**, so any transaction occurred today with this method may still be considered. " - card: - status: - active: Active - closed: Closed - inactive: Upcoming - superCashback: - rankLabel: "{{position}}º user in rank" - rankTitle: "Super Cashback ranking" - howItWorks: - title: "How does it work?" - body: "The **{{citizens}} citizens** with the highest number of transactions **receive the Super Cashback, a prize of €{{amount}}.**" - status: - active: "**The ranking changes every day.** You will receive a message when it will be published." - closed: "Ranking for this period is closed." - lastUpdate: Updated at {{hour}} on {{date}} - optInPaymentMethods: - cashbackUpdate: - header: "News and updates" - title: "Choose to keep or delete your payment methods" - body: !include bonus/bpd/optInPaymentMethods.md - choice: - header: "Configura IO" - title: "Vuoi mantenere i tuoi metodi di pagamento?" - subtitle: Se li mantieni, potrai utilizzarli per aderire a sconti, bonus e iniziative future o per altre funzionalità, come pagare in app. - suggestedOption: Consigliato - toast: "You've already made your choice" - options: - keepAll: - title: Mantieni tutti i metodi nel Portafoglio - body: PagoPA S.p.A. tratterà i dati dei tuoi metodi di pagamento in qualità di titolare del trattamento. Per maggiori informazioni puoi consultare l’Informativa Privacy. - deleteAll: - title: Elimina tutti i metodi dal Portafoglio - body: Potrai aggiungerli di nuovo in qualsiasi momento, ma dovrai reinserire i dati e ripetere le procedure di autorizzazione. - deleteAllButton: Elimina tutti i metodi - deletePaymentMethodsBottomSheet: - title: "Vuoi davvero eliminare i seguenti metodi dal Portafoglio?" - subtitle: "Potrai aggiungerli di nuovo in qualsiasi momento, ma dovrai reinserire i dati e ripetere le procedure di autorizzazione." - thankYouPage: - cta: - goToWallet: "Vai al Portafoglio" - retry: "Riprova" - success: - title: "Done!" - body: "We’ve saved your choice." - retryAfterDeletion: - title: "An unexpected error has occurred" - body: "Your methods have not been deleted. Try again, or go to Wallet and delete them one by one." - toast: "Your choice was not saved. Try again later." cgn: generic: linkError: "The site can't be reached at the moment. Please, try again later." @@ -2827,174 +2570,6 @@ bonus: other: "{{seconds}} seconds" sv: headerTitle: "Sicilia Vola" - voucherGeneration: - acceptTos: - alert: - title: "Attention" - message: "We inform you that the information you enter constitutes in effect a self-certification. Any false declarations will be punishable under the d.P.R. 445/2000" - buttons: - ok: "Continue" - ko: "Abort" - buttons: - requestBonus: "Request a discount code" - checkResidence: - title: "Residency's region" - items: - inSicily: "I reside in Sicily" - notInSicily: "I reside in a different region" - info: "Please remember that the discount is available only to residents of Sicily" - selectBeneficiaryCategory: - title: "I declare to be" - categories: - student: "Off-site student" - disabled: "Severely disabled" - worker: "Employee with a workplace outside Sicily" - sick: "Patient in need of treatment outside the Sicily region" - other: "None of the above" - student: - selectDestination: - title: "StudentSelectDestinationScreen" - disabled: - additionalInfo: - title: "Additional informations" - disclaimer: - normal: "I declare that I meet the requirements referred to in " - link: "Article 3, paragraph 3, of the law of February 5, 1992, no. 104" - worker: - selectDestination: - title: "WorkerSelectDestinationScreen" - sick: - selectDestination: - title: "SickSelectDestinationScreen" - checkIncome: - title: "I also declare" - threshold: - under: "to have a gross annual income of less than or equal to {{amount}}" - over: "to have a gross annual income exceeding {{amount}}" - selectFlightsDate: - title: "Flight date" - subtitle: "Please indicate the type of flight and the date (s) you will travel on" - flights_choice: - departure: "One way flight" - return: "Round trip" - labels: - departure: "Departure date" - return: "Return date" - summary: - title: "Summary" - subtitle1: - normal1: "By continuing, you declare under your responsibility and aware of the penal sanctions in case of untruthful declarations and false acts (" - link: "art.76 of the Presidential Decree of 28 December 2000, n.445" - normal2: ") that you meet the following requirements:" - subtitle2: "And to request a discount code for a flight with the following characteristics:" - fields: - residence: - label: "Residence:" - value: "Sicily" - category: - label: "Category:" - value: - disabled: "Severely disabled pursuant to article 3, paragraph 3, of law no. 104" - student: "Off-site student" - worker: "Employee with a workplace outside Sicily" - sick: "Patient in need of treatment outside the Sicily region" - flightDate: - label: "Flight date:" - disabled: "All" - availableDestination: "Possible destinations:" - voucherGenerated: - title: "Here is your discount code" - subtitle: "Enter it on the portal or communicate it at the ticket office of the company when purchasing the ticket. We remind you that the code is nominative and cannot be used by others." - ko: - checkIncome: - title: "You do not have the features to access the discounts." - body: "Sicilia Vola discounts are dedicated only to those with a gross personal income of less than € 25,000." - selectBeneficiaryCategory: - title: "You do not have the features to access the discounts." - body: "Sicilia Vola discounts are dedicated only to the categories presented in the previous screen." - checkResidence: - title: "You do not have the features to access the discounts." - body: "Sicilia Vola discounts are dedicated only to residents of Sicily." - timeout: - title: "Your Sicilia Vola discount code is being generated." - body: "You will receive a message in the IO app when it is ready." - voucherList: - title: "Your discount codes available" - loading: "Loading" - filter: - title: "Filter vouchers" - searchValuePlaceholder: "Search coupon code" - stateSection: - title: "State" - dateSection: - title: "Date" - departure: "Departure date" - return: "Return date" - cta: - removeFilter: "Remove" - applyFilter: - zero: "Apply filters" - other: "Apply filters ({{count}})" - emptyList: - title: "There are no discount codes available" - subtitle: "Search to see your used or expired codes or request a new code" - cta: "Generate a new code" - error: "We are unable to recover your vouchers, please try again." - details: - title: "Your discount code" - fields: - uniqueCode: "Unique code" - beneficiary: "Beneficiary" - residence: - label: "Residence" - value: "Sicily" - category: "Category" - flightDate: "Flight date" - possibleDestination: "Possible destinations" - cta: - voucherRevocation: "Voucher revocation" - openQr: "Open QR code" - voucherRevocation: - alert: - title: "Attention" - message: "Are you sure you want to proceed? The discount code will be deleted." - cta: - ok: "Continue" - ko: "Cancel the request" - toast: - ok: "Voucher successfully deleted" - ko: "Error while deleting the voucher. Try again" - components: - voucherVisualDetails: - uniqueCode: "Unique code" - qrCode: "QR Code" - barCode: "Bar Code" - destinationLabels: - universityName: "University name" - companyName: "Company name" - hospitalName: "Hospital or professional name" - municipality: "Municipality" - voucherBottomsheet: - title: "Sicilia Vola discount code" - cta: - exit: "Exit" - voucherRevocation: "Voucher revocation" - destinationSelector: - state: - title: "Select a state" - label: "State" - placeholder: "Select a state" - municipality: - title: "Select a municipality" - label: "Municipality" - placeholder: "Select a municipality" - ko: - label1: "Error loading municipalities. " - label2: "Try again" - pdfVoucher: - toast: - ok: "Voucher saved successfully" - ko: "Problems saving the voucher" cdc: title: "Carta della cultura" serviceCta: @@ -3838,16 +3413,6 @@ fastLogin: whatsNew: title: Logging into IO just got easier! subtitle: From now on, to log into the app you'll have to use your SPID or CIE only once a year. After that you can just use your unlock code, fingerprint or face. - changes: - first: - title: Easier - description: log in with just your unlock code, fingerprint or face. - second: - title: Faster - description: use your SPID or CIE only once a year or in case you log out. - third: - title: Safer - description: every time a login with SPID or CIE is performed, we'll send you an e-mail to let you know. whatsNew: title: What's changed? bonusCard: diff --git a/locales/it/index.yml b/locales/it/index.yml index fdcc44df3e6..bdd05f16e81 100644 --- a/locales/it/index.yml +++ b/locales/it/index.yml @@ -728,7 +728,6 @@ authentication: error_1001: "Accesso negato: non hai l'età minima richiesta per usare IO" expiredSessionBanner: title: Avviso di sicurezza - message: Per mantenere al sicuro i tuoi dati privati, accedi nuovamente con le tue credenziali SPID, grazie! unlock: title: Sblocca l’accesso subtitlel2: Per poter usare l'app, devi prima sbloccare l'accesso a IO. @@ -2358,8 +2357,6 @@ bonus: caption: "concluso" description: "Questa iniziativa è terminata e non è più possibile richiederla" bonusVacanze: - accessibility: - card: Il tuo Bonus Vacanze con codice {{code}}, del valore massimo di {{value}} euro è {{status}} multipleBonus: Risultano due o più bonus richiesti e attivati da te. Assicurati di usare quello relativo alla DSU corretta, per evitare che chi utilizza il bonus incorra in successive azioni di recupero. usableAmount: Spendibile presso la struttura ricettiva taxBenefit: Detraibile in dichiarazione dei redditi @@ -2414,265 +2411,11 @@ bonus: title: Informativa sul trattamento dei dati personali content: !include bonus/bonusVacanze/bonus_tos.md bpd: - accessibility: - card: - preview: "Cashback, periodo dal {{startDate}} al {{endDate}}. Importo accumulato {{amount}} €" title: Cashback description: "Ottieni un rimborso quando paghi nei negozi con questo metodo" name: Cashback - earned: Importo accumulato cta: activeBonus: Attiva il Cashback - unsubscribe: - cta: "Cancella la tua iscrizione al Cashback" - title: "Disattivazione Cashback" - body1: "Vuoi davvero cancellare la tua iscrizione al Cashback?" - body2: "Se confermi, le tue transazioni non potranno più essere registrate per il Cashback né potrai concorrere per il Super Cashback; inoltre, **non potrai riscuotere un rimborso**, nel caso ti fosse stato riconosciuto. La disattivazione del Cashback avrà effetto **anche negli altri canali** che hai usato per attivarlo (home banking, app, etc).\n\nSe riattivi il Cashback in un secondo momento, **ripartirai da zero transazioni**." - confirmCta: "Cancella iscrizione" - loading: "Stiamo cancellando la tua iscrizione" - success: "La tua iscrizione al Cashback è stata cancellata" - failure: "Non siamo riusciti a cancellare la tua iscrizione, riprova per favore" - onboarding: - alert: - title: Il Cashback è già attivo - body: Puoi vedere maggiori dettagli nel tuo Portafoglio. - cancel: Chiudi - confirm: Torna indietro - loadingActivationStatus: - title: Verifico lo stato di attivazione - declaration: - header: Per poter attivare il Cashback devi dichiarare - cta: "Dichiaro" - conditions: - age: di essere maggiorenne - resident: di risiedere in Italia - owner: - normal: "di attivare ai fini del Cashback " - bold: "solo metodi di pagamento di cui sei il titolare" - personal_use: - normal: "che userai i metodi di pagamento su cui è attivo il Cashback solo per acquisti effettuati per finalità personali, " - bold: "non legati ad attività di Impresa, Arte o Professione" - disclaimer: - normal1: "Questa autodichiarazione è resa ai sensi del " - link: "dpr 28 dicembre 2000 n. 445 art 46 e 47" - normal2: " e consapevole delle sanzioni penali e della perdita di diritto al rimborso in caso di falsa dichiarazione" - loadingActivateBpd: - title: "Stiamo attivando il Cashback" - body: "Ti preghiamo di attendere..." - noPaymentMethod: - title: "Aggiungi almeno un metodo di pagamento" - body: "Per iniziare a collezionare transazioni valide, aggiungi al tuo Portafoglio i tuoi metodi di pagamento preferiti: oggi sono supportate le principali carte di pagamento, app e altri strumenti digitali.\n\n In futuro verranno supportati altri strumenti: potrai aggiungere quando vuoi nuovi metodi di pagamento su IO e attivare su ciascuno il Cashback!" - enrollPaymentMethod: - title: "Scegli quali metodi di pagamento attivare" - body1: "Attiva il Cashback sui metodi salvati nel tuo portafoglio per iniziare a collezionare le transazioni valide." - body2: "Potrai aggiungere in un secondo momento altri metodi di pagamento al tuo portafoglio e attivare su questi il Cashback." - errorPaymentMethod: - title: "Ci siamo quasi, attiva il Cashback sui tuoi metodi di pagamento!" - body: "Abilita il Cashback sui metodi già presenti nel tuo portafoglio o aggiungine di nuovi." - cta: "Attiva i metodi di pagamento" - suggestActivation: - title: "Vuoi attivare il Cashback?" - body: "Hai aggiunto dei metodi di pagamento compatibili con il Cashback, l’iniziativa promossa dalla Presidenza del Consiglio dei Ministri e dal Ministero dell’Economia e delle Finanze, allo scopo di incentivare un maggiore utilizzo di moneta elettronica nel Paese.\n\n Puoi ricevere un rimborso sugli acquisti effettuati con carte, bancomat e app di pagamento.\n\n" - skip: "No, grazie" - confirm: "Info e attivazione" - activateOnNewMethods: - title: "Vuoi attivare il Cashback?" - body1: "Attiva il Cashback sui metodi salvati nel tuo portafoglio per iniziare a collezionare le transazioni valide." - body2: "Se preferisci, puoi attivare il Cashback su questi metodi anche in un secondo momento." - skip: "Non ora" - iban: - bpdCompletedMessage: "Questa iniziativa è terminata e non è più possibile modificare l'IBAN" - cta: - bpdNotActiveTitle: "attenzione" - bpdNotActiveMessage: "non sei iscritto al cashback, iscriviti e riprova." - noActivePeriodTitle: "attenzione" - noActivePeriodMessage: "non c'è alcun cashback attivo in questo momento." - iban: "IBAN" - edit: "Modifica IBAN" - verify: "Controlla IBAN" - insertion: - title: "IBAN per l’accredito" - body1: "Per ricevere eventuali rimborsi, inserisci il tuo " - body1Bold: "codice IBAN senza spazi" - body2: "L’IBAN verrà verificato per sapere se il relativo conto corrente è intestato proprio a te. Puoi inserirlo anche in un secondo momento." - koWrong: - title: "IBAN non corretto" - text1: "L'IBAN che hai inserito" - text2: "non risulta corretto: controllalo per piacere!" - koCannotVerify: - title: "Non è stato possibile verificare il tuo IBAN" - text1: "Se hai la certezza che l’IBAN" - text2: "identifichi il conto su cui vuoi ricevere gli accrediti, puoi proseguire." - koNotOwned: - title: "Controlla l'IBAN inserito" - text1: "L’IBAN" - text2: "non risulta intestato a" - loading: "Stiamo verificando il tuo IBAN\n\nTi preghiamo di attendere." - success: "IBAN inserito con successo" - details: - howItWorks: - title: "Extra Cashback di Natale" - body: "1. Il programma Cashback si divide in periodi. Il periodo corrente inizia il **{{startDate}}** e finisce il **{{endDate}}**. **Accumula transazioni** valide durante tutta la durata di ciascun periodo con i **metodi di pagamento che hai attivato**.\n\n2. In questo periodo, se raggiungi le **{{minTransactionNumber}} transazioni**, riceverai un rimborso pari al {{cashbackPercentage}}% fino ad un rimborso massimo di **{{maxTransactionCashback}} euro** a transazione ed un massimo di **{{maxPeriodCashback}} euro** in tutto il periodo.\n\n3. Al termine del periodo, ricevi il rimborso accumulato sull’IBAN da te indicato.\n\n‎" - components: - iban: - title: "IBAN per l’accredito" - noIbanBody: "Imposta il tuo IBAN per poter ricevere il Cashback accumulato" - button: "Imposta IBAN" - transactionsCountOverview: - title: "Le tue transazioni" - of: "su" - closedPeriodKOBody: "Non hai raggiunto le {{transactions}} transazioni necessarie per ottenere un rimborso: avresti ricevuto € {{amount}}. Provaci nel prossimo periodo!" - currentPeriodKOBody: - one: "Devi aver fatto almeno" - two: " {{transactions}} transazioni" - three: " per sbloccare il Cashback che hai accumulato!" - currentPeriodUnlockBody: "Complimenti {{name}}! Hai superato la soglia di {{transactions}} transazioni e sbloccato il Cashback!" - currentPeriodMaxAmount: "Complimenti {{name}}! Hai raggiunto l’importo massimo previsto!" - currentPeriodSuperCashback: "In questo momento avresti diritto al Super Cashback di {{superCashbackAmount}} €! Continua così per rimanere in classifica." - gracePeriodBody: "Questo periodo del Cashback si è chiuso il {{date}}. Stiamo aspettando di ricevere le ultime transazioni, per calcolare i rimborsi. Riceverai un messaggio quando l'operazione verrà completata." - closedPeriodOKBody: "Complimenti {{name}}! \nHai diritto ad un rimborso di € {{amount}}" - closedPeriodMaxAmount: ", il massimo del rimborso possibile" - closedPeriodSuperCashback: ", di cui € {{amount}} di Super Cashback" - moneyTransfer: "Riceverai un messaggio quando verrà effettuato il bonifico all'IBAN da te scelto." - inactivePeriodBody: "Potrai iniziare a collezionare transazioni valide a partire dal {{date}}" - label: - one: "1 transazione valida" - other: "{{transactions}} transazioni valide" - ranking: - title: "La tua posizione" - notReady: - title: "Quando vedrai la classifica Super Cashback?" - body: "La classifica si basa sul **numero di transazioni** eseguite con i metodi di pagamento su cui hai attivato il Cashback.\n\n Mostreremo la tua posizione in classifica **quando la distribuzione dei partecipanti sarà più significativa**: in questo momento ci sono moltissimi utenti con lo stesso numero di transazioni.\n\n Una volta pubblicata, la classifica **continuerà a cambiare** a seconda del numero di transazioni di tutti i partecipanti, fino alla fine dei 6 mesi." - transaction: - label: - one: "1 transazione" - other: "{{transactions}} transazioni" - title: "Le tue transazioni" - goToButton: "Dettaglio transazioni" - loading: "Stiamo recuperando la lista delle tue transazioni\n\nAttendi qualche secondo..." - error: - title: "I sistemi stanno impiegando più tempo del previsto" - body: "In questo momento non riusciamo a recuperare le tue transazioni. Non preoccuparti, a breve l’elenco tornerà nuovamente disponibile." - pageLoading: "Non riusciamo a recuperare le transazioni, riprova per piacere." - noPaymentMethod: - text1: "Devi attivare " - text2: "almeno un metodo di pagamento " - text3: "al Cashback per iniziare a collezionare le transazioni necessarie" - detail: - empty: - text1: "Non ci sono ancora transazioni valide." - text2: "Controlla di nuovo nei prossimi giorni!" - summary: - bottomSheet: - title: Quando troverai le transazioni? - body: "**Continui a non vedere la transazione?**\n\n- Controlla se la tua banca ha già **contabilizzato** la transazione: i dati vengono trasmessi all'app entro 5 giorni lavorativi dalla contabilizzazione.\n\n- I pagamenti effettuati con Google Pay, Apple Pay e Samsung Pay non sono ancora supportati. Stiamo lavorando con la tua banca per ricevere anche questo tipo di transazioni.\n\n- La transazione potrebbe essere stata gestita con il POS di un soggetto (acquirer) **non ancora convenzionato.**" - readMore: "Leggi di più" - calendarBlock: - text1: "Ti informiamo che prima che tu veda la transazione su IO," - text2: "possono passare in media 3 giorni lavorativi" - text3: "." - lastUpdated: "Ultimo aggiornamento: " - link: "Manca qualcosa?" - body: - text1: "Nel periodo " - text2: "hai totalizzato " - text3: - one: "1 transazione valida " - other: "{{transactions}} transazioni valide " - text4: "e accumulato " - text5: "un rimborso di " - milestone: - title: "Complimenti, hai raggiunto {{cashbackValue}}" - body: "Hai raggiunto l'importo massimo previsto in questo periodo. Continua ad accumulare transazioni valide per salire in classifica!" - title: "Dettaglio della transazione" - paymentCircuit: "Circuito di pagamento" - transactionAmount: "Importo transazione" - cashbackAmount: "Importo Cashback" - acquirerId: "ID transazione Acquirer" - issuerId: "ID transazione Issuer" - maxCashbackWarning: "Per ogni transazione puoi ottenere un Cashback massimo di € {{amount}}." - maxCashbackForPeriodWarning: "Hai già raggiunto il rimborso massimo previsto per questo periodo." - canceledOperationWarning: "Questa transazione è uno storno, ovvero annulla una transazione che era stata effettuata in precedenza." - canceled: "Storno" - paymentMethods: - add: - cta: "Aggiungi un metodo al Cashback" - alertBody: "Il metodo di pagamento che stai aggiungendo sarà salvato nel wallet dell'app IO e, se compatibile, potrà essere usato anche per eventuali pagamenti all'interno dell'app." - noPaymentMethods: "Devi aggiungere almeno un metodo di pagamento per iniziare a collezionare transazioni valide" - noActiveMethod: "Devi aver attivato almeno un metodo di pagamento per collezionare transazioni valide" - error: "Anche se in questo momento non è possibile visualizzare i tuoi metodi, registreremo le transazioni effettuate coi metodi già abilitati al Cashback." - activateOnOthersChannel: - text1: "Attivati su " - text2: "altri canali" - title: "Metodi aggiunti da altri canali" - body: "Hai aggiunto al Cashback questi metodi di pagamento direttamente dai canali messi a disposizione dalla tua banca o app di pagamenti. Puoi attivare o disattivare la registrazione delle transazioni di questi metodi anche da IO.\n Se vuoi usare alcuni di questi metodi anche per pagare tramite IO, aggiungili al tuo portafoglio!" - addWallet: "Aggiungi al portafoglio" - whyOtherCards: - title: "Perché vedo carte che non riconosco?" - body: "Non preoccuparti, si tratta delle versioni virtuali delle tue carte che Apple, Google e Samsung utilizzano per proteggere i tuoi acquisti effettuati tramite i loro ‘wallet’. Stiamo lavorando con i soggetti coinvolti nell’iniziativa per migliorare la visualizzazione sull’app IO di questo tipo di carte." - cta: "Scopri di più" - notActivable: - header: "Non attivabili o non compatibili" - title: "Metodo non attivabile" - body: "Qualcun altro ha già attivo in questo momento il Cashback su questo metodo di pagamento: il Cashback può essere attivato da un solo utente alla volta per ciascun metodo di pagamento." - notCompatible: - title: "Metodo non compatibile" - body: "Il metodo di pagamento non è compatibile con il Cashback perché la banca non ha ancora attivato il supporto a queste funzionalità. Contatta la tua banca per maggiori dettagli." - activate: - title: "Attivare il Cashback su questo metodo?" - body: "L’attivazione sarà operativa **da domani**, quindi non saranno valide ai fini del Cashback le transazioni effettuate nella giornata di oggi." - disclaimer: "Scegliendo {{activate}}, dichiari di essere il titolare di questo metodo di pagamento." - deactivate: - title: "Disattivare il Cashback su questo metodo?" - body: "Se confermi questa scelta, le transazioni effettuate con questo metodo non verranno più collezionate. La disattivazione sarà operativa **da domani**, quindi potrebbero essere ancora collezionate le transazioni effettuate oggi." - card: - status: - active: Attivo - closed: Concluso - inactive: In arrivo - superCashback: - rankLabel: "{{position}}º utente in classifica" - rankTitle: "Classifica Super Cashback" - howItWorks: - title: "Come funziona?" - body: "I **{{citizens}} cittadini** con il più alto numero di transazioni **ricevono il Super Cashback, un premio pari a €{{amount}}.**" - status: - active: "**La classifica cambia ogni giorno.** Riceverai un messaggio quando verrà consolidata." - closed: "La classifica per questo periodo è chiusa." - lastUpdate: Aggiornato alle {{hour}} del {{date}} - optInPaymentMethods: - cashbackUpdate: - header: "Novità e aggiornamenti" - title: "Vuoi mantenere i tuoi metodi di pagamento?" - body: !include bonus/bpd/optInPaymentMethods.md - choice: - header: "Configura IO" - title: "Vuoi mantenere i tuoi metodi di pagamento?" - subtitle: Se li mantieni, potrai utilizzarli per aderire a sconti, bonus e iniziative future o per altre funzionalità, come pagare in app. - suggestedOption: Consigliato - toast: "Hai già fatto la tua scelta" - options: - keepAll: - title: Mantieni tutti i metodi nel Portafoglio - body: PagoPA S.p.A. tratterà i dati dei tuoi metodi di pagamento in qualità di titolare del trattamento. Per maggiori informazioni puoi consultare l’Informativa Privacy. - deleteAll: - title: Elimina tutti i metodi dal Portafoglio - body: Potrai aggiungerli di nuovo in qualsiasi momento, ma dovrai reinserire i dati e ripetere le procedure di autorizzazione. - deleteAllButton: Elimina tutti i metodi - deletePaymentMethodsBottomSheet: - title: "Vuoi davvero eliminare i seguenti metodi dal Portafoglio?" - subtitle: "Potrai aggiungerli di nuovo in qualsiasi momento, ma dovrai reinserire i dati e ripetere le procedure di autorizzazione." - thankYouPage: - cta: - goToWallet: "Vai al Portafoglio" - retry: "Riprova" - success: - title: "Fatto!" - body: "Abbiamo salvato la tua scelta" - retryAfterDeletion: - title: "Si è verificato un errore imprevisto" - body: "I tuoi metodi non sono stati eliminati. Riprova, oppure vai al Portafoglio ed eliminali manualmente." - toast: "La tua scelta non è stata salvata. Riprova più tardi." cgn: generic: linkError: "In questo momento, il sito dell'operatore non è raggiungibile. Riprova più tardi." @@ -2827,174 +2570,6 @@ bonus: other: "{{seconds}} secondi" sv: headerTitle: "Sicilia Vola" - voucherGeneration: - acceptTos: - alert: - title: "Attenzione" - message: "Ti informiamo che le informazioni che inserirai costituiscono a tutti gli effetti una autocertificazione. Eventuali dichiarazioni mendaci saranno perseguibili ai sensi del d.P.R. n.445/2000" - buttons: - ok: "Continua" - ko: "Annulla richiesta" - buttons: - requestBonus: "Richiedi un codice sconto" - checkResidence: - title: "Regione di residenza" - items: - inSicily: "Risiedo in Sicilia" - notInSicily: "Risiedo in un'altra regione" - info: "Ricorda che gli sconti sono diponibili solo per i cittadini residenti in Sicilia." - selectBeneficiaryCategory: - title: "Dichiaro di essere" - categories: - student: "Studente fuori sede" - disabled: "Disabile grave" - worker: "Lavoratore dipendente con sede lavorativa al di fuori della Sicilia" - sick: "Paziente con necessità di cure al di fuori della Sicilia" - other: "Nessuno dei precedenti" - student: - selectDestination: - title: "StudentSelectDestinationScreen" - disabled: - additionalInfo: - title: "Informazioni aggiuntive" - disclaimer: - normal: "Dichiaro di possedere i requisiti di cui all’" - link: "articolo 3, comma 3, della legge 5 febbraio 1992, n. 104" - worker: - selectDestination: - title: "WorkerSelectDestinationScreen" - sick: - selectDestination: - title: "SickSelectDestinationScreen" - checkIncome: - title: "Dichiaro inoltre" - threshold: - under: "di avere un reddito lordo annuo inferiore o uguale a {{amount}}" - over: "di avere un reddito lordo annuo superiore a {{amount}}" - selectFlightsDate: - title: "Data del volo" - subtitle: "Indica il tipo di volo e la/le data/e in cui viaggerai" - flights_choice: - departure: "Volo di sola andata" - return: "Andata e ritorno" - labels: - departure: "Data di partenza" - return: "Data di ritorno" - summary: - title: "Riepilogo" - subtitle1: - normal1: "Proseguendo dichiari sotto la tua responsabilità e consapevole delle sanzioni penali in caso di dichiarazioni non veritiere e di falsità negli atti (" - link: "art. 76 del d.P.R. 28 Dicembre 2000, n.445" - normal2: ") di possedere i seguenti requisiti" - subtitle2: "E di richiedere un codice sconto per un volo con le seguenti caratteristiche:" - fields: - residence: - label: "Residenza:" - value: "Sicilia" - category: - label: "Categoria:" - value: - disabled: "Disabile grave ai sensi dell’articolo 3, comma 3, della legge 5 febbraio 1992, n. 104" - student: "Studente fuori sede" - worker: "Lavoratore dipendente con sede lavorativa al di fuori della Sicilia" - sick: "Paziente con necessità di cure al di fuori della regione Sicilia" - flightDate: - label: "Data del volo:" - disabled: "Tutte" - availableDestination: "Possibili destinazioni:" - voucherGenerated: - title: "Ecco il tuo codice sconto" - subtitle: "Inseriscilo sul portale o comunicalo alla biglietteria della compagnia in fase di acquisto del biglietto. Ti ricordiamo che il codice è nominativo e non può essere usato da altri." - ko: - checkIncome: - title: "Siamo spiacenti.\nNon hai le caratteristiche per accedere agli sconti." - body: "Gli sconti Sicilia Vola sono dedicati solo a chi ha un reddito personale lordo inferiore a 25.000€." - selectBeneficiaryCategory: - title: "Siamo spiacenti.\nNon hai le caratteristiche per accedere agli sconti." - body: "Gli sconti Sicilia Vola sono dedicati solo alle categorie presentate nella schermata precedente." - checkResidence: - title: "Siamo spiacenti.\nNon hai le caratteristiche per accedere agli sconti." - body: "Gli sconti Sicilia Vola sono dedicati solo ai residenti in Sicilia." - timeout: - title: "Il tuo codice sconto Sicilia Vola è in fase di generazione." - body: "Riceverai un messaggio in app IO quando sarà pronto." - voucherList: - title: "I tuoi codici sconto disponibili" - loading: "Caricamento in corso" - filter: - title: "Filtra voucher" - searchValuePlaceholder: "Cerca codice buono" - stateSection: - title: "Stato" - dateSection: - title: "Data" - departure: "Data di partenza" - return: "Data di ritorno" - cta: - removeFilter: "Rimuovi" - applyFilter: - zero: "Applica filtri" - other: "Applica filtri ({{count}})" - emptyList: - title: "Non ci sono codici sconto disponibili" - subtitle: "Fai una ricerca per vedere i tuoi codici utilizzati o scaduti oppure richiedi un nuovo codice" - cta: "Genera un nuovo codice" - error: "Non riusciamo a recuperare i tuoi voucher, riprova per piacere." - details: - title: "Il tuo codice sconto" - fields: - uniqueCode: "Codice univoco" - beneficiary: "Beneficiario" - residence: - label: "Residenza" - value: "Sicilia" - category: "Categoria" - flightDate: "Data del volo" - possibleDestination: "Possibili destinazioni" - cta: - voucherRevocation: "Revoca voucher" - openQr: "Apri QR code" - voucherRevocation: - alert: - title: "Attenzione" - message: "Sei sicuro di voler procedere? Il codice sconto sarà eliminato." - cta: - ok: "Continua" - ko: "Annulla la richiesta" - toast: - ok: "Voucher eliminato correttamente" - ko: "Errore durante l'eliminazione del voucher. Riprova" - components: - voucherVisualDetails: - uniqueCode: "Codice univoco" - qrCode: "QR Code" - barCode: "Bar Code" - destinationLabels: - universityName: "Nome ateneo" - companyName: "Ragione sociale azienda" - hospitalName: "Nome struttura o professionista" - municipality: "Comune" - voucherBottomsheet: - title: "Codice sconto Sicilia Vola" - cta: - exit: "Esci" - voucherRevocation: "Revoca voucher" - destinationSelector: - state: - title: "Seleziona uno stato" - label: "Stato" - placeholder: "Seleziona uno stato" - municipality: - title: "Seleziona un comune" - label: "Comune" - placeholder: "Seleziona un comune" - ko: - label1: "Errore durante il caricamento dei comuni. " - label2: "Riprova" - pdfVoucher: - toast: - ok: "Voucher salvato con successo" - ko: "Problemi durante il salvataggio del voucher" cdc: title: "Carta della cultura" serviceCta: @@ -3838,16 +3413,6 @@ fastLogin: whatsNew: title: Abbiamo migliorato l’accesso a IO! subtitle: Ora puoi accedere all'app utilizzando il tuo SPID o la tua CIE solo una volta all'anno. Ti basterà poi utilizzare il tuo codice di sblocco o il biometrico per entrare. - changes: - first: - title: Più semplice - description: accedi inserendo solo il codice di sblocco dell’app o con il biometrico. - second: - title: Più veloce - description: ti chiederemo di autenticarti con SPID o CIE solo una volta all’anno o se ti disconnetti dall’app. - third: - title: Più sicura - description: a ogni nuovo accesso con SPID o CIE, ti invieremo un’email. whatsNew: title: Cosa cambia? bonusCard: diff --git a/ts/features/bonus/common/store/actions/index.ts b/ts/features/bonus/common/store/actions/index.ts index 645de11800f..f5869b862ce 100644 --- a/ts/features/bonus/common/store/actions/index.ts +++ b/ts/features/bonus/common/store/actions/index.ts @@ -1,10 +1,5 @@ import { CdcActions } from "../../../cdc/store/actions"; import { CgnActions } from "../../../cgn/store/actions"; -import { SvActions } from "../../../siciliaVola/store/actions"; import { AvailableBonusesActions } from "./availableBonusesTypes"; -export type BonusActions = - | AvailableBonusesActions - | CgnActions - | SvActions - | CdcActions; +export type BonusActions = AvailableBonusesActions | CgnActions | CdcActions; diff --git a/ts/features/bonus/common/store/reducers/index.ts b/ts/features/bonus/common/store/reducers/index.ts index 31659451b06..192e7801417 100644 --- a/ts/features/bonus/common/store/reducers/index.ts +++ b/ts/features/bonus/common/store/reducers/index.ts @@ -2,7 +2,6 @@ import { combineReducers } from "redux"; import { Action } from "../../../../../store/actions/types"; import cdcReducer, { CdcState } from "../../../cdc/store/reducers"; import cgnReducer, { CgnState } from "../../../cgn/store/reducers"; -import svReducer, { SvState } from "../../../siciliaVola/store/reducers"; import availableBonusesReducer, { AvailableBonusTypesState } from "./availableBonusesTypes"; @@ -10,14 +9,12 @@ import availableBonusesReducer, { export type BonusState = Readonly<{ availableBonusTypes: AvailableBonusTypesState; cgn: CgnState; - sv: SvState; cdc: CdcState; }>; const bonusReducer = combineReducers({ availableBonusTypes: availableBonusesReducer, cgn: cgnReducer, - sv: svReducer, cdc: cdcReducer }); diff --git a/ts/features/bonus/siciliaVola/analytics/placeholder b/ts/features/bonus/siciliaVola/analytics/placeholder deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/ts/features/bonus/siciliaVola/api/backendSiciliaVola.ts b/ts/features/bonus/siciliaVola/api/backendSiciliaVola.ts deleted file mode 100644 index aa53c80f90b..00000000000 --- a/ts/features/bonus/siciliaVola/api/backendSiciliaVola.ts +++ /dev/null @@ -1,234 +0,0 @@ -import { - ApiHeaderJson, - composeHeaderProducers, - createFetchRequestForApi -} from "@pagopa/ts-commons/lib/requests"; -import { Omit } from "@pagopa/ts-commons/lib/types"; -import { pipe } from "fp-ts/lib/function"; -import { AeroportiAmmessiInputBean } from "../../../../../definitions/api_sicilia_vola/AeroportiAmmessiInputBean"; -import { - annullaVoucherDefaultDecoder, - AnnullaVoucherT, - getAeroportiAmmessiDefaultDecoder, - GetAeroportiAmmessiT, - getListaComuniBySiglaProvinciaDefaultDecoder, - GetListaComuniBySiglaProvinciaT, - getListaProvinceByIdRegioneDefaultDecoder, - GetListaProvinceByIdRegioneT, - getListaRegioniDefaultDecoder, - GetListaRegioniT, - getPdfDefaultDecoder, - GetPdfT, - getStatiUEDefaultDecoder, - GetStatiUET, - getStatiVoucherDefaultDecoder, - GetStatiVoucherT, - getVoucherBeneficiarioDefaultDecoder, - GetVoucherBeneficiarioT -} from "../../../../../definitions/api_sicilia_vola/requestTypes"; -import { VoucherBeneficiarioInputBean } from "../../../../../definitions/api_sicilia_vola/VoucherBeneficiarioInputBean"; -import { VoucherCodeInputBean } from "../../../../../definitions/api_sicilia_vola/VoucherCodeInputBean"; -import { MitVoucherToken } from "../../../../../definitions/io_sicilia_vola_token/MitVoucherToken"; -import { - getMitVoucherTokenDefaultDecoder, - GetMitVoucherTokenT -} from "../../../../../definitions/io_sicilia_vola_token/requestTypes"; -import { SessionToken } from "../../../../types/SessionToken"; -import { - tokenHeaderProducer, - withBearerToken as withToken -} from "../../../../utils/api"; -import { defaultRetryingFetch } from "../../../../utils/fetch"; - -/** - * Get the Sicilia Vola session token - */ -const GetMitVoucherToken: GetMitVoucherTokenT = { - method: "get", - url: () => "/api/v1/mitvoucher/auth/token", - query: _ => ({}), - headers: composeHeaderProducers(tokenHeaderProducer, ApiHeaderJson), - response_decoder: getMitVoucherTokenDefaultDecoder() -}; - -/** - * Get the list of states selectable by the user - */ -const GetStatiUE: GetStatiUET = { - method: "get", - url: () => "/api/v1/mitvoucher/data/rest/unsecured/statiUE", - query: _ => ({}), - headers: _ => ({}), - response_decoder: getStatiUEDefaultDecoder() -}; - -/** - * Get the list of regions selectable by the user - */ -const GetListaRegioni: GetListaRegioniT = { - method: "get", - url: () => "/api/v1/mitvoucher/data/rest/unsecured/regioni", - query: _ => ({}), - headers: _ => ({}), - response_decoder: getListaRegioniDefaultDecoder() -}; - -/** - * Get the list of province selectable by the user given a regionID - */ -const GetListaProvinceByIdRegione: GetListaProvinceByIdRegioneT = { - method: "get", - url: params => - `/api/v1/mitvoucher/data/rest/unsecured/province/${params.idRegione}`, - query: _ => ({}), - headers: _ => ({}), - response_decoder: getListaProvinceByIdRegioneDefaultDecoder() -}; - -/** - * Get the list of municipalities selectable by the user given a province abbreviation - */ -const GetListaComuniBySiglaProvincia: GetListaComuniBySiglaProvinciaT = { - method: "get", - url: params => - `/api/v1/mitvoucher/data/rest/unsecured/comuni/${params.siglaProvincia}`, - query: _ => ({}), - headers: _ => ({}), - response_decoder: getListaComuniBySiglaProvinciaDefaultDecoder() -}; - -/** - * Get the list of the airports available for the voucher given a stateId, a longitude and a latitude - */ -const GetAeroportiAmmessi: GetAeroportiAmmessiT = { - method: "post", - url: _ => - `/api/v1/mitvoucher/data/rest/secured/beneficiario/aeroportiAmmessi`, - query: _ => ({}), - body: ({ body }) => JSON.stringify({ body }), - headers: composeHeaderProducers(tokenHeaderProducer, ApiHeaderJson), - response_decoder: getAeroportiAmmessiDefaultDecoder() -}; - -/** -/** - * Revoke a voucher identified by id - */ -const PostAnnullaVoucher: AnnullaVoucherT = { - method: "post", - url: _ => `/api/v1/mitvoucher/data/rest/secured/beneficiario/annullaVoucher`, - query: _ => ({}), - body: ({ body }) => JSON.stringify(body), - headers: composeHeaderProducers(tokenHeaderProducer, ApiHeaderJson), - response_decoder: annullaVoucherDefaultDecoder() -}; - -/** - * Get the list of user's vouchers - * - * TODO: modify post in get and add auth header when the swagger will be fixed - */ -const GetVoucherBeneficiario: GetVoucherBeneficiarioT = { - method: "post", - url: _ => `/api/v1/mitvoucher/data/rest/secured/beneficiario/ricercaVoucher`, - query: _ => ({}), - body: voucherListRequest => JSON.stringify(voucherListRequest), - headers: ApiHeaderJson, - response_decoder: getVoucherBeneficiarioDefaultDecoder() -}; - -/** - * Get the possible voucher state - * - * TODO: modify post in get and add auth header when the swagger will be fixed - */ -const GetStatiVoucher: GetStatiVoucherT = { - method: "get", - url: _ => `/api/v1/mitvoucher/data/rest/secured/beneficiario/statiVoucher`, - query: _ => ({}), - headers: ApiHeaderJson, - response_decoder: getStatiVoucherDefaultDecoder() -}; - -/** - * Get the pdf voucher - * - */ -const GetStampaVoucher: GetPdfT = { - method: "post", - url: _ => `/api/v1/mitvoucher/data/rest/secured/beneficiario/stampaVoucher`, - query: _ => ({}), - body: ({ body }) => JSON.stringify(body), - headers: composeHeaderProducers(tokenHeaderProducer, ApiHeaderJson), - response_decoder: getPdfDefaultDecoder() -}; - -const withSiciliaVolaToken = -

(f: (p: P) => Promise) => - (token: MitVoucherToken) => - async (po: Omit): Promise => { - const params = Object.assign({ Bearer: String(token.token) }, po) as P; - return f(params); - }; - -// client for SiciliaVola to handle API communications -export const BackendSiciliaVolaClient = ( - baseUrl: string, - token: SessionToken, - fetchApi: typeof fetch = defaultRetryingFetch() -) => { - const options = { - baseUrl, - fetchApi - }; - const withBearerToken = withToken(token); - return { - getMitVoucherToken: withBearerToken( - createFetchRequestForApi(GetMitVoucherToken, options) - ), - getStatiUE: createFetchRequestForApi(GetStatiUE, options), - getListaRegioni: createFetchRequestForApi(GetListaRegioni, options), - getListaProvinceByIdRegione: createFetchRequestForApi( - GetListaProvinceByIdRegione, - options - ), - getListaComuniBySiglaProvincia: createFetchRequestForApi( - GetListaComuniBySiglaProvincia, - options - ), - getAeroportiAmmessi: ( - avilableDestinationRequest: AeroportiAmmessiInputBean - ) => - pipe( - createFetchRequestForApi(GetAeroportiAmmessi, options), - withSiciliaVolaToken, - fn => (token: MitVoucherToken) => - fn(token)({ body: avilableDestinationRequest }) - ), - getVoucherBeneficiario: ( - voucherListRequest: VoucherBeneficiarioInputBean - ) => - // TODO: add auth header - createFetchRequestForApi( - GetVoucherBeneficiario, - options - )({ body: voucherListRequest }), - getStatiVoucher: createFetchRequestForApi(GetStatiVoucher, options), - getStampaVoucher: (voucherCode: VoucherCodeInputBean) => - pipe( - createFetchRequestForApi(GetStampaVoucher, options), - withSiciliaVolaToken, - fn => (token: MitVoucherToken) => fn(token)({ body: voucherCode }) - ), - postAnnullaVoucher: (voucherCode: VoucherCodeInputBean) => - pipe( - createFetchRequestForApi(PostAnnullaVoucher, options), - withSiciliaVolaToken, - fn => (token: MitVoucherToken) => fn(token)({ body: voucherCode }) - ) - }; -}; - -export type BackendSiciliaVolaClient = ReturnType< - typeof BackendSiciliaVolaClient ->; diff --git a/ts/features/bonus/siciliaVola/components/AcceptTosComponent.tsx b/ts/features/bonus/siciliaVola/components/AcceptTosComponent.tsx deleted file mode 100644 index 9d4737d4cd2..00000000000 --- a/ts/features/bonus/siciliaVola/components/AcceptTosComponent.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import * as React from "react"; -import { SafeAreaView } from "react-native"; -import { IOStyles } from "../../../../components/core/variables/IOStyles"; -import { withLoadingSpinner } from "../../../../components/helpers/withLoadingSpinner"; -import BaseScreenComponent from "../../../../components/screens/BaseScreenComponent"; -import FooterWithButtons from "../../../../components/ui/FooterWithButtons"; -import I18n from "../../../../i18n"; -import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp"; -import { LoadingErrorComponent } from "../../../../components/LoadingErrorComponent"; - -type Props = { - onCancel: () => void; - onAccept: () => void; -}; - -// TODO change with the ufficial TOS page see https://pagopa.atlassian.net/browse/IASV-10 -const tosUrl = "https://io.italia.it/app-content/tos_privacy.html"; - -/** - * This component loads and shows the tos url - * The user can accept or cancel (if the content is successfully loaded) - * If the tos content can't be load, an error will be shown and the user can retry to reload - * @param props - * @constructor - */ -const AcceptTosComponent = (props: Props): React.ReactElement => { - const [tosLoadingState, setTosLoadingState] = React.useState< - "loading" | "error" | "loaded" - >("loading"); - const [_, setUrl] = React.useState(tosUrl); - const undoButtonProps = { - primary: false, - bordered: true, - onPress: props.onCancel, - title: I18n.t("global.buttons.cancel") - }; - const requestBonusButtonProps = { - primary: true, - bordered: false, - onPress: props.onAccept, - title: I18n.t("bonus.sv.voucherGeneration.acceptTos.buttons.requestBonus") - }; - - const renderContent = () => { - switch (tosLoadingState) { - case "loaded": - case "loading": - // TODO Replace with a proper component (see https://pagopa.atlassian.net/browse/IASV-10) - return <>; - case "error": - return ( - { - setTosLoadingState("loading"); - // force url reloading - setUrl(`${tosUrl}?time=${new Date().getTime()}`); - }} - /> - ); - } - }; - - const ContainerComponent = withLoadingSpinner(() => ( - - - {renderContent()} - {tosLoadingState === "loaded" && ( - - )} - - - )); - return ; -}; - -export default AcceptTosComponent; diff --git a/ts/features/bonus/siciliaVola/components/CheckIncomeComponent.tsx b/ts/features/bonus/siciliaVola/components/CheckIncomeComponent.tsx deleted file mode 100644 index 3d379b5e101..00000000000 --- a/ts/features/bonus/siciliaVola/components/CheckIncomeComponent.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import { VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; -import { SafeAreaView, ScrollView } from "react-native"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { - RadioButtonList, - RadioItem -} from "../../../../components/core/selection/RadioButtonList"; -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 { GlobalState } from "../../../../store/reducers/types"; -import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp"; -import { formatNumberAmount } from "../../../../utils/stringBuilder"; -import { - svGenerateVoucherCancel, - svGenerateVoucherUnderThresholdIncome -} from "../store/actions/voucherGeneration"; - -type OwnProps = { - onContinuePress: () => void; -}; -type Props = OwnProps & - ReturnType & - ReturnType; - -const threshold = 25000; -const getCheckIncomeUnderThresholdItems = (): ReadonlyArray< - RadioItem -> => [ - { - body: I18n.t("bonus.sv.voucherGeneration.checkIncome.threshold.under", { - amount: formatNumberAmount(threshold, true) - }), - id: true - }, - { - body: I18n.t("bonus.sv.voucherGeneration.checkIncome.threshold.over", { - amount: formatNumberAmount(threshold, true) - }), - id: false - } -]; - -const CheckIncomeComponent = (props: Props): React.ReactElement => { - const [incomeUnderThreshold, setIncomeUnderThreshold] = React.useState< - boolean | undefined - >(); - - const handleContinue = () => { - if (incomeUnderThreshold === undefined) { - return; - } - props.underThresholdIncome(incomeUnderThreshold); - - if (incomeUnderThreshold) { - props.onContinuePress(); - } - }; - - const cancelButtonProps = { - primary: false, - bordered: true, - onPress: props.cancel, - title: I18n.t("global.buttons.cancel") - }; - const continueButtonProps = { - bordered: false, - onPress: handleContinue, - title: I18n.t("global.buttons.continue"), - disabled: incomeUnderThreshold === undefined - }; - - return ( - - - -

{I18n.t("bonus.sv.voucherGeneration.checkIncome.title")}

- - - key="check_income" - items={getCheckIncomeUnderThresholdItems()} - selectedItem={incomeUnderThreshold} - onPress={setIncomeUnderThreshold} - /> - - - - - ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - cancel: () => dispatch(svGenerateVoucherCancel()), - underThresholdIncome: (isUnderThresholdIncome: boolean) => - dispatch(svGenerateVoucherUnderThresholdIncome(isUnderThresholdIncome)) -}); -const mapStateToProps = (_: GlobalState) => ({}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(CheckIncomeComponent); diff --git a/ts/features/bonus/siciliaVola/components/CheckResidenceComponent.tsx b/ts/features/bonus/siciliaVola/components/CheckResidenceComponent.tsx deleted file mode 100644 index e189db8b0ce..00000000000 --- a/ts/features/bonus/siciliaVola/components/CheckResidenceComponent.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { VSpacer } from "@pagopa/io-app-design-system"; -import React from "react"; -import { SafeAreaView, ScrollView } from "react-native"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { - RadioButtonList, - RadioItem -} from "../../../../components/core/selection/RadioButtonList"; -import { Body } from "../../../../components/core/typography/Body"; -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 { GlobalState } from "../../../../store/reducers/types"; -import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp"; -import { svGenerateVoucherCancel } from "../store/actions/voucherGeneration"; - -type Props = ReturnType & - ReturnType; -const getCheckResidencyRegionItems = (): ReadonlyArray> => [ - { - body: I18n.t("bonus.sv.voucherGeneration.checkResidence.items.inSicily"), - id: true - }, - { - body: I18n.t("bonus.sv.voucherGeneration.checkResidence.items.notInSicily"), - id: false - } -]; - -const CheckResidenceComponent = (props: Props): React.ReactElement => { - const [isResidentInSicily, setIsResidentInSicily] = React.useState< - boolean | undefined - >(); - - const cancelButtonProps = { - primary: false, - bordered: true, - onPress: props.cancel, - title: I18n.t("global.buttons.cancel") - }; - const continueButtonProps = { - bordered: false, - onPress: () => isResidentInSicily === true, - title: I18n.t("global.buttons.continue"), - disabled: isResidentInSicily === undefined - }; - - return ( - - - -

{I18n.t("bonus.sv.voucherGeneration.checkResidence.title")}

- - - - key="check_income" - items={getCheckResidencyRegionItems()} - selectedItem={isResidentInSicily} - onPress={setIsResidentInSicily} - /> - - - {I18n.t("bonus.sv.voucherGeneration.checkResidence.info")} - -
- -
-
- ); -}; - -const mapDispatchToProps = (dispatch: Dispatch) => ({ - cancel: () => dispatch(svGenerateVoucherCancel()) -}); -const mapStateToProps = (_: GlobalState) => ({}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(CheckResidenceComponent); diff --git a/ts/features/bonus/siciliaVola/components/DestinationSelector.tsx b/ts/features/bonus/siciliaVola/components/DestinationSelector.tsx deleted file mode 100644 index 0cd72014510..00000000000 --- a/ts/features/bonus/siciliaVola/components/DestinationSelector.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import * as React from "react"; -import { Dispatch } from "redux"; -import { connect } from "react-redux"; -import { ListItem } from "native-base"; -import { debounce } from "lodash"; -import { useContext, useEffect, useRef, useState } from "react"; -import { FlatList } from "react-native"; -import { VSpacer } from "@pagopa/io-app-design-system"; -import { GlobalState } from "../../../../store/reducers/types"; -import TextboxWithSuggestion from "../../../../components/ui/TextboxWithSuggestion"; -import { H4 } from "../../../../components/core/typography/H4"; -import { IndexedById, toArray } from "../../../../store/helpers/indexer"; -import { Municipality, State } from "../types/SvVoucherRequest"; -import { - svGenerateVoucherAvailableMunicipality, - svGenerateVoucherResetAvailableMunicipality -} from "../store/actions/voucherGeneration"; -import { LightModalContext } from "../../../../components/ui/LightModal"; -import I18n from "../../../../i18n"; -import WrappedFlatList from "./WrappedMunicipalityFlatList"; - -type OwnProps = { - availableStates: IndexedById; - selectedState?: State; - onStateSelected: (state: State) => void; - selectedMunicipality?: Municipality; - onMunicipalitySelected: (municipality?: Municipality) => void; -}; - -type Props = OwnProps & - ReturnType & - ReturnType; - -const DestinationSelector: React.FunctionComponent = (props: Props) => { - const { hideModal } = useContext(LightModalContext); - const [searchText, setSearchText] = useState(undefined); - - const refVal = useRef(); - - const performMunicipalitySearch = (text: string) => { - if (text.length < 3) { - return; - } - props.requestAvailableMunicipalities(text); - }; - - const debounceRef = React.useRef(debounce(performMunicipalitySearch, 300)); - - useEffect(() => { - // Passed to the WrappedFlatList in order to make the selectedText reactable - // eslint-disable-next-line functional/immutable-data - refVal.current = searchText; - if (searchText) { - debounceRef.current(searchText); - } - }, [searchText]); - - const StateFlatList = ( - ( - { - props.onStateSelected(i.item); - props.onMunicipalitySelected(undefined); - hideModal(); - }} - > -

- {i.item.name} -

-
- )} - keyExtractor={i => i.name} - keyboardShouldPersistTaps={"handled"} - /> - ); - - return ( - <> - - - { - setSearchText(v.length === 0 ? undefined : v); - }} - title={I18n.t( - "bonus.sv.components.destinationSelector.municipality.title" - )} - label={I18n.t( - "bonus.sv.components.destinationSelector.municipality.label" - )} - placeholder={I18n.t( - "bonus.sv.components.destinationSelector.municipality.placeholder" - )} - disabled={props.selectedState === undefined} - showModalInputTextbox={true} - wrappedFlatlist={ - { - props.onMunicipalitySelected(selectedMunicipality); - props.resetAvailableMunicipalities(); - }} - onRetry={searchText => { - if (searchText) { - debounceRef.current(searchText); - } - }} - selectedText={refVal} - /> - } - selectedValue={props.selectedMunicipality?.name} - onClose={props.resetAvailableMunicipalities} - /> - - ); -}; - -const mapDispatchToProps = (dispatch: Dispatch) => ({ - requestAvailableMunicipalities: (subString: string) => - dispatch(svGenerateVoucherAvailableMunicipality.request(subString)), - resetAvailableMunicipalities: () => - dispatch(svGenerateVoucherResetAvailableMunicipality()) -}); -const mapStateToProps = (_: GlobalState) => ({}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(DestinationSelector); diff --git a/ts/features/bonus/siciliaVola/components/SvVoucherListFilters.tsx b/ts/features/bonus/siciliaVola/components/SvVoucherListFilters.tsx deleted file mode 100644 index bac26f0a022..00000000000 --- a/ts/features/bonus/siciliaVola/components/SvVoucherListFilters.tsx +++ /dev/null @@ -1,232 +0,0 @@ -import * as React from "react"; -import { useState } from "react"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { Body, Container, Left, ListItem, Right } from "native-base"; -import { View, Keyboard, SafeAreaView, ScrollView } from "react-native"; -import { Icon, VSpacer } from "@pagopa/io-app-design-system"; -import AppHeader from "../../../../components/ui/AppHeader"; -import ButtonDefaultOpacity from "../../../../components/ButtonDefaultOpacity"; -import { H5 } from "../../../../components/core/typography/H5"; -import I18n from "../../../../i18n"; -import { IOStyles } from "../../../../components/core/variables/IOStyles"; -import { H2 } from "../../../../components/core/typography/H2"; -import ItemSeparatorComponent from "../../../../components/ItemSeparatorComponent"; -import FooterWithButtons from "../../../../components/ui/FooterWithButtons"; -import { - cancelButtonProps, - confirmButtonProps -} from "../../../../components/buttons/ButtonConfigurations"; -import { LabelledItem } from "../../../../components/LabelledItem"; -import DateTimePicker from "../../../../components/ui/DateTimePicker"; -import { GlobalState } from "../../../../store/reducers/types"; -import { possibleVoucherStateSelector } from "../store/reducers/voucherList/possibleVoucherState"; -import { isReady } from "../../../../common/model/RemoteValue"; -import { StatoVoucherBean } from "../../../../../definitions/api_sicilia_vola/StatoVoucherBean"; -import { H4 } from "../../../../components/core/typography/H4"; -import { svSetFilter } from "../store/actions/voucherList"; -import { FilterState } from "../store/reducers/voucherList/filters"; - -type Props = ReturnType & - ReturnType & { - onClose: () => void; - onConfirm: () => void; - }; - -/** - * Component used to show and select the possible voucher state option using a radio button - * @param text - * @param value - * @param onPress - * @param checked - * @constructor - */ -const PossibleVoucherStateOption = ({ - text, - value, - onPress, - checked -}: { - text: string; - value: number; - onPress: (value: number) => void; - checked: boolean; -}) => ( - onPress(value)} - > -

- {text} -

- -
-); - -const SvVoucherListFilters: React.FunctionComponent = (props: Props) => { - const [searchValue, setSearchValue] = useState(undefined); - const [departureDate, setDepartureDate] = useState( - undefined - ); - const [returnDate, setReturnDate] = useState(undefined); - - const [voucherStatus, setVoucherStatus] = useState( - undefined - ); - - const onVoucherStatusSelect = (value: number) => { - setVoucherStatus(value); - Keyboard.dismiss(); - }; - - const renderVoucherStateItem = (possibleState: StatoVoucherBean) => - possibleState.idStato && possibleState.statoDesc ? ( - - ) : null; - - /** - * Clean the filter locally and in the store - */ - const onRemoveButton = () => { - setSearchValue(undefined); - setVoucherStatus(undefined); - setDepartureDate(undefined); - setReturnDate(undefined); - props.updateFilter({}); - props.onClose(); - }; - - const onConfirmButton = () => { - props.updateFilter({ - codiceVoucher: searchValue, - idStato: voucherStatus, - dataDa: departureDate, - dataA: returnDate - }); - props.onConfirm(); - }; - - const selectedFilters = - (voucherStatus !== undefined ? 1 : 0) + - (departureDate !== undefined ? 1 : 0) + - (returnDate !== undefined ? 1 : 0) + - (searchValue && searchValue.length > 0 ? 1 : 0); - - return ( - - - - -
- {I18n.t("bonus.sv.voucherList.filter.title")} -
- - - - - - -
- - - - - - {isReady(props.possibleVoucherState) && ( - <> -

- {I18n.t("bonus.sv.voucherList.filter.stateSection.title")} -

- - {props.possibleVoucherState.value.map((pVS, i) => ( - - {renderVoucherStateItem(pVS)} - - - ))} - - - )} - <> -

{I18n.t("bonus.sv.voucherList.filter.dateSection.title")}

- - - - - -
-
- -
-
- ); -}; - -const mapDispatchToProps = (dispatch: Dispatch) => ({ - updateFilter: (filter: FilterState) => dispatch(svSetFilter(filter)) -}); -const mapStateToProps = (state: GlobalState) => ({ - possibleVoucherState: possibleVoucherStateSelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(SvVoucherListFilters); diff --git a/ts/features/bonus/siciliaVola/components/VoucherDetailBottomsheet.tsx b/ts/features/bonus/siciliaVola/components/VoucherDetailBottomsheet.tsx deleted file mode 100644 index 6bc0dd13ef0..00000000000 --- a/ts/features/bonus/siciliaVola/components/VoucherDetailBottomsheet.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from "react"; -import { View } from "react-native"; -import { VSpacer } from "@pagopa/io-app-design-system"; -import { NetworkError } from "../../../../utils/errors"; -import { RemoteValue } from "../../../../common/model/RemoteValue"; -import VoucherInformationComponent from "./VoucherInformationComponent"; - -type Props = { - qrCode: string; - barCode: string; - pdfVoucherState: RemoteValue; -}; - -const VoucherDetailBottomSheet = (props: Props): React.ReactElement => ( - - - - -); - -export default VoucherDetailBottomSheet; diff --git a/ts/features/bonus/siciliaVola/components/VoucherInformationComponent.tsx b/ts/features/bonus/siciliaVola/components/VoucherInformationComponent.tsx deleted file mode 100644 index 15d5f95b9c3..00000000000 --- a/ts/features/bonus/siciliaVola/components/VoucherInformationComponent.tsx +++ /dev/null @@ -1,92 +0,0 @@ -import React from "react"; -import { View, Image, StyleSheet } from "react-native"; -import { HSpacer, VSpacer } from "@pagopa/io-app-design-system"; -import I18n from "../../../../i18n"; -import { H5 } from "../../../../components/core/typography/H5"; -import { H3 } from "../../../../components/core/typography/H3"; -import CopyButtonComponent from "../../../../components/CopyButtonComponent"; -import { withBase64Uri } from "../../../../utils/image"; -import { IOStyles } from "../../../../components/core/variables/IOStyles"; - -type Props = { - voucherCode: string; - qrCode: string; - barCode: string; - onPressWithGestureHandler?: true; -}; - -const styles = StyleSheet.create({ - qrCode: { - width: 249, - height: 249 - }, - barCode: { - width: 249, - height: 70 - }, - centerContentRow: { - flex: 1, - flexDirection: "row", - justifyContent: "center" - } -}); - -const VoucherInformationComponent = (props: Props): React.ReactElement => ( - <> -
- {I18n.t("bonus.sv.components.voucherVisualDetails.uniqueCode")} -
- - -

- {props.voucherCode} -

- - -
- -
- {I18n.t("bonus.sv.components.voucherVisualDetails.qrCode")} -
- - - -
- {I18n.t("bonus.sv.components.voucherVisualDetails.barCode")} -
- - - - - -); - -export default VoucherInformationComponent; diff --git a/ts/features/bonus/siciliaVola/components/WrappedMunicipalityFlatList.tsx b/ts/features/bonus/siciliaVola/components/WrappedMunicipalityFlatList.tsx deleted file mode 100644 index df304df66d7..00000000000 --- a/ts/features/bonus/siciliaVola/components/WrappedMunicipalityFlatList.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import { Dispatch } from "redux"; -import { connect } from "react-redux"; -import { View, ActivityIndicator, FlatList } from "react-native"; -import * as React from "react"; -import { ListItem } from "native-base"; -import { useContext } from "react"; -import { VSpacer } from "@pagopa/io-app-design-system"; -import { GlobalState } from "../../../../store/reducers/types"; -import { availableMunicipalitiesSelector } from "../store/reducers/voucherGeneration/availableMunicipalities"; -import { - isError, - isLoading, - isReady -} from "../../../../common/model/RemoteValue"; -import { toArray } from "../../../../store/helpers/indexer"; -import { H4 } from "../../../../components/core/typography/H4"; -import { Municipality } from "../types/SvVoucherRequest"; -import { LightModalContext } from "../../../../components/ui/LightModal"; -import I18n from "../../../../i18n"; -import { svGenerateVoucherAvailableMunicipality } from "../store/actions/voucherGeneration"; -import { Link } from "../../../../components/core/typography/Link"; - -type Props = { - onPress: (municipality: Municipality) => void; - onRetry: (s?: string) => void; - selectedText: React.MutableRefObject; -} & ReturnType & - ReturnType; - -const FooterLoading = () => ( - <> - - - -); - -const FooterError = (props: Props) => ( - -

- {I18n.t("bonus.sv.components.destinationSelector.municipality.ko.label1")} -

- { - if (props.selectedText.current) { - props.requestAvailableMunicipalities(props.selectedText.current); - } - }} - > - {I18n.t("bonus.sv.components.destinationSelector.municipality.ko.label2")} - -
-); - -const WrappedMunicipalityFlatList = (props: Props) => { - const { hideModal } = useContext(LightModalContext); - return ( - - ) : ( - isError(props.availableMunicipalities) && FooterError(props) - ) - } - renderItem={i => ( - { - props.onPress(i.item); - hideModal(); - }} - > -

- {i.item.name} -

-
- )} - keyExtractor={i => i.name} - keyboardShouldPersistTaps={"handled"} - /> - ); -}; - -const mapDispatchToProps = (dispatch: Dispatch) => ({ - requestAvailableMunicipalities: (subString: string) => - dispatch(svGenerateVoucherAvailableMunicipality.request(subString)) -}); -const mapStateToProps = (state: GlobalState) => ({ - availableMunicipalities: availableMunicipalitiesSelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(WrappedMunicipalityFlatList); diff --git a/ts/features/bonus/siciliaVola/components/__tests__/CheckResidenceComponent.test.tsx b/ts/features/bonus/siciliaVola/components/__tests__/CheckResidenceComponent.test.tsx deleted file mode 100644 index c5f8823a967..00000000000 --- a/ts/features/bonus/siciliaVola/components/__tests__/CheckResidenceComponent.test.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { fireEvent } from "@testing-library/react-native"; -import configureMockStore from "redux-mock-store"; -import I18n from "../../../../../i18n"; -import ROUTES from "../../../../../navigation/routes"; -import { applicationChangeState } from "../../../../../store/actions/application"; -import { appReducer } from "../../../../../store/reducers"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { renderScreenWithNavigationStoreContext } from "../../../../../utils/testWrapper"; -import { svGenerateVoucherCancel } from "../../store/actions/voucherGeneration"; - -import CheckResidenceComponent from "../CheckResidenceComponent"; - -jest.useFakeTimers(); - -describe("the CheckResidenceComponent", () => { - it("should render the title", () => { - const { component } = renderComponent(); - expect( - component.getByText( - I18n.t("bonus.sv.voucherGeneration.checkResidence.title") - ) - ).toBeDefined(); - }); - - it("should render two radio buttons", () => { - const { component } = renderComponent(); - const itemYes = component.getByText( - I18n.t("bonus.sv.voucherGeneration.checkResidence.items.inSicily") - ); - expect(itemYes).toBeDefined(); - const itemNo = component.getByText( - I18n.t("bonus.sv.voucherGeneration.checkResidence.items.notInSicily") - ); - expect(itemNo).toBeDefined(); - }); - - it("should render the information text", () => { - const { component } = renderComponent(); - expect( - component.getByText( - I18n.t("bonus.sv.voucherGeneration.checkResidence.info") - ) - ).toBeDefined(); - }); - - describe("when the cancel button is pressed", () => { - it("should dispatch a `svGenerateVoucherCancel` action", () => { - const { component, store } = renderComponent(); - const cancelButton = component.getByText(I18n.t("global.buttons.cancel")); - fireEvent(cancelButton, "onPress"); - expect(store.getActions()).toEqual([svGenerateVoucherCancel()]); - }); - }); -}); - -function renderComponent() { - const globalState = appReducer(undefined, applicationChangeState("active")); - const mockStore = configureMockStore(); - const store = mockStore(globalState); - return { - component: renderScreenWithNavigationStoreContext( - CheckResidenceComponent, - ROUTES.MAIN, - {}, - store - ), - store - }; -} diff --git a/ts/features/bonus/siciliaVola/saga/index.ts b/ts/features/bonus/siciliaVola/saga/index.ts deleted file mode 100644 index b438c781265..00000000000 --- a/ts/features/bonus/siciliaVola/saga/index.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { takeLatest } from "typed-redux-saga/macro"; -import { getType } from "typesafe-actions"; -import { SagaIterator } from "redux-saga"; -import * as O from "fp-ts/lib/Option"; -import * as E from "fp-ts/lib/Either"; -import { SessionManager } from "../../../../utils/SessionManager"; -import { apiUrlPrefix } from "../../../../config"; -import { - svGenerateVoucherAvailableDestination, - svGenerateVoucherAvailableMunicipality, - svGenerateVoucherAvailableState, - svGenerateVoucherGeneratedVoucher, - svGenerateVoucherStart, - svGetPdfVoucher -} from "../store/actions/voucherGeneration"; -import { BackendSiciliaVolaClient } from "../api/backendSiciliaVola"; -import { SessionToken } from "../../../../types/SessionToken"; -import { MitVoucherToken } from "../../../../../definitions/io_sicilia_vola_token/MitVoucherToken"; -import { - svAcceptTos, - svServiceAlive, - svTosAccepted -} from "../store/actions/activation"; -import { - svPossibleVoucherStateGet, - svVoucherDetailGet, - svVoucherListGet, - svVoucherRevocation -} from "../store/actions/voucherList"; -import { handleSvVoucherGenerationStartActivationSaga } from "./orchestration/voucherGeneration"; -import { handleSvServiceAlive } from "./networking/handleSvServiceAlive"; -import { handleGetStatiUE } from "./networking/handleGetStatiUE"; -import { handleSvTosAccepted } from "./networking/handleSvTosAccepted"; -import { handleGetListaComuniBySiglaProvincia } from "./networking/handleGetListaComuniBySiglaProvincia"; -import { handleGetDettaglioVoucher } from "./networking/handleGetDettaglioVoucher"; -import { handlePostAggiungiVoucher } from "./networking/handlePostAggiungiVoucher"; -import { handleGetVoucherBeneficiario } from "./networking/handleGetVoucherBeneficiario"; -import { handleSvAccepTos } from "./networking/handleSvAcceptTos"; -import { handleGetAeroportiAmmessi } from "./networking/handleGetAeroportAmmessi"; -import { handleVoucherRevocation } from "./networking/handleVoucherRevocation"; -import { handleGetVoucheStati } from "./networking/handleGetVoucherStati"; -import { handleGetStampaVoucher } from "./networking/handleGetStampaVoucher"; - -export function* watchBonusSvSaga(sessionToken: SessionToken): SagaIterator { - // Client for the Sicilia Vola - const siciliaVolaClient: BackendSiciliaVolaClient = BackendSiciliaVolaClient( - apiUrlPrefix, - sessionToken - ); - - // Helper function that requests a new session token from the SiciliaVola. - // When calling the Sv APIs, we must use separate session, generated from the - // sessionToken. - const getSiciliaVolaSessionToken = async () => { - try { - const response = await siciliaVolaClient.getMitVoucherToken(sessionToken); - if (E.isRight(response) && response.right.status === 200) { - return O.some(response.right.value); - } - return O.none; - } catch { - return O.none; - } - }; - // The session manager for SiciliaVola (Sv) will manage the - // refreshing of the Sv session when calling its APIs, keeping a shared token - // and serializing the refresh requests. - const svSessionManager: SessionManager = new SessionManager( - getSiciliaVolaSessionToken - ); - - // SV Activation workflow - yield* takeLatest( - getType(svGenerateVoucherStart), - handleSvVoucherGenerationStartActivationSaga - ); - - // SV get check if the service is alive - yield* takeLatest(getType(svServiceAlive.request), handleSvServiceAlive); - - // SV get check if the user already accepted the ToS - // TODO: pass svSessionManager in order to send the MitVoucherToken - yield* takeLatest(getType(svTosAccepted.request), handleSvTosAccepted); - - // SV post the user tos acceptance - // TODO: pass svSessionManager in order to send the MitVoucherToken - yield* takeLatest(getType(svAcceptTos.request), handleSvAccepTos); - - // SV get the list of UE state - yield* takeLatest( - getType(svGenerateVoucherAvailableState.request), - handleGetStatiUE, - siciliaVolaClient.getStatiUE - ); - - // SV get the list municipalities given a province - yield* takeLatest( - getType(svGenerateVoucherAvailableMunicipality.request), - handleGetListaComuniBySiglaProvincia, - siciliaVolaClient.getListaComuniBySiglaProvincia - ); - - // SV get the list of available destination given a region when the selected state is Italy - yield* takeLatest( - getType(svGenerateVoucherAvailableDestination.request), - handleGetAeroportiAmmessi, - siciliaVolaClient.getAeroportiAmmessi, - svSessionManager - ); - - // SV post the voucher request - yield* takeLatest( - getType(svGenerateVoucherGeneratedVoucher.request), - handlePostAggiungiVoucher, - svSessionManager - ); - - // SV get the vouchers list already generated - yield* takeLatest( - getType(svVoucherListGet.request), - handleGetVoucherBeneficiario, - siciliaVolaClient.getVoucherBeneficiario, - svSessionManager - ); - - // SV get the list of the possible voucher state - yield* takeLatest( - getType(svPossibleVoucherStateGet.request), - handleGetVoucheStati, - siciliaVolaClient.getStatiVoucher, - svSessionManager - ); - - // SV get the voucher details - // TODO: pass the client when it will be created - yield* takeLatest( - getType(svVoucherDetailGet.request), - handleGetDettaglioVoucher, - svSessionManager - ); - - // SV post the voucher revocation - yield* takeLatest( - getType(svVoucherRevocation.request), - handleVoucherRevocation, - siciliaVolaClient.postAnnullaVoucher, - svSessionManager - ); - - yield* takeLatest( - getType(svGetPdfVoucher.request), - handleGetStampaVoucher, - siciliaVolaClient.getStampaVoucher, - svSessionManager - ); -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleGetAeroportAmmessi.ts b/ts/features/bonus/siciliaVola/saga/networking/handleGetAeroportAmmessi.ts deleted file mode 100644 index c3960dc1cbb..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleGetAeroportAmmessi.ts +++ /dev/null @@ -1,73 +0,0 @@ -import * as E from "fp-ts/lib/Either"; -import { call, put } from "typed-redux-saga/macro"; -import { ActionType } from "typesafe-actions"; -import { AeroportoSedeBeanList } from "../../../../../../definitions/api_sicilia_vola/AeroportoSedeBeanList"; -import { MitVoucherToken } from "../../../../../../definitions/io_sicilia_vola_token/MitVoucherToken"; -import { SagaCallReturnType } from "../../../../../types/utils"; -import { getGenericError, getNetworkError } from "../../../../../utils/errors"; -import { isDefined } from "../../../../../utils/guards"; -import { SessionManager } from "../../../../../utils/SessionManager"; -import { BackendSiciliaVolaClient } from "../../api/backendSiciliaVola"; -import { svGenerateVoucherAvailableDestination } from "../../store/actions/voucherGeneration"; -import { AvailableDestinations } from "../../types/SvVoucherRequest"; - -const mapKinds: Record = { - 400: "wrongFormat", - 500: "ServerError" -}; - -// convert a success response to the logical app representation of it -const convertSuccess = ( - availableDestinations: AeroportoSedeBeanList -): AvailableDestinations => - availableDestinations - .map(d => (d.denominazione ? d.denominazione : undefined)) - .filter(isDefined); - -export function* handleGetAeroportiAmmessi( - getAeroportiAmmessi: ReturnType< - typeof BackendSiciliaVolaClient - >["getAeroportiAmmessi"], - svSessionManager: SessionManager, - action: ActionType -) { - try { - const request = svSessionManager.withRefresh( - getAeroportiAmmessi(action.payload) - ); - const getAeroportiAmmessiResult: SagaCallReturnType = - yield* call(request); - - if (E.isRight(getAeroportiAmmessiResult)) { - if (getAeroportiAmmessiResult.right.status === 200) { - yield* put( - svGenerateVoucherAvailableDestination.success( - convertSuccess(getAeroportiAmmessiResult.right.value) - ) - ); - return; - } - if (mapKinds[getAeroportiAmmessiResult.right.status] !== undefined) { - yield* put( - svGenerateVoucherAvailableDestination.failure({ - ...getGenericError( - new Error(mapKinds[getAeroportiAmmessiResult.right.status]) - ) - }) - ); - return; - } - } - yield* put( - svGenerateVoucherAvailableDestination.failure({ - ...getGenericError( - new Error("Invalid payload from getAeroportiBeneficiarioResult") - ) - }) - ); - } catch (e) { - yield* put( - svGenerateVoucherAvailableDestination.failure({ ...getNetworkError(e) }) - ); - } -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleGetDettaglioVoucher.ts b/ts/features/bonus/siciliaVola/saga/networking/handleGetDettaglioVoucher.ts deleted file mode 100644 index 7ab2be6e9ea..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleGetDettaglioVoucher.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { ActionType } from "typesafe-actions"; -import { delay, put } from "typed-redux-saga/macro"; -import { svVoucherDetailGet } from "../../store/actions/voucherList"; -import { SvVoucher } from "../../types/SvVoucher"; -import { SessionManager } from "../../../../../utils/SessionManager"; -import { MitVoucherToken } from "../../../../../../definitions/io_sicilia_vola_token/MitVoucherToken"; -import { ReduxSagaEffect } from "../../../../../types/utils"; - -/** - * Handle the remote call to check if the service is alive - * @param __ - * @param _ - */ -// TODO: add client as parameter when the client will be created -export function* handleGetDettaglioVoucher( - __: SessionManager, - _: ActionType -): Generator { - // TODO: add networking logic - yield* delay(500); - const stubVoucher = { - id: 123456, - beneficiary: "Mario Rossi", - category: "student", - university: { - universityName: "Università Cattolica", - municipality: { id: "1", name: "Milano" } - }, - departureDate: new Date(), - availableDestination: [ - "Catania - Fontanarossa", - "Palermo - Falcone e Borsellino", - "Milano - Malpensa", - "Bergamo - Orio al serio" - ] as ReadonlyArray, - qrCode: - "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AQAAAACgl2eQAAAAz0lEQVR42u3YQQ6EIAwF0N68PdrcjMHSFtRoJrPkf4wG5K0aaUFp7+0jBAQEBAQ/ABNv2nvarxrBAR3PvOY7NNCDMyZ7fHKECypc4MCXDDSYbI4AQaTOSCDPmXZzkG0E56Xybg7M14kn0SNcfisqOIi2WVkBwSwkPlkdSOA59Py5oAGT8TY2WuK7LUCwfjTtFCksUIW1nnqPJALIrZV3MqciguUAErFCBpb7jGbXHxRQICuKPJ9YNwfFlmICCCqRxnn0tnAwAP9XExAQEPwNvr/Ly7QrJMNyAAAAAElFTkSuQmCC", - barCode: - "iVBORw0KGgoAAAANSUhEUgAAAJYAAABQAQAAAADTy7HmAAAALElEQVR42mP4/zO/UMX1WWdJn15k9c6qdJH/fxhGxUbFRsVGxUbFRsUIiAEAxCE9PtkFIH0AAAAASUVORK5CYII=" - } as SvVoucher; - yield* put(svVoucherDetailGet.success(stubVoucher)); -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleGetListaComuniBySiglaProvincia.ts b/ts/features/bonus/siciliaVola/saga/networking/handleGetListaComuniBySiglaProvincia.ts deleted file mode 100644 index ce0b2361846..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleGetListaComuniBySiglaProvincia.ts +++ /dev/null @@ -1,72 +0,0 @@ -import * as E from "fp-ts/lib/Either"; -import { call, put } from "typed-redux-saga/macro"; -import { ActionType } from "typesafe-actions"; -import { ComuneBeanList } from "../../../../../../definitions/api_sicilia_vola/ComuneBeanList"; -import { SagaCallReturnType } from "../../../../../types/utils"; -import { getGenericError, getNetworkError } from "../../../../../utils/errors"; -import { BackendSiciliaVolaClient } from "../../api/backendSiciliaVola"; -import { svGenerateVoucherAvailableMunicipality } from "../../store/actions/voucherGeneration"; -import { Municipality } from "../../types/SvVoucherRequest"; - -// TODO: add the mapping when the swagger will be fixed -const mapKinds: Record = {}; - -// convert a success response to the logical app representation of it -// TODO: remove the mock when the swagger is completed -const convertSuccess = ( - listaComuni: ComuneBeanList -): ReadonlyArray => - listaComuni.flatMap(r => - r.codiceCatastale && r.descrizioneComune - ? [ - { - id: r.codiceCatastale, - name: r.descrizioneComune, - latitude: 1, - longitude: 1 - } - ] - : [] - ); - -export function* handleGetListaComuniBySiglaProvincia( - getListaComuni: ReturnType< - typeof BackendSiciliaVolaClient - >["getListaComuniBySiglaProvincia"], - action: ActionType -) { - try { - const getListaComuniResult: SagaCallReturnType = - yield* call(getListaComuni, { siglaProvincia: action.payload }); - - if (E.isRight(getListaComuniResult)) { - if (getListaComuniResult.right.status === 200) { - yield* put( - svGenerateVoucherAvailableMunicipality.success( - convertSuccess(getListaComuniResult.right.value) - ) - ); - return; - } - if (mapKinds[getListaComuniResult.right.status] !== undefined) { - yield* put( - svGenerateVoucherAvailableMunicipality.failure({ - ...getGenericError( - new Error(mapKinds[getListaComuniResult.right.status]) - ) - }) - ); - return; - } - } - yield* put( - svGenerateVoucherAvailableMunicipality.failure({ - ...getGenericError(new Error("Generic Error")) - }) - ); - } catch (e) { - yield* put( - svGenerateVoucherAvailableMunicipality.failure({ ...getNetworkError(e) }) - ); - } -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleGetStampaVoucher.ts b/ts/features/bonus/siciliaVola/saga/networking/handleGetStampaVoucher.ts deleted file mode 100644 index 7851ea359a3..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleGetStampaVoucher.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { readableReport } from "@pagopa/ts-commons/lib/reporters"; -import * as E from "fp-ts/lib/Either"; -import { Platform } from "react-native"; -import RNFS from "react-native-fs"; -import { call, put } from "typed-redux-saga/macro"; -import { ActionType } from "typesafe-actions"; -import { MitVoucherToken } from "../../../../../../definitions/io_sicilia_vola_token/MitVoucherToken"; -import { SagaCallReturnType } from "../../../../../types/utils"; -import { waitBackoffError } from "../../../../../utils/backoffError"; -import { getGenericError, getNetworkError } from "../../../../../utils/errors"; -import { SessionManager } from "../../../../../utils/SessionManager"; -import { BackendSiciliaVolaClient } from "../../api/backendSiciliaVola"; -import { svGetPdfVoucher } from "../../store/actions/voucherGeneration"; -import { svPossibleVoucherStateGet } from "../../store/actions/voucherList"; - -/** - * Handle the remote call that allows the user to download and save the voucher - */ -export function* handleGetStampaVoucher( - getStampaVoucher: ReturnType< - typeof BackendSiciliaVolaClient - >["getStampaVoucher"], - svSessionManager: SessionManager, - action: ActionType -) { - const fPath = Platform.select({ - ios: RNFS.DocumentDirectoryPath, - default: RNFS.DownloadDirectoryPath - }); - - const voucherFilename = "sicilia_vola"; - - try { - yield* call(waitBackoffError, svGetPdfVoucher.failure); - const request = svSessionManager.withRefresh( - getStampaVoucher({ codiceVoucher: action.payload }) - ); - const getStampaVoucherResult: SagaCallReturnType = - yield* call(request); - - if (E.isRight(getStampaVoucherResult)) { - if (getStampaVoucherResult.right.status === 200) { - try { - yield* call( - RNFS.writeFile, - `${fPath}/${voucherFilename}.pdf`, - getStampaVoucherResult.right.value.data, - "base64" - ); - yield* put(svGetPdfVoucher.success(fPath)); - } catch (e) { - yield* put(svPossibleVoucherStateGet.failure(getNetworkError(e))); - } - - return; - } - - yield* put( - svGetPdfVoucher.failure( - getGenericError( - new Error(`response status ${getStampaVoucherResult.right.status}`) - ) - ) - ); - return; - } - yield* put( - svPossibleVoucherStateGet.failure( - getGenericError(new Error(readableReport(getStampaVoucherResult.left))) - ) - ); - } catch (e) { - yield* put(svGetPdfVoucher.failure(getNetworkError(e))); - } -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleGetStatiUE.ts b/ts/features/bonus/siciliaVola/saga/networking/handleGetStatiUE.ts deleted file mode 100644 index f1af69ea3cc..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleGetStatiUE.ts +++ /dev/null @@ -1,67 +0,0 @@ -import * as E from "fp-ts/lib/Either"; -import { call, put } from "typed-redux-saga/macro"; -import { ActionType } from "typesafe-actions"; -import { StatoUEBeanList } from "../../../../../../definitions/api_sicilia_vola/StatoUEBeanList"; -import { SagaCallReturnType } from "../../../../../types/utils"; -import { getGenericError, getNetworkError } from "../../../../../utils/errors"; -import { isDefined } from "../../../../../utils/guards"; -import { BackendSiciliaVolaClient } from "../../api/backendSiciliaVola"; -import { svGenerateVoucherAvailableState } from "../../store/actions/voucherGeneration"; -import { State } from "../../types/SvVoucherRequest"; - -// TODO: add the mapping when the swagger will be fixed -const mapKinds: Record = {}; - -// convert a success response to the logical app representation of it -const convertSuccess = (statiUE: StatoUEBeanList): ReadonlyArray => - statiUE - .map(s => - s.id && s.descrizione - ? { - id: s.id, - name: s.descrizione - } - : undefined - ) - .filter(isDefined); - -export function* handleGetStatiUE( - getStatiUE: ReturnType["getStatiUE"], - _: ActionType -) { - try { - const getStatiUEResult: SagaCallReturnType = yield* call( - getStatiUE, - {} - ); - if (E.isRight(getStatiUEResult)) { - if (getStatiUEResult.right.status === 200) { - yield* put( - svGenerateVoucherAvailableState.success( - convertSuccess(getStatiUEResult.right.value) - ) - ); - return; - } - if (mapKinds[getStatiUEResult.right.status] !== undefined) { - yield* put( - svGenerateVoucherAvailableState.failure({ - ...getGenericError( - new Error(mapKinds[getStatiUEResult.right.status]) - ) - }) - ); - return; - } - } - yield* put( - svGenerateVoucherAvailableState.failure({ - ...getGenericError(new Error("Generic Error")) - }) - ); - } catch (e) { - yield* put( - svGenerateVoucherAvailableState.failure({ ...getNetworkError(e) }) - ); - } -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleGetVoucherBeneficiario.ts b/ts/features/bonus/siciliaVola/saga/networking/handleGetVoucherBeneficiario.ts deleted file mode 100644 index 28e6a68c9e9..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleGetVoucherBeneficiario.ts +++ /dev/null @@ -1,89 +0,0 @@ -import * as E from "fp-ts/lib/Either"; -import { call, put, select } from "typed-redux-saga/macro"; -import { ActionType } from "typesafe-actions"; -import { ListaVoucherBeneficiarioOutputBean } from "../../../../../../definitions/api_sicilia_vola/ListaVoucherBeneficiarioOutputBean"; -import { MitVoucherToken } from "../../../../../../definitions/io_sicilia_vola_token/MitVoucherToken"; -import { SagaCallReturnType } from "../../../../../types/utils"; -import { waitBackoffError } from "../../../../../utils/backoffError"; -import { getGenericError, getNetworkError } from "../../../../../utils/errors"; -import { isDefined } from "../../../../../utils/guards"; -import { SessionManager } from "../../../../../utils/SessionManager"; -import { BackendSiciliaVolaClient } from "../../api/backendSiciliaVola"; -import { svVoucherListGet } from "../../store/actions/voucherList"; -import { svVouchersListUiSelector } from "../../store/reducers/voucherList/ui"; -import { SvVoucherId } from "../../types/SvVoucher"; -import { SvVoucherListResponse } from "../../types/SvVoucherResponse"; - -// convert a success response to the logical app representation of it -const convertSuccess = ( - voucherBeneficiario: ListaVoucherBeneficiarioOutputBean -): SvVoucherListResponse => { - if (voucherBeneficiario.listaRisultati) { - return voucherBeneficiario.listaRisultati - .map(v => - v.idVoucher !== undefined && - v.aeroportoDest !== undefined && - v.dataVolo !== undefined - ? { - idVoucher: v.idVoucher as SvVoucherId, - departureDate: v.dataVolo, - destination: v.aeroportoDest - } - : undefined - ) - .filter(isDefined); - } else { - return []; - } -}; - -export function* handleGetVoucherBeneficiario( - getVoucherBeneficiario: ReturnType< - typeof BackendSiciliaVolaClient - >["getVoucherBeneficiario"], - _: SessionManager, - action: ActionType -) { - const pagination = true; - const elementsXPage = 10; - - try { - yield* call(waitBackoffError, svVoucherListGet.failure); - const { nextPage }: ReturnType = - yield* select(svVouchersListUiSelector); - - // TODO: add MitVoucherToken - const getVoucherBeneficiarioResult: SagaCallReturnType< - typeof getVoucherBeneficiario - > = yield* call(getVoucherBeneficiario, { - ...action.payload, - pagination, - pageNum: nextPage, - elementsXPage - }); - - if (E.isRight(getVoucherBeneficiarioResult)) { - if (getVoucherBeneficiarioResult.right.status === 200) { - yield* put( - svVoucherListGet.success( - convertSuccess(getVoucherBeneficiarioResult.right.value) - ) - ); - return; - } - - // TODO: manage error case and dispatch of last page when the swagger will be updated - if (getVoucherBeneficiarioResult.right.status === 500) { - yield* put(svVoucherListGet.success([])); - return; - } - } - yield* put( - svVoucherListGet.failure({ - ...getGenericError(new Error("Generic Error")) - }) - ); - } catch (e) { - yield* put(svVoucherListGet.failure({ ...getNetworkError(e) })); - } -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleGetVoucherStati.ts b/ts/features/bonus/siciliaVola/saga/networking/handleGetVoucherStati.ts deleted file mode 100644 index 2af8bfb1525..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleGetVoucherStati.ts +++ /dev/null @@ -1,55 +0,0 @@ -import * as E from "fp-ts/lib/Either"; -import { call, put } from "typed-redux-saga/macro"; -import { ActionType } from "typesafe-actions"; -import { MitVoucherToken } from "../../../../../../definitions/io_sicilia_vola_token/MitVoucherToken"; -import { SagaCallReturnType } from "../../../../../types/utils"; -import { waitBackoffError } from "../../../../../utils/backoffError"; -import { getGenericError, getNetworkError } from "../../../../../utils/errors"; -import { SessionManager } from "../../../../../utils/SessionManager"; -import { BackendSiciliaVolaClient } from "../../api/backendSiciliaVola"; -import { svPossibleVoucherStateGet } from "../../store/actions/voucherList"; - -// TODO: add the mapping when the swagger will be fixed -const mapKinds: Record = {}; - -export function* handleGetVoucheStati( - getStatiVoucher: ReturnType< - typeof BackendSiciliaVolaClient - >["getStatiVoucher"], - _: SessionManager, - __: ActionType -) { - try { - yield* call(waitBackoffError, svPossibleVoucherStateGet.failure); - - // TODO: add MitVoucherToken - const getStatiVoucherResult: SagaCallReturnType = - yield* call(getStatiVoucher, {}); - - if (E.isRight(getStatiVoucherResult)) { - if (getStatiVoucherResult.right.status === 200) { - yield* put( - svPossibleVoucherStateGet.success(getStatiVoucherResult.right.value) - ); - return; - } - if (mapKinds[getStatiVoucherResult.right.status] !== undefined) { - yield* put( - svPossibleVoucherStateGet.failure({ - ...getGenericError( - new Error(mapKinds[getStatiVoucherResult.right.status]) - ) - }) - ); - return; - } - } - yield* put( - svPossibleVoucherStateGet.failure({ - ...getGenericError(new Error("Generic Error")) - }) - ); - } catch (e) { - yield* put(svPossibleVoucherStateGet.failure(getNetworkError(e))); - } -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handlePostAggiungiVoucher.ts b/ts/features/bonus/siciliaVola/saga/networking/handlePostAggiungiVoucher.ts deleted file mode 100644 index eea5bbf9246..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handlePostAggiungiVoucher.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { ActionType } from "typesafe-actions"; -import { delay, put } from "typed-redux-saga/macro"; -import { SessionManager } from "../../../../../utils/SessionManager"; -import { MitVoucherToken } from "../../../../../../definitions/io_sicilia_vola_token/MitVoucherToken"; -import { svGenerateVoucherGeneratedVoucher } from "../../store/actions/voucherGeneration"; -import { SvVoucherGeneratedResponse } from "../../types/SvVoucherResponse"; -import { SvVoucher } from "../../types/SvVoucher"; -import { ReduxSagaEffect } from "../../../../../types/utils"; - -/** - * Handle the remote call to check if the service is alive - * @param __ - * @param _ - */ -// TODO: add client as parameter when the client will be created -export function* handlePostAggiungiVoucher( - __: SessionManager, - _: ActionType -): Generator { - // TODO: add networking logic - yield* delay(500); - const stubVoucher = { - id: 123456, - beneficiary: "Mario Rossi", - category: "student", - university: { - universityName: "Università Cattolica", - municipality: { id: "1", name: "Milano" } - }, - departureDate: new Date(), - availableDestination: [ - "Catania - Fontanarossa", - "Palermo - Falcone e Borsellino", - "Milano - Malpensa", - "Bergamo - Orio al serio" - ] as ReadonlyArray, - qrCode: - "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6AQAAAACgl2eQAAAAz0lEQVR42u3YQQ6EIAwF0N68PdrcjMHSFtRoJrPkf4wG5K0aaUFp7+0jBAQEBAQ/ABNv2nvarxrBAR3PvOY7NNCDMyZ7fHKECypc4MCXDDSYbI4AQaTOSCDPmXZzkG0E56Xybg7M14kn0SNcfisqOIi2WVkBwSwkPlkdSOA59Py5oAGT8TY2WuK7LUCwfjTtFCksUIW1nnqPJALIrZV3MqciguUAErFCBpb7jGbXHxRQICuKPJ9YNwfFlmICCCqRxnn0tnAwAP9XExAQEPwNvr/Ly7QrJMNyAAAAAElFTkSuQmCC", - barCode: - "iVBORw0KGgoAAAANSUhEUgAAAJYAAABQAQAAAADTy7HmAAAALElEQVR42mP4/zO/UMX1WWdJn15k9c6qdJH/fxhGxUbFRsVGxUbFRsUIiAEAxCE9PtkFIH0AAAAASUVORK5CYII=" - } as SvVoucher; - yield* put( - svGenerateVoucherGeneratedVoucher.success({ - kind: "success", - value: stubVoucher - } as SvVoucherGeneratedResponse) - ); -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleSvAcceptTos.ts b/ts/features/bonus/siciliaVola/saga/networking/handleSvAcceptTos.ts deleted file mode 100644 index 2d7bd164073..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleSvAcceptTos.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ActionType } from "typesafe-actions"; -import { delay, put } from "typed-redux-saga/macro"; -import { svAcceptTos } from "../../store/actions/activation"; -import { ReduxSagaEffect } from "../../../../../types/utils"; - -/** - * Handle the remote call to check if the service is alive - * @param _ - */ -export function* handleSvAccepTos( - _: ActionType -): Generator { - // TODO: add networking logic - yield* delay(500); - yield* put(svAcceptTos.success(true)); -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleSvServiceAlive.ts b/ts/features/bonus/siciliaVola/saga/networking/handleSvServiceAlive.ts deleted file mode 100644 index f66ebe8c064..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleSvServiceAlive.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ActionType } from "typesafe-actions"; -import { delay, put } from "typed-redux-saga/macro"; -import { svServiceAlive } from "../../store/actions/activation"; -import { ReduxSagaEffect } from "../../../../../types/utils"; - -/** - * Handle the remote call to check if the service is alive - * @param _ - */ -export function* handleSvServiceAlive( - _: ActionType -): Generator { - // TODO: add networking logic - yield* delay(500); - yield* put(svServiceAlive.success(true)); -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleSvTosAccepted.ts b/ts/features/bonus/siciliaVola/saga/networking/handleSvTosAccepted.ts deleted file mode 100644 index 341f48ee471..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleSvTosAccepted.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ActionType } from "typesafe-actions"; -import { delay, put } from "typed-redux-saga/macro"; -import { svTosAccepted } from "../../store/actions/activation"; -import { ReduxSagaEffect } from "../../../../../types/utils"; - -/** - * Handle the remote call to check if the service is alive - * @param _ - */ -export function* handleSvTosAccepted( - _: ActionType -): Generator { - // TODO: add networking logic - yield* delay(500); - yield* put(svTosAccepted.success(true)); -} diff --git a/ts/features/bonus/siciliaVola/saga/networking/handleVoucherRevocation.ts b/ts/features/bonus/siciliaVola/saga/networking/handleVoucherRevocation.ts deleted file mode 100644 index c1b67a07666..00000000000 --- a/ts/features/bonus/siciliaVola/saga/networking/handleVoucherRevocation.ts +++ /dev/null @@ -1,53 +0,0 @@ -import * as E from "fp-ts/lib/Either"; -import { call, put } from "typed-redux-saga/macro"; -import { ActionType } from "typesafe-actions"; -import { MitVoucherToken } from "../../../../../../definitions/io_sicilia_vola_token/MitVoucherToken"; -import { SagaCallReturnType } from "../../../../../types/utils"; -import { getGenericError, getNetworkError } from "../../../../../utils/errors"; -import { SessionManager } from "../../../../../utils/SessionManager"; -import { BackendSiciliaVolaClient } from "../../api/backendSiciliaVola"; -import { svVoucherRevocation } from "../../store/actions/voucherList"; - -/** - * Handle the voucher revocation - * @param postAnnullaVoucher - * @param svSessionManager - * @param action - */ -export function* handleVoucherRevocation( - postAnnullaVoucher: ReturnType< - typeof BackendSiciliaVolaClient - >["postAnnullaVoucher"], - svSessionManager: SessionManager, - action: ActionType -) { - try { - const request = svSessionManager.withRefresh( - postAnnullaVoucher({ codiceVoucher: action.payload }) - ); - const postAnnullaVoucherResult: SagaCallReturnType = - yield* call(request); - - if (E.isRight(postAnnullaVoucherResult)) { - if (postAnnullaVoucherResult.right.status === 200) { - yield* put(svVoucherRevocation.success()); - return; - } - yield* put( - svVoucherRevocation.failure( - getGenericError( - new Error( - `response status ${postAnnullaVoucherResult.right.status}` - ) - ) - ) - ); - return; - } - yield* put( - svVoucherRevocation.failure(getGenericError(new Error("Generic Error"))) - ); - } catch (e) { - yield* put(svVoucherRevocation.failure(getNetworkError(e))); - } -} diff --git a/ts/features/bonus/siciliaVola/saga/orchestration/voucherGeneration.ts b/ts/features/bonus/siciliaVola/saga/orchestration/voucherGeneration.ts deleted file mode 100644 index 02a78f95b9c..00000000000 --- a/ts/features/bonus/siciliaVola/saga/orchestration/voucherGeneration.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { SagaIterator } from "redux-saga"; -import { call } from "typed-redux-saga/macro"; -import NavigationService from "../../../../../navigation/NavigationService"; -import { - executeWorkUnit, - withResetNavigationStack -} from "../../../../../sagas/workUnit"; -import { - navigateBack, - navigateToWorkunitGenericFailureScreen -} from "../../../../../store/actions/navigation"; -import { SagaCallReturnType } from "../../../../../types/utils"; -import { - svGenerateVoucherBack, - svGenerateVoucherCancel, - svGenerateVoucherCompleted -} from "../../store/actions/voucherGeneration"; - -/** - * Define the workflow that allows the user to generate a new voucher. - * The workflow ends when: - * - The user send the request to generate a new voucher {@link svGenerateVoucherCompleted} - * - The user aborts the voucher generation {@link svGenerateVoucherCancel} - * - The user chooses back from the first screen {@link svGenerateVoucherBack} - */ -// eslint-disable-next-line require-yield -function* svVoucherGenerationWorkUnit() { - return null; -} - -/** - * This saga handles the SV activation workflow - */ -export function* handleSvVoucherGenerationStartActivationSaga(): SagaIterator { - const initialRoute: ReturnType = - yield* call(NavigationService.getCurrentRouteName); - - const sagaExecution = () => - withResetNavigationStack(svVoucherGenerationWorkUnit); - - const res: SagaCallReturnType | null = yield* call( - sagaExecution - ); - - if ( - // if the activation started from the CTA -> go back - initialRoute === null - ) { - yield* call(navigateBack); - } - - if (res === "failure") { - yield* call(navigateToWorkunitGenericFailureScreen); - } -} diff --git a/ts/features/bonus/siciliaVola/saga/placeholder b/ts/features/bonus/siciliaVola/saga/placeholder deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/CheckStatusRouterScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/CheckStatusRouterScreen.tsx deleted file mode 100644 index bdf13fd8cf1..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/CheckStatusRouterScreen.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import * as React from "react"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { constNull } from "fp-ts/lib/function"; -import { Alert } from "react-native"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { - svGenerateVoucherBack, - svGenerateVoucherCancel, - svGenerateVoucherStart -} from "../../store/actions/voucherGeneration"; -import { - isAliveSelector, - tosAcceptedSelector -} from "../../store/reducers/activation"; -import GenericErrorComponent from "../../../../../components/screens/GenericErrorComponent"; -import { svServiceAlive, svTosAccepted } from "../../store/actions/activation"; -import { - fold, - isLoading, - isReady -} from "../../../../../common/model/RemoteValue"; -import { LoadingErrorComponent } from "../../../../../components/LoadingErrorComponent"; -import AcceptTosComponent from "../../components/AcceptTosComponent"; -import CheckResidenceComponent from "../../components/CheckResidenceComponent"; -import I18n from "../../../../../i18n"; - -type Props = ReturnType & - ReturnType; - -const CheckStatusRouterScreen = (props: Props): React.ReactElement => { - const { start, checkServiceAvailable, checkTosAccepted } = props; - - React.useEffect(() => { - start(); - checkServiceAvailable(); - checkTosAccepted(); - }, [start, checkServiceAvailable, checkTosAccepted]); - - if ( - !isReady(props.isServiceAlive) || - (isReady(props.isServiceAlive) && !props.isServiceAlive.value) - ) { - return ( - - ); - } - - const handleTosCancel = () => { - props.cancel(); - }; - - const handleTosAccepted = () => { - Alert.alert( - I18n.t("bonus.sv.voucherGeneration.acceptTos.alert.title"), - I18n.t("bonus.sv.voucherGeneration.acceptTos.alert.message"), - [ - { - text: I18n.t("bonus.sv.voucherGeneration.acceptTos.alert.buttons.ok"), - style: "default", - // TODO replace with the effective implementation - onPress: constNull - }, - { - text: I18n.t("bonus.sv.voucherGeneration.acceptTos.alert.buttons.ko"), - style: "default", - onPress: handleTosCancel - } - ] - ); - }; - const manageTosResponse = (tosAccepted: boolean): React.ReactElement => - tosAccepted ? ( - - ) : ( - - ); - - return fold( - props.tosAccepted, - () => , - () => ( - - ), - v => manageTosResponse(v), - _ => - ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - start: () => dispatch(svGenerateVoucherStart()), - back: () => dispatch(svGenerateVoucherBack()), - cancel: () => dispatch(svGenerateVoucherCancel()), - checkServiceAvailable: () => dispatch(svServiceAlive.request()), - checkTosAccepted: () => dispatch(svTosAccepted.request()) -}); -const mapStateToProps = (state: GlobalState) => ({ - isServiceAlive: isAliveSelector(state), - tosAccepted: tosAcceptedSelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(CheckStatusRouterScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/DisabledAdditionalInfoScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/DisabledAdditionalInfoScreen.tsx deleted file mode 100644 index d0e5cc0b48d..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/DisabledAdditionalInfoScreen.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import { VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; -import { useState } from "react"; -import { SafeAreaView, ScrollView } from "react-native"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { Body } from "../../../../../components/core/typography/Body"; -import { H1 } from "../../../../../components/core/typography/H1"; -import { Link } from "../../../../../components/core/typography/Link"; -import { IOStyles } from "../../../../../components/core/variables/IOStyles"; -import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent"; -import FooterWithButtons from "../../../../../components/ui/FooterWithButtons"; -import I18n from "../../../../../i18n"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { dpr28Dec2000Url } from "../../../../../urls"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { openWebUrl } from "../../../../../utils/url"; -import { DeclarationEntry } from "../../../common/components/DeclarationEntry"; -import { - svGenerateVoucherBack, - svGenerateVoucherCancel -} from "../../store/actions/voucherGeneration"; - -type Props = ReturnType & - ReturnType; - -// TODO: update with the correct disclaimer: https://pagopa.atlassian.net/browse/IASV-40 - -const loadLocales = () => ({ - headerTitle: I18n.t("bonus.sv.headerTitle"), - title: I18n.t("bonus.sv.voucherGeneration.disabled.additionalInfo.title"), - disclaimer: { - normal: I18n.t( - "bonus.sv.voucherGeneration.disabled.additionalInfo.disclaimer.normal" - ), - link: I18n.t( - "bonus.sv.voucherGeneration.disabled.additionalInfo.disclaimer.link" - ) - } -}); - -const DisabledAdditionalInfoScreen = (props: Props): React.ReactElement => { - const [acceptedDisclaimer, setAcceptedDisclaimer] = useState(false); - - const cancelButtonProps = { - primary: false, - bordered: true, - onPress: props.cancel, - title: I18n.t("global.buttons.cancel") - }; - const continueButtonProps = { - bordered: false, - onPress: () => null, - title: I18n.t("global.buttons.continue"), - disabled: !acceptedDisclaimer - }; - - const { title, disclaimer, headerTitle } = loadLocales(); - return ( - - - -

{title}

- - - {disclaimer.normal} - openWebUrl(dpr28Dec2000Url)}> - {disclaimer.link} - - - } - onValueChange={setAcceptedDisclaimer} - /> -
- -
-
- ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - back: () => dispatch(svGenerateVoucherBack()), - cancel: () => dispatch(svGenerateVoucherCancel()) -}); -const mapStateToProps = (_: GlobalState) => ({}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(DisabledAdditionalInfoScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/SelectBeneficiaryCategoryScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/SelectBeneficiaryCategoryScreen.tsx deleted file mode 100644 index 3ca60c26f0b..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/SelectBeneficiaryCategoryScreen.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import { VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; -import { useRef, useState } from "react"; -import { SafeAreaView, ScrollView } from "react-native"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { - RadioButtonList, - RadioItem -} from "../../../../../components/core/selection/RadioButtonList"; -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 { GlobalState } from "../../../../../store/reducers/types"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { - svGenerateVoucherBack, - svGenerateVoucherCancel, - svGenerateVoucherSelectCategory -} from "../../store/actions/voucherGeneration"; -import { selectedBeneficiaryCategorySelector } from "../../store/reducers/voucherGeneration/voucherRequest"; -import { SvBeneficiaryCategory } from "../../types/SvVoucherRequest"; - -type BeneficiaryCategory = SvBeneficiaryCategory | "other"; - -type Props = ReturnType & - ReturnType; - -const getCategoryBeneficiaryItems = (): ReadonlyArray< - RadioItem -> => [ - { - body: I18n.t( - "bonus.sv.voucherGeneration.selectBeneficiaryCategory.categories.student" - ), - id: "student" - }, - { - body: I18n.t( - "bonus.sv.voucherGeneration.selectBeneficiaryCategory.categories.disabled" - ), - id: "disabled" - }, - { - body: I18n.t( - "bonus.sv.voucherGeneration.selectBeneficiaryCategory.categories.worker" - ), - id: "worker" - }, - { - body: I18n.t( - "bonus.sv.voucherGeneration.selectBeneficiaryCategory.categories.sick" - ), - id: "sick" - }, - { - body: I18n.t( - "bonus.sv.voucherGeneration.selectBeneficiaryCategory.categories.other" - ), - id: "other" - } -]; - -const SelectBeneficiaryCategoryScreen = (props: Props): React.ReactElement => { - const elementRef = useRef(null); - - const [categoryBeneficiary, setCategoryBeneficiary] = useState< - BeneficiaryCategory | undefined - >(undefined); - - const routeNextScreen = () => null; - - const backButtonProps = { - primary: false, - bordered: true, - onPress: props.back, - title: I18n.t("global.buttons.cancel") - }; - const continueButtonProps = { - primary: false, - bordered: false, - onPress: routeNextScreen, - title: I18n.t("global.buttons.continue"), - disabled: categoryBeneficiary === undefined - }; - - return ( - - - -

- {I18n.t( - "bonus.sv.voucherGeneration.selectBeneficiaryCategory.title" - )} -

- - - - key="delete_reason" - items={getCategoryBeneficiaryItems()} - selectedItem={categoryBeneficiary} - onPress={setCategoryBeneficiary} - /> -
- -
-
- ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - back: () => dispatch(svGenerateVoucherBack()), - cancel: () => dispatch(svGenerateVoucherCancel()), - selectCategory: (category: SvBeneficiaryCategory) => - dispatch(svGenerateVoucherSelectCategory(category)) -}); -const mapStateToProps = (state: GlobalState) => ({ - selectedBeneficiaryCategory: selectedBeneficiaryCategorySelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(SelectBeneficiaryCategoryScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/SelectFlightsDateScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/SelectFlightsDateScreen.tsx deleted file mode 100644 index 678880dab3a..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/SelectFlightsDateScreen.tsx +++ /dev/null @@ -1,151 +0,0 @@ -import { VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; -import { useRef, useState } from "react"; -import { SafeAreaView, ScrollView } from "react-native"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { - RadioButtonList, - RadioItem -} from "../../../../../components/core/selection/RadioButtonList"; -import { H1 } from "../../../../../components/core/typography/H1"; -import { H5 } from "../../../../../components/core/typography/H5"; -import { IOStyles } from "../../../../../components/core/variables/IOStyles"; -import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent"; -import DateTimePicker from "../../../../../components/ui/DateTimePicker"; -import FooterWithButtons from "../../../../../components/ui/FooterWithButtons"; -import I18n from "../../../../../i18n"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { - FlightsDate, - svGenerateVoucherBack, - svGenerateVoucherCancel, - svGenerateVoucherSelectFlightsDate -} from "../../store/actions/voucherGeneration"; - -type Props = ReturnType & - ReturnType; - -const getShowReturnDateItems = (): ReadonlyArray> => [ - { - id: false, - body: I18n.t( - "bonus.sv.voucherGeneration.selectFlightsDate.flights_choice.departure" - ) - }, - { - id: true, - body: I18n.t( - "bonus.sv.voucherGeneration.selectFlightsDate.flights_choice.return" - ) - } -]; - -const SelectFlightsDateScreen = (props: Props): React.ReactElement => { - const elementRef = useRef(null); - const [departureDate, setDepartureDate] = useState( - undefined - ); - const [returnDate, setReturnDate] = useState(undefined); - - const [showReturn, setShowReturn] = useState(false); - - const handleDisableContinue = (): boolean => { - if (showReturn === true) { - return departureDate === undefined || returnDate === undefined; - } - return departureDate === undefined; - }; - - const handleOnPressContinue = () => { - if (departureDate) { - props.selectFlightsDate({ - departureDate, - returnDate - }); - } - }; - - const cancelButtonProps = { - bordered: true, - onPress: props.back, - title: I18n.t("global.buttons.cancel") - }; - const continueButtonProps = { - bordered: false, - onPress: handleOnPressContinue, - title: I18n.t("global.buttons.continue"), - disabled: handleDisableContinue() - }; - - return ( - - - -

- {I18n.t("bonus.sv.voucherGeneration.selectFlightsDate.title")} -

- -
- {I18n.t("bonus.sv.voucherGeneration.selectFlightsDate.subtitle")} -
- - - key="flights" - items={getShowReturnDateItems()} - selectedItem={showReturn} - onPress={setShowReturn} - /> - - - - - {showReturn && ( - - )} -
- -
-
- ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - back: () => dispatch(svGenerateVoucherBack()), - cancel: () => dispatch(svGenerateVoucherCancel()), - selectFlightsDate: (flightsDate: FlightsDate) => - dispatch(svGenerateVoucherSelectFlightsDate(flightsDate)) -}); - -const mapStateToProps = (_: GlobalState) => ({}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(SelectFlightsDateScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/SickCheckIncomeScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/SickCheckIncomeScreen.tsx deleted file mode 100644 index 60aec283203..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/SickCheckIncomeScreen.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { GlobalState } from "../../../../../store/reducers/types"; -import CheckIncomeComponent from "../../components/CheckIncomeComponent"; -import { - svGenerateVoucherFailure, - svGenerateVoucherSelectCategory -} from "../../store/actions/voucherGeneration"; -import { selectedBeneficiaryCategorySelector } from "../../store/reducers/voucherGeneration/voucherRequest"; -import { SvBeneficiaryCategory } from "../../types/SvVoucherRequest"; - -type Props = ReturnType & - ReturnType; - -const SickCheckIncomeScreen = (props: Props): React.ReactElement | null => { - if ( - O.isSome(props.selectedBeneficiaryCategory) && - props.selectedBeneficiaryCategory.value !== "sick" - ) { - props.failure("The selected category is not Sick"); - return null; - } - - return null} />; -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - failure: (reason: string) => dispatch(svGenerateVoucherFailure(reason)), - selectCategory: (category: SvBeneficiaryCategory) => - dispatch(svGenerateVoucherSelectCategory(category)) -}); -const mapStateToProps = (state: GlobalState) => ({ - selectedBeneficiaryCategory: selectedBeneficiaryCategorySelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(SickCheckIncomeScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/SickSelectDestinationScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/SickSelectDestinationScreen.tsx deleted file mode 100644 index 766afdc19f4..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/SickSelectDestinationScreen.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { useRef } from "react"; -import { SafeAreaView, ScrollView } from "react-native"; -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 { GlobalState } from "../../../../../store/reducers/types"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { - svGenerateVoucherBack, - svGenerateVoucherCancel, - svGenerateVoucherFailure, - svGenerateVoucherSelectHospital -} from "../../store/actions/voucherGeneration"; -import { selectedBeneficiaryCategorySelector } from "../../store/reducers/voucherGeneration/voucherRequest"; -import { Hospital } from "../../types/SvVoucherRequest"; - -type Props = ReturnType & - ReturnType; - -const SickSelectDestinationScreen = ( - props: Props -): React.ReactElement | null => { - const elementRef = useRef(null); - - const backButtonProps = { - primary: false, - bordered: true, - onPress: props.back, - title: "Back" - }; - const continueButtonProps = { - primary: false, - bordered: true, - onPress: () => null, - title: "Continue" - }; - - if ( - O.isSome(props.selectedBeneficiaryCategory) && - props.selectedBeneficiaryCategory.value !== "sick" - ) { - props.failure("The selected category is not Sick"); - return null; - } - - return ( - - - -

- {I18n.t("bonus.sv.voucherGeneration.sick.selectDestination.title")} -

-
- -
-
- ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - back: () => dispatch(svGenerateVoucherBack()), - cancel: () => dispatch(svGenerateVoucherCancel()), - failure: (reason: string) => dispatch(svGenerateVoucherFailure(reason)), - selectHospital: (hospital: Hospital) => - dispatch(svGenerateVoucherSelectHospital(hospital)) -}); -const mapStateToProps = (state: GlobalState) => ({ - selectedBeneficiaryCategory: selectedBeneficiaryCategorySelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(SickSelectDestinationScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/StudentSelectDestinationScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/StudentSelectDestinationScreen.tsx deleted file mode 100644 index 465b15016dd..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/StudentSelectDestinationScreen.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { useRef } from "react"; -import { SafeAreaView, ScrollView } from "react-native"; -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 { GlobalState } from "../../../../../store/reducers/types"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { - svGenerateVoucherBack, - svGenerateVoucherCancel, - svGenerateVoucherFailure, - svGenerateVoucherSelectUniversity -} from "../../store/actions/voucherGeneration"; -import { selectedBeneficiaryCategorySelector } from "../../store/reducers/voucherGeneration/voucherRequest"; -import { University } from "../../types/SvVoucherRequest"; - -type Props = ReturnType & - ReturnType; - -const StudentSelectDestinationScreen = ( - props: Props -): React.ReactElement | null => { - const elementRef = useRef(null); - - const backButtonProps = { - primary: false, - bordered: true, - onPress: props.back, - title: "Back" - }; - const continueButtonProps = { - primary: false, - bordered: true, - onPress: () => null, - title: "Continue" - }; - - if ( - O.isSome(props.selectedBeneficiaryCategory) && - props.selectedBeneficiaryCategory.value !== "student" - ) { - props.failure("The selected category is not Student"); - return null; - } - - return ( - - - -

- {I18n.t( - "bonus.sv.voucherGeneration.student.selectDestination.title" - )} -

-
- -
-
- ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - back: () => dispatch(svGenerateVoucherBack()), - cancel: () => dispatch(svGenerateVoucherCancel()), - failure: (reason: string) => dispatch(svGenerateVoucherFailure(reason)), - selectUniversity: (university: University) => - dispatch(svGenerateVoucherSelectUniversity(university)) -}); -const mapStateToProps = (state: GlobalState) => ({ - selectedBeneficiaryCategory: selectedBeneficiaryCategorySelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(StudentSelectDestinationScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/SummaryScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/SummaryScreen.tsx deleted file mode 100644 index a0c4846b0d9..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/SummaryScreen.tsx +++ /dev/null @@ -1,245 +0,0 @@ -import { HSpacer, IOColors, VSpacer } from "@pagopa/io-app-design-system"; -import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { useEffect } from "react"; -import { SafeAreaView, ScrollView, StyleSheet, View } from "react-native"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { AeroportiAmmessiInputBean } from "../../../../../../definitions/api_sicilia_vola/AeroportiAmmessiInputBean"; -import { isLoading, isReady } from "../../../../../common/model/RemoteValue"; -import { LoadingErrorComponent } from "../../../../../components/LoadingErrorComponent"; -import { H1 } from "../../../../../components/core/typography/H1"; -import { H4 } from "../../../../../components/core/typography/H4"; -import { Link } from "../../../../../components/core/typography/Link"; -import { IOStyles } from "../../../../../components/core/variables/IOStyles"; -import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent"; -import FooterWithButtons from "../../../../../components/ui/FooterWithButtons"; -import I18n from "../../../../../i18n"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { dpr28Dec2000Url } from "../../../../../urls"; -import { formatDateAsLocal } from "../../../../../utils/dates"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { openWebUrl } from "../../../../../utils/url"; -import { - svGenerateVoucherAvailableDestination, - svGenerateVoucherBack, - svGenerateVoucherCancel, - svGenerateVoucherFailure -} from "../../store/actions/voucherGeneration"; -import { availableDestinationsSelector } from "../../store/reducers/voucherGeneration/availableDestinations"; -import { voucherRequestSelector } from "../../store/reducers/voucherGeneration/voucherRequest"; -import { SvBeneficiaryCategory } from "../../types/SvVoucherRequest"; -import { - destinationsInfoFromVoucherRequest, - isVoucherRequest -} from "../../utils"; - -type Props = ReturnType & - ReturnType; - -const mapCategory: Record = { - disabled: I18n.t( - "bonus.sv.voucherGeneration.summary.fields.category.value.disabled" - ), - student: I18n.t( - "bonus.sv.voucherGeneration.summary.fields.category.value.student" - ), - sick: I18n.t("bonus.sv.voucherGeneration.summary.fields.category.value.sick"), - worker: I18n.t( - "bonus.sv.voucherGeneration.summary.fields.category.value.worker" - ) -}; - -const styles = StyleSheet.create({ - borderedContainer: { - borderLeftWidth: 2, - borderLeftColor: IOColors.greyLight, - paddingLeft: 10 - }, - row: { - flex: 1, - flexDirection: "row" - } -}); - -// TODO: update with the correct disclaimer: https://pagopa.atlassian.net/browse/IASV-40 - -const SummaryScreen = (props: Props): React.ReactElement | null => { - const { - maybeVoucherRequest, - requestAvailableDestinations, - availableDestinations - } = props; - useEffect(() => { - if ( - O.isSome(maybeVoucherRequest) && - isVoucherRequest(maybeVoucherRequest.value) && - maybeVoucherRequest.value.category !== "disabled" - ) { - requestAvailableDestinations( - destinationsInfoFromVoucherRequest(maybeVoucherRequest.value) - ); - } - }, [maybeVoucherRequest, requestAvailableDestinations]); - - if (!O.isSome(maybeVoucherRequest)) { - props.failure(); - return null; - } - const voucherRequest = maybeVoucherRequest.value; - - if (!isVoucherRequest(voucherRequest)) { - props.failure(); - return null; - } - - if ( - !isReady(availableDestinations) && - voucherRequest.category !== "disabled" - ) { - return ( - - - requestAvailableDestinations( - destinationsInfoFromVoucherRequest(voucherRequest) - ) - } - /> - - ); - } - - const cancelButtonProps = { - bordered: true, - onPress: props.back, - title: I18n.t("global.buttons.cancel") - }; - const continueButtonProps = { - primary: true, - onPress: () => null, - title: I18n.t("global.buttons.continue") - }; - - const destinations: ReadonlyArray = - voucherRequest.category === "disabled" - ? [ - I18n.t( - "bonus.sv.voucherGeneration.summary.fields.flightDate.disabled" - ) - ] - : isReady(availableDestinations) - ? availableDestinations.value - : []; - - return ( - - - -

{I18n.t("bonus.sv.voucherGeneration.summary.title")}

- -

- {I18n.t("bonus.sv.voucherGeneration.summary.subtitle1.normal1")} - openWebUrl(dpr28Dec2000Url)}> - {I18n.t("bonus.sv.voucherGeneration.summary.subtitle1.link")} - - {I18n.t("bonus.sv.voucherGeneration.summary.subtitle1.normal2")} -

- - - - -

- {I18n.t( - "bonus.sv.voucherGeneration.summary.fields.residence.label" - )} -

- -

- {I18n.t( - "bonus.sv.voucherGeneration.summary.fields.residence.value" - )} -

-
- -

- {I18n.t( - "bonus.sv.voucherGeneration.summary.fields.category.label" - )} -

- -

- {mapCategory[voucherRequest.category]} -

-
-
-
- - -

- {I18n.t("bonus.sv.voucherGeneration.summary.subtitle2")} -

- - - - - -

- {I18n.t( - "bonus.sv.voucherGeneration.summary.fields.flightDate.label" - )} -

- -

- {formatDateAsLocal(voucherRequest.departureDate, true, true)} -

-
- -

- {I18n.t( - "bonus.sv.voucherGeneration.summary.fields.availableDestination" - )} -

- {destinations.map(d => ( -

{d}

- ))} -
-
-
-
- -
-
- ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - back: () => dispatch(svGenerateVoucherBack()), - cancel: () => dispatch(svGenerateVoucherCancel()), - failure: () => dispatch(svGenerateVoucherFailure("Request not complete")), - requestAvailableDestinations: ( - availableDestinationRequest: AeroportiAmmessiInputBean - ) => - dispatch( - svGenerateVoucherAvailableDestination.request(availableDestinationRequest) - ) -}); -const mapStateToProps = (state: GlobalState) => ({ - maybeVoucherRequest: voucherRequestSelector(state), - availableDestinations: availableDestinationsSelector(state) -}); - -export default connect(mapStateToProps, mapDispatchToProps)(SummaryScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/VoucherGeneratedScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/VoucherGeneratedScreen.tsx deleted file mode 100644 index 50b469d05b3..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/VoucherGeneratedScreen.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import { pipe } from "fp-ts/lib/function"; -import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { useEffect } from "react"; -import { SafeAreaView, ScrollView } from "react-native"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { VSpacer } from "@pagopa/io-app-design-system"; -import { H1 } from "../../../../../components/core/typography/H1"; -import { H5 } from "../../../../../components/core/typography/H5"; -import { IOStyles } from "../../../../../components/core/variables/IOStyles"; -import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent"; -import { BlockButtonProps } from "../../../../../components/ui/BlockButtons"; -import FooterWithButtons from "../../../../../components/ui/FooterWithButtons"; -import I18n from "../../../../../i18n"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { showToast } from "../../../../../utils/showToast"; -import { LoadingErrorComponent } from "../../../../../components/LoadingErrorComponent"; -import { - fold, - isLoading, - isReady -} from "../../../../../common/model/RemoteValue"; -import VoucherInformationComponent from "../../components/VoucherInformationComponent"; -import { - svGenerateVoucherBack, - svGenerateVoucherCompleted, - svGenerateVoucherFailure, - svGenerateVoucherGeneratedVoucher, - svGetPdfVoucher -} from "../../store/actions/voucherGeneration"; -import { selectedPdfVoucherStateSelector } from "../../store/reducers/selectedVoucher"; -import { voucherGeneratedSelector } from "../../store/reducers/voucherGeneration/voucherGenerated"; -import { voucherRequestSelector } from "../../store/reducers/voucherGeneration/voucherRequest"; -import { SvVoucherId } from "../../types/SvVoucher"; -import { VoucherRequest } from "../../types/SvVoucherRequest"; -import { isVoucherRequest } from "../../utils"; -import SvGeneratedVoucherTimeoutScreen from "./ko/SvGeneratedVoucherTimeoutScreen"; - -type Props = ReturnType & - ReturnType; - -const VoucherGeneratedScreen = (props: Props): React.ReactElement | null => { - const { - remoteVoucherGenerated, - maybeVoucherRequest, - generateVoucherRequest, - pdfVoucherState - } = props; - - useEffect(() => { - pipe( - maybeVoucherRequest, - O.map(vR => { - if (isVoucherRequest(vR)) { - generateVoucherRequest(vR); - } - }) - ); - }, [maybeVoucherRequest, generateVoucherRequest]); - - useEffect(() => { - fold( - pdfVoucherState, - () => null, - () => null, - _ => showToast(I18n.t("bonus.sv.pdfVoucher.toast.ok"), "success"), - _ => showToast(I18n.t("bonus.sv.pdfVoucher.toast.ko")) - ); - }, [pdfVoucherState]); - - if (O.isNone(maybeVoucherRequest)) { - props.failure("Voucher request is None"); - return null; - } - const voucherRequest = maybeVoucherRequest.value; - if (!isVoucherRequest(voucherRequest)) { - props.failure("Partial voucher request is not a complete voucher request"); - return null; - } - - if (!isReady(remoteVoucherGenerated)) { - return ( - - props.generateVoucherRequest(voucherRequest)} - /> - - ); - } - - const voucherGenerated = remoteVoucherGenerated.value; - - switch (voucherGenerated.kind) { - // TODO: manage conflict and other state when the final swagger is available - case "success": - const backButtonProps: BlockButtonProps = { - primary: false, - bordered: true, - onPress: props.completed, - title: I18n.t("global.buttons.exit") - }; - - const continueButtonProps: BlockButtonProps = { - primary: true, - onPress: () => props.stampaVoucher(voucherGenerated.value.id), - title: I18n.t("global.genericSave"), - disabled: isLoading(pdfVoucherState) - }; - return ( - - - -

- {I18n.t("bonus.sv.voucherGeneration.voucherGenerated.title")} -

- -
- {I18n.t("bonus.sv.voucherGeneration.voucherGenerated.subtitle")} -
- - - -
- -
-
- ); - case "timeout": - return ; - } -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - back: () => dispatch(svGenerateVoucherBack()), - completed: () => dispatch(svGenerateVoucherCompleted()), - failure: (reason: string) => dispatch(svGenerateVoucherFailure(reason)), - generateVoucherRequest: (voucherRequest: VoucherRequest) => - dispatch(svGenerateVoucherGeneratedVoucher.request(voucherRequest)), - stampaVoucher: (voucherId: SvVoucherId) => - dispatch(svGetPdfVoucher.request(voucherId)) -}); -const mapStateToProps = (state: GlobalState) => ({ - maybeVoucherRequest: voucherRequestSelector(state), - remoteVoucherGenerated: voucherGeneratedSelector(state), - pdfVoucherState: selectedPdfVoucherStateSelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(VoucherGeneratedScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/WorkerCheckIncomeScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/WorkerCheckIncomeScreen.tsx deleted file mode 100644 index 9b8005c0bf5..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/WorkerCheckIncomeScreen.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { GlobalState } from "../../../../../store/reducers/types"; -import CheckIncomeComponent from "../../components/CheckIncomeComponent"; -import { svGenerateVoucherFailure } from "../../store/actions/voucherGeneration"; -import { selectedBeneficiaryCategorySelector } from "../../store/reducers/voucherGeneration/voucherRequest"; - -type Props = ReturnType & - ReturnType; - -const WorkerCheckIncomeScreen = (props: Props): React.ReactElement | null => { - if ( - O.isSome(props.selectedBeneficiaryCategory) && - props.selectedBeneficiaryCategory.value !== "worker" - ) { - props.failure("The selected category is not Worker"); - return null; - } - - return null} />; -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - failure: (reason: string) => dispatch(svGenerateVoucherFailure(reason)) -}); -const mapStateToProps = (state: GlobalState) => ({ - selectedBeneficiaryCategory: selectedBeneficiaryCategorySelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(WorkerCheckIncomeScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/WorkerSelectDestinationScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/WorkerSelectDestinationScreen.tsx deleted file mode 100644 index 6934ae3897e..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/WorkerSelectDestinationScreen.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { useRef } from "react"; -import { SafeAreaView, ScrollView } from "react-native"; -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 { GlobalState } from "../../../../../store/reducers/types"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { - svGenerateVoucherBack, - svGenerateVoucherCancel, - svGenerateVoucherFailure, - svGenerateVoucherSelectCompany -} from "../../store/actions/voucherGeneration"; -import { selectedBeneficiaryCategorySelector } from "../../store/reducers/voucherGeneration/voucherRequest"; -import { Company } from "../../types/SvVoucherRequest"; - -type Props = ReturnType & - ReturnType; - -const WorkerSelectDestinationScreen = ( - props: Props -): React.ReactElement | null => { - const elementRef = useRef(null); - - const backButtonProps = { - primary: false, - bordered: true, - onPress: props.back, - title: "Back" - }; - const continueButtonProps = { - primary: false, - bordered: true, - onPress: () => null, - title: "Continue" - }; - - if ( - O.isSome(props.selectedBeneficiaryCategory) && - props.selectedBeneficiaryCategory.value !== "worker" - ) { - props.failure("The selected category is not Worker"); - return null; - } - - return ( - - - -

- {I18n.t( - "bonus.sv.voucherGeneration.worker.selectDestination.title" - )} -

-
- -
-
- ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - back: () => dispatch(svGenerateVoucherBack()), - cancel: () => dispatch(svGenerateVoucherCancel()), - failure: (reason: string) => dispatch(svGenerateVoucherFailure(reason)), - selectCompany: (company: Company) => - dispatch(svGenerateVoucherSelectCompany(company)) -}); -const mapStateToProps = (state: GlobalState) => ({ - selectedBeneficiaryCategory: selectedBeneficiaryCategorySelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(WorkerSelectDestinationScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvCheckIncomeKoScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvCheckIncomeKoScreen.tsx deleted file mode 100644 index 8d243ea20cd..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvCheckIncomeKoScreen.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import * as React from "react"; -import { Dispatch } from "redux"; -import { connect } from "react-redux"; -import { SafeAreaView } from "react-native"; -import { InfoScreenComponent } from "../../../../../../components/infoScreen/InfoScreenComponent"; -import { renderInfoRasterImage } from "../../../../../../components/infoScreen/imageRendering"; -import image from "../../../../../../../img/servicesStatus/error-detail-icon.png"; -import I18n from "../../../../../../i18n"; -import { GlobalState } from "../../../../../../store/reducers/types"; -import { cancelButtonProps } from "../../../../../../components/buttons/ButtonConfigurations"; -import FooterWithButtons from "../../../../../../components/ui/FooterWithButtons"; -import { IOStyles } from "../../../../../../components/core/variables/IOStyles"; -import { svGenerateVoucherCancel } from "../../../store/actions/voucherGeneration"; - -type Props = ReturnType & - ReturnType; - -const SvCheckIncomeKoScreen: React.FC = (props: Props) => ( - - - - -); - -const mapDispatchToProps = (dispatch: Dispatch) => ({ - onExit: () => dispatch(svGenerateVoucherCancel()) -}); -const mapStateToProps = (_: GlobalState) => ({}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(SvCheckIncomeKoScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvCheckResidenceKoScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvCheckResidenceKoScreen.tsx deleted file mode 100644 index 217917febef..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvCheckResidenceKoScreen.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import * as React from "react"; -import { Dispatch } from "redux"; -import { connect } from "react-redux"; -import { SafeAreaView } from "react-native"; -import { InfoScreenComponent } from "../../../../../../components/infoScreen/InfoScreenComponent"; -import { renderInfoRasterImage } from "../../../../../../components/infoScreen/imageRendering"; -import image from "../../../../../../../img/servicesStatus/error-detail-icon.png"; -import I18n from "../../../../../../i18n"; -import { GlobalState } from "../../../../../../store/reducers/types"; -import { IOStyles } from "../../../../../../components/core/variables/IOStyles"; -import { cancelButtonProps } from "../../../../../../components/buttons/ButtonConfigurations"; -import FooterWithButtons from "../../../../../../components/ui/FooterWithButtons"; -import { svGenerateVoucherCancel } from "../../../store/actions/voucherGeneration"; - -type Props = ReturnType & - ReturnType; - -const SvCheckResidenceKoScreen: React.FC = (props: Props) => ( - - - - -); - -const mapDispatchToProps = (dispatch: Dispatch) => ({ - onExit: () => dispatch(svGenerateVoucherCancel()) -}); -const mapStateToProps = (_: GlobalState) => ({}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(SvCheckResidenceKoScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvGeneratedVoucherTimeoutScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvGeneratedVoucherTimeoutScreen.tsx deleted file mode 100644 index bd219d3f797..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvGeneratedVoucherTimeoutScreen.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import * as React from "react"; -import { Dispatch } from "redux"; -import { connect } from "react-redux"; -import { SafeAreaView } from "react-native"; -import { InfoScreenComponent } from "../../../../../../components/infoScreen/InfoScreenComponent"; -import RequestTimeoutImage from "../../../../../../../img/bonus/siciliaVola/generateVoucherTimeout.svg"; -import I18n from "../../../../../../i18n"; -import { GlobalState } from "../../../../../../store/reducers/types"; -import { svGenerateVoucherCancel } from "../../../store/actions/voucherGeneration"; -import { IOStyles } from "../../../../../../components/core/variables/IOStyles"; -import { cancelButtonProps } from "../../../../../../components/buttons/ButtonConfigurations"; -import FooterWithButtons from "../../../../../../components/ui/FooterWithButtons"; - -type Props = ReturnType & - ReturnType; - -const SvGeneratedVoucherTimeoutScreen: React.FC = (props: Props) => ( - - } - title={I18n.t("bonus.sv.voucherGeneration.ko.timeout.title")} - body={I18n.t("bonus.sv.voucherGeneration.ko.timeout.body")} - /> - - -); - -const mapDispatchToProps = (dispatch: Dispatch) => ({ - onExit: () => dispatch(svGenerateVoucherCancel()) -}); -const mapStateToProps = (_: GlobalState) => ({}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(SvGeneratedVoucherTimeoutScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvSelectBeneficiaryCategoryKoScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvSelectBeneficiaryCategoryKoScreen.tsx deleted file mode 100644 index 80baa321ae8..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherGeneration/ko/SvSelectBeneficiaryCategoryKoScreen.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import * as React from "react"; -import { Dispatch } from "redux"; -import { connect } from "react-redux"; -import { SafeAreaView } from "react-native"; -import { InfoScreenComponent } from "../../../../../../components/infoScreen/InfoScreenComponent"; -import { renderInfoRasterImage } from "../../../../../../components/infoScreen/imageRendering"; -import image from "../../../../../../../img/servicesStatus/error-detail-icon.png"; -import I18n from "../../../../../../i18n"; -import { GlobalState } from "../../../../../../store/reducers/types"; -import { IOStyles } from "../../../../../../components/core/variables/IOStyles"; -import { cancelButtonProps } from "../../../../../../components/buttons/ButtonConfigurations"; -import FooterWithButtons from "../../../../../../components/ui/FooterWithButtons"; -import { svGenerateVoucherCancel } from "../../../store/actions/voucherGeneration"; - -type Props = ReturnType & - ReturnType; - -const SvSelectBeneficiaryCategoryKoScreen: React.FC = (props: Props) => ( - - - - -); - -const mapDispatchToProps = (dispatch: Dispatch) => ({ - onExit: () => dispatch(svGenerateVoucherCancel()) -}); -const mapStateToProps = (_: GlobalState) => ({}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(SvSelectBeneficiaryCategoryKoScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherList/VoucherDetailsScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherList/VoucherDetailsScreen.tsx deleted file mode 100644 index 6947738d735..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherList/VoucherDetailsScreen.tsx +++ /dev/null @@ -1,327 +0,0 @@ -import { pipe } from "fp-ts/lib/function"; -import * as O from "fp-ts/lib/Option"; -import * as React from "react"; -import { useEffect } from "react"; -import { - View, - Alert, - SafeAreaView, - ScrollView, - StyleSheet -} from "react-native"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import { IOColors, HSpacer, VSpacer } from "@pagopa/io-app-design-system"; -import CopyButtonComponent from "../../../../../components/CopyButtonComponent"; -import { H1 } from "../../../../../components/core/typography/H1"; -import { H3 } from "../../../../../components/core/typography/H3"; -import { H4 } from "../../../../../components/core/typography/H4"; -import { IOStyles } from "../../../../../components/core/variables/IOStyles"; -import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent"; -import FooterWithButtons from "../../../../../components/ui/FooterWithButtons"; -import I18n from "../../../../../i18n"; -import { navigateBack } from "../../../../../store/actions/navigation"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { formatDateAsLocal } from "../../../../../utils/dates"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { useLegacyIOBottomSheetModal } from "../../../../../utils/hooks/bottomSheet"; -import { showToast } from "../../../../../utils/showToast"; -import { LoadingErrorComponent } from "../../../../../components/LoadingErrorComponent"; -import { - fold, - isError, - isLoading, - isReady -} from "../../../../../common/model/RemoteValue"; -import VoucherDetailBottomSheet from "../../components/VoucherDetailBottomsheet"; -import { svGetPdfVoucher } from "../../store/actions/voucherGeneration"; -import { - svVoucherDetailGet, - svVoucherRevocation -} from "../../store/actions/voucherList"; -import { - selectedPdfVoucherStateSelector, - selectedVoucherCodeSelector, - selectedVoucherRevocationStateSelector, - selectedVoucherSelector -} from "../../store/reducers/selectedVoucher"; -import { SvVoucherId } from "../../types/SvVoucher"; -import { fromVoucherToDestinationLabels } from "../../utils"; - -type Props = ReturnType & - ReturnType; - -const styles = StyleSheet.create({ - itemRow: { - flex: 1, - flexDirection: "row", - justifyContent: "space-between" - } -}); - -const handleVoucherRevocation = (onVoucherRevocation: () => void) => { - Alert.alert( - I18n.t("bonus.sv.voucherList.details.voucherRevocation.alert.title"), - I18n.t("bonus.sv.voucherList.details.voucherRevocation.alert.message"), - [ - { - text: I18n.t( - "bonus.sv.voucherList.details.voucherRevocation.alert.cta.ok" - ), - style: "default", - onPress: onVoucherRevocation - }, - { - text: I18n.t( - "bonus.sv.voucherList.details.voucherRevocation.alert.cta.ko" - ), - style: "default" - } - ] - ); -}; - -const VoucherDetailsScreen = (props: Props): React.ReactElement | null => { - const { - selectedVoucherCode, - getVoucherDetail, - revocationState, - back, - pdfVoucherState - } = props; - - useEffect(() => { - if (selectedVoucherCode !== undefined) { - getVoucherDetail(selectedVoucherCode); - } - }, [selectedVoucherCode, getVoucherDetail]); - - useEffect(() => { - if (isError(revocationState)) { - showToast( - I18n.t("bonus.sv.voucherList.details.voucherRevocation.toast.ko") - ); - } - // Return to the VoucherListScreen if the revocation is completed since the voucher doesn't exist anymore. - if (isReady(revocationState)) { - showToast( - I18n.t("bonus.sv.voucherList.details.voucherRevocation.toast.ok"), - "success" - ); - back(); - } - }, [revocationState, back]); - - useEffect(() => { - fold( - pdfVoucherState, - () => null, - () => null, - _ => showToast(I18n.t("bonus.sv.pdfVoucher.toast.ok"), "success"), - _ => showToast(I18n.t("bonus.sv.pdfVoucher.toast.ko")) - ); - }, [pdfVoucherState]); - - const { present, bottomSheet, dismiss } = useLegacyIOBottomSheetModal( - isReady(props.selectedVoucher) ? ( - - ) : null, - I18n.t("bonus.sv.components.voucherBottomsheet.title"), - 650, - dismiss(), - title: I18n.t("bonus.sv.components.voucherBottomsheet.cta.exit"), - onPressWithGestureHandler: true - }} - rightButton={{ - primary: true, - onPress: () => { - dismiss(); - props.stampaVoucher(selectedVoucher.id); - }, - title: I18n.t("global.genericSave"), - onPressWithGestureHandler: true, - disabled: isLoading(props.pdfVoucherState) - }} - /> - ); - - // The selectedVoucherCode can't be undefined in this screen - if (!isReady(props.selectedVoucher)) { - return pipe( - selectedVoucherCode, - O.fromNullable, - O.fold( - () => null, - svc => ( - - getVoucherDetail(svc)} - /> - - ) - ) - ); - } - - const selectedVoucher = props.selectedVoucher.value; - - const voucherRevocationButtonProps = { - bordered: true, - style: { - borderColor: IOColors.red - }, - labelColor: IOColors.red, - onPress: () => - handleVoucherRevocation(() => - props.voucherRevocationRequest(selectedVoucher.id) - ), - title: I18n.t("bonus.sv.voucherList.details.cta.voucherRevocation") - }; - - const voucherId = selectedVoucher.id?.toString() ?? ""; - - // The check isReady(revocationState) is needed in order to avoid glitch while change screen - if (isLoading(revocationState) || isReady(revocationState)) { - return ( - - null} - /> - - ); - } - - const openQrButtonProps = { - primary: true, - bordered: false, - onPress: present, - title: I18n.t("bonus.sv.voucherList.details.cta.openQr") - }; - - return ( - - - -

{I18n.t("bonus.sv.voucherList.details.title")}

- - -

{I18n.t("bonus.sv.voucherList.details.fields.uniqueCode")}

- - -

{voucherId}

- - -
-
- - -

- {I18n.t("bonus.sv.voucherList.details.fields.beneficiary")} -

- -

{selectedVoucher.beneficiary}

-
- -

- {I18n.t("bonus.sv.voucherList.details.fields.residence.label")} -

-

- {I18n.t("bonus.sv.voucherList.details.fields.residence.value")} -

-
- -

- {I18n.t("bonus.sv.voucherList.details.fields.category")} -

-

{selectedVoucher.category}

-
- - {fromVoucherToDestinationLabels(selectedVoucher).map(d => ( - -

{d.label}

- -

{d.value}

-
- ))} - -

- {I18n.t("bonus.sv.voucherList.details.fields.flightDate")} -

-

- {formatDateAsLocal(selectedVoucher.departureDate, true, true)} -

-
- - -

- {I18n.t( - "bonus.sv.voucherList.details.fields.possibleDestination" - )} -

- - {selectedVoucher.availableDestination.map(d => ( -

- {d} -

- ))} -
-
-
- - {bottomSheet} -
-
- ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - back: () => navigateBack(), - voucherRevocationRequest: (voucherId: SvVoucherId) => - dispatch(svVoucherRevocation.request(voucherId)), - getVoucherDetail: (voucherId: SvVoucherId) => - dispatch(svVoucherDetailGet.request(voucherId)), - stampaVoucher: (voucherId: SvVoucherId) => - dispatch(svGetPdfVoucher.request(voucherId)) -}); -const mapStateToProps = (state: GlobalState) => ({ - selectedVoucher: selectedVoucherSelector(state), - selectedVoucherCode: selectedVoucherCodeSelector(state), - revocationState: selectedVoucherRevocationStateSelector(state), - pdfVoucherState: selectedPdfVoucherStateSelector(state) -}); - -export default connect( - mapStateToProps, - mapDispatchToProps -)(VoucherDetailsScreen); diff --git a/ts/features/bonus/siciliaVola/screens/voucherList/VoucherListScreen.tsx b/ts/features/bonus/siciliaVola/screens/voucherList/VoucherListScreen.tsx deleted file mode 100644 index 19188eaf4a9..00000000000 --- a/ts/features/bonus/siciliaVola/screens/voucherList/VoucherListScreen.tsx +++ /dev/null @@ -1,268 +0,0 @@ -import { VSpacer } from "@pagopa/io-app-design-system"; -import * as React from "react"; -import { useContext, useEffect, useState } from "react"; -import { ActivityIndicator, FlatList, SafeAreaView } from "react-native"; -import { connect } from "react-redux"; -import { Dispatch } from "redux"; -import EmptyListImage from "../../../../../../img/bonus/siciliaVola/emptyVoucherList.svg"; -import { - isError, - isLoading, - isReady, - isUndefined -} from "../../../../../common/model/RemoteValue"; -import ItemSeparatorComponent from "../../../../../components/ItemSeparatorComponent"; -import { LoadingErrorComponent } from "../../../../../components/LoadingErrorComponent"; -import { confirmButtonProps } from "../../../../../components/buttons/ButtonConfigurations"; -import { H1 } from "../../../../../components/core/typography/H1"; -import { IOStyles } from "../../../../../components/core/variables/IOStyles"; -import { InfoScreenComponent } from "../../../../../components/infoScreen/InfoScreenComponent"; -import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent"; -import ListItemComponent from "../../../../../components/screens/ListItemComponent"; -import FooterWithButtons from "../../../../../components/ui/FooterWithButtons"; -import { - BottomTopAnimation, - LightModalContext -} from "../../../../../components/ui/LightModal"; -import I18n from "../../../../../i18n"; -import { toArray } from "../../../../../store/helpers/indexer"; -import { useIODispatch } from "../../../../../store/hooks"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { formatDateAsLocal } from "../../../../../utils/dates"; -import { emptyContextualHelp } from "../../../../../utils/emptyContextualHelp"; -import { showToast } from "../../../../../utils/showToast"; -import SvVoucherListFilters from "../../components/SvVoucherListFilters"; -import { svGenerateVoucherStart } from "../../store/actions/voucherGeneration"; -import { - svPossibleVoucherStateGet, - svSelectVoucher, - svSetFilter, - svVoucherListGet -} from "../../store/actions/voucherList"; -import { selectedVoucherRevocationStateSelector } from "../../store/reducers/selectedVoucher"; -import { - FilterState, - svFiltersSelector -} from "../../store/reducers/voucherList/filters"; -import { possibleVoucherStateSelector } from "../../store/reducers/voucherList/possibleVoucherState"; -import { - svRequiredDataLoadedSelector, - svVouchersListUiSelector -} from "../../store/reducers/voucherList/ui"; -import { svVouchersSelector } from "../../store/reducers/voucherList/vouchers"; -import { VoucherPreview } from "../../types/SvVoucherResponse"; - -type Props = ReturnType & - ReturnType; - -const RenderItemBase = (voucher: VoucherPreview): React.ReactElement => { - const dispatch = useIODispatch(); - - return ( - { - dispatch(svSelectVoucher(voucher.idVoucher)); - }} - /> - ); -}; - -/** - * In order to optimize the rendering of the item, we use the idVoucher as unique identifier to avoid to redraw the component. - * The VoucherPreview data cannot change while consulting the list and we use this information to avoid a deep comparison - */ -export const RenderItem = React.memo( - RenderItemBase, - (prev: VoucherPreview, curr: VoucherPreview) => - prev.idVoucher === curr.idVoucher -); - -/** - * Loading item, placed in the footer during the loading of the next page - * @constructor - */ -const FooterLoading = () => ( - <> - - - -); -const EmptyVoucherList = () => { - const dispatch = useIODispatch(); - - return ( - <> - } - title={I18n.t("bonus.sv.voucherList.emptyList.title")} - body={I18n.t("bonus.sv.voucherList.emptyList.subtitle")} - /> - dispatch(svGenerateVoucherStart()), - I18n.t("bonus.sv.voucherList.emptyList.cta") - )} - /> - - ); -}; - -const VoucherListScreen = (props: Props): React.ReactElement => { - const { showAnimatedModal, hideModal } = useContext(LightModalContext); - const { - requestVoucherState, - resetFilter, - filters, - requestVoucherPage, - revocationState - } = props; - - const [isFirstPageLoadedSuccessfully, setIsFirstPageLoadedSuccessfully] = - useState(false); - - const vouchers = toArray(props.indexedVouchers); - const isDataLoadedUndefined = isUndefined(props.requiredDataLoaded); - const isDataLoadedLoading = isLoading(props.requiredDataLoaded); - const isDataLoadedError = isError(props.requiredDataLoaded); - - useEffect(() => { - requestVoucherState(); - resetFilter(); - }, [requestVoucherState, resetFilter]); - - useEffect(() => { - if (isDataLoadedUndefined) { - setIsFirstPageLoadedSuccessfully(false); - requestVoucherPage(filters); - } - }, [filters, isDataLoadedUndefined, requestVoucherPage]); - - useEffect(() => { - if (isDataLoadedError && isFirstPageLoadedSuccessfully) { - showToast(I18n.t("bonus.sv.voucherList.error"), "danger"); - } - }, [isDataLoadedError, isFirstPageLoadedSuccessfully]); - - useEffect(() => { - if (isReady(revocationState)) { - showToast( - I18n.t("bonus.sv.voucherList.details.voucherRevocation.toast.ok"), - "success" - ); - } - }, [revocationState]); - - const openFiltersModal = () => - showAnimatedModal( - , - BottomTopAnimation - ); - - if ( - !isReady(props.possibleVoucherState) || - ((isDataLoadedError || isDataLoadedLoading) && - !isFirstPageLoadedSuccessfully) - ) { - return ( - - { - if (isDataLoadedError) { - props.requestVoucherPage(props.filters); - } - if (isError(props.possibleVoucherState)) { - props.requestVoucherState(); - } - }} - /> - - ); - } - if (!isFirstPageLoadedSuccessfully) { - setIsFirstPageLoadedSuccessfully(true); - } - - return ( - - - <> -

- {I18n.t("bonus.sv.voucherList.title")} -

- - - {isReady(props.requiredDataLoaded) && vouchers.length === 0 ? ( - - ) : ( - - } - keyExtractor={v => v.idVoucher.toString()} - ItemSeparatorComponent={() => ( - - )} - onEndReached={() => { - if (props.uiParameters.nextPage !== undefined) { - props.requestVoucherPage(props.filters); - } - }} - renderItem={v => ( - - )} - scrollEnabled={true} - keyboardShouldPersistTaps={"handled"} - /> - )} - -
-
- ); -}; -const mapDispatchToProps = (dispatch: Dispatch) => ({ - requestVoucherState: () => dispatch(svPossibleVoucherStateGet.request()), - resetFilter: () => dispatch(svSetFilter({})), - requestVoucherPage: (filters: FilterState) => - dispatch(svVoucherListGet.request(filters)) -}); -const mapStateToProps = (state: GlobalState) => ({ - indexedVouchers: svVouchersSelector(state), - filters: svFiltersSelector(state), - requiredDataLoaded: svRequiredDataLoadedSelector(state), - uiParameters: svVouchersListUiSelector(state), - possibleVoucherState: possibleVoucherStateSelector(state), - revocationState: selectedVoucherRevocationStateSelector(state) -}); - -export default connect(mapStateToProps, mapDispatchToProps)(VoucherListScreen); diff --git a/ts/features/bonus/siciliaVola/store/actions/activation.ts b/ts/features/bonus/siciliaVola/store/actions/activation.ts deleted file mode 100644 index 8a1d64942cb..00000000000 --- a/ts/features/bonus/siciliaVola/store/actions/activation.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ActionType, createAsyncAction } from "typesafe-actions"; -import { NetworkError } from "../../../../../utils/errors"; - -/** - * check if the external systems are alive - */ -export const svServiceAlive = createAsyncAction( - "SV_SERVICE_ALIVE_REQUEST", - "SV_SERVICE_ALIVE_SUCCESS", - "SV_SERVICE_ALIVE_FAILURE" -)(); - -/** - * check if the user had already accepted the ToS - */ -export const svTosAccepted = createAsyncAction( - "SV_TOS_ACCEPTED_REQUEST", - "SV_TOS_ACCEPTED_SUCCESS", - "SV_TOS_ACCEPTED_FAILURE" -)(); - -/** - * send the user's choice to accept the tos - */ -export const svAcceptTos = createAsyncAction( - "SV_ACCEPT_TOS_REQUEST", - "SV_ACCEPT_TOS_SUCCESS", - "SV_ACCEPT_TOS_FAILURE" -)(); - -export type SvActivationActions = - | ActionType - | ActionType - | ActionType; diff --git a/ts/features/bonus/siciliaVola/store/actions/index.ts b/ts/features/bonus/siciliaVola/store/actions/index.ts deleted file mode 100644 index 326b7fda90e..00000000000 --- a/ts/features/bonus/siciliaVola/store/actions/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { SvVoucherGenerationActions } from "./voucherGeneration"; -import { SvVoucherListActions } from "./voucherList"; -import { SvActivationActions } from "./activation"; - -export type SvActions = - | SvVoucherGenerationActions - | SvVoucherListActions - | SvActivationActions; diff --git a/ts/features/bonus/siciliaVola/store/actions/voucherGeneration.ts b/ts/features/bonus/siciliaVola/store/actions/voucherGeneration.ts deleted file mode 100644 index 4acbce517f6..00000000000 --- a/ts/features/bonus/siciliaVola/store/actions/voucherGeneration.ts +++ /dev/null @@ -1,173 +0,0 @@ -import { - ActionType, - createAsyncAction, - createStandardAction -} from "typesafe-actions"; -import { - AvailableDestinations, - Company, - Hospital, - Municipality, - State, - SvBeneficiaryCategory, - University, - VoucherRequest -} from "../../types/SvVoucherRequest"; -import { NetworkError } from "../../../../../utils/errors"; -import { SvVoucherGeneratedResponse } from "../../types/SvVoucherResponse"; -import { SvVoucherId } from "../../types/SvVoucher"; -import { AeroportiAmmessiInputBean } from "../../../../../../definitions/api_sicilia_vola/AeroportiAmmessiInputBean"; - -/** - * The user chooses to start the workflow to generate a new SiciliaVola voucher - */ -export const svGenerateVoucherStart = createStandardAction( - "SV_GENERATE_VOUCHER_START" -)(); -/** - * The user completes the workflow to generate a new SiciliaVola voucher - * (the request is sent and we receive an OK or a timeout response) - */ -export const svGenerateVoucherCompleted = createStandardAction( - "SV_GENERATE_VOUCHER_COMPLETED" -)(); - -/** - * The user chooses to cancel the generation of a SiciliaVola voucher (no voucher request has been sent) - */ -export const svGenerateVoucherCancel = createStandardAction( - "SV_GENERATE_VOUCHER_CANCEL" -)(); - -/** - * The user chooses `back` from the first screen - */ -export const svGenerateVoucherBack = createStandardAction( - "SV_GENERATE_VOUCHER_BACK" -)(); - -/** - * The workflow fails - */ -export const svGenerateVoucherFailure = createStandardAction( - "SV_GENERATE_VOUCHER_FAILURE" -)(); - -/** - * First step of the voucher generation: category selection - */ -export const svGenerateVoucherSelectCategory = createStandardAction( - "SV_GENERATE_VOUCHER_SELECT_CATEGORY" -)(); - -/** - * Step for worker or sick, to confirm that the annual income is under the threshold limit - */ -export const svGenerateVoucherUnderThresholdIncome = createStandardAction( - "SV_GENERATE_VOUCHER_UNDER_THRESHOLD_INCOME" -)(); - -/** - * Step for worker, to indicate the company data - */ -export const svGenerateVoucherSelectCompany = createStandardAction( - "SV_GENERATE_VOUCHER_SELECT_COMPANY" -)(); - -/** - * Step for sick, to indicate the hospital data - */ -export const svGenerateVoucherSelectHospital = createStandardAction( - "SV_GENERATE_VOUCHER_SELECT_HOSPITAL" -)(); - -/** - * Step for student, to indicate the university data - */ -export const svGenerateVoucherSelectUniversity = createStandardAction( - "SV_GENERATE_VOUCHER_SELECT_UNIVERSITY" -)(); - -export type FlightsDate = { - departureDate: Date; - returnDate?: Date; -}; - -/** - * Step for student, worker and sick to indicate the departure and the return date - */ -export const svGenerateVoucherSelectFlightsDate = createStandardAction( - "SV_GENERATE_VOUCHER_SELECT_FLIGHTS_DATE" -)(); - -/** - * get and handle available destination for a voucher request - */ -export const svGenerateVoucherAvailableDestination = createAsyncAction( - "SV_GENERATE_VOUCHER_AVAILABLE_DESTINATION_REQUEST", - "SV_GENERATE_VOUCHER_AVAILABLE_DESTINATION_SUCCESS", - "SV_GENERATE_VOUCHER_AVAILABLE_DESTINATION_FAILURE" -)(); - -/** - * get and handle the generated voucher - */ -// TODO: check the request type when the API will be fixed -export const svGenerateVoucherGeneratedVoucher = createAsyncAction( - "SV_GENERATE_VOUCHER_GENERATED_VOUCHER_REQUEST", - "SV_GENERATE_VOUCHER_GENERATED_VOUCHER_SUCCESS", - "SV_GENERATE_VOUCHER_GENERATED_VOUCHER_FAILURE" -)(); - -/** - * get and handle the available state - */ -export const svGenerateVoucherAvailableState = createAsyncAction( - "SV_GENERATE_VOUCHER_AVAILABLE_STATE_REQUEST", - "SV_GENERATE_VOUCHER_AVAILABLE_STATE_SUCCESS", - "SV_GENERATE_VOUCHER_AVAILABLE_STATE_FAILURE" -), NetworkError>(); - -/** - * get and handle the available municipality - */ -export const svGenerateVoucherAvailableMunicipality = createAsyncAction( - "SV_GENERATE_VOUCHER_AVAILABLE_MUNICIPALITY_REQUEST", - "SV_GENERATE_VOUCHER_AVAILABLE_MUNICIPALITY_SUCCESS", - "SV_GENERATE_VOUCHER_AVAILABLE_MUNICIPALITY_FAILURE" -), NetworkError>(); - -/** - * Reset the available municipalities - */ -export const svGenerateVoucherResetAvailableMunicipality = createStandardAction( - "SV_GENERATE_VOUCHER_SELECT_RESET_AVAILABLE_MUNICIPALITY" -)(); - -/** - * get and handle the voucher pdf download - */ -export const svGetPdfVoucher = createAsyncAction( - "SV_GENERATE_GET_VOUCHER_PDF_REQUEST", - "SV_GENERATE_GET_VOUCHER_PDF_SUCCESS", - "SV_GENERATE_GET_VOUCHER_PDF_FAILURE" -)(); - -export type SvVoucherGenerationActions = - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType; diff --git a/ts/features/bonus/siciliaVola/store/actions/voucherList.ts b/ts/features/bonus/siciliaVola/store/actions/voucherList.ts deleted file mode 100644 index 9efe7156728..00000000000 --- a/ts/features/bonus/siciliaVola/store/actions/voucherList.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { - ActionType, - createAsyncAction, - createStandardAction -} from "typesafe-actions"; -import { NetworkError } from "../../../../../utils/errors"; -import { SvVoucher, SvVoucherId } from "../../types/SvVoucher"; -import { VoucherBeneficiarioInputBean } from "../../../../../../definitions/api_sicilia_vola/VoucherBeneficiarioInputBean"; -import { SvVoucherListResponse } from "../../types/SvVoucherResponse"; -import { StatoVoucherBeanList } from "../../../../../../definitions/api_sicilia_vola/StatoVoucherBeanList"; -import { FilterState } from "../reducers/voucherList/filters"; - -/** - * get and handle the voucher list - */ -export const svVoucherListGet = createAsyncAction( - "SV_VOUCHER_LIST_GET_REQUEST", - "SV_VOUCHER_LIST_GET_SUCCESS", - "SV_VOUCHER_LIST_GET_FAILURE" -)(); - -/** - * get and handle the possible voucher states - */ -export const svPossibleVoucherStateGet = createAsyncAction( - "SV_POSSIBLE_VOUCHER_STATE_GET_REQUEST", - "SV_POSSIBLE_VOUCHER_STATE_GET_SUCCESS", - "SV_POSSIBLE_VOUCHER_STATE_GET_FAILURE" -)(); - -/** - * get and handle the voucher details - */ -export const svVoucherDetailGet = createAsyncAction( - "SV_VOUCHER_DETAIL_GET_REQUEST", - "SV_VOUCHER_DETAIL_GET_SUCCESS", - "SV_VOUCHER_DETAIL_GET_FAILURE" -)(); - -/** - * handle the voucher revocation - */ -export const svVoucherRevocation = createAsyncAction( - "SV_VOUCHER_REVOCATION_REQUEST", - "SV_VOUCHER_REVOCATION_GET_SUCCESS", - "SV_VOUCHER_REVOCATION_GET_FAILURE" -)(); - -/** - * The user chooses the filter to make the voucher research - */ -export const svSetFilter = createStandardAction("SV_SET_FILTER")(); - -/** - * The user chooses the voucher to see the details - */ -export const svSelectVoucher = - createStandardAction("SV_SELECT_VOUCHER")(); - -export type SvVoucherListActions = - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType - | ActionType; diff --git a/ts/features/bonus/siciliaVola/store/reducers/__test__/availableDestinations.test.ts b/ts/features/bonus/siciliaVola/store/reducers/__test__/availableDestinations.test.ts deleted file mode 100644 index 454e21df92e..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/__test__/availableDestinations.test.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { createStore } from "redux"; -import { appReducer } from "../../../../../../store/reducers"; -import { applicationChangeState } from "../../../../../../store/actions/application"; -import { - svGenerateVoucherAvailableDestination, - svGenerateVoucherStart -} from "../../actions/voucherGeneration"; -import { getTimeoutError } from "../../../../../../utils/errors"; -import { AvailableDestinations } from "../../../types/SvVoucherRequest"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined -} from "../../../../../../common/model/RemoteValue"; - -const genericError = getTimeoutError(); -const mockDestination = { stato: "1", latitudine: 1, longitudine: 1 }; -const mockResponse: AvailableDestinations = ["dest1", "dest2"]; - -describe("Test availableDestination reducer", () => { - it("Initial state should be remoteUndefined", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - expect( - globalState.bonus.sv.voucherGeneration.availableDestinations - ).toStrictEqual(remoteUndefined); - }); - it("Should be remoteUndefined after if the voucher generation workunit starts", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherStart()); - - expect( - store.getState().bonus.sv.voucherGeneration.availableDestinations - ).toStrictEqual(remoteUndefined); - }); - it("Should be remoteLoading after the first loading action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch( - svGenerateVoucherAvailableDestination.request(mockDestination) - ); - - expect( - store.getState().bonus.sv.voucherGeneration.availableDestinations - ).toStrictEqual(remoteLoading); - }); - it("Should be remoteReady with the response, after the success action", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherAvailableDestination.success(mockResponse)); - - expect( - store.getState().bonus.sv.voucherGeneration.availableDestinations - ).toStrictEqual(remoteReady(mockResponse)); - }); - it("Should be remoteError if is dispatched a failure", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch( - svGenerateVoucherAvailableDestination.request(mockDestination) - ); - store.dispatch(svGenerateVoucherAvailableDestination.failure(genericError)); - - expect( - store.getState().bonus.sv.voucherGeneration.availableDestinations - ).toStrictEqual(remoteError(genericError)); - }); -}); diff --git a/ts/features/bonus/siciliaVola/store/reducers/__test__/availableMunicipalities.test.ts b/ts/features/bonus/siciliaVola/store/reducers/__test__/availableMunicipalities.test.ts deleted file mode 100644 index 71f52453de2..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/__test__/availableMunicipalities.test.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { createStore } from "redux"; -import { appReducer } from "../../../../../../store/reducers"; -import { applicationChangeState } from "../../../../../../store/actions/application"; -import { - svGenerateVoucherAvailableMunicipality, - svGenerateVoucherAvailableState, - svGenerateVoucherStart -} from "../../actions/voucherGeneration"; -import { getTimeoutError } from "../../../../../../utils/errors"; -import { Municipality } from "../../../types/SvVoucherRequest"; -import { toIndexed } from "../../../../../../store/helpers/indexer"; -import { - remoteError, - remoteReady, - remoteUndefined -} from "../../../../../../common/model/RemoteValue"; - -const genericError = getTimeoutError(); - -const mockResponse: ReadonlyArray = [ - { id: "A010", name: "mun1", latitude: 1, longitude: 1 }, - { id: "A020", name: "mun2", latitude: 2, longitude: 2 } -]; - -describe("Test availableMunicipality reducer", () => { - it("Initial state should be remoteUndefined", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - expect( - globalState.bonus.sv.voucherGeneration.availableMunicipalities - ).toStrictEqual(remoteUndefined); - }); - it("Should be remoteUndefined after if the voucher generation workunit starts", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherStart()); - - expect( - store.getState().bonus.sv.voucherGeneration.availableMunicipalities - ).toStrictEqual(remoteUndefined); - }); - it("Should be remoteUndefined after if is dispatched a state request action", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - - store.dispatch(svGenerateVoucherAvailableState.request()); - expect( - store.getState().bonus.sv.voucherGeneration.availableMunicipalities - ).toStrictEqual(remoteUndefined); - }); - it("Should be remoteReady with the response, after the success action", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch( - svGenerateVoucherAvailableMunicipality.success(mockResponse) - ); - - expect( - store.getState().bonus.sv.voucherGeneration.availableMunicipalities - ).toStrictEqual(remoteReady(toIndexed(mockResponse, mR => mR.id))); - }); - it("Should be remoteError if is dispatched a failure after the first loading action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - - store.dispatch( - svGenerateVoucherAvailableMunicipality.failure(genericError) - ); - - expect( - store.getState().bonus.sv.voucherGeneration.availableMunicipalities - ).toStrictEqual(remoteError(genericError)); - }); -}); diff --git a/ts/features/bonus/siciliaVola/store/reducers/__test__/availableStates.test.ts b/ts/features/bonus/siciliaVola/store/reducers/__test__/availableStates.test.ts deleted file mode 100644 index ab09d91577a..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/__test__/availableStates.test.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { createStore } from "redux"; -import { appReducer } from "../../../../../../store/reducers"; -import { applicationChangeState } from "../../../../../../store/actions/application"; -import { - svGenerateVoucherAvailableState, - svGenerateVoucherStart -} from "../../actions/voucherGeneration"; -import { getTimeoutError } from "../../../../../../utils/errors"; -import { State } from "../../../types/SvVoucherRequest"; -import { toIndexed } from "../../../../../../store/helpers/indexer"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined -} from "../../../../../../common/model/RemoteValue"; - -const genericError = getTimeoutError(); - -const mockResponse: ReadonlyArray = [ - { id: 1, name: "stat1" }, - { id: 2, name: "stat2" } -]; - -describe("Test availableRegion reducer", () => { - it("Initial state should be remoteUndefined", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - expect( - globalState.bonus.sv.voucherGeneration.availableStates - ).toStrictEqual(remoteUndefined); - }); - it("Should be remoteUndefined after if the voucher generation workunit starts", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherStart()); - - expect( - store.getState().bonus.sv.voucherGeneration.availableStates - ).toStrictEqual(remoteUndefined); - }); - it("Should be remoteLoading after the first loading action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherAvailableState.request()); - - expect( - store.getState().bonus.sv.voucherGeneration.availableStates - ).toStrictEqual(remoteLoading); - }); - it("Should be remoteReady with the response, after the success action", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherAvailableState.success(mockResponse)); - - expect( - store.getState().bonus.sv.voucherGeneration.availableStates - ).toStrictEqual(remoteReady(toIndexed(mockResponse, mR => mR.id))); - }); - it("Should be remoteError if is dispatched a failure after the first loading action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherAvailableState.request()); - store.dispatch(svGenerateVoucherAvailableState.failure(genericError)); - - expect( - store.getState().bonus.sv.voucherGeneration.availableStates - ).toStrictEqual(remoteError(genericError)); - }); -}); diff --git a/ts/features/bonus/siciliaVola/store/reducers/__test__/voucherGenerated.test.ts b/ts/features/bonus/siciliaVola/store/reducers/__test__/voucherGenerated.test.ts deleted file mode 100644 index 5f1975ea465..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/__test__/voucherGenerated.test.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { createStore } from "redux"; -import { appReducer } from "../../../../../../store/reducers"; -import { applicationChangeState } from "../../../../../../store/actions/application"; -import { - svGenerateVoucherGeneratedVoucher, - svGenerateVoucherStart -} from "../../actions/voucherGeneration"; -import { getTimeoutError } from "../../../../../../utils/errors"; -import { University, VoucherRequest } from "../../../types/SvVoucherRequest"; -import { SvVoucherGeneratedResponse } from "../../../types/SvVoucherResponse"; -import { SvVoucher, SvVoucherId } from "../../../types/SvVoucher"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined -} from "../../../../../../common/model/RemoteValue"; - -const genericError = getTimeoutError(); -const mockVoucherRequest: VoucherRequest = { - category: "student", - university: {} as University, - departureDate: new Date() -}; -const mockResponse: SvVoucherGeneratedResponse = { - kind: "success", - value: { - id: 12345 as SvVoucherId - } as SvVoucher -}; - -describe("Test voucherGenerated reducer", () => { - it("Initial state should be remoteUndefined", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - expect( - globalState.bonus.sv.voucherGeneration.voucherGenerated - ).toStrictEqual(remoteUndefined); - }); - it("Should be remoteUndefined after if the voucher generation workunit starts", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherStart()); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherGenerated - ).toStrictEqual(remoteUndefined); - }); - it("Should be remoteLoading after the first loading action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch( - svGenerateVoucherGeneratedVoucher.request(mockVoucherRequest) - ); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherGenerated - ).toStrictEqual(remoteLoading); - }); - it("Should be remoteReady with the response, after the success action", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherGeneratedVoucher.success(mockResponse)); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherGenerated - ).toStrictEqual(remoteReady(mockResponse)); - }); - it("Should be remoteError if is dispatched a failure after the first loading action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch( - svGenerateVoucherGeneratedVoucher.request(mockVoucherRequest) - ); - store.dispatch(svGenerateVoucherGeneratedVoucher.failure(genericError)); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherGenerated - ).toStrictEqual(remoteError(genericError)); - }); -}); diff --git a/ts/features/bonus/siciliaVola/store/reducers/__test__/voucherRequest.test.ts b/ts/features/bonus/siciliaVola/store/reducers/__test__/voucherRequest.test.ts deleted file mode 100644 index 35406a2881b..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/__test__/voucherRequest.test.ts +++ /dev/null @@ -1,229 +0,0 @@ -import { createStore } from "redux"; -import * as O from "fp-ts/lib/Option"; -import { appReducer } from "../../../../../../store/reducers"; -import { applicationChangeState } from "../../../../../../store/actions/application"; -import { - FlightsDate, - svGenerateVoucherSelectCategory, - svGenerateVoucherSelectCompany, - svGenerateVoucherSelectFlightsDate, - svGenerateVoucherSelectHospital, - svGenerateVoucherSelectUniversity, - svGenerateVoucherStart, - svGenerateVoucherUnderThresholdIncome -} from "../../actions/voucherGeneration"; -import { - Company, - Hospital, - SvBeneficiaryCategory, - University -} from "../../../types/SvVoucherRequest"; -import { VoucherRequestState } from "../voucherGeneration/voucherRequest"; - -const mockCategoryStudent: SvBeneficiaryCategory = "student"; -const mockCategoryWorker: SvBeneficiaryCategory = "worker"; -const mockCategorySick: SvBeneficiaryCategory = "sick"; -const mockCompany: Company = { - businessName: "myCompany", - vat: "1234abcd", - state: { id: 1, name: "state1" }, - municipality: { id: "A010", name: "mun1", latitude: 1, longitude: 1 } -}; -const mockHospital: Hospital = { - hospitalName: "myHospital", - state: { id: 1, name: "state1" }, - municipality: { id: "A010", name: "mun1", latitude: 1, longitude: 1 } -}; -const mockUniversity: University = { - universityName: "myUniversity", - state: { id: 1, name: "state1" }, - municipality: { id: "A010", name: "mun1", latitude: 1, longitude: 1 } -}; -const mockFlightsDate: FlightsDate = { - departureDate: new Date(), - returnDate: new Date() -}; - -describe("Test availableRegion reducer", () => { - it("Initial state should be none", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - expect(globalState.bonus.sv.voucherGeneration.voucherRequest).toStrictEqual( - O.none - ); - }); - it("Should none after if the voucher generation workunit starts", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherStart()); - expect(globalState.bonus.sv.voucherGeneration.voucherRequest).toStrictEqual( - O.none - ); - }); - it("Should be some with the category valued after the select category action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherSelectCategory(mockCategoryStudent)); - - const mockState: VoucherRequestState = O.some({ - category: mockCategoryStudent - }); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(mockState); - }); - it("Should be some and update the underThresholdIncome field if the category is worker or sick after the underThresholdIncome action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherSelectCategory(mockCategoryWorker)); - store.dispatch(svGenerateVoucherUnderThresholdIncome(true)); - - const mockState: VoucherRequestState = O.some({ - category: mockCategoryWorker, - underThresholdIncome: true - }); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(mockState); - }); - it("Should return the same state if the category is not worker or sick or the voucherRequest is none after the underThresholdIncome action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - - store.dispatch(svGenerateVoucherUnderThresholdIncome(true)); - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(O.none); - - store.dispatch(svGenerateVoucherSelectCategory(mockCategoryStudent)); - store.dispatch(svGenerateVoucherUnderThresholdIncome(true)); - - const mockState: VoucherRequestState = O.some({ - category: mockCategoryStudent - }); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(mockState); - }); - it("Should be some and update the company field if the category is worker after the select company action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherSelectCategory(mockCategoryWorker)); - store.dispatch(svGenerateVoucherSelectCompany(mockCompany)); - - const mockState: VoucherRequestState = O.some({ - category: mockCategoryWorker, - company: mockCompany - }); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(mockState); - }); - it("Should return the same state if the category is not worker or the voucherRequest is none after the select company action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - - store.dispatch(svGenerateVoucherSelectCompany(mockCompany)); - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(O.none); - - store.dispatch(svGenerateVoucherSelectCategory(mockCategoryStudent)); - store.dispatch(svGenerateVoucherSelectCompany(mockCompany)); - - const mockState: VoucherRequestState = O.some({ - category: mockCategoryStudent - }); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(mockState); - }); - it("Should be some and update the hospital field if the category is sick after the select hospital action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherSelectCategory(mockCategorySick)); - store.dispatch(svGenerateVoucherSelectHospital(mockHospital)); - - const mockState: VoucherRequestState = O.some({ - category: mockCategorySick, - hospital: mockHospital - }); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(mockState); - }); - it("Should return the same state if the category is not sick or the voucherRequest is none after the select hospital action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherSelectHospital(mockHospital)); - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(O.none); - - store.dispatch(svGenerateVoucherSelectCategory(mockCategoryWorker)); - store.dispatch(svGenerateVoucherSelectHospital(mockHospital)); - - const mockState: VoucherRequestState = O.some({ - category: mockCategoryWorker - }); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(mockState); - }); - it("Should be some and update the university field if the category is student after the select university action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherSelectCategory(mockCategoryStudent)); - store.dispatch(svGenerateVoucherSelectUniversity(mockUniversity)); - - const mockState: VoucherRequestState = O.some({ - category: mockCategoryStudent, - university: mockUniversity - }); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(mockState); - }); - it("Should return the same state if the category is not student or the voucherRequest is none after the select university action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherSelectUniversity(mockUniversity)); - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(O.none); - - store.dispatch(svGenerateVoucherSelectCategory(mockCategoryWorker)); - store.dispatch(svGenerateVoucherSelectUniversity(mockUniversity)); - - const mockState: VoucherRequestState = O.some({ - category: mockCategoryWorker - }); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(mockState); - }); - it("Should be some and update the departureDate and the returnDate fields after the select flights date action dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svGenerateVoucherSelectCategory(mockCategoryStudent)); - store.dispatch(svGenerateVoucherSelectFlightsDate(mockFlightsDate)); - - const mockState: VoucherRequestState = O.some({ - category: mockCategoryStudent, - departureDate: mockFlightsDate.departureDate, - returnDate: mockFlightsDate.returnDate - }); - - expect( - store.getState().bonus.sv.voucherGeneration.voucherRequest - ).toStrictEqual(mockState); - }); -}); diff --git a/ts/features/bonus/siciliaVola/store/reducers/__test__/vouchers.test.ts b/ts/features/bonus/siciliaVola/store/reducers/__test__/vouchers.test.ts deleted file mode 100644 index 043ff65e31d..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/__test__/vouchers.test.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { createStore } from "redux"; -import { appReducer } from "../../../../../../store/reducers"; -import { applicationChangeState } from "../../../../../../store/actions/application"; -import { getTimeoutError } from "../../../../../../utils/errors"; -import { toIndexed } from "../../../../../../store/helpers/indexer"; -import { svSetFilter, svVoucherListGet } from "../../actions/voucherList"; -import { SvVoucherId } from "../../../types/SvVoucher"; -import { - SvVoucherListResponse, - VoucherPreview -} from "../../../types/SvVoucherResponse"; -import { svGenerateVoucherCompleted } from "../../actions/voucherGeneration"; - -const genericError = getTimeoutError(); - -const mockResponse: SvVoucherListResponse = [ - { - idVoucher: 12345 as SvVoucherId - } as VoucherPreview, - { - idVoucher: 67890 as SvVoucherId - } as VoucherPreview -]; - -const mockResponse2: SvVoucherListResponse = [ - { - idVoucher: 45123 as SvVoucherId - } as VoucherPreview, - { - idVoucher: 90678 as SvVoucherId - } as VoucherPreview -]; - -describe("Test vouchers reducer", () => { - it("Initial state should be an empty object", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - expect(globalState.bonus.sv.voucherList.vouchers).toStrictEqual({}); - }); - it("Should be in the initial state after the svSetFilter or svGenerateVoucherCompleted actions are dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svSetFilter({})); - expect(store.getState().bonus.sv.voucherList.vouchers).toStrictEqual({}); - store.dispatch(svGenerateVoucherCompleted()); - expect(store.getState().bonus.sv.voucherList.vouchers).toStrictEqual({}); - }); - it("Should contain the new object when svVoucherListGet.success is dispatched", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - store.dispatch(svVoucherListGet.success(mockResponse)); - - const indexedMockResponse = toIndexed(mockResponse, mR => mR.idVoucher); - expect(store.getState().bonus.sv.voucherList.vouchers).toStrictEqual( - indexedMockResponse - ); - store.dispatch(svVoucherListGet.success(mockResponse2)); - - expect(store.getState().bonus.sv.voucherList.vouchers).toStrictEqual({ - ...indexedMockResponse, - ...toIndexed(mockResponse2, mR2 => mR2.idVoucher) - }); - }); - it("The state should remain unchanged if is dispatched a svVoucherListGet.request or a svVoucherListGet.failure action", () => { - const globalState = appReducer(undefined, applicationChangeState("active")); - const store = createStore(appReducer, globalState as any); - - const initialState = {}; - expect(store.getState().bonus.sv.voucherList.vouchers).toStrictEqual( - initialState - ); - store.dispatch(svVoucherListGet.request({})); - expect(store.getState().bonus.sv.voucherList.vouchers).toStrictEqual( - initialState - ); - store.dispatch(svVoucherListGet.failure(genericError)); - expect(store.getState().bonus.sv.voucherList.vouchers).toStrictEqual( - initialState - ); - }); -}); diff --git a/ts/features/bonus/siciliaVola/store/reducers/activation.ts b/ts/features/bonus/siciliaVola/store/reducers/activation.ts deleted file mode 100644 index b8bf73413fb..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/activation.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { createSelector } from "reselect"; -import { getType } from "typesafe-actions"; -import { Action } from "../../../../../store/actions/types"; -import { NetworkError } from "../../../../../utils/errors"; -import { - svAcceptTos, - svServiceAlive, - svTosAccepted -} from "../actions/activation"; -import { GlobalState } from "../../../../../store/reducers/types"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined, - RemoteValue -} from "../../../../../common/model/RemoteValue"; - -export type ActivationState = { - isAlive: RemoteValue; - tosAccepted: RemoteValue; -}; - -const INITIAL_STATE: ActivationState = { - isAlive: remoteUndefined, - tosAccepted: remoteUndefined -}; - -const reducer = ( - state: ActivationState = INITIAL_STATE, - action: Action -): ActivationState => { - switch (action.type) { - case getType(svServiceAlive.request): - return { - ...state, - isAlive: remoteLoading - }; - case getType(svServiceAlive.success): - return { - ...state, - isAlive: remoteReady(action.payload) - }; - case getType(svServiceAlive.failure): - return { - ...state, - isAlive: remoteError(action.payload) - }; - case getType(svAcceptTos.request): - case getType(svTosAccepted.request): - return { - ...state, - tosAccepted: remoteLoading - }; - case getType(svAcceptTos.success): - case getType(svTosAccepted.success): - return { - ...state, - tosAccepted: remoteReady(action.payload) - }; - case getType(svAcceptTos.failure): - case getType(svTosAccepted.failure): - return { - ...state, - tosAccepted: remoteError(action.payload) - }; - } - return state; -}; - -export default reducer; - -export const isAliveSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.activation.isAlive], - ( - isAlive: RemoteValue - ): RemoteValue => isAlive -); - -export const tosAcceptedSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.activation.tosAccepted], - ( - tosAccepted: RemoteValue - ): RemoteValue => tosAccepted -); diff --git a/ts/features/bonus/siciliaVola/store/reducers/index.ts b/ts/features/bonus/siciliaVola/store/reducers/index.ts deleted file mode 100644 index 4b43abf4437..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Action, combineReducers } from "redux"; -import svVoucherGenerationReducer, { - VoucherGenerationState -} from "./voucherGeneration/voucherGeneration"; -import svVoucherListReducer, { - VoucherListState -} from "./voucherList/voucherList"; -import svActivationReducer, { ActivationState } from "./activation"; -import selectedVoucherReducer, { - SelectedVoucherState -} from "./selectedVoucher"; - -export type SvState = { - activation: ActivationState; - voucherGeneration: VoucherGenerationState; - voucherList: VoucherListState; - selectedVoucher: SelectedVoucherState; -}; - -const svReducer = combineReducers({ - activation: svActivationReducer, - voucherGeneration: svVoucherGenerationReducer, - voucherList: svVoucherListReducer, - selectedVoucher: selectedVoucherReducer -}); - -export default svReducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/selectedVoucher.ts b/ts/features/bonus/siciliaVola/store/reducers/selectedVoucher.ts deleted file mode 100644 index 630112c13e1..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/selectedVoucher.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { getType } from "typesafe-actions"; -import { createSelector } from "reselect"; -import { Action } from "../../../../../store/actions/types"; -import { - svGenerateVoucherStart, - svGetPdfVoucher -} from "../actions/voucherGeneration"; -import { SvVoucher, SvVoucherId } from "../../types/SvVoucher"; -import { - svSelectVoucher, - svVoucherDetailGet, - svVoucherRevocation -} from "../actions/voucherList"; -import { NetworkError } from "../../../../../utils/errors"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined, - RemoteValue -} from "../../../../../common/model/RemoteValue"; -import { GlobalState } from "../../../../../store/reducers/types"; - -export type SelectedVoucherState = { - voucherCode?: SvVoucherId; - voucher: RemoteValue; - revocation: RemoteValue; - voucherPdf: RemoteValue; -}; -const INITIAL_STATE: SelectedVoucherState = { - voucher: remoteUndefined, - revocation: remoteUndefined, - voucherPdf: remoteUndefined -}; - -const reducer = ( - state: SelectedVoucherState = INITIAL_STATE, - action: Action -): SelectedVoucherState => { - switch (action.type) { - case getType(svGenerateVoucherStart): - return INITIAL_STATE; - case getType(svVoucherDetailGet.request): - return { ...state, voucher: remoteLoading }; - case getType(svVoucherDetailGet.success): - return { ...state, voucher: remoteReady(action.payload) }; - case getType(svVoucherDetailGet.failure): - return { ...state, voucher: remoteError(action.payload) }; - case getType(svSelectVoucher): - return { - ...state, - voucherCode: action.payload, - revocation: remoteUndefined, - voucherPdf: remoteUndefined - }; - case getType(svVoucherRevocation.request): - return { ...state, revocation: remoteLoading }; - case getType(svVoucherRevocation.success): - return { ...state, revocation: remoteReady(true) }; - case getType(svVoucherRevocation.failure): - return { ...state, revocation: remoteError(action.payload) }; - case getType(svGetPdfVoucher.request): - return { ...state, voucherPdf: remoteLoading }; - case getType(svGetPdfVoucher.success): - return { ...state, voucherPdf: remoteReady(action.payload) }; - case getType(svGetPdfVoucher.failure): - return { ...state, voucherPdf: remoteError(action.payload) }; - } - - return state; -}; - -export const selectedVoucherCodeSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.selectedVoucher.voucherCode], - (voucherCode?: SvVoucherId): SvVoucherId | undefined => voucherCode -); -export const selectedVoucherSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.selectedVoucher.voucher], - ( - voucher: RemoteValue - ): RemoteValue => voucher -); -export const selectedVoucherRevocationStateSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.selectedVoucher.revocation], - ( - revocationState: RemoteValue - ): RemoteValue => revocationState -); - -export const selectedPdfVoucherStateSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.selectedVoucher.voucherPdf], - ( - voucherPdfState: RemoteValue - ): RemoteValue => voucherPdfState -); - -export default reducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableDestinations.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableDestinations.ts deleted file mode 100644 index ecd3774f9db..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableDestinations.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { getType } from "typesafe-actions"; -import { createSelector } from "reselect"; -import { AvailableDestinations } from "../../../types/SvVoucherRequest"; -import { NetworkError } from "../../../../../../utils/errors"; -import { Action } from "../../../../../../store/actions/types"; -import { - svGenerateVoucherAvailableDestination, - svGenerateVoucherStart -} from "../../actions/voucherGeneration"; -import { GlobalState } from "../../../../../../store/reducers/types"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined, - RemoteValue -} from "../../../../../../common/model/RemoteValue"; - -export type AvailableDestinationsState = RemoteValue< - AvailableDestinations, - NetworkError ->; -const INITIAL_STATE: AvailableDestinationsState = remoteUndefined; - -const reducer = ( - state: AvailableDestinationsState = INITIAL_STATE, - action: Action -): AvailableDestinationsState => { - switch (action.type) { - case getType(svGenerateVoucherStart): - return INITIAL_STATE; - case getType(svGenerateVoucherAvailableDestination.request): - return remoteLoading; - case getType(svGenerateVoucherAvailableDestination.success): - return remoteReady(action.payload); - case getType(svGenerateVoucherAvailableDestination.failure): - return remoteError(action.payload); - } - return state; -}; - -export const availableDestinationsSelector = createSelector( - [ - (state: GlobalState) => - state.bonus.sv.voucherGeneration.availableDestinations - ], - ( - availableDestinations: AvailableDestinationsState - ): AvailableDestinationsState => availableDestinations -); - -export default reducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableMunicipalities.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableMunicipalities.ts deleted file mode 100644 index 9b403cb27ed..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableMunicipalities.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { getType } from "typesafe-actions"; -import { createSelector } from "reselect"; -import { - IndexedById, - toIndexed -} from "../../../../../../store/helpers/indexer"; -import { Municipality } from "../../../types/SvVoucherRequest"; -import { NetworkError } from "../../../../../../utils/errors"; -import { Action } from "../../../../../../store/actions/types"; -import { - svGenerateVoucherAvailableMunicipality, - svGenerateVoucherAvailableState, - svGenerateVoucherResetAvailableMunicipality, - svGenerateVoucherStart -} from "../../actions/voucherGeneration"; -import { GlobalState } from "../../../../../../store/reducers/types"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined, - RemoteValue -} from "../../../../../../common/model/RemoteValue"; - -export type AvailableMunicipalitiesState = RemoteValue< - IndexedById, - NetworkError ->; -const INITIAL_STATE: AvailableMunicipalitiesState = remoteUndefined; - -const reducer = ( - state: AvailableMunicipalitiesState = INITIAL_STATE, - action: Action -): AvailableMunicipalitiesState => { - switch (action.type) { - case getType(svGenerateVoucherStart): - case getType(svGenerateVoucherAvailableState.request): - case getType(svGenerateVoucherResetAvailableMunicipality): - return INITIAL_STATE; - case getType(svGenerateVoucherAvailableMunicipality.request): - return remoteLoading; - case getType(svGenerateVoucherAvailableMunicipality.success): - return remoteReady(toIndexed(action.payload, m => m.id)); - case getType(svGenerateVoucherAvailableMunicipality.failure): - return remoteError(action.payload); - } - return state; -}; - -export const availableMunicipalitiesSelector = createSelector( - [ - (state: GlobalState) => - state.bonus.sv.voucherGeneration.availableMunicipalities - ], - ( - availableMunicipalities: AvailableMunicipalitiesState - ): AvailableMunicipalitiesState => availableMunicipalities -); - -export default reducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableStates.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableStates.ts deleted file mode 100644 index 07f12acc776..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/availableStates.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { getType } from "typesafe-actions"; -import { createSelector } from "reselect"; -import { - IndexedById, - toIndexed -} from "../../../../../../store/helpers/indexer"; -import { State } from "../../../types/SvVoucherRequest"; -import { NetworkError } from "../../../../../../utils/errors"; -import { Action } from "../../../../../../store/actions/types"; -import { - svGenerateVoucherAvailableState, - svGenerateVoucherStart -} from "../../actions/voucherGeneration"; -import { GlobalState } from "../../../../../../store/reducers/types"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined, - RemoteValue -} from "../../../../../../common/model/RemoteValue"; - -export type AvailableStatesState = RemoteValue< - IndexedById, - NetworkError ->; -const INITIAL_STATE: AvailableStatesState = remoteUndefined; - -const reducer = ( - state: AvailableStatesState = INITIAL_STATE, - action: Action -): AvailableStatesState => { - switch (action.type) { - case getType(svGenerateVoucherStart): - return INITIAL_STATE; - case getType(svGenerateVoucherAvailableState.request): - return remoteLoading; - case getType(svGenerateVoucherAvailableState.success): - return remoteReady(toIndexed(action.payload, s => s.id)); - case getType(svGenerateVoucherAvailableState.failure): - return remoteError(action.payload); - } - return state; -}; - -export const availableStatesSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.voucherGeneration.availableStates], - (availableState: AvailableStatesState): AvailableStatesState => availableState -); - -export default reducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherGenerated.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherGenerated.ts deleted file mode 100644 index 739e3d67bd2..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherGenerated.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { getType } from "typesafe-actions"; -import { createSelector } from "reselect"; -import { SvVoucherGeneratedResponse } from "../../../types/SvVoucherResponse"; -import { NetworkError } from "../../../../../../utils/errors"; -import { Action } from "../../../../../../store/actions/types"; -import { - svGenerateVoucherGeneratedVoucher, - svGenerateVoucherStart -} from "../../actions/voucherGeneration"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined, - RemoteValue -} from "../../../../../../common/model/RemoteValue"; -import { GlobalState } from "../../../../../../store/reducers/types"; - -export type VoucherGeneratedState = RemoteValue< - SvVoucherGeneratedResponse, - NetworkError ->; -const INITIAL_STATE: VoucherGeneratedState = remoteUndefined; - -const reducer = ( - state: VoucherGeneratedState = INITIAL_STATE, - action: Action -): VoucherGeneratedState => { - switch (action.type) { - case getType(svGenerateVoucherStart): - return INITIAL_STATE; - case getType(svGenerateVoucherGeneratedVoucher.request): - return remoteLoading; - case getType(svGenerateVoucherGeneratedVoucher.success): - return remoteReady(action.payload); - case getType(svGenerateVoucherGeneratedVoucher.failure): - return remoteError(action.payload); - } - return state; -}; - -export const voucherGeneratedSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.voucherGeneration.voucherGenerated], - (voucherGenerated: VoucherGeneratedState): VoucherGeneratedState => - voucherGenerated -); - -export default reducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherGeneration.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherGeneration.ts deleted file mode 100644 index f3b9edc018a..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherGeneration.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { combineReducers } from "redux"; -import { Action } from "../../../../../../store/actions/types"; -import voucherGeneratedReducer, { - VoucherGeneratedState -} from "./voucherGenerated"; -import voucherRequestReducer, { VoucherRequestState } from "./voucherRequest"; -import availableDestinationReducer, { - AvailableDestinationsState -} from "./availableDestinations"; -import availableStatesReducer, { - AvailableStatesState -} from "./availableStates"; - -import availableMunicipalitiesReducer, { - AvailableMunicipalitiesState -} from "./availableMunicipalities"; - -export type VoucherGenerationState = { - voucherRequest: VoucherRequestState; - voucherGenerated: VoucherGeneratedState; - availableDestinations: AvailableDestinationsState; - availableStates: AvailableStatesState; - availableMunicipalities: AvailableMunicipalitiesState; -}; - -const svVoucherGenerationReducer = combineReducers< - VoucherGenerationState, - Action ->({ - voucherRequest: voucherRequestReducer, - availableDestinations: availableDestinationReducer, - voucherGenerated: voucherGeneratedReducer, - availableStates: availableStatesReducer, - availableMunicipalities: availableMunicipalitiesReducer -}); - -export default svVoucherGenerationReducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherRequest.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherRequest.ts deleted file mode 100644 index 900ca53ee92..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherGeneration/voucherRequest.ts +++ /dev/null @@ -1,171 +0,0 @@ -import * as O from "fp-ts/lib/Option"; -import { getType } from "typesafe-actions"; -import { createSelector } from "reselect"; -import { pipe } from "fp-ts/lib/function"; -import { - Company, - Hospital, - PartialVoucherRequest, - University, - SvBeneficiaryCategory -} from "../../../types/SvVoucherRequest"; -import { - FlightsDate, - svGenerateVoucherSelectCategory, - svGenerateVoucherSelectCompany, - svGenerateVoucherSelectFlightsDate, - svGenerateVoucherSelectHospital, - svGenerateVoucherSelectUniversity, - svGenerateVoucherStart, - svGenerateVoucherUnderThresholdIncome -} from "../../actions/voucherGeneration"; -import { Action } from "../../../../../../store/actions/types"; -import { GlobalState } from "../../../../../../store/reducers/types"; - -export type VoucherRequestState = O.Option; -const INITIAL_STATE: VoucherRequestState = O.none; - -/** - * Utils needed to update only the under threshold value - * @param state - * @param underThresholdIncome - */ -const updateUnderThresholdIncome = ( - state: VoucherRequestState, - underThresholdIncome: boolean -): VoucherRequestState => - pipe( - state, - O.chain(vR => { - if (vR.category === "worker" || vR.category === "sick") { - return O.some({ ...vR, underThresholdIncome }); - } - return state; - }) - ); - -/** - * Utils needed to update only the university value - * @param state - * @param university - */ -const updateUniversity = ( - state: VoucherRequestState, - university: University -): VoucherRequestState => - pipe( - state, - O.chain(vR => { - if (vR.category === "student") { - return O.some({ ...vR, university }); - } - return state; - }) - ); - -/** - * Utils needed to update only the company value - * @param state - * @param company - */ -const updateCompany = ( - state: VoucherRequestState, - company: Company -): VoucherRequestState => - pipe( - state, - O.chain(vR => { - if (vR.category === "worker") { - return O.some({ ...vR, company }); - } - return state; - }) - ); - -/** - * Utils needed to update only the hospital value - * @param state - * @param hospital - */ -const updateHospital = ( - state: VoucherRequestState, - hospital: Hospital -): VoucherRequestState => - pipe( - state, - O.chain(vR => { - if (vR.category === "sick") { - return O.some({ ...vR, hospital }); - } - return state; - }) - ); - -/** - * Utils needed to update only the flights date values - * @param state - * @param flightsDate - */ -const updateFlightsDate = ( - state: VoucherRequestState, - flightsDate: FlightsDate -): VoucherRequestState => - pipe( - state, - O.chain(vR => - O.some({ - ...vR, - departureDate: flightsDate.departureDate, - returnDate: flightsDate.returnDate - }) - ) - ); - -const reducer = ( - state: VoucherRequestState = INITIAL_STATE, - action: Action -): VoucherRequestState => { - switch (action.type) { - case getType(svGenerateVoucherStart): - return INITIAL_STATE; - case getType(svGenerateVoucherSelectCategory): - return O.some({ - category: action.payload - }); - - case getType(svGenerateVoucherUnderThresholdIncome): - return updateUnderThresholdIncome(state, action.payload); - - case getType(svGenerateVoucherSelectCompany): - return updateCompany(state, action.payload); - - case getType(svGenerateVoucherSelectHospital): - return updateHospital(state, action.payload); - - case getType(svGenerateVoucherSelectUniversity): - return updateUniversity(state, action.payload); - - case getType(svGenerateVoucherSelectFlightsDate): - return updateFlightsDate(state, action.payload); - } - return state; -}; - -export default reducer; - -export const selectedBeneficiaryCategorySelector = createSelector( - [(state: GlobalState) => state.bonus.sv.voucherGeneration.voucherRequest], - (voucherRequest: VoucherRequestState): O.Option => - pipe( - voucherRequest, - O.fold( - () => O.none, - vR => O.some(vR.category) - ) - ) -); - -export const voucherRequestSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.voucherGeneration.voucherRequest], - (voucherRequest: VoucherRequestState): VoucherRequestState => voucherRequest -); diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherList/filters.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherList/filters.ts deleted file mode 100644 index 15e2cb73ea5..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherList/filters.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { getType } from "typesafe-actions"; -import { UTCISODateFromString } from "@pagopa/ts-commons/lib/dates"; -import { createSelector } from "reselect"; -import { Action } from "../../../../../../store/actions/types"; -import { svSetFilter } from "../../actions/voucherList"; -import { GlobalState } from "../../../../../../store/reducers/types"; - -export type FilterState = { - codiceVoucher?: string; - idStato?: number; - dataDa?: UTCISODateFromString; - dataA?: UTCISODateFromString; -}; - -const INITIAL_STATE: FilterState = { - codiceVoucher: undefined, - idStato: undefined, - dataDa: undefined, - dataA: undefined -}; - -const reducer = ( - state: FilterState = INITIAL_STATE, - action: Action -): FilterState => { - switch (action.type) { - case getType(svSetFilter): - const { codiceVoucher, idStato, dataDa, dataA } = action.payload; - return { codiceVoucher, idStato, dataDa, dataA }; - } - - return state; -}; - -export const svFiltersSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.voucherList.filters], - (filters: FilterState): FilterState => filters -); - -export default reducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherList/possibleVoucherState.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherList/possibleVoucherState.ts deleted file mode 100644 index e1ce116e7c8..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherList/possibleVoucherState.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { getType } from "typesafe-actions"; -import { createSelector } from "reselect"; -import { Action } from "../../../../../../store/actions/types"; -import { svPossibleVoucherStateGet } from "../../actions/voucherList"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined, - RemoteValue -} from "../../../../../../common/model/RemoteValue"; -import { GlobalState } from "../../../../../../store/reducers/types"; -import { StatoVoucherBeanList } from "../../../../../../../definitions/api_sicilia_vola/StatoVoucherBeanList"; -import { NetworkError } from "../../../../../../utils/errors"; - -export type PossibleVoucherStateState = RemoteValue< - StatoVoucherBeanList, - NetworkError ->; - -const INITIAL_STATE: PossibleVoucherStateState = remoteUndefined; - -const reducer = ( - state: PossibleVoucherStateState = INITIAL_STATE, - action: Action -): PossibleVoucherStateState => { - switch (action.type) { - case getType(svPossibleVoucherStateGet.request): - return remoteLoading; - case getType(svPossibleVoucherStateGet.success): - return remoteReady(action.payload); - case getType(svPossibleVoucherStateGet.failure): - return remoteError(action.payload); - } - - return state; -}; - -export const possibleVoucherStateSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.voucherList.possibleVoucherState], - ( - possibleVoucherState: PossibleVoucherStateState - ): PossibleVoucherStateState => possibleVoucherState -); - -export default reducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherList/ui.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherList/ui.ts deleted file mode 100644 index 4dffb55e583..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherList/ui.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { getType } from "typesafe-actions"; -import { createSelector } from "reselect"; -import { Action } from "../../../../../../store/actions/types"; -import { - svSetFilter, - svVoucherListGet, - svVoucherRevocation -} from "../../actions/voucherList"; -import { - remoteError, - remoteLoading, - remoteReady, - remoteUndefined, - RemoteValue -} from "../../../../../../common/model/RemoteValue"; -import { svGenerateVoucherCompleted } from "../../actions/voucherGeneration"; -import { NetworkError } from "../../../../../../utils/errors"; -import { GlobalState } from "../../../../../../store/reducers/types"; - -export type VouchersListUiState = { - nextPage?: number; - requiredDataLoaded: RemoteValue; -}; - -const INITIAL_STATE: VouchersListUiState = { - nextPage: 1, - requiredDataLoaded: remoteUndefined -}; - -const reducer = ( - state: VouchersListUiState = INITIAL_STATE, - action: Action -): VouchersListUiState => { - switch (action.type) { - // when a voucher has been revoked the current voucher list is obsolete - case getType(svGenerateVoucherCompleted): - case getType(svSetFilter): - case getType(svVoucherRevocation.success): - return INITIAL_STATE; - case getType(svVoucherListGet.request): - return { ...state, requiredDataLoaded: remoteLoading }; - case getType(svVoucherListGet.success): - return { - nextPage: - action.payload.length > 0 && state.nextPage !== undefined - ? state.nextPage + 1 - : undefined, - requiredDataLoaded: remoteReady(true) - }; - case getType(svVoucherListGet.failure): - return { ...state, requiredDataLoaded: remoteError(action.payload) }; - } - - return state; -}; - -export const svVouchersListUiSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.voucherList.ui], - (uiParameters: VouchersListUiState): VouchersListUiState => uiParameters -); - -export const svRequiredDataLoadedSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.voucherList.ui.requiredDataLoaded], - ( - requiredDataLoaded: RemoteValue - ): RemoteValue => requiredDataLoaded -); - -export default reducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherList/voucherList.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherList/voucherList.ts deleted file mode 100644 index 8f00e3e4529..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherList/voucherList.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { combineReducers } from "redux"; -import { Action } from "../../../../../../store/actions/types"; -import svPossibleVoucherStateReducer, { - PossibleVoucherStateState -} from "./possibleVoucherState"; -import svVouchersStateReducer, { VouchersState } from "./vouchers"; -import svFilterStateReducer, { FilterState } from "./filters"; -import svVouchersListUiReducer, { VouchersListUiState } from "./ui"; - -export type VoucherListState = { - possibleVoucherState: PossibleVoucherStateState; - vouchers: VouchersState; - filters: FilterState; - ui: VouchersListUiState; -}; - -const svVoucherListReducer = combineReducers({ - possibleVoucherState: svPossibleVoucherStateReducer, - vouchers: svVouchersStateReducer, - filters: svFilterStateReducer, - ui: svVouchersListUiReducer -}); - -export default svVoucherListReducer; diff --git a/ts/features/bonus/siciliaVola/store/reducers/voucherList/vouchers.ts b/ts/features/bonus/siciliaVola/store/reducers/voucherList/vouchers.ts deleted file mode 100644 index 3f003d67f07..00000000000 --- a/ts/features/bonus/siciliaVola/store/reducers/voucherList/vouchers.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { getType } from "typesafe-actions"; -import { createSelector } from "reselect"; -import { Action } from "../../../../../../store/actions/types"; -import { svSetFilter, svVoucherListGet } from "../../actions/voucherList"; -import { svGenerateVoucherCompleted } from "../../actions/voucherGeneration"; -import { - IndexedById, - toIndexed -} from "../../../../../../store/helpers/indexer"; -import { - SvVoucherListResponse, - VoucherPreview -} from "../../../types/SvVoucherResponse"; -import { GlobalState } from "../../../../../../store/reducers/types"; - -export type VouchersState = IndexedById; - -const INITIAL_STATE: VouchersState = {}; - -const updateVouchers = ( - currentVouchers: VouchersState, - newVouchers: SvVoucherListResponse -): IndexedById => { - const newVouchersIndexed = toIndexed(newVouchers, v => v.idVoucher); - return { ...currentVouchers, ...newVouchersIndexed }; -}; - -const reducer = ( - state: VouchersState = INITIAL_STATE, - action: Action -): VouchersState => { - switch (action.type) { - case getType(svGenerateVoucherCompleted): - case getType(svSetFilter): - return INITIAL_STATE; - case getType(svVoucherListGet.request): - case getType(svVoucherListGet.failure): - return state; - case getType(svVoucherListGet.success): - return updateVouchers(state, action.payload); - } - - return state; -}; - -export const svVouchersSelector = createSelector( - [(state: GlobalState) => state.bonus.sv.voucherList.vouchers], - (vouchers: VouchersState): VouchersState => vouchers -); - -export default reducer; diff --git a/ts/features/bonus/siciliaVola/types/SvVoucher.ts b/ts/features/bonus/siciliaVola/types/SvVoucher.ts deleted file mode 100644 index 6c70375a97d..00000000000 --- a/ts/features/bonus/siciliaVola/types/SvVoucher.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { IUnitTag } from "@pagopa/ts-commons/lib/units"; -import { AvailableDestinations, VoucherRequest } from "./SvVoucherRequest"; - -/** - * The unique ID of a SiciliaVola Voucher - */ -export type SvVoucherId = number & IUnitTag<"SvVoucherId">; - -type WithSvVoucherId = { - id: SvVoucherId; -}; - -type QRCode = string; - -type BarCode = string; - -/** - * This type represents the Sv Voucher - */ -export type SvVoucher = WithSvVoucherId & - VoucherRequest & { - beneficiary: string; - qrCode: QRCode; - barCode: BarCode; - availableDestination: AvailableDestinations; - }; diff --git a/ts/features/bonus/siciliaVola/types/SvVoucherRequest.ts b/ts/features/bonus/siciliaVola/types/SvVoucherRequest.ts deleted file mode 100644 index 02de17bac46..00000000000 --- a/ts/features/bonus/siciliaVola/types/SvVoucherRequest.ts +++ /dev/null @@ -1,89 +0,0 @@ -export type State = { - id: number; - name: string; -}; - -export type Municipality = { - id: string; - name: string; - latitude: number; - longitude: number; -}; -export type University = { - universityName: string; - state: State; - municipality: Municipality; -}; - -export type Company = { - businessName: string; - vat: string; - state: State; - municipality: Municipality; -}; - -export type Hospital = { - hospitalName: string; - state: State; - municipality: Municipality; -}; - -export type DisabledVoucherRequest = { - category: "disabled"; - departureDate: Date; - returnDate?: Date; -}; - -export type StudentVoucherRequest = { - category: "student"; - university: University; - departureDate: Date; - returnDate?: Date; -}; - -export type WorkerVoucherRequest = { - category: "worker"; - underThresholdIncome: boolean; - company: Company; - departureDate: Date; - returnDate?: Date; -}; - -export type SickVoucherRequest = { - category: "sick"; - underThresholdIncome: boolean; - hospital: Hospital; - departureDate: Date; - returnDate?: Date; -}; - -type PartialDisabledVoucherRequest = Partial< - Omit -> & - Pick; -type PartialStudentVoucherRequest = Partial< - Omit -> & - Pick; -type PartialWorkerVoucherRequest = Partial< - Omit -> & - Pick; -type PartialSickVoucherRequest = Partial> & - Pick; - -export type VoucherRequest = - | DisabledVoucherRequest - | StudentVoucherRequest - | WorkerVoucherRequest - | SickVoucherRequest; - -export type PartialVoucherRequest = - | PartialSickVoucherRequest - | PartialDisabledVoucherRequest - | PartialStudentVoucherRequest - | PartialWorkerVoucherRequest; - -export type SvBeneficiaryCategory = VoucherRequest["category"]; - -export type AvailableDestinations = ReadonlyArray; diff --git a/ts/features/bonus/siciliaVola/types/SvVoucherResponse.ts b/ts/features/bonus/siciliaVola/types/SvVoucherResponse.ts deleted file mode 100644 index 46656aa76dc..00000000000 --- a/ts/features/bonus/siciliaVola/types/SvVoucherResponse.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { SvVoucher, SvVoucherId } from "./SvVoucher"; - -export type SvVoucherGeneratedResponseSuccess = { - kind: "success"; - value: SvVoucher; -}; - -/** - * The required voucher request goes into timeout - */ -export type SvVoucherGeneratedResponseTimeout = { - kind: "timeout"; -}; - -export type SvVoucherGeneratedResponseFailure = - SvVoucherGeneratedResponseTimeout; - -/** - * This type represents all the possible remote responses - */ -export type SvVoucherGeneratedResponse = - | SvVoucherGeneratedResponseSuccess - | SvVoucherGeneratedResponseFailure; - -export type VoucherPreview = { - idVoucher: SvVoucherId; - departureDate: Date; - returnDate?: Date; - destination: string; -}; -export type SvVoucherListResponse = ReadonlyArray; diff --git a/ts/features/bonus/siciliaVola/utils.ts b/ts/features/bonus/siciliaVola/utils.ts deleted file mode 100644 index 6040511c05c..00000000000 --- a/ts/features/bonus/siciliaVola/utils.ts +++ /dev/null @@ -1,109 +0,0 @@ -import I18n from "../../../i18n"; -import { AeroportiAmmessiInputBean } from "../../../../definitions/api_sicilia_vola/AeroportiAmmessiInputBean"; -import { SvVoucher } from "./types/SvVoucher"; -import { - DisabledVoucherRequest, - PartialVoucherRequest, - SickVoucherRequest, - StudentVoucherRequest, - VoucherRequest, - WorkerVoucherRequest -} from "./types/SvVoucherRequest"; - -export const fromVoucherToDestinationLabels = (voucher: SvVoucher) => { - switch (voucher.category) { - case "student": - return [ - { - label: I18n.t("bonus.sv.components.destinationLabels.universityName"), - value: voucher.university.universityName - }, - { - label: I18n.t("bonus.sv.components.destinationLabels.municipality"), - value: voucher.university.municipality.name - } - ]; - case "worker": - return [ - { - label: I18n.t("bonus.sv.components.destinationLabels.companyName"), - value: voucher.company.businessName - }, - { - label: I18n.t("bonus.sv.components.destinationLabels.municipality"), - value: voucher.company.municipality.name - } - ]; - case "sick": - return [ - { - label: I18n.t("bonus.sv.components.destinationLabels.hospitalName"), - value: voucher.hospital.hospitalName - }, - { - label: I18n.t("bonus.sv.components.destinationLabels.municipality"), - value: voucher.hospital.municipality.name - } - ]; - case "disabled": - return []; - } -}; - -const isStudentVoucherRequest = ( - partialVoucherRequest: PartialVoucherRequest -): partialVoucherRequest is StudentVoucherRequest => - partialVoucherRequest.category === "student" && - partialVoucherRequest.university !== undefined && - partialVoucherRequest.departureDate !== undefined; - -const isWorkerVoucherRequest = ( - partialVoucherRequest: PartialVoucherRequest -): partialVoucherRequest is WorkerVoucherRequest => - partialVoucherRequest.category === "worker" && - partialVoucherRequest.underThresholdIncome !== undefined && - partialVoucherRequest.company !== undefined && - partialVoucherRequest.departureDate !== undefined; - -const isSickVoucherRequest = ( - partialVoucherRequest: PartialVoucherRequest -): partialVoucherRequest is SickVoucherRequest => - partialVoucherRequest.category === "sick" && - partialVoucherRequest.underThresholdIncome !== undefined && - partialVoucherRequest.hospital !== undefined && - partialVoucherRequest.departureDate !== undefined; - -const isDisabledVoucherRequest = ( - partialVoucherRequest: PartialVoucherRequest -): partialVoucherRequest is DisabledVoucherRequest => - partialVoucherRequest.category === "disabled" && - partialVoucherRequest.departureDate !== undefined; - -export const isVoucherRequest = ( - partialVoucherRequest: PartialVoucherRequest -): partialVoucherRequest is VoucherRequest => - isStudentVoucherRequest(partialVoucherRequest) || - isWorkerVoucherRequest(partialVoucherRequest) || - isSickVoucherRequest(partialVoucherRequest) || - isDisabledVoucherRequest(partialVoucherRequest); - -export const destinationsInfoFromVoucherRequest = ( - voucherRequest: - | StudentVoucherRequest - | WorkerVoucherRequest - | SickVoucherRequest -): AeroportiAmmessiInputBean => { - const destination = - voucherRequest.category === "student" - ? voucherRequest.university - : voucherRequest.category === "worker" - ? voucherRequest.company - : voucherRequest.hospital; - - return { - // TODO: check consistency between type in swagger. - stato: destination.state.id.toString(), - latitudine: destination.municipality.latitude, - longitudine: destination.municipality.longitude - }; -}; diff --git a/ts/store/reducers/backoffErrorConfig.ts b/ts/store/reducers/backoffErrorConfig.ts index a7232176516..2208e39bc4a 100644 --- a/ts/store/reducers/backoffErrorConfig.ts +++ b/ts/store/reducers/backoffErrorConfig.ts @@ -12,11 +12,6 @@ import { fetchWalletsSuccess } from "../actions/wallet/wallets"; import { euCovidCertificateGet } from "../../features/euCovidCert/store/actions"; -import { - svPossibleVoucherStateGet, - svVoucherListGet -} from "../../features/bonus/siciliaVola/store/actions/voucherList"; -import { svGetPdfVoucher } from "../../features/bonus/siciliaVola/store/actions/voucherGeneration"; /** * list of monitored actions @@ -30,10 +25,7 @@ const monitoredActions: ReadonlyArray< [addWalletCreditCardFailure, addWalletCreditCardSuccess], [fetchTransactionsFailure, fetchTransactionsSuccess], [fetchWalletsFailure, fetchWalletsSuccess], - [euCovidCertificateGet.failure, euCovidCertificateGet.success], - [svPossibleVoucherStateGet.failure, svPossibleVoucherStateGet.success], - [svVoucherListGet.failure, svVoucherListGet.success], - [svGetPdfVoucher.failure, svGetPdfVoucher.success] + [euCovidCertificateGet.failure, euCovidCertificateGet.success] ]; const failureActions = monitoredActions.map(ma => ma[0]); From 4d9389da455a6da857e35797d5403772965177b5 Mon Sep 17 00:00:00 2001 From: forrest57 Date: Wed, 31 Jan 2024 15:30:40 +0100 Subject: [PATCH 2/3] some more references --- img/bonus/{siciliaVola => common}/emptyVoucherList.svg | 0 img/bonus/{siciliaVola => common}/generateVoucherTimeout.svg | 0 package.json | 5 ----- ts/features/design-system/core/DSLegacyPictograms.tsx | 4 ++-- 4 files changed, 2 insertions(+), 7 deletions(-) rename img/bonus/{siciliaVola => common}/emptyVoucherList.svg (100%) rename img/bonus/{siciliaVola => common}/generateVoucherTimeout.svg (100%) diff --git a/img/bonus/siciliaVola/emptyVoucherList.svg b/img/bonus/common/emptyVoucherList.svg similarity index 100% rename from img/bonus/siciliaVola/emptyVoucherList.svg rename to img/bonus/common/emptyVoucherList.svg diff --git a/img/bonus/siciliaVola/generateVoucherTimeout.svg b/img/bonus/common/generateVoucherTimeout.svg similarity index 100% rename from img/bonus/siciliaVola/generateVoucherTimeout.svg rename to img/bonus/common/generateVoucherTimeout.svg diff --git a/package.json b/package.json index 3b2aa48ce5e..6e6b4936a2a 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,8 @@ "io_bpd_winning_transactions_v2": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.29/bonus/specs/bpd/winning_transactions_v2.json", "api_fci": "https://raw.githubusercontent.com/pagopa/io-backend/v13.25.1-RELEASE/api_io_sign.yaml", "io_eu_covid_cert": "https://raw.githubusercontent.com/pagopa/io-backend/v13.25.1-RELEASE/api_eucovidcert.yaml", - "io_sicilia_vola_token": "https://raw.githubusercontent.com/pagopa/io-backend/v13.25.1-RELEASE/api_mit_voucher.yaml", "io_pn_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v13.25.1-RELEASE/api_pn.yaml", "io_consumed_pn_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v13.25.1-RELEASE/openapi/consumed/api-piattaforma-notifiche.yaml", - "api_sicilia_vola": "assets/SiciliaVola.yml", "api_cdc": "assets/CdcSwagger.yml", "pagopa_api": "assets/paymentManager/spec.json", "pagopa_api_walletv2": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.29/bonus/specs/bpd/pm/walletv2.json", @@ -75,8 +73,6 @@ "generate:bpd-winning-transactions": "rimraf definitions/bpd/winning_transactions && mkdir -p definitions/bpd/winning_transactions && gen-api-models --api-spec $npm_package_io_bpd_winning_transactions --out-dir ./definitions/bpd/winning_transactions --no-strict --request-types --response-decoders", "generate:bpd-winning-transactions-v2": "rimraf definitions/bpd/winning_transactions_v2 && mkdir -p definitions/bpd/winning_transactions_v2 && gen-api-models --api-spec $npm_package_io_bpd_winning_transactions_v2 --out-dir ./definitions/bpd/winning_transactions_v2 --no-strict --request-types --response-decoders", "generate:eu-covid-cert": "rimraf definitions/eu_covid_cert && mkdir -p definitions/eu_covid_cert && gen-api-models --api-spec $npm_package_io_eu_covid_cert --out-dir ./definitions/eu_covid_cert --no-strict --request-types --response-decoders", - "generate:io_sicilia_vola_token": "rimraf definitions/io_sicilia_vola_token && mkdir -p definitions/io_sicilia_vola_token && gen-api-models --api-spec $npm_package_io_sicilia_vola_token --out-dir ./definitions/io_sicilia_vola_token --no-strict --request-types --response-decoders", - "generate:sicilia_vola_api": "rimraf definitions/api_sicilia_vola && mkdir -p definitions/api_sicilia_vola && gen-api-models --api-spec $npm_package_api_sicilia_vola --out-dir ./definitions/api_sicilia_vola --no-strict --request-types --response-decoders", "generate:pn-definitions": "rimraf definitions/pn && mkdir -p definitions/pn && gen-api-models --api-spec $npm_package_io_consumed_pn_specs --out-dir ./definitions/pn && gen-api-models --api-spec $npm_package_io_pn_specs --out-dir ./definitions/pn --no-strict --request-types --response-decoders", "generate:pagopa-api-walletv2": "rimraf definitions/pagopa/walletv2 && mkdir -p definitions/pagopa/walletv2 && gen-api-models --api-spec $npm_package_pagopa_api_walletv2 --out-dir ./definitions/pagopa/walletv2 --no-strict --request-types --response-decoders", "generate:pagopa-cobadge-configuration": "rimraf definitions/pagopa/cobadge/configuration && mkdir -p definitions/pagopa/cobadge/configuration && gen-api-models --api-spec $npm_package_pagopa_cobadge_configuration --out-dir ./definitions/pagopa/cobadge/configuration", @@ -87,7 +83,6 @@ "generate:locales": "ts-node --skip-project -O '{\"lib\":[\"es2015\"]}' scripts/make-locales.ts", "generate:bpd": "npm-run-all generate:bpd-citizen generate:bpd-citizen-v2 generate:bpd-payment generate:bpd-award-periods generate:bpd-winning-transactions generate:bpd-winning-transactions-v2", "generate:cgn": "npm-run-all generate:cgn-definitions generate:cgn-merchants-definitions", - "generate:sicilia_vola": "npm-run-all generate:io_sicilia_vola_token generate:sicilia_vola_api", "generate:cdc": "npm-run-all generate:cdc-api", "generate:pn": "npm-run-all generate:pn-definitions", "generate:fci": "npm-run-all generate:fci-api", diff --git a/ts/features/design-system/core/DSLegacyPictograms.tsx b/ts/features/design-system/core/DSLegacyPictograms.tsx index dbeb2167b77..deb485e4169 100644 --- a/ts/features/design-system/core/DSLegacyPictograms.tsx +++ b/ts/features/design-system/core/DSLegacyPictograms.tsx @@ -9,8 +9,8 @@ import { } from "../components/DSAssetViewerBox"; /* PICTOGRAMS */ -import AirBaloon from "../../../../img/bonus/siciliaVola/emptyVoucherList.svg"; -import Timeout from "../../../../img/bonus/siciliaVola/generateVoucherTimeout.svg"; +import AirBaloon from "../../../../img/bonus/common/emptyVoucherList.svg"; +import Timeout from "../../../../img/bonus/common/generateVoucherTimeout.svg"; import BrokenLink from "../../../../img/broken-link.png"; import AirBaloonRaster from "../../../../img/landing/session_expired.png"; import Baloons from "../../../../img/messages/empty-due-date-list-icon.png"; From a2ac1d5e4cdd558c223ac2b85c084893e8c2a178 Mon Sep 17 00:00:00 2001 From: Damiano Plebani Date: Wed, 31 Jan 2024 17:54:01 +0100 Subject: [PATCH 3/3] Remove legacy assets used by SiciliaVola feature --- img/bonus/common/emptyVoucherList.svg | 8 -------- img/bonus/common/generateVoucherTimeout.svg | 11 ----------- ts/features/design-system/core/DSLegacyPictograms.tsx | 4 ---- 3 files changed, 23 deletions(-) delete mode 100644 img/bonus/common/emptyVoucherList.svg delete mode 100755 img/bonus/common/generateVoucherTimeout.svg diff --git a/img/bonus/common/emptyVoucherList.svg b/img/bonus/common/emptyVoucherList.svg deleted file mode 100644 index 07def6e41a8..00000000000 --- a/img/bonus/common/emptyVoucherList.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/img/bonus/common/generateVoucherTimeout.svg b/img/bonus/common/generateVoucherTimeout.svg deleted file mode 100755 index 0247086b882..00000000000 --- a/img/bonus/common/generateVoucherTimeout.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - E4C38C32-2CA4-44F9-965E-37E2911E6F38 - Created with sketchtool. - - - - - - \ No newline at end of file diff --git a/ts/features/design-system/core/DSLegacyPictograms.tsx b/ts/features/design-system/core/DSLegacyPictograms.tsx index deb485e4169..6d41cb43161 100644 --- a/ts/features/design-system/core/DSLegacyPictograms.tsx +++ b/ts/features/design-system/core/DSLegacyPictograms.tsx @@ -9,8 +9,6 @@ import { } from "../components/DSAssetViewerBox"; /* PICTOGRAMS */ -import AirBaloon from "../../../../img/bonus/common/emptyVoucherList.svg"; -import Timeout from "../../../../img/bonus/common/generateVoucherTimeout.svg"; import BrokenLink from "../../../../img/broken-link.png"; import AirBaloonRaster from "../../../../img/landing/session_expired.png"; import Baloons from "../../../../img/messages/empty-due-date-list-icon.png"; @@ -75,7 +73,6 @@ export const DSLegacyPictograms = () => { name={"Hourglass"} image={renderRasterImage(Hourglass)} /> - } /> { image={renderRasterImage(Unrecognized)} /> - } />