@swan-io/shared-business 12.2.10 → 12.2.11
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.11",
|
|
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.11"
|
|
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.11"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from "@swan-io/lake/src/components/Box";
|
|
3
3
|
import { Separator } from "@swan-io/lake/src/components/Separator";
|
|
4
4
|
import { Space } from "@swan-io/lake/src/components/Space";
|
|
@@ -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.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(
|
|
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(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 }))
|
|
@@ -107,7 +107,7 @@ export const ChoicePicker = ({ tile = true, items, getId = identity, large = fal
|
|
|
107
107
|
const containerRef = useRef(null);
|
|
108
108
|
const { desktop } = useResponsive(breakpoints.medium);
|
|
109
109
|
const [mobilePosition, setMobilePosition] = useState("start");
|
|
110
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies:
|
|
110
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: _
|
|
111
111
|
useEffect(() => {
|
|
112
112
|
if (desktop) {
|
|
113
113
|
return;
|
|
@@ -14,7 +14,7 @@ const zendeskFieldMapping = {
|
|
|
14
14
|
};
|
|
15
15
|
const [zendeskApi, setZendeskApi] = Deferred.make();
|
|
16
16
|
export const SupportChat = ({ children, accentColor, type, additionalInfo }) => {
|
|
17
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies(zE):
|
|
17
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(zE): _
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
const script = document.createElement("script");
|
|
20
20
|
script.id = "ze-snippet";
|
|
@@ -38,7 +38,7 @@ export const SupportChat = ({ children, accentColor, type, additionalInfo }) =>
|
|
|
38
38
|
color: { theme: accentColor !== null && accentColor !== void 0 ? accentColor : "#26232f" },
|
|
39
39
|
};
|
|
40
40
|
}, [accentColor]);
|
|
41
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies(zE):
|
|
41
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(zE): _
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
const { firstName, lastName, email, projectName, ...fieldInfos } = additionalInfo;
|
|
44
44
|
const values = Dict.entries({ ...fieldInfos, email });
|
|
@@ -76,7 +76,7 @@ export const SupportChat = ({ children, accentColor, type, additionalInfo }) =>
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
}, [accentColor, additionalInfo]);
|
|
79
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies(zE):
|
|
79
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies(zE): _
|
|
80
80
|
const onPressShow = useCallback(() => {
|
|
81
81
|
try {
|
|
82
82
|
zE("webWidget", "show");
|
package/src/utils/languages.js
CHANGED
|
@@ -2,7 +2,7 @@ import { intersection } from "@swan-io/lake/src/utils/array";
|
|
|
2
2
|
import { isNotNullish, isNullish } from "@swan-io/lake/src/utils/nullish";
|
|
3
3
|
export const LANGUAGE_FALLBACK = "en";
|
|
4
4
|
const PREFERRED_LANGUAGE_KEY = "swan__PreferredLanguage";
|
|
5
|
-
let supportedLanguages
|
|
5
|
+
let supportedLanguages;
|
|
6
6
|
export const getLanguagesHelpers = (languages) => {
|
|
7
7
|
// Restrict shared-business supported languages to the current project ones
|
|
8
8
|
supportedLanguages = isNullish(supportedLanguages)
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { countries, france } from "../constants/countries";
|
|
1
|
+
import { france, getCountryByCCA2, isCountryCCA2 } from "../constants/countries";
|
|
3
2
|
export const getMostLikelyUserCountry = () => {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const navigatorCountry = navigatorCountries[index];
|
|
9
|
-
const country = countries.find(({ cca2 }) => cca2 === navigatorCountry);
|
|
10
|
-
if (isNotNullish(country)) {
|
|
11
|
-
return country;
|
|
3
|
+
const countries = navigator.languages.map(language => language.split("-")[1]);
|
|
4
|
+
for (const country of countries) {
|
|
5
|
+
if (isCountryCCA2(country)) {
|
|
6
|
+
return getCountryByCCA2(country);
|
|
12
7
|
}
|
|
13
8
|
}
|
|
14
9
|
// fallback to france when no valid country found in navigator locales
|