diff --git a/LICENSE_REPORT.md b/LICENSE_REPORT.md
index a06365d41..be53d621a 100644
--- a/LICENSE_REPORT.md
+++ b/LICENSE_REPORT.md
@@ -42,7 +42,6 @@ nanoid | 5.0.2 | MIT | https://github.com/ai/nanoid.git | Unknown | Andrey Sitni
node-mailjet | 6.0.4 | MIT | https://github.com/mailjet/mailjet-apiv3-nodejs.git | https://github.com/mailjet/mailjet-apiv3-nodejs#readme | Mailjet
pathe | 1.1.1 | MIT | https://github.com/unjs/pathe.git | Unknown | Unknown
pino-pretty | 10.2.3 | MIT | ssh://git@github.com/pinojs/pino-pretty.git | https://github.com/pinojs/pino-pretty#readme | James Sumners
-polished | 4.2.2 | MIT | https://github.com/styled-components/polished.git | https://polished.js.org/ | Brian Hough
react | 18.2.0 | MIT | https://github.com/facebook/react.git | https://reactjs.org/ | Unknown
react-atomic-state | 1.2.7 | MIT | https://github.com/zoontek/react-atomic-state.git | https://github.com/zoontek/react-atomic-state#readme | Mathieu Acthernoene
react-dom | 18.2.0 | MIT | https://github.com/facebook/react.git | https://reactjs.org/ | Unknown
diff --git a/clients/banking/package.json b/clients/banking/package.json
index 10b0ea8d8..7eaf6a72e 100644
--- a/clients/banking/package.json
+++ b/clients/banking/package.json
@@ -32,7 +32,6 @@
"iban": "0.0.14",
"libphonenumber-js": "1.10.48",
"nanoid": "5.0.2",
- "polished": "4.2.2",
"react": "18.2.0",
"react-atomic-state": "1.2.7",
"react-dom": "18.2.0",
@@ -44,8 +43,6 @@
"wonka": "6.3.4"
},
"devDependencies": {
- "@testing-library/react": "14.0.0",
- "@testing-library/user-event": "14.5.1",
"@types/iban": "0.0.34",
"@types/react": "18.2.31",
"@types/react-dom": "18.2.14",
diff --git a/clients/banking/src/components/FormText.tsx b/clients/banking/src/components/FormText.tsx
deleted file mode 100644
index 52be6df33..000000000
--- a/clients/banking/src/components/FormText.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { LakeHeading } from "@swan-io/lake/src/components/LakeHeading";
-import { LakeText } from "@swan-io/lake/src/components/LakeText";
-import { Space } from "@swan-io/lake/src/components/Space";
-import { colors } from "@swan-io/lake/src/constants/design";
-
-type Props = {
- children: string;
- isMobile: boolean;
-};
-
-export const FieldsetTitle = ({ children, isMobile }: Props) => {
- if (isMobile) {
- return (
- <>
-
- {children}
-
-
-
- >
- );
- }
-
- return (
- <>
-
- {children}
-
-
-
- >
- );
-};
diff --git a/clients/banking/src/components/TransactionListCells.tsx b/clients/banking/src/components/TransactionListCells.tsx
index 4b72647da..fa371c234 100644
--- a/clients/banking/src/components/TransactionListCells.tsx
+++ b/clients/banking/src/components/TransactionListCells.tsx
@@ -182,7 +182,7 @@ export const TransactionNameCell = ({ transaction }: { transaction: Transaction
);
};
-export const formatTransactionType = (typename: string) => {
+const formatTransactionType = (typename: string) => {
const unprefixed = typename.startsWith("SEPA") ? typename.slice(4) : typename;
return (
diff --git a/clients/banking/src/components/TransferRecurringWizardDetails.tsx b/clients/banking/src/components/TransferRecurringWizardDetails.tsx
index f5d0345b2..a60a9a3e2 100644
--- a/clients/banking/src/components/TransferRecurringWizardDetails.tsx
+++ b/clients/banking/src/components/TransferRecurringWizardDetails.tsx
@@ -33,14 +33,14 @@ const styles = StyleSheet.create({
},
});
-export type FixedAmountDetails = {
+type FixedAmountDetails = {
type: "FixedAmount";
amount: PaymentCurrencyAmount;
label?: string;
reference?: string;
};
-export type TargetAccountBalanceDetails = {
+type TargetAccountBalanceDetails = {
type: "TargetAccountBalance";
targetAmount: PaymentCurrencyAmount;
label?: string;
diff --git a/clients/banking/src/utils/date.ts b/clients/banking/src/utils/date.ts
index 227162fb1..359856a05 100644
--- a/clients/banking/src/utils/date.ts
+++ b/clients/banking/src/utils/date.ts
@@ -1,16 +1,6 @@
import dayjs from "dayjs";
import { locale } from "./i18n";
-export const decodeDate = (value: string) => {
- const date = dayjs.utc(value, "YYYY-MM-DD");
- return date.isValid() ? date.format(locale.dateFormat) : "";
-};
-
-export const encodeDate = (value: string) => {
- const date = dayjs.utc(value, locale.dateFormat);
- return date.isValid() ? date.format("YYYY-MM-DD") : "";
-};
-
export const encodeDateTime = (date: string, time: string) => {
const dateTime = dayjs(`${date} ${time}`, `${locale.dateFormat} ${locale.timeFormat}`);
return dateTime.isValid() ? dateTime.toISOString() : "";
diff --git a/clients/banking/src/utils/iban.ts b/clients/banking/src/utils/iban.ts
index bd9f32e8a..d3373deb9 100644
--- a/clients/banking/src/utils/iban.ts
+++ b/clients/banking/src/utils/iban.ts
@@ -1,61 +1,9 @@
-import { Result } from "@swan-io/boxed";
-import { parseOperationResult } from "@swan-io/lake/src/utils/urql";
import { isValid as isValidIban } from "iban";
-import { match, P } from "ts-pattern";
-import { Client } from "urql";
-import { GetIbanValidationDocument, ValidIbanInformationFragment } from "../graphql/partner";
import { t } from "./i18n";
-export { isValid as isValidIban, printFormat as printIbanFormat } from "iban";
+export { printFormat as printIbanFormat } from "iban";
export const validateIban = (iban: string) => {
if (!isValidIban(iban)) {
return t("error.iban.invalid");
}
};
-
-// Cache already validated IBANs to avoid backend call on submit
-const alreadyValidatedIbans: Record = {};
-
-export const getIbanValidation = async (client: Client, iban: string) => {
- const ibanWithoutSpaces = iban.replace(/ /g, "");
-
- // If we already validated the IBAN, we return the cached result
- const cachedValidation = alreadyValidatedIbans[ibanWithoutSpaces];
- if (cachedValidation) {
- return Result.Ok(cachedValidation);
- }
-
- const result = (
- await Result.fromPromise(
- client
- .query(GetIbanValidationDocument, { iban: ibanWithoutSpaces })
- .toPromise()
- .then(parseOperationResult),
- )
- )
- .mapError(() => "NoIbanValidation" as const)
- .flatMap(({ ibanValidation }) =>
- match(ibanValidation)
- .with(P.nullish, () => Result.Error("NoIbanValidation" as const))
- .with({ __typename: "InvalidIban" }, ({ code }) => Result.Error(code))
- .with({ __typename: "ValidIban" }, validation => {
- alreadyValidatedIbans[ibanWithoutSpaces] = validation;
- return Result.Ok(validation);
- })
- .exhaustive(),
- )
- .mapError(error =>
- match(error)
- .with("InvalidLength", "InvalidStructure", "InvalidChecksum", () => t("error.iban.invalid"))
- .with("InvalidBank", () => t("error.iban.invalidBank"))
- .with("NoIbanValidation", () => {
- // If we failed to validate the IBAN with backend, we do local validation
- if (!isValidIban(iban)) {
- return t("error.iban.invalid");
- }
- })
- .exhaustive(),
- );
-
- return result;
-};
diff --git a/clients/banking/src/utils/routes.ts b/clients/banking/src/utils/routes.ts
index 6f11507e7..260bdda5a 100644
--- a/clients/banking/src/utils/routes.ts
+++ b/clients/banking/src/utils/routes.ts
@@ -115,11 +115,6 @@ export const accountTransactionsRoutes = [
"AccountTransactionsUpcoming",
] as const;
-export const accountTransactionsStatementsRoutes = [
- "AccountTransactionsListStatementsMonthly",
- "AccountTransactionsListStatementsUpcoming",
-];
-
export const membershipsRoutes = ["AccountMembersList", "AccountMembersDetailsArea"] as const;
export const membershipsDetailRoutes = [
diff --git a/clients/banking/src/utils/validations.ts b/clients/banking/src/utils/validations.ts
index 197194b63..63a8e2e68 100644
--- a/clients/banking/src/utils/validations.ts
+++ b/clients/banking/src/utils/validations.ts
@@ -1,4 +1,3 @@
-import { Lazy } from "@swan-io/boxed";
import { DatePickerDate } from "@swan-io/shared-business/src/components/DatePicker";
import { isValidVatNumber } from "@swan-io/shared-business/src/utils/validation";
import dayjs from "dayjs";
@@ -150,22 +149,6 @@ export const validateAddressLine: Validator = value => {
}
};
-export const REFERENCE_MAX_LENGTH = 35;
-
-export const validateReference: Validator = value => {
- const hasOnlyLatinChars = /^[\w/\-?:().,’+ ]*$/.test(value);
- const hasDoubleSlash = value.includes("//");
- const startOrEndWithSlash = [value[0], value[value.length - 1]].includes("/");
-
- if (value !== "" && (!hasOnlyLatinChars || hasDoubleSlash || startOrEndWithSlash)) {
- return t("error.transferReferenceInvalid");
- }
-
- if (value !== "" && value.length > REFERENCE_MAX_LENGTH) {
- return t("error.transferReferenceTooLong");
- }
-};
-
export const validateVatNumber: Validator = value => {
const cleaned = value.replace(/[^A-Z0-9]/gi, "");
if (cleaned.length === 0) {
@@ -177,20 +160,6 @@ export const validateVatNumber: Validator = value => {
}
};
-// Whitelisting the first 8 blocks of unicode (the 9th being cyrilic)
-// And then whitelisting General punctuation, mathematical notations and emojis
-// For reference : https://jrgraphix.net/r/Unicode/
-const VALID_SEPA_BENEFICIARY_NAME_ALPHABET = Lazy(
- () =>
- /^([\u0020-\u03FF\u2200-\u22FF\u2000-\u206F]|(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]))+$/,
-);
-
-export const validateSepaBeneficiaryNameAlphabet: Validator = value => {
- if (!VALID_SEPA_BENEFICIARY_NAME_ALPHABET.get().test(value)) {
- return t("error.beneficiaryNameInvalid");
- }
-};
-
export const isAfterUpdatedAtSelectable = (date: DatePickerDate, filters: unknown) => {
return match(filters)
.with({ isBeforeUpdatedAt: P.string }, ({ isBeforeUpdatedAt }) => {
diff --git a/yarn.lock b/yarn.lock
index 93e4d7d6d..9b54ea38e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6937,7 +6937,7 @@ playwright@1.39.0:
optionalDependencies:
fsevents "2.3.2"
-polished@4.2.2, polished@^4.2.2:
+polished@^4.2.2:
version "4.2.2"
resolved "https://registry.yarnpkg.com/polished/-/polished-4.2.2.tgz#2529bb7c3198945373c52e34618c8fe7b1aa84d1"
integrity sha512-Sz2Lkdxz6F2Pgnpi9U5Ng/WdWAUZxmHrNPoVlm3aAemxoy2Qy7LGjQg4uf8qKelDAUW94F4np3iH2YPf2qefcQ==