@swan-io/shared-business 13.1.7 → 13.1.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": "13.1.7",
3
+ "version": "13.1.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": "13.1.7"
28
+ "@swan-io/lake": "13.1.9"
29
29
  },
30
30
  "dependencies": {
31
31
  "@formatjs/intl": "^3.1.6",
@@ -50,6 +50,6 @@
50
50
  "@types/react-dom": "^19.1.7",
51
51
  "@types/react-native": "^0.72.8",
52
52
  "type-fest": "^4.41.0",
53
- "@swan-io/lake": "13.1.7"
53
+ "@swan-io/lake": "13.1.9"
54
54
  }
55
55
  }
@@ -39,8 +39,9 @@ type CreditStatementV1Props = {
39
39
  issuerName: string;
40
40
  siret: string;
41
41
  repaymentDate: string;
42
+ closingBalance: Amount;
42
43
  };
43
- export declare const CreditStatementV1: ({ partnerLogoUrl, accountHolderType, accountHolderName, accountHolderAddress, iban, bic, openingDate, closingDate, transactions, issueDate, issuerName, siret, repaymentDate, }: CreditStatementV1Props) => import("react/jsx-runtime").JSX.Element;
44
+ export declare const CreditStatementV1: ({ partnerLogoUrl, accountHolderType, accountHolderName, accountHolderAddress, iban, bic, openingDate, closingDate, transactions, issueDate, issuerName, siret, repaymentDate, closingBalance, }: CreditStatementV1Props) => import("react/jsx-runtime").JSX.Element;
44
45
  export type CreditStatementProps = CreditStatementV1Props;
45
46
  export declare const CreditStatement: (props: CreditStatementProps) => import("react/jsx-runtime").JSX.Element;
46
47
  export {};
@@ -11,7 +11,7 @@ import { printFormat } from "iban";
11
11
  import { StyleSheet } from "react-native";
12
12
  import { match } from "ts-pattern";
13
13
  import { getCountryName } from "../constants/countries";
14
- import { formatNestedMessage, locale, t } from "../utils/i18n";
14
+ import { formatCurrencySymbol, formatNestedMessage, locale, t } from "../utils/i18n";
15
15
  const LOGO_MAX_HEIGHT = 24;
16
16
  const LOGO_MAX_WIDTH = 150;
