@swan-io/shared-business 12.2.7 → 12.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swan-io/shared-business",
|
|
3
|
-
"version": "12.2.
|
|
3
|
+
"version": "12.2.9",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": "^22.12.0"
|
|
6
6
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@swan-io/lake": "12.2.
|
|
28
|
+
"@swan-io/lake": "12.2.9"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@formatjs/intl": "^3.1.6",
|
|
@@ -51,6 +51,6 @@
|
|
|
51
51
|
"@types/react-native": "^0.72.8",
|
|
52
52
|
"jsdom": "^26.1.0",
|
|
53
53
|
"vitest": "^3.2.0",
|
|
54
|
-
"@swan-io/lake": "12.2.
|
|
54
|
+
"@swan-io/lake": "12.2.9"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { StyleProp, ViewStyle } from "react-native";
|
|
2
2
|
import { CountryCCA3 } from "../constants/countries";
|
|
3
|
-
export type TransactionType = "
|
|
3
|
+
export type TransactionType = "Card" | "Check" | "Fees" | "InternationalDirectDebit" | "InternationalCreditTransfer" | "SepaCreditTransfer" | "SepaDirectDebit";
|
|
4
4
|
type AddressInfo = {
|
|
5
|
-
|
|
6
|
-
addressLine2?: string;
|
|
5
|
+
street: string;
|
|
7
6
|
city: string;
|
|
8
|
-
|
|
9
|
-
state?: string;
|
|
10
|
-
country: CountryCCA3;
|
|
7
|
+
country?: CountryCCA3;
|
|
11
8
|
};
|
|
12
9
|
type Amount = {
|
|
13
10
|
value: string;
|
|
14
11
|
currency: string;
|
|
15
12
|
};
|
|
16
|
-
type Transaction = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
export type Transaction = {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
date: string;
|
|
17
|
+
type: "Card" | "Check" | "Fees" | "InternationalDirectDebit" | "InternationalCreditTransfer" | "SepaCreditTransfer" | "SepaDirectDebit";
|
|
18
|
+
credit?: Amount;
|
|
19
|
+
debit?: Amount;
|
|
23
20
|
};
|
|
24
21
|
type AccountStatementV1Props = {
|
|
25
22
|
version: "v1";
|
|
@@ -94,11 +94,11 @@ const Title = ({ text, align = "left", style, }) => (_jsx(Text, { style: [
|
|
|
94
94
|
], children: text }));
|
|
95
95
|
const translateTransaction = (transaction) => {
|
|
96
96
|
return match(transaction)
|
|
97
|
-
.with("
|
|
98
|
-
.with("
|
|
99
|
-
.with("
|
|
100
|
-
.with("
|
|
101
|
-
.with("
|
|
97
|
+
.with("Card", () => t("accountStatement.card"))
|
|
98
|
+
.with("Check", () => t("accountStatement.check"))
|
|
99
|
+
.with("Fees", () => t("accountStatement.fees"))
|
|
100
|
+
.with("InternationalDirectDebit", "SepaDirectDebit", () => t("accountStatement.directDebit"))
|
|
101
|
+
.with("InternationalCreditTransfer", "SepaCreditTransfer", () => t("accountStatement.creditTransfer"))
|
|
102
102
|
.exhaustive();
|
|
103
103
|
};
|
|
104
104
|
const logoStyle = {
|
|
@@ -110,7 +110,7 @@ const logoStyle = {
|
|
|
110
110
|
export const AccountStatementV1 = ({ partnerLogoUrl, style, accountHolderType, accountHolderName, accountHolderAddress, iban, bic, openingDate, closingDate, openingBalance, transactions, feesDebit, feesCredit, totalsCredit, totalsDebit, closingBalance, }) => {
|
|
111
111
|
return (_jsxs(Box, { style: [styles.container, style], direction: "column", justifyContent: "spaceBetween", children: [_jsxs(Box, { children: [_jsx(Box, { direction: "row", justifyContent: "spaceBetween", children: _jsxs(Box, { direction: "row", alignItems: "center", children: [isNotNullishOrEmpty(partnerLogoUrl) ? (_jsx("img", { src: partnerLogoUrl, style: logoStyle })) : (_jsx(SwanLogo, { style: styles.defaultLogo })), _jsx(Separator, { horizontal: true, space: 8 }), _jsx(Text, { style: styles.partnershipText, children: t("accountStatement.partnership") }), _jsx(Space, { width: 4 }), _jsx(SwanLogo, { color: colors.gray[900], style: styles.swanLogo })] }) }), _jsx(Space, { height: 24 }), _jsx(Text, { style: styles.pageTitle, children: t("accountStatement.titleDocument") }), _jsx(Space, { height: 8 }), _jsx(Text, { style: styles.text, children: accountHolderType === "Company"
|
|
112
112
|
? t("accountStatement.titleDocument.companyDescription")
|
|
113
|
-
: t("accountStatement.titleDocument.individualDescription") }), _jsx(Space, { height: 24 }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", children: [_jsxs(Box, { direction: "column", children: [_jsx(Text, { style: styles.sectionTitle, children: accountHolderName.toUpperCase() }), _jsx(Text, { style: styles.text, children: accountHolderAddress.
|
|
113
|
+
: t("accountStatement.titleDocument.individualDescription") }), _jsx(Space, { height: 24 }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", children: [_jsxs(Box, { direction: "column", children: [_jsx(Text, { style: styles.sectionTitle, children: accountHolderName.toUpperCase() }), _jsx(Text, { style: styles.text, children: accountHolderAddress.street }), _jsx(Text, { style: styles.text, children: accountHolderAddress.city }), isNotNullish(accountHolderAddress.country) && (_jsx(Text, { style: styles.text, children: getCountryName(accountHolderAddress.country) }))] }), _jsxs(Box, { direction: "column", alignItems: "end", children: [_jsx(Text, { style: styles.sectionTitle, children: t("accountStatement.contactSupport") }), _jsx(Text, { style: styles.text, children: "support@swan.io" })] })] }), _jsx(Space, { height: 24 }), _jsx(Text, { style: styles.sectionTitle, children: t("accountStatement.iban") }), _jsx(Text, { style: styles.text, children: iban }), _jsx(Space, { height: 12 }), _jsx(Text, { style: styles.sectionTitle, children: t("accountStatement.bic") }), _jsx(Text, { style: styles.text, children: bic }), _jsx(Space, { height: 48 }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", children: [_jsx(Box, { direction: "column", children: _jsx(Text, { style: styles.sectionTitle, children: t("accountStatement.date", { openingDate, closingDate }) }) }), _jsxs(Box, { direction: "column", children: [_jsx(Text, { style: styles.openingBalanceText, children: t("accountStatement.openingBalance") }), _jsx(Text, { style: styles.totalAmount, children: formatCurrencyIso(Number(openingBalance.value), openingBalance.currency) })] })] }), _jsx(Space, { height: 24 }), _jsxs(_Fragment, { children: [_jsxs(Box, { direction: "row", style: { backgroundColor: colors.gray[50] }, children: [_jsx(Text, { style: [styles.titleColumn, { width: "15%" }], children: t("accountStatement.column.date") }), _jsx(Text, { style: [styles.titleColumn, { width: "22%" }], children: t("accountStatement.column.type") }), _jsx(Text, { style: [styles.titleColumn, { width: "33%" }], children: t("accountStatement.column.description") }), _jsx(Text, { style: [styles.titleColumn, { width: "15%", textAlign: "right" }], children: t("accountStatement.column.credit") }), _jsx(Text, { style: [styles.titleColumn, { width: "15%", textAlign: "right" }], children: t("accountStatement.column.debit") })] }), _jsx(Box, { direction: "column", children: transactions.map(transaction => (_jsxs(Box, { direction: "row", children: [_jsx(Text, { style: [styles.textColumn, { width: "15%" }], children: transaction.date }), _jsx(Text, { style: [styles.textColumn, { width: "22%" }], children: translateTransaction(transaction.type) }), _jsx(Text, { style: [styles.textColumn, { width: "33%" }], children: transaction.label }), _jsx(Text, { style: [styles.textColumn, { width: "15%", textAlign: "right" }], children: transaction.credit ? transaction.credit.value : "" }), _jsx(Text, { style: [styles.textColumn, { width: "15%", textAlign: "right" }], children: transaction.debit ? transaction.debit.value : "" })] }, transaction.id))) })] }), _jsxs(Box, { direction: "column", children: [_jsxs(Box, { direction: "row", justifyContent: "end", children: [_jsx(Text, { style: styles.row, children: t("accountStatement.column.fees") }), _jsx(Text, { style: styles.row, children: feesCredit.value }), _jsx(Text, { style: styles.row, children: feesDebit.value })] }), _jsxs(Box, { direction: "row", justifyContent: "end", children: [_jsx(Text, { style: styles.row, children: t("accountStatement.column.totals") }), _jsx(Text, { style: styles.row, children: totalsCredit.value }), _jsx(Text, { style: styles.row, children: totalsDebit.value })] })] }), _jsx(Box, { direction: "row", justifyContent: "end", children: _jsxs(Box, { direction: "row", alignItems: "center", style: styles.closingBalanceRow, justifyContent: "spaceBetween", children: [_jsx(Title, { text: t("accountStatement.closingBalance") }), _jsx(Title, { text: formatCurrencyIso(Number(closingBalance.value), closingBalance.currency), style: styles.totalAmount, align: "right" })] }) })] }), _jsxs(Box, { children: [_jsx(Separator, { space: 24 }), _jsx(Text, { style: styles.footer, children: t("transactionStatement.footer") })] })] }));
|
|
114
114
|
};
|
|
115
115
|
export const AccountStatement = (props) => match(props)
|
|
116
116
|
.with({ version: "v1" }, props => _jsx(AccountStatementV1, { ...props }))
|