From acd9a51b240d10dcb1ec0bdd207bb2d489d9287e Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Mon, 5 Aug 2024 16:37:49 +0200 Subject: [PATCH 1/8] Simplify countryName --- .../banking/src/components/TransactionDetail.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/clients/banking/src/components/TransactionDetail.tsx b/clients/banking/src/components/TransactionDetail.tsx index c4472fbac..d4cc15657 100644 --- a/clients/banking/src/components/TransactionDetail.tsx +++ b/clients/banking/src/components/TransactionDetail.tsx @@ -26,7 +26,7 @@ import { isNotNullishOrEmpty, isNullish, } from "@swan-io/lake/src/utils/nullish"; -import { CountryCCA3, countries } from "@swan-io/shared-business/src/constants/countries"; +import { getCountryByCCA3, isCountryCCA3 } from "@swan-io/shared-business/src/constants/countries"; import { printIbanFormat } from "@swan-io/shared-business/src/utils/validation"; import { printFormat } from "iban"; import { useState } from "react"; @@ -847,14 +847,10 @@ export const TransactionDetail = ({ const contactEmail = enrichedTransactionInfo.contactEmail; const contactPhone = enrichedTransactionInfo.contactPhone; const city = enrichedTransactionInfo.city ?? merchantCity; - const countryCCA3 = (enrichedTransactionInfo.country ?? merchantCountry) as - | CountryCCA3 - | null - | undefined; - - const countryName = countries.find( - country => country.cca3 === countryCCA3, - )?.name; + + const countryName = match(enrichedTransactionInfo.country ?? merchantCountry) + .with(P.when(isCountryCCA3), value => getCountryByCCA3(value).name) + .otherwise(() => undefined); return ( From 18efbdb7dc856eea605cf7a9eb5fa4d1cbff5561 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Mon, 5 Aug 2024 16:50:47 +0200 Subject: [PATCH 2/8] Add beneficiary tab --- .../src/components/TransactionDetail.tsx | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/clients/banking/src/components/TransactionDetail.tsx b/clients/banking/src/components/TransactionDetail.tsx index d4cc15657..9a8ce6aed 100644 --- a/clients/banking/src/components/TransactionDetail.tsx +++ b/clients/banking/src/components/TransactionDetail.tsx @@ -89,7 +89,7 @@ type Props = { canViewAccount: boolean; }; -type Tab = "Details" | "MerchantInfo"; +type Tab = "details" | "beneficiary" | "merchantInfo"; export const TransactionDetail = ({ accountMembershipId, @@ -110,7 +110,7 @@ export const TransactionDetail = ({ { suspense }, ); - const [activeTab, setActiveTab] = useState("Details"); + const [activeTab, setActiveTab] = useState("details"); if (data.isNotAsked() || data.isLoading()) { return ; @@ -298,33 +298,28 @@ export const TransactionDetail = ({ - {match(transaction) - .with( - { - __typename: "CardTransaction", - }, - () => ( - <> - setActiveTab(tab as Tab)} - otherLabel={t("common.tabs.other")} - tabs={ - [ - { id: "Details", label: t("transaction.tabs.details") }, - { id: "MerchantInfo", label: t("transaction.tabs.merchantInfo") }, - ] satisfies { id: Tab; label: string }[] - } - /> + {match(transaction.__typename) + .with("CardTransaction", () => ( + <> + setActiveTab(tab as Tab)} + otherLabel={t("common.tabs.other")} + tabs={ + [ + { id: "details", label: t("transaction.tabs.details") }, + { id: "merchantInfo", label: t("transaction.tabs.merchantInfo") }, + ] satisfies { id: Tab; label: string }[] + } + /> - - - ), - ) + + + )) .otherwise(() => null)} {match(activeTab) - .with("Details", () => ( + .with("details", () => ( {match(transaction.statusInfo) .with({ __typename: "BookedTransactionStatusInfo" }, ({ bookingDate }) => ( @@ -832,7 +827,10 @@ export const TransactionDetail = ({ )) - .with("MerchantInfo", () => ( + .with("beneficiary", () => { + return null; + }) + .with("merchantInfo", () => ( {match(transaction) .with( From a739e88806dc25ece51a55ea10fcd10b4e445381 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Mon, 5 Aug 2024 17:00:06 +0200 Subject: [PATCH 3/8] Add beneficiary tab --- .../src/components/TransactionDetail.tsx | 59 +++++++++++-------- clients/banking/src/locales/en.json | 1 + 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/clients/banking/src/components/TransactionDetail.tsx b/clients/banking/src/components/TransactionDetail.tsx index 9a8ce6aed..bf21c4d73 100644 --- a/clients/banking/src/components/TransactionDetail.tsx +++ b/clients/banking/src/components/TransactionDetail.tsx @@ -52,9 +52,13 @@ import { } from "./TransactionListCells"; const styles = StyleSheet.create({ - container: { + fill: { ...commonStyles.fill, }, + content: { + ...commonStyles.fill, + paddingVertical: spacings[24], + }, tile: { alignItems: "center", }, @@ -128,9 +132,23 @@ export const TransactionDetail = ({ return ; } + const tabs: { id: Tab; label: string }[] = [ + { id: "details", label: t("transaction.tabs.details") }, + + ...match(transaction.__typename) + .returnType() + .with("CardTransaction", () => [ + { id: "merchantInfo", label: t("transaction.tabs.merchantInfo") }, + ]) + .with("SEPACreditTransferTransaction", () => [ + { id: "beneficiary", label: t("transaction.tabs.beneficiary") }, + ]) + .otherwise(() => []), + ]; + return ( - - + + - - - {match(transaction.__typename) - .with("CardTransaction", () => ( - <> - setActiveTab(tab as Tab)} - otherLabel={t("common.tabs.other")} - tabs={ - [ - { id: "details", label: t("transaction.tabs.details") }, - { id: "merchantInfo", label: t("transaction.tabs.merchantInfo") }, - ] satisfies { id: Tab; label: string }[] - } - /> + {tabs.length > 1 && ( + <> + - - - )) - .otherwise(() => null)} + setActiveTab(tab as Tab)} + otherLabel={t("common.tabs.other")} + /> + + )} {match(activeTab) .with("details", () => ( - + {match(transaction.statusInfo) .with({ __typename: "BookedTransactionStatusInfo" }, ({ bookingDate }) => ( <> @@ -831,7 +840,7 @@ export const TransactionDetail = ({ return null; }) .with("merchantInfo", () => ( - + {match(transaction) .with( { diff --git a/clients/banking/src/locales/en.json b/clients/banking/src/locales/en.json index 64c454bfa..8a1064785 100644 --- a/clients/banking/src/locales/en.json +++ b/clients/banking/src/locales/en.json @@ -897,6 +897,7 @@ "transaction.reservedUntil": "Reserved until", "transaction.rlmcKey": "RLMCKey", "transaction.subcategory": "Subcategory", + "transaction.tabs.beneficiary": "Beneficiary", "transaction.tabs.details": "Details", "transaction.tabs.merchantInfo": "Merchant info", "transaction.website": "Website", From f649bf01e2bf5b21a61bbef42eec4d10dced5949 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Mon, 5 Aug 2024 17:10:07 +0200 Subject: [PATCH 4/8] Add beneficiary tab --- .../src/components/TransactionDetail.tsx | 40 ++++++++++++++++--- clients/banking/src/graphql/partner.gql | 14 +++++++ 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/clients/banking/src/components/TransactionDetail.tsx b/clients/banking/src/components/TransactionDetail.tsx index bf21c4d73..6a4cd9cde 100644 --- a/clients/banking/src/components/TransactionDetail.tsx +++ b/clients/banking/src/components/TransactionDetail.tsx @@ -42,6 +42,7 @@ import { getTransactionRejectedReasonLabel, getWiseIctLabel, } from "../utils/templateTranslations"; +import { concatSepaBeneficiaryAddress } from "./BeneficiaryDetail"; import { DetailCopiableLine, DetailLine } from "./DetailLine"; import { ErrorView } from "./ErrorView"; import { @@ -135,12 +136,12 @@ export const TransactionDetail = ({ const tabs: { id: Tab; label: string }[] = [ { id: "details", label: t("transaction.tabs.details") }, - ...match(transaction.__typename) + ...match(transaction) .returnType() - .with("CardTransaction", () => [ + .with({ __typename: "CardTransaction" }, () => [ { id: "merchantInfo", label: t("transaction.tabs.merchantInfo") }, ]) - .with("SEPACreditTransferTransaction", () => [ + .with({ __typename: "SEPACreditTransferTransaction", beneficiary: P.nonNullable }, () => [ { id: "beneficiary", label: t("transaction.tabs.beneficiary") }, ]) .otherwise(() => []), @@ -836,9 +837,36 @@ export const TransactionDetail = ({ )) - .with("beneficiary", () => { - return null; - }) + .with("beneficiary", () => ( + + {match(transaction) + .with( + { + __typename: "SEPACreditTransferTransaction", + beneficiary: P.select(P.nonNullable), + }, + ({ name, iban, address }) => ( + + + + + + {match(concatSepaBeneficiaryAddress(address)) + .with(P.nonNullable, address => ( + + )) + .otherwise(() => null)} + + ), + ) + .otherwise(() => ( + + ))} + + )) .with("merchantInfo", () => ( {match(transaction) diff --git a/clients/banking/src/graphql/partner.gql b/clients/banking/src/graphql/partner.gql index 8f0c32d25..4a1c0a6fa 100644 --- a/clients/banking/src/graphql/partner.gql +++ b/clients/banking/src/graphql/partner.gql @@ -106,6 +106,20 @@ fragment TransactionDetails on Transaction { name IBAN } + beneficiary { + __typename + + ... on TrustedBeneficiary { + ...TrustedBeneficiaryDetails + } + ... on UnsavedSepaBeneficiary { + name + iban + address { + ...AddressDetails + } + } + } } ... on InternalDirectDebitTransaction { reservedAmount { From 84d6f3124a1254af5e8cc010d8162218544768f2 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Mon, 5 Aug 2024 17:34:45 +0200 Subject: [PATCH 5/8] Show international beneficiary details --- .../src/components/TransactionDetail.tsx | 60 ++++++++++++------- clients/banking/src/graphql/partner.gql | 15 +++-- 2 files changed, 49 insertions(+), 26 deletions(-) diff --git a/clients/banking/src/components/TransactionDetail.tsx b/clients/banking/src/components/TransactionDetail.tsx index 6a4cd9cde..85fdd292c 100644 --- a/clients/banking/src/components/TransactionDetail.tsx +++ b/clients/banking/src/components/TransactionDetail.tsx @@ -141,7 +141,7 @@ export const TransactionDetail = ({ .with({ __typename: "CardTransaction" }, () => [ { id: "merchantInfo", label: t("transaction.tabs.merchantInfo") }, ]) - .with({ __typename: "SEPACreditTransferTransaction", beneficiary: P.nonNullable }, () => [ + .with({ beneficiary: P.nonNullable }, () => [ { id: "beneficiary", label: t("transaction.tabs.beneficiary") }, ]) .otherwise(() => []), @@ -840,28 +840,46 @@ export const TransactionDetail = ({ .with("beneficiary", () => ( {match(transaction) - .with( - { - __typename: "SEPACreditTransferTransaction", - beneficiary: P.select(P.nonNullable), - }, - ({ name, iban, address }) => ( - - + .with({ beneficiary: P.select(P.nonNullable) }, beneficiary => ( + + - + {match(beneficiary) + .with( + { __typename: "TrustedSepaBeneficiary" }, + { __typename: "UnsavedSepaBeneficiary" }, + ({ address, iban }) => ( + <> + - {match(concatSepaBeneficiaryAddress(address)) - .with(P.nonNullable, address => ( - - )) - .otherwise(() => null)} - - ), - ) + {match(concatSepaBeneficiaryAddress(address)) + .with(P.nonNullable, address => ( + + )) + .otherwise(() => null)} + + ), + ) + .with({ __typename: "TrustedInternationalBeneficiary" }, ({ details }) => + details.map(detail => ( + printFormat(value)) + .otherwise(({ value }) => value)} + /> + )), + ) + .otherwise(() => null)} + + )) .otherwise(() => ( ))} diff --git a/clients/banking/src/graphql/partner.gql b/clients/banking/src/graphql/partner.gql index 4a1c0a6fa..2df9f4f06 100644 --- a/clients/banking/src/graphql/partner.gql +++ b/clients/banking/src/graphql/partner.gql @@ -219,6 +219,15 @@ fragment TransactionDetails on Transaction { value } } + beneficiary { + name + currency + route + details { + key + value + } + } } ... on InternalCreditTransfer { creditor { @@ -340,11 +349,7 @@ fragment TrustedBeneficiaryDetails on TrustedBeneficiary { ... on TrustedSepaBeneficiary { iban address { - addressLine1 - addressLine2 - postalCode - city - country + ...AddressDetails } } } From 866e1c34206a88f8b08f8f86c62f2adde20119ed Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Tue, 6 Aug 2024 10:06:47 +0200 Subject: [PATCH 6/8] Update locales --- clients/banking/src/locales/de.json | 4 +++- clients/banking/src/locales/es.json | 4 +++- clients/banking/src/locales/fi.json | 4 +++- clients/banking/src/locales/fr.json | 4 +++- clients/banking/src/locales/it.json | 4 +++- clients/banking/src/locales/nl.json | 4 +++- clients/banking/src/locales/pt.json | 4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/clients/banking/src/locales/de.json b/clients/banking/src/locales/de.json index 966978003..35f9cfedd 100644 --- a/clients/banking/src/locales/de.json +++ b/clients/banking/src/locales/de.json @@ -721,6 +721,7 @@ "recurringTransfer.table.nextExecution": "Nächste Ausführung", "recurringTransfer.table.period": "Wiederholung", "recurringTransfer.table.recipient": "Empfänger", + "sandboxUser.impersonatedAs": "Als dargestellt", "supportingDocuments.AdministratorDecisionOfAppointment.description": "Beschluss über die Bestellung des Administrators", "supportingDocuments.AdministratorDecisionOfAppointment.title": "Beschluss über die Bestellung des Administrators", "supportingDocuments.AssociationRegistration.description": "Dieses Dokument sollte das Datum der Einreichung der Erklärung sowie den Titel, den Grund und die Adresse der Organisation enthalten.", @@ -950,6 +951,7 @@ "transaction.reservedUntil": "Reserviert bis", "transaction.rlmcKey": "RLMCKey", "transaction.subcategory": "Subkategorie", + "transaction.tabs.beneficiary": "Begünstigter", "transaction.tabs.details": "Details", "transaction.tabs.merchantInfo": "Händlerinfo", "transaction.website": "Webseite", @@ -1259,4 +1261,4 @@ "transfer.transfer": "Überweisung", "upcomingTransansactionList.noResults": "Keine bevorstehenden Transaktionen", "upcomingTransansactionList.noResultsDescription": "Es sind keine eingehenden oder ausgehenden Transaktionen im Gange." -} \ No newline at end of file +} diff --git a/clients/banking/src/locales/es.json b/clients/banking/src/locales/es.json index c8a809e54..ad4ee5296 100644 --- a/clients/banking/src/locales/es.json +++ b/clients/banking/src/locales/es.json @@ -721,6 +721,7 @@ "recurringTransfer.table.nextExecution": "Siguiente ejecución", "recurringTransfer.table.period": "Frecuencia", "recurringTransfer.table.recipient": "Destinatario", + "sandboxUser.impersonatedAs": "Suplantando a", "supportingDocuments.AdministratorDecisionOfAppointment.description": "Decisión de nombramiento de Administrador", "supportingDocuments.AdministratorDecisionOfAppointment.title": "Decisión de nombramiento de Administrador", "supportingDocuments.AssociationRegistration.description": "Este documento debe incluir la fecha en que se presentó la declaración, el nombre de la asociación, el motivo y la dirección de la asociación.", @@ -950,6 +951,7 @@ "transaction.reservedUntil": "Reservado hasta", "transaction.rlmcKey": "RLMCKey", "transaction.subcategory": "Subcategoría", + "transaction.tabs.beneficiary": "Beneficiario", "transaction.tabs.details": "Detalles", "transaction.tabs.merchantInfo": "Información del comerciante", "transaction.website": "Sitio web", @@ -1259,4 +1261,4 @@ "transfer.transfer": "Transferencia", "upcomingTransansactionList.noResults": "No hay operaciones próximas", "upcomingTransansactionList.noResultsDescription": "No hay operaciones entrantes ni salientes en curso." -} \ No newline at end of file +} diff --git a/clients/banking/src/locales/fi.json b/clients/banking/src/locales/fi.json index 1ef320427..eae41a68e 100644 --- a/clients/banking/src/locales/fi.json +++ b/clients/banking/src/locales/fi.json @@ -721,6 +721,7 @@ "recurringTransfer.table.nextExecution": "Seuraava suoritus", "recurringTransfer.table.period": "Toistuvuus", "recurringTransfer.table.recipient": "Vastaanottaja", + "sandboxUser.impersonatedAs": "Tekeydytty käyttäjäksi", "supportingDocuments.AdministratorDecisionOfAppointment.description": "Päättäjän nimittämispäätös", "supportingDocuments.AdministratorDecisionOfAppointment.title": "Päättäjän nimittämispäätös", "supportingDocuments.AssociationRegistration.description": "Tämän asiakirjan on sisällettävä ilmoituksen jättämisen päivämäärä sekä järjestön nimi, toimintaperuste ja osoite.", @@ -950,6 +951,7 @@ "transaction.reservedUntil": "Varattu seuraavaan päivämäärään asti", "transaction.rlmcKey": "RLMCKey", "transaction.subcategory": "Alakategoria", + "transaction.tabs.beneficiary": "Vastaanottaja", "transaction.tabs.details": "Yksityiskohdat", "transaction.tabs.merchantInfo": "Kauppiaan tiedot", "transaction.website": "Verkkosivusto", @@ -1259,4 +1261,4 @@ "transfer.transfer": "Siirto", "upcomingTransansactionList.noResults": "Ei tulevia tapahtumia", "upcomingTransansactionList.noResultsDescription": "Ei ole käynnissä olevia meneviä tai tulevia tapahtumia." -} \ No newline at end of file +} diff --git a/clients/banking/src/locales/fr.json b/clients/banking/src/locales/fr.json index 9984e2093..5c826e1c8 100644 --- a/clients/banking/src/locales/fr.json +++ b/clients/banking/src/locales/fr.json @@ -721,6 +721,7 @@ "recurringTransfer.table.nextExecution": "Exécution suivante", "recurringTransfer.table.period": "Récurrence", "recurringTransfer.table.recipient": "Destinataire", + "sandboxUser.impersonatedAs": "Faites-vous passer pour", "supportingDocuments.AdministratorDecisionOfAppointment.description": "Décision de nomination de l'administrateur", "supportingDocuments.AdministratorDecisionOfAppointment.title": "Décision de nomination de l'administrateur", "supportingDocuments.AssociationRegistration.description": "Ce document doit contenir la date de dépôt de la déclaration, ainsi que le titre, la raison sociale et l'adresse de l'association.", @@ -950,6 +951,7 @@ "transaction.reservedUntil": "Réservé jusqu'à", "transaction.rlmcKey": "RLMCKey", "transaction.subcategory": "Sous-catégorie", + "transaction.tabs.beneficiary": "Bénéficiaire", "transaction.tabs.details": "Détails", "transaction.tabs.merchantInfo": "Infos commerçant", "transaction.website": "Site web", @@ -1259,4 +1261,4 @@ "transfer.transfer": "Virement", "upcomingTransansactionList.noResults": "Aucune transaction à venir", "upcomingTransansactionList.noResultsDescription": "Il n’y a pas de transactions entrantes ou sortantes en cours." -} \ No newline at end of file +} diff --git a/clients/banking/src/locales/it.json b/clients/banking/src/locales/it.json index 9d857e6f1..313f867a4 100644 --- a/clients/banking/src/locales/it.json +++ b/clients/banking/src/locales/it.json @@ -721,6 +721,7 @@ "recurringTransfer.table.nextExecution": "Prossima esecuzione", "recurringTransfer.table.period": "Periodicità", "recurringTransfer.table.recipient": "Beneficiario", + "sandboxUser.impersonatedAs": "Impersonato come", "supportingDocuments.AdministratorDecisionOfAppointment.description": "Decisione di nomina dell'Amministratore", "supportingDocuments.AdministratorDecisionOfAppointment.title": "Decisione di nomina dell'Amministratore", "supportingDocuments.AssociationRegistration.description": "Questo documento dovrebbe contenere la data di effettuazione della dichiarazione, oltre a titolo, motivo e indirizzo dell'associazione.", @@ -950,6 +951,7 @@ "transaction.reservedUntil": "Riservato fino a", "transaction.rlmcKey": "RLMCKey", "transaction.subcategory": "Sottocategoria", + "transaction.tabs.beneficiary": "Beneficiario", "transaction.tabs.details": "Dettagli", "transaction.tabs.merchantInfo": "Informazioni sul commerciante", "transaction.website": "Sito web", @@ -1259,4 +1261,4 @@ "transfer.transfer": "Bonifico", "upcomingTransansactionList.noResults": "Nessuna transazione in corso", "upcomingTransansactionList.noResultsDescription": "Non ci sono transazioni in entrata o in uscita." -} \ No newline at end of file +} diff --git a/clients/banking/src/locales/nl.json b/clients/banking/src/locales/nl.json index b6f6f02c0..b9aa953f4 100644 --- a/clients/banking/src/locales/nl.json +++ b/clients/banking/src/locales/nl.json @@ -721,6 +721,7 @@ "recurringTransfer.table.nextExecution": "Volgende uitvoering", "recurringTransfer.table.period": "Herhaling", "recurringTransfer.table.recipient": "Begunstigde", + "sandboxUser.impersonatedAs": "Geïmpersonaliseerd als", "supportingDocuments.AdministratorDecisionOfAppointment.description": "Besluit tot benoeming van de administrateur", "supportingDocuments.AdministratorDecisionOfAppointment.title": "Besluit tot benoeming van de administrateur", "supportingDocuments.AssociationRegistration.description": "Dit document moet de aangiftedatum bevatten, en de naam van de vereniging, de reden en het adres.", @@ -950,6 +951,7 @@ "transaction.reservedUntil": "Gereserveerd tot", "transaction.rlmcKey": "RLMCKey", "transaction.subcategory": "Subcategorie", + "transaction.tabs.beneficiary": "Begunstigde", "transaction.tabs.details": "Details", "transaction.tabs.merchantInfo": "Winkelinfo", "transaction.website": "Website", @@ -1259,4 +1261,4 @@ "transfer.transfer": "Overschrijving", "upcomingTransansactionList.noResults": "Geen aanstaande transacties", "upcomingTransansactionList.noResultsDescription": "Er zijn geen inkomende of uitgaande transacties in behandeling." -} \ No newline at end of file +} diff --git a/clients/banking/src/locales/pt.json b/clients/banking/src/locales/pt.json index 29d35960c..dbf4d19b1 100644 --- a/clients/banking/src/locales/pt.json +++ b/clients/banking/src/locales/pt.json @@ -721,6 +721,7 @@ "recurringTransfer.table.nextExecution": "Próxima execução", "recurringTransfer.table.period": "Recorrência", "recurringTransfer.table.recipient": "Destinatário", + "sandboxUser.impersonatedAs": "Fazendo-se passar por", "supportingDocuments.AdministratorDecisionOfAppointment.description": "Decisão de nomeação do Administrador", "supportingDocuments.AdministratorDecisionOfAppointment.title": "Decisão de nomeação do Administrador", "supportingDocuments.AssociationRegistration.description": "Este documento deve conter a data em que a declaração foi apresentada, bem como o título, a razão e o endereço da associação.", @@ -950,6 +951,7 @@ "transaction.reservedUntil": "Reservado até", "transaction.rlmcKey": "RLMCKey", "transaction.subcategory": "Subcategoria", + "transaction.tabs.beneficiary": "Beneficiário", "transaction.tabs.details": "Detalhes", "transaction.tabs.merchantInfo": "Informações do comerciante", "transaction.website": "Website", @@ -1259,4 +1261,4 @@ "transfer.transfer": "Transferência", "upcomingTransansactionList.noResults": "Nenhuma transação futura", "upcomingTransansactionList.noResultsDescription": "Não há nenhuma transação de entrada ou saída em curso." -} \ No newline at end of file +} From 5de37d6256db87725a7cd6d249631da9627f75d1 Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Tue, 6 Aug 2024 10:59:36 +0200 Subject: [PATCH 7/8] Add flag --- clients/banking/src/components/TransactionDetail.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/clients/banking/src/components/TransactionDetail.tsx b/clients/banking/src/components/TransactionDetail.tsx index 85fdd292c..ac4925ac4 100644 --- a/clients/banking/src/components/TransactionDetail.tsx +++ b/clients/banking/src/components/TransactionDetail.tsx @@ -42,6 +42,7 @@ import { getTransactionRejectedReasonLabel, getWiseIctLabel, } from "../utils/templateTranslations"; +import { useTgglFlag } from "../utils/tggl"; import { concatSepaBeneficiaryAddress } from "./BeneficiaryDetail"; import { DetailCopiableLine, DetailLine } from "./DetailLine"; import { ErrorView } from "./ErrorView"; @@ -103,6 +104,7 @@ export const TransactionDetail = ({ canQueryCardOnTransaction, canViewAccount, }: Props) => { + const beneficiariesEnabled = useTgglFlag("beneficiaries").getOr(false); const suspense = useIsSuspendable(); const [data] = useQuery( @@ -141,9 +143,11 @@ export const TransactionDetail = ({ .with({ __typename: "CardTransaction" }, () => [ { id: "merchantInfo", label: t("transaction.tabs.merchantInfo") }, ]) - .with({ beneficiary: P.nonNullable }, () => [ - { id: "beneficiary", label: t("transaction.tabs.beneficiary") }, - ]) + .with({ beneficiary: P.nonNullable }, () => + beneficiariesEnabled + ? [{ id: "beneficiary", label: t("transaction.tabs.beneficiary") }] + : [], + ) .otherwise(() => []), ]; From 88dd31696d901fe790e83b3ce04546d3114944bb Mon Sep 17 00:00:00 2001 From: Mathieu Acthernoene Date: Tue, 6 Aug 2024 11:04:30 +0200 Subject: [PATCH 8/8] Add feature flags --- .../TransferInternationalWizard.tsx | 32 ++++++++++++------- .../src/components/TransferRegularWizard.tsx | 32 ++++++++++++------- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/clients/banking/src/components/TransferInternationalWizard.tsx b/clients/banking/src/components/TransferInternationalWizard.tsx index e4c63fa7b..193b349e4 100644 --- a/clients/banking/src/components/TransferInternationalWizard.tsx +++ b/clients/banking/src/components/TransferInternationalWizard.tsx @@ -20,6 +20,7 @@ import { P, match } from "ts-pattern"; import { InitiateInternationalCreditTransferDocument } from "../graphql/partner"; import { t } from "../utils/i18n"; import { Router } from "../utils/routes"; +import { useTgglFlag } from "../utils/tggl"; import { BeneficiaryInternationalWizardForm, InternationalBeneficiary, @@ -87,27 +88,34 @@ const BeneficiaryStep = ({ onPressSubmit: (beneficiary: InternationalBeneficiary) => void; onPressPrevious: () => void; }) => { + const beneficiariesEnabled = useTgglFlag("beneficiaries").getOr(false); const [activeTab, setActiveTab] = useState(initialBeneficiary?.kind ?? "new"); + const tabs: { id: InternationalBeneficiary["kind"]; label: string }[] = [ + { id: "new", label: t("transfer.new.beneficiary.new") }, + ...(beneficiariesEnabled + ? [{ id: "saved" as const, label: t("transfer.new.beneficiary.saved") }] + : []), + ]; + return ( <> {t("transfer.new.internationalTransfer.beneficiary.title")} - + {tabs.length > 1 && ( + <> + - setActiveTab(tab as InternationalBeneficiary["kind"])} - otherLabel={t("common.tabs.other")} - tabs={ - [ - { id: "new", label: t("transfer.new.beneficiary.new") }, - { id: "saved", label: t("transfer.new.beneficiary.saved") }, - ] satisfies { id: InternationalBeneficiary["kind"]; label: string }[] - } - /> + setActiveTab(tab as InternationalBeneficiary["kind"])} + otherLabel={t("common.tabs.other")} + /> + + )} diff --git a/clients/banking/src/components/TransferRegularWizard.tsx b/clients/banking/src/components/TransferRegularWizard.tsx index 70b3c4407..363387759 100644 --- a/clients/banking/src/components/TransferRegularWizard.tsx +++ b/clients/banking/src/components/TransferRegularWizard.tsx @@ -19,6 +19,7 @@ import { AccountCountry, InitiateSepaCreditTransfersDocument } from "../graphql/ import { encodeDateTime } from "../utils/date"; import { t } from "../utils/i18n"; import { Router } from "../utils/routes"; +import { useTgglFlag } from "../utils/tggl"; import { BeneficiarySepaWizardForm, SepaBeneficiary, @@ -78,27 +79,34 @@ const BeneficiaryStep = ({ initialBeneficiary: SepaBeneficiary | undefined; onPressSubmit: (beneficiary: SepaBeneficiary) => void; }) => { + const beneficiariesEnabled = useTgglFlag("beneficiaries").getOr(false); const [activeTab, setActiveTab] = useState(initialBeneficiary?.kind ?? "new"); + const tabs: { id: SepaBeneficiary["kind"]; label: string }[] = [ + { id: "new", label: t("transfer.new.beneficiary.new") }, + ...(beneficiariesEnabled + ? [{ id: "saved" as const, label: t("transfer.new.beneficiary.saved") }] + : []), + ]; + return ( <> {t("transfer.new.beneficiary.title")} - + {tabs.length > 1 && ( + <> + - setActiveTab(tab as SepaBeneficiary["kind"])} - otherLabel={t("common.tabs.other")} - tabs={ - [ - { id: "new", label: t("transfer.new.beneficiary.new") }, - { id: "saved", label: t("transfer.new.beneficiary.saved") }, - ] satisfies { id: SepaBeneficiary["kind"]; label: string }[] - } - /> + setActiveTab(tab as SepaBeneficiary["kind"])} + otherLabel={t("common.tabs.other")} + /> + + )}