17
17
  const styles = StyleSheet.create({
@@ -33,6 +33,14 @@ const styles = StyleSheet.create({
33
33
  fontSize: 18,
34
34
  fontWeight: "400",
35
35
  },
36
+ closingBalanceLabel: {
37
+ fontSize: 15,
38
+ fontWeight: "500",
39
+ },
40
+ closingBalanceAmount: {
41
+ fontSize: 15,
42
+ fontWeight: "400",
43
+ },
36
44
  pageTitle: {
37
45
  fontSize: 20,
38
46
  color: colors.swan[500],
@@ -88,7 +96,7 @@ const logoStyle = {
88
96
  objectPosition: "left",
89
97
  };
90
98
  const formatMaskedPan = (value) => `••${value.slice(-4)}`;
91
- export const CreditStatementV1 = ({ partnerLogoUrl, accountHolderType, accountHolderName, accountHolderAddress, iban, bic, openingDate, closingDate, transactions, issueDate, issuerName, siret, repaymentDate, }) => {
99
+ export const CreditStatementV1 = ({ partnerLogoUrl, accountHolderType, accountHolderName, accountHolderAddress, iban, bic, openingDate, closingDate, transactions, issueDate, issuerName, siret, repaymentDate, closingBalance, }) => {
92
100
  return (_jsxs(Box, { style: styles.container, direction: "column", justifyContent: "spaceBetween", children: [_jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "start", 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(LakeText, { style: styles.mediumText, children: t("accountStatement.partnership") }), _jsx(Space, { width: 4 }), _jsx(SwanLogo, { color: colors.gray[900], style: styles.swanLogo })] }), _jsxs(Box, { children: [_jsx(LakeText, { style: styles.pageTitle, children: t("creditStatement.titleDocument") }), _jsx(LakeText, { style: styles.text, color: colors.gray[700], children: accountHolderType === "Company"
93
101
  ? t("accountStatement.titleDocument.companyDescription")
94
102
  : t("accountStatement.titleDocument.individualDescription") }), _jsx(LakeText, { align: "right", style: styles.smallText, children: t("creditStatement.issueDate", {
@@ -101,7 +109,7 @@ export const CreditStatementV1 = ({ partnerLogoUrl, accountHolderType, accountHo
101
109
  }) }), _jsx(Space, { height: 24 }), _jsx(Box, { direction: "row", justifyContent: "spaceBetween", children: _jsx(Box, { direction: "column", justifyContent: "end", children: _jsx(LakeText, { style: styles.subtitle, color: colors.gray[900], children: t("accountStatement.date", {
102
110
  openingDate: dayjs(openingDate).format(locale.dateFormat),
103
111
  closingDate: dayjs(closingDate).format(locale.dateFormat),
104
- }) }) }) }), _jsx(Space, { height: 16 }), _jsxs(_Fragment, { children: [_jsxs(Box, { direction: "row", children: [_jsx(LakeText, { style: [styles.titleColumn, { width: "15%" }], color: colors.gray[700], children: t("accountStatement.column.date") }), _jsx(LakeText, { style: [styles.titleColumn, { width: "55%" }], color: colors.gray[700], children: t("accountStatement.column.description") }), _jsx(LakeText, { style: [styles.titleColumn, { width: "15%", textAlign: "right" }], color: colors.gray[700], children: t("creditStatement.column.debit") }), _jsx(LakeText, { style: [styles.titleColumn, { width: "15%", textAlign: "right" }], color: colors.gray[700], children: t("creditStatement.column.credit") })] }), _jsx(Space, { height: 12 }), _jsx(Box, { direction: "column", children: transactions.map(({ transactionAmount, transactionDate, transactionLabel, transactionSide, transactionType, transactionId, counterparty, maskedPan, }) => (_jsxs(_Fragment, { children: [_jsxs(Box, { direction: "row", children: [_jsx(LakeText, { style: [styles.smallText, { width: "15%" }], color: colors.gray[700], children: dayjs(transactionDate).format(locale.dateFormat) }), _jsxs(Box, { direction: "column", style: { width: "55%" }, children: [_jsx(LakeText, { style: styles.smallText, color: colors.gray[700], children: `${translateTransaction(transactionType)} ${transactionLabel}` }), _jsx(LakeText, { style: styles.smallText, color: colors.gray[500], children: `${counterparty} ${maskedPan ? formatMaskedPan(maskedPan) : ""}` })] }), _jsx(LakeText, { color: colors.gray[700], style: [styles.smallText, styles.rightColumnContent], children: transactionSide === "Debit" ? `- ${transactionAmount.value}` : "" }), _jsx(LakeText, { color: colors.gray[700], style: [styles.smallText, styles.rightColumnContent], children: transactionSide === "Credit" ? transactionAmount.value : "" })] }, transactionId), _jsx(Space, { height: 8 })] }))) })] }), _jsx(Space, { height: 24 })] }));
112
+ }) }) }) }), _jsx(Space, { height: 16 }), _jsxs(_Fragment, { children: [_jsxs(Box, { direction: "row", children: [_jsx(LakeText, { style: [styles.titleColumn, { width: "15%" }], color: colors.gray[700], children: t("accountStatement.column.date") }), _jsx(LakeText, { style: [styles.titleColumn, { width: "55%" }], color: colors.gray[700], children: t("accountStatement.column.description") }), _jsx(LakeText, { style: [styles.titleColumn, { width: "15%", textAlign: "right" }], color: colors.gray[700], children: t("creditStatement.column.debit") }), _jsx(LakeText, { style: [styles.titleColumn, { width: "15%", textAlign: "right" }], color: colors.gray[700], children: t("creditStatement.column.credit") })] }), _jsx(Space, { height: 12 }), _jsxs(Box, { direction: "column", children: [transactions.map(({ transactionAmount, transactionDate, transactionLabel, transactionSide, transactionType, transactionId, counterparty, maskedPan, }) => (_jsxs(_Fragment, { children: [_jsxs(Box, { direction: "row", children: [_jsx(LakeText, { style: [styles.smallText, { width: "15%" }], color: colors.gray[700], children: dayjs(transactionDate).format(locale.dateFormat) }), _jsxs(Box, { direction: "column", style: { width: "55%" }, children: [_jsx(LakeText, { style: styles.smallText, color: colors.gray[700], children: `${translateTransaction(transactionType)} ${transactionLabel}` }), _jsx(LakeText, { style: styles.smallText, color: colors.gray[500], children: `${counterparty} ${maskedPan ? formatMaskedPan(maskedPan) : ""}` })] }), _jsx(LakeText, { color: colors.gray[700], style: [styles.smallText, styles.rightColumnContent], children: transactionSide === "Debit" ? `- ${transactionAmount.value}` : "" }), _jsx(LakeText, { color: colors.gray[700], style: [styles.smallText, styles.rightColumnContent], children: transactionSide === "Credit" ? transactionAmount.value : "" })] }, transactionId), _jsx(Space, { height: 8 })] }))), _jsx(Box, { direction: "row", justifyContent: "end", children: _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", style: { width: "50%" }, children: [_jsx(LakeText, { style: styles.closingBalanceLabel, color: colors.gray[900], children: t("accountStatement.closingBalance") }), _jsx(LakeText, { color: colors.gray[900], style: styles.closingBalanceAmount, children: formatCurrencySymbol(Number(closingBalance.value), closingBalance.currency) })] }) })] })] }), _jsx(Space, { height: 24 })] }));
105
113
  };
106
114
  export const CreditStatement = (props) => match(props)
107
115
  .with({ version: "v1" }, props => _jsx(CreditStatementV1, { ...props }))