@swan-io/shared-business 15.3.0 → 15.4.0
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 +9 -10
- package/src/components/AccountStatement.d.ts +2 -2
- package/src/components/AccountStatement.js +2 -2
- package/src/components/AccountStatementAnnualFees.d.ts +1 -1
- package/src/components/AccountStatementFooter.d.ts +1 -1
- package/src/components/AccountStatementHeader.d.ts +1 -1
- package/src/components/AccountStatementHeader.js +1 -1
- package/src/components/BirthdatePicker.d.ts +1 -1
- package/src/components/ChoicePicker.d.ts +1 -1
- package/src/components/ChoicePicker.js +3 -3
- package/src/components/CollapsibleLakeAlert.d.ts +1 -1
- package/src/components/ConfirmModal.d.ts +1 -1
- package/src/components/CountryPicker.d.ts +1 -1
- package/src/components/CreditStatement.d.ts +2 -2
- package/src/components/CreditStatement.js +2 -2
- package/src/components/DatePicker.d.ts +4 -4
- package/src/components/DatePicker.js +2 -2
- package/src/components/FileInput.d.ts +1 -1
- package/src/components/FileInput.js +2 -2
- package/src/components/FileTile.d.ts +1 -1
- package/src/components/FileTile.js +2 -2
- package/src/components/FilesUploader.d.ts +1 -1
- package/src/components/FilesUploader.js +1 -1
- package/src/components/Flag.d.ts +1 -1
- package/src/components/InlineDatePicker.d.ts +1 -1
- package/src/components/InlineDatePicker.js +5 -8
- package/src/components/InputPhoneNumber.d.ts +3 -3
- package/src/components/InputPhoneNumber.js +1 -1
- package/src/components/LakeModal.d.ts +1 -1
- package/src/components/LakeModal.js +1 -1
- package/src/components/PhoneCountryPicker.d.ts +1 -1
- package/src/components/PhoneCountryPicker.js +4 -3
- package/src/components/PlacekitAddressSearchInput.d.ts +1 -1
- package/src/components/PlacekitAddressSearchInput.js +1 -4
- package/src/components/PlacekitCityInput.d.ts +1 -1
- package/src/components/PlacekitCityInput.js +5 -8
- package/src/components/RIB.d.ts +1 -1
- package/src/components/RIB.js +1 -1
- package/src/components/SkipToContent.d.ts +1 -1
- package/src/components/SupportChat.js +0 -3
- package/src/components/SupportingDocumentCollection.d.ts +1 -1
- package/src/components/SupportingDocumentCollection.js +3 -9
- package/src/components/TaxIdentificationNumberInput.d.ts +1 -1
- package/src/components/ToastStack.d.ts +1 -1
- package/src/components/ToastStack.js +2 -2
- package/src/components/TransactionStatement.d.ts +2 -2
- package/src/constants/countries.d.ts +8 -8
- package/src/constants/registrationNumbers.js +2 -1
- package/src/utils/__tests__/date.test.js +1 -1
- package/src/utils/__tests__/i18n.test.js +12 -1
- package/src/utils/flags.d.ts +1 -1
- package/src/utils/flags.js +0 -1
- package/src/utils/i18n.js +2 -2
- package/src/utils/languages.js +2 -1
- package/src/utils/validation.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swan-io/shared-business",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.4.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">22.12.0"
|
|
6
6
|
},
|
|
@@ -28,32 +28,31 @@
|
|
|
28
28
|
"react": ">=19.0.0",
|
|
29
29
|
"react-dom": ">=19.0.0",
|
|
30
30
|
"react-native-web": ">=0.21.2",
|
|
31
|
-
"@swan-io/lake": "15.
|
|
31
|
+
"@swan-io/lake": "15.4.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@formatjs/intl": "^4.1.
|
|
34
|
+
"@formatjs/intl": "^4.1.16",
|
|
35
35
|
"@placekit/client-js": "^2.3.0",
|
|
36
36
|
"@swan-io/boxed": "^3.2.1",
|
|
37
37
|
"@swan-io/request": "^3.1.0",
|
|
38
38
|
"@swan-io/use-form": "^3.1.0",
|
|
39
|
-
"dayjs": "^1.11.
|
|
39
|
+
"dayjs": "^1.11.21",
|
|
40
40
|
"iban": "^0.0.14",
|
|
41
41
|
"react-atomic-state": "^2.1.0",
|
|
42
|
-
"react-dropzone": "^
|
|
43
|
-
"prism-react-renderer": "^2.4.1",
|
|
42
|
+
"react-dropzone": "^17.0.0",
|
|
44
43
|
"rifm": "^0.12.1",
|
|
45
44
|
"ts-pattern": "^5.9.0",
|
|
46
|
-
"uuid": "^14.0.
|
|
45
|
+
"uuid": "^14.0.1"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@types/iban": "0.0.35",
|
|
50
|
-
"@types/react": "^19.2.
|
|
49
|
+
"@types/react": "^19.2.17",
|
|
51
50
|
"@types/react-dom": "^19.2.3",
|
|
52
51
|
"@types/react-native": "^0.72.8",
|
|
53
52
|
"react": "^19.2.7",
|
|
54
53
|
"react-dom": "^19.2.7",
|
|
55
54
|
"react-native-web": "^0.21.2",
|
|
56
|
-
"type-fest": "^5.
|
|
57
|
-
"@swan-io/lake": "15.
|
|
55
|
+
"type-fest": "^5.8.0",
|
|
56
|
+
"@swan-io/lake": "15.4.0"
|
|
58
57
|
}
|
|
59
58
|
}
|
|
@@ -40,7 +40,7 @@ type AccountStatementV1Props = {
|
|
|
40
40
|
hideFooter?: boolean;
|
|
41
41
|
language?: SupportedLanguage;
|
|
42
42
|
};
|
|
43
|
-
export declare const AccountStatementV1: ({ style, accountHolderName, accountHolderAddress, accountHolderType, iban, bic, openingDate, closingDate, openingBalance, transactions, feesDebit, feesCredit, totalsCredit, totalsDebit, closingBalance, language, }: AccountStatementV1Props) => import("react
|
|
43
|
+
export declare const AccountStatementV1: ({ style, accountHolderName, accountHolderAddress, accountHolderType, iban, bic, openingDate, closingDate, openingBalance, transactions, feesDebit, feesCredit, totalsCredit, totalsDebit, closingBalance, language, }: AccountStatementV1Props) => import("react").JSX.Element;
|
|
44
44
|
export type AccountStatementProps = AccountStatementV1Props;
|
|
45
|
-
export declare const AccountStatement: (props: AccountStatementProps) => import("react
|
|
45
|
+
export declare const AccountStatement: (props: AccountStatementProps) => import("react").JSX.Element;
|
|
46
46
|
export {};
|
|
@@ -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 { Space } from "@swan-io/lake/src/components/Space";
|
|
4
4
|
import { colors, spacings } from "@swan-io/lake/src/constants/design";
|
|
@@ -122,7 +122,7 @@ export const AccountStatementV1 = ({ style, accountHolderName, accountHolderAddr
|
|
|
122
122
|
const t = useTranslation(language);
|
|
123
123
|
return (_jsx(Box, { style: style, children: _jsx(Box, { style: styles.container, direction: "column", justifyContent: "spaceBetween", children: _jsxs(Box, { children: [_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 }), _jsxs(Text, { style: styles.text, children: [accountHolderAddress.city, ",", " ", isNotNullish(accountHolderAddress.country) && accountHolderAddress.country] }), _jsx(Space, { height: 24 }), isNotEmpty(iban) && (_jsxs(Text, { style: styles.textBold, children: [t("accountStatement.iban"), " ", _jsx(Text, { style: styles.text, children: iban })] })), _jsx(Space, { height: 4 }), isNotEmpty(bic) && (_jsxs(Text, { style: styles.textBold, children: [t("accountStatement.bic"), " ", _jsx(Text, { style: styles.text, children: bic })] }))] }), _jsxs(Box, { direction: "column", alignItems: "end", children: [_jsx(Text, { style: styles.pageTitle, children: t("accountStatement.titleDocument") }), _jsx(Text, { style: styles.pageSubTitle, children: accountHolderType === "Company"
|
|
124
124
|
? t("accountStatement.titleDocument.companyDescription")
|
|
125
|
-
: t("accountStatement.titleDocument.individualDescription") }), _jsx(Space, { height: 24 }), _jsx(Text, { style: styles.textBold, children: t("accountStatement.contactSupport") }), _jsx(Text, { style: styles.text, children: "support.swan.io" })] })] }), _jsx(Space, { height: 48 }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", children: [_jsx(Box, { style: styles.dateContainer, children: _jsxs(Text, { style: styles.dateText, children: [t("accountStatement.from"), " ", _jsx(Text, { style: styles.dateBold, children: openingDate }), " ", t("accountStatement.to"), " ", _jsx(Text, { style: styles.dateBold, children: closingDate })] }) }), _jsxs(Box, { direction: "column", children: [_jsx(Text, { style: styles.openingBalanceText, children: t("accountStatement.openingBalance") }), _jsx(Text, { style: styles.totalAmount, children: openingBalance.value })] })] }), _jsx(Space, { height: 24 }), _jsxs(
|
|
125
|
+
: t("accountStatement.titleDocument.individualDescription") }), _jsx(Space, { height: 24 }), _jsx(Text, { style: styles.textBold, children: t("accountStatement.contactSupport") }), _jsx(Text, { style: styles.text, children: "support.swan.io" })] })] }), _jsx(Space, { height: 48 }), _jsxs(Box, { direction: "row", justifyContent: "spaceBetween", alignItems: "center", children: [_jsx(Box, { style: styles.dateContainer, children: _jsxs(Text, { style: styles.dateText, children: [t("accountStatement.from"), " ", _jsx(Text, { style: styles.dateBold, children: openingDate }), " ", t("accountStatement.to"), " ", _jsx(Text, { style: styles.dateBold, children: closingDate })] }) }), _jsxs(Box, { direction: "column", children: [_jsx(Text, { style: styles.openingBalanceText, children: t("accountStatement.openingBalance") }), _jsx(Text, { style: styles.totalAmount, children: openingBalance.value })] })] }), _jsx(Space, { height: 24 }), _jsxs(Box, { direction: "row", style: styles.thead, children: [_jsx(Text, { style: [styles.titleColumn, { width: "13%" }], children: t("accountStatement.column.date") }), _jsx(Text, { style: [styles.titleColumn, { width: "21%" }], children: t("accountStatement.column.type") }), _jsx(Text, { style: [styles.titleColumn, { width: "42%" }], 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: "13%" }], children: transaction.date }), _jsx(Text, { style: [styles.textColumn, { width: "20%" }], children: translateTransaction(transaction.type, t) }), _jsx(Text, { style: [styles.textColumn, { width: "40%" }], 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))) }), _jsx(Space, { height: 12 }), _jsxs(Box, { direction: "column", children: [_jsxs(Box, { direction: "row", justifyContent: "end", children: [_jsx(Text, { style: [styles.row, styles.textBold], children: t("accountStatement.column.fees") }), _jsx(Text, { style: [styles.row, styles.textBold], children: feesCredit.value }), _jsx(Text, { style: [styles.row, styles.textBold], children: feesDebit.value })] }), _jsxs(Box, { direction: "row", justifyContent: "end", children: [_jsx(Text, { style: [styles.row, styles.textBold], children: t("accountStatement.column.totals") }), _jsx(Text, { style: [styles.row, styles.textBold], children: totalsCredit.value }), _jsx(Text, { style: [styles.row, styles.textBold], children: totalsDebit.value })] })] }), _jsx(Space, { height: 12 }), _jsx(Box, { direction: "row", justifyContent: "end", children: _jsxs(Box, { direction: "row", alignItems: "center", style: styles.closingBalanceRow, justifyContent: "spaceBetween", children: [_jsx(Title, { style: styles.closingBalanceRowText, text: t("accountStatement.closingBalance") }), _jsx(Title, { text: closingBalance.value, style: styles.totalAmount, align: "right" })] }) })] }) }) }));
|
|
126
126
|
};
|
|
127
127
|
export const AccountStatement = (props) => match(props)
|
|
128
128
|
.with({ version: "v1" }, props => _jsx(AccountStatementV1, { ...props }))
|
|
@@ -19,5 +19,5 @@ export type AccountStatementAnnualFeesProps = {
|
|
|
19
19
|
annualFeeStatement: AnnualFeeStatementData;
|
|
20
20
|
language?: SupportedLanguage;
|
|
21
21
|
};
|
|
22
|
-
export declare const AccountStatementAnnualFees: ({ annualFeeStatement, language, }: AccountStatementAnnualFeesProps) => import("react
|
|
22
|
+
export declare const AccountStatementAnnualFees: ({ annualFeeStatement, language, }: AccountStatementAnnualFeesProps) => import("react").JSX.Element;
|
|
23
23
|
export {};
|
|
@@ -3,5 +3,5 @@ type AccountStatementHeaderProps = {
|
|
|
3
3
|
partnerLogoUrl?: string;
|
|
4
4
|
language?: SupportedLanguage;
|
|
5
5
|
};
|
|
6
|
-
export declare const AccountStatementHeader: ({ partnerLogoUrl, language, }: AccountStatementHeaderProps) => import("react
|
|
6
|
+
export declare const AccountStatementHeader: ({ partnerLogoUrl, language, }: AccountStatementHeaderProps) => import("react").JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SwanLogo } from "@swan-io/lake/src/components/SwanLogo";
|
|
3
3
|
import { colors } from "@swan-io/lake/src/constants/design";
|
|
4
4
|
import { isNotNullishOrEmpty } from "@swan-io/lake/src/utils/nullish";
|
|
@@ -8,4 +8,4 @@ export type BirthdatePickerProps = {
|
|
|
8
8
|
readOnly?: boolean;
|
|
9
9
|
responsive?: boolean;
|
|
10
10
|
};
|
|
11
|
-
export declare const BirthdatePicker: ({ value, label, readOnly, onValueChange, error: externalError, style, responsive, }: BirthdatePickerProps) => import("react
|
|
11
|
+
export declare const BirthdatePicker: ({ value, label, readOnly, onValueChange, error: externalError, style, responsive, }: BirthdatePickerProps) => import("react").JSX.Element;
|
|
@@ -10,5 +10,5 @@ type Props<T> = {
|
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
tileColor?: ColorVariants;
|
|
12
12
|
};
|
|
13
|
-
export declare const ChoicePicker: <T>({ tileColor, items, getId, large, renderItem, value, disabled, onChange, }: Props<T>) => import("react
|
|
13
|
+
export declare const ChoicePicker: <T>({ tileColor, items, getId, large, renderItem, value, disabled, onChange, }: Props<T>) => import("react").JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { LakeButton } from "@swan-io/lake/src/components/LakeButton";
|
|
3
3
|
import { LakeRadio } from "@swan-io/lake/src/components/LakeRadio";
|
|
4
4
|
import { Pressable } from "@swan-io/lake/src/components/Pressable";
|
|
@@ -114,7 +114,7 @@ export const ChoicePicker = ({ tileColor, items, getId = identity, large = false
|
|
|
114
114
|
const containerRef = useRef(null);
|
|
115
115
|
const { desktop } = useResponsive(breakpoints.medium);
|
|
116
116
|
const [mobilePosition, setMobilePosition] = useState("start");
|
|
117
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies:
|
|
117
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: rerun effect only when screen size change from desktop to mobile
|
|
118
118
|
useEffect(() => {
|
|
119
119
|
if (desktop) {
|
|
120
120
|
return;
|
|
@@ -124,7 +124,7 @@ export const ChoicePicker = ({ tileColor, items, getId = identity, large = false
|
|
|
124
124
|
if (container == null) {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
-
const index = items.
|
|
127
|
+
const index = value != null ? items.indexOf(value) : -1;
|
|
128
128
|
if (index !== -1 && container.element != null) {
|
|
129
129
|
const width = container.element.offsetWidth;
|
|
130
130
|
container.scrollTo({ x: index * width, animated: false });
|
|
@@ -6,5 +6,5 @@ type CollapsibleLakeAlertProps = ComponentProps<typeof LakeAlert> & {
|
|
|
6
6
|
initialCollapsed?: boolean;
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
};
|
|
9
|
-
export declare const CollapsibleLakeAlert: ({ showMoreLabel, showLessLabel, initialCollapsed, children, ...rest }: CollapsibleLakeAlertProps) => import("react
|
|
9
|
+
export declare const CollapsibleLakeAlert: ({ showMoreLabel, showLessLabel, initialCollapsed, children, ...rest }: CollapsibleLakeAlertProps) => import("react").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -12,5 +12,5 @@ type Props = {
|
|
|
12
12
|
onConfirm: () => void;
|
|
13
13
|
onCancel: () => void;
|
|
14
14
|
};
|
|
15
|
-
export declare const ConfirmModal: ({ visible, title, message, confirmText, cancelText, color, icon, loading, onConfirm, onCancel, }: Props) => import("react
|
|
15
|
+
export declare const ConfirmModal: ({ visible, title, message, confirmText, cancelText, color, icon, loading, onConfirm, onCancel, }: Props) => import("react").JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -13,5 +13,5 @@ type Props<T extends CountryCCA3> = {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
hideErrors?: boolean;
|
|
15
15
|
};
|
|
16
|
-
export declare const CountryPicker: <T extends CountryCCA3>({ ref, onValueChange, value, countries, readOnly, id, error, placeholder, disabled, hideErrors, }: Props<T>) => import("react
|
|
16
|
+
export declare const CountryPicker: <T extends CountryCCA3>({ ref, onValueChange, value, countries, readOnly, id, error, placeholder, disabled, hideErrors, }: Props<T>) => import("react").JSX.Element;
|
|
17
17
|
export {};
|
|
@@ -41,7 +41,7 @@ type CreditStatementV1Props = {
|
|
|
41
41
|
repaymentDate: string;
|
|
42
42
|
closingBalance: Amount;
|
|
43
43
|
};
|
|
44
|
-
export declare const CreditStatementV1: ({ partnerLogoUrl, accountHolderType, accountHolderName, accountHolderAddress, iban, bic, openingDate, closingDate, transactions, issueDate, issuerName, siret, repaymentDate, closingBalance, }: CreditStatementV1Props) => import("react
|
|
44
|
+
export declare const CreditStatementV1: ({ partnerLogoUrl, accountHolderType, accountHolderName, accountHolderAddress, iban, bic, openingDate, closingDate, transactions, issueDate, issuerName, siret, repaymentDate, closingBalance, }: CreditStatementV1Props) => import("react").JSX.Element;
|
|
45
45
|
export type CreditStatementProps = CreditStatementV1Props;
|
|
46
|
-
export declare const CreditStatement: (props: CreditStatementProps) => import("react
|
|
46
|
+
export declare const CreditStatement: (props: CreditStatementProps) => import("react").JSX.Element;
|
|
47
47
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from "@swan-io/lake/src/components/Box";
|
|
3
3
|
import { LakeText } from "@swan-io/lake/src/components/LakeText";
|
|
4
4
|
import { Separator } from "@swan-io/lake/src/components/Separator";
|
|
@@ -109,7 +109,7 @@ export const CreditStatementV1 = ({ partnerLogoUrl, accountHolderType, accountHo
|
|
|
109
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("creditStatement.date", {
|
|
110
110
|
openingDate: dayjs(openingDate).format(locale.dateFormat),
|
|
111
111
|
closingDate: dayjs(closingDate).format(locale.dateFormat),
|
|
112
|
-
}) }) }) }), _jsx(Space, { height: 16 }), _jsxs(
|
|
112
|
+
}) }) }) }), _jsx(Space, { height: 16 }), _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 })] }));
|
|
113
113
|
};
|
|
114
114
|
export const CreditStatement = (props) => match(props)
|
|
115
115
|
.with({ version: "v1" }, props => _jsx(CreditStatementV1, { ...props }))
|
|
@@ -50,7 +50,7 @@ export type DatePickerProps = {
|
|
|
50
50
|
isSelectable?: (date: DatePickerDate) => boolean;
|
|
51
51
|
onChange: (date: string) => void;
|
|
52
52
|
};
|
|
53
|
-
export declare const DatePicker: ({ label, value, error, format, firstWeekDay, isSelectable, onChange, }: DatePickerProps) => import("react
|
|
53
|
+
export declare const DatePicker: ({ label, value, error, format, firstWeekDay, isSelectable, onChange, }: DatePickerProps) => import("react").JSX.Element;
|
|
54
54
|
type DatePickerModalProps = Except<DatePickerProps, "error"> & {
|
|
55
55
|
visible: boolean;
|
|
56
56
|
cancelLabel: string;
|
|
@@ -58,7 +58,7 @@ type DatePickerModalProps = Except<DatePickerProps, "error"> & {
|
|
|
58
58
|
validate?: (value: string) => ValidatorResult;
|
|
59
59
|
onDismiss: () => void;
|
|
60
60
|
};
|
|
61
|
-
export declare const DatePickerModal: ({ value, format, firstWeekDay, isSelectable, onChange, visible, label, cancelLabel, confirmLabel, validate, onDismiss, }: DatePickerModalProps) => import("react
|
|
61
|
+
export declare const DatePickerModal: ({ value, format, firstWeekDay, isSelectable, onChange, visible, label, cancelLabel, confirmLabel, validate, onDismiss, }: DatePickerModalProps) => import("react").JSX.Element;
|
|
62
62
|
export type DateRangePickerProps = {
|
|
63
63
|
value: {
|
|
64
64
|
start: string;
|
|
@@ -75,12 +75,12 @@ export type DateRangePickerProps = {
|
|
|
75
75
|
end: string;
|
|
76
76
|
}) => void;
|
|
77
77
|
};
|
|
78
|
-
export declare const DateRangePicker: ({ value, error, format, startLabel, endLabel, firstWeekDay, isSelectable, onChange, }: DateRangePickerProps) => import("react
|
|
78
|
+
export declare const DateRangePicker: ({ value, error, format, startLabel, endLabel, firstWeekDay, isSelectable, onChange, }: DateRangePickerProps) => import("react").JSX.Element;
|
|
79
79
|
type DateRangePickerModalProps = DateRangePickerProps & {
|
|
80
80
|
visible: boolean;
|
|
81
81
|
cancelLabel: string;
|
|
82
82
|
confirmLabel: string;
|
|
83
83
|
onDismiss: () => void;
|
|
84
84
|
};
|
|
85
|
-
export declare const DateRangePickerModal: ({ value, error, format, firstWeekDay, isSelectable, onChange, visible, startLabel, endLabel, cancelLabel, confirmLabel, onDismiss, }: DateRangePickerModalProps) => import("react
|
|
85
|
+
export declare const DateRangePickerModal: ({ value, error, format, firstWeekDay, isSelectable, onChange, visible, startLabel, endLabel, cancelLabel, confirmLabel, onDismiss, }: DateRangePickerModalProps) => import("react").JSX.Element;
|
|
86
86
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Option } from "@swan-io/boxed";
|
|
3
3
|
import { BottomPanel } from "@swan-io/lake/src/components/BottomPanel";
|
|
4
4
|
import { Box } from "@swan-io/lake/src/components/Box";
|
|
@@ -25,7 +25,7 @@ import dayjs from "dayjs";
|
|
|
25
25
|
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
26
26
|
import { StyleSheet, View } from "react-native";
|
|
27
27
|
import { Rifm } from "rifm";
|
|
28
|
-
import {
|
|
28
|
+
import { match, P } from "ts-pattern";
|
|
29
29
|
import { t } from "../utils/i18n";
|
|
30
30
|
import { LakeModal } from "./LakeModal";
|
|
31
31
|
const styles = StyleSheet.create({
|
|
@@ -16,5 +16,5 @@ type Props = {
|
|
|
16
16
|
onError?: () => void;
|
|
17
17
|
onPressRemove?: () => void;
|
|
18
18
|
};
|
|
19
|
-
export declare const FileInput: ({ icon, accept, value, disabled, onPressRemove, onFiles, onError, layout, description, error, maxSize, }: Props) => import("react
|
|
19
|
+
export declare const FileInput: ({ icon, accept, value, disabled, onPressRemove, onFiles, onError, layout, description, error, maxSize, }: Props) => import("react").JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Option, Result } from "@swan-io/boxed";
|
|
3
3
|
import { Icon } from "@swan-io/lake/src/components/Icon";
|
|
4
4
|
import { LakeButton } from "@swan-io/lake/src/components/LakeButton";
|
|
@@ -13,7 +13,7 @@ import { isNotNullish } from "@swan-io/lake/src/utils/nullish";
|
|
|
13
13
|
import { useMemo } from "react";
|
|
14
14
|
import { useDropzone } from "react-dropzone";
|
|
15
15
|
import { StyleSheet, Text, View } from "react-native";
|
|
16
|
-
import {
|
|
16
|
+
import { match, P } from "ts-pattern";
|
|
17
17
|
import { formatNestedMessage, t } from "../utils/i18n";
|
|
18
18
|
const styles = StyleSheet.create({
|
|
19
19
|
container: {
|
|
@@ -5,5 +5,5 @@ type Props = {
|
|
|
5
5
|
showId?: boolean;
|
|
6
6
|
onRemove?: () => Future<unknown>;
|
|
7
7
|
};
|
|
8
|
-
export declare const FileTile: ({ file: { id, statusInfo, name, url }, showId, onRemove, }: Props) => import("react
|
|
8
|
+
export declare const FileTile: ({ file: { id, statusInfo, name, url }, showId, onRemove, }: Props) => import("react").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from "@swan-io/lake/src/components/Box";
|
|
3
3
|
import { Icon } from "@swan-io/lake/src/components/Icon";
|
|
4
4
|
import { LakeAlert } from "@swan-io/lake/src/components/LakeAlert";
|
|
@@ -15,7 +15,7 @@ import { getIconNameFromFilename } from "@swan-io/lake/src/utils/file";
|
|
|
15
15
|
import { isNotNullish, isNotNullishOrEmpty } from "@swan-io/lake/src/utils/nullish";
|
|
16
16
|
import { useCallback, useState } from "react";
|
|
17
17
|
import { StyleSheet, View } from "react-native";
|
|
18
|
-
import {
|
|
18
|
+
import { match, P } from "ts-pattern";
|
|
19
19
|
import { getRejectionReasonLabel, t } from "../utils/i18n";
|
|
20
20
|
import { LakeModal } from "./LakeModal";
|
|
21
21
|
const styles = StyleSheet.create({
|
|
@@ -18,5 +18,5 @@ type Props<UploadInput, UploadOutput, GenerateUploadError, UploadFileError> = Co
|
|
|
18
18
|
export type FilesUploaderRef = {
|
|
19
19
|
add: (file: SwanFile) => void;
|
|
20
20
|
};
|
|
21
|
-
export declare const FilesUploader: <UploadInput, UploadOutput, GenerateUploadError, UploadFileError>({ ref, maxSize, accept, icon, getUploadConfig, onRemoveFile, onChange, formatAndSizeDescription, canUpload, showIds, ...config }: Props<UploadInput, UploadOutput, GenerateUploadError, UploadFileError>) => import("react
|
|
21
|
+
export declare const FilesUploader: <UploadInput, UploadOutput, GenerateUploadError, UploadFileError>({ ref, maxSize, accept, icon, getUploadConfig, onRemoveFile, onChange, formatAndSizeDescription, canUpload, showIds, ...config }: Props<UploadInput, UploadOutput, GenerateUploadError, UploadFileError>) => import("react").JSX.Element;
|
|
22
22
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from "@swan-io/lake/src/components/Box";
|
|
3
3
|
import { Space } from "@swan-io/lake/src/components/Space";
|
|
4
4
|
import { Fragment, useEffect, useImperativeHandle, useRef } from "react";
|
package/src/components/Flag.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export type InlineDatePickerProps = {
|
|
|
10
10
|
responsive?: boolean;
|
|
11
11
|
validate?: (value: ExtractedDate | undefined) => string | undefined;
|
|
12
12
|
};
|
|
13
|
-
export declare const InlineDatePicker: ({ value, label, readOnly, responsive, onValueChange, validate, error: externalError, style, }: InlineDatePickerProps) => import("react
|
|
13
|
+
export declare const InlineDatePicker: ({ value, label, readOnly, responsive, onValueChange, validate, error: externalError, style, }: InlineDatePickerProps) => import("react").JSX.Element;
|
|
@@ -123,14 +123,11 @@ export const InlineDatePicker = ({ value, label, readOnly = false, responsive =
|
|
|
123
123
|
const year = (_jsx(View, { style: desktop ? styles.year : styles.yearMobile, children: _jsx(LakeTextInput, { value: value === null || value === void 0 ? void 0 : value.year, style: (isNotNullish(error) || isNotNullish(externalError)) && styles.error, readOnly: readOnly, placeholder: t("datePicker.year"), onBlur: () => {
|
|
124
124
|
touched.current.add("year");
|
|
125
125
|
validateDate();
|
|
126
|
-
}, hideErrors: true, onChangeText: year => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
year,
|
|
132
|
-
});
|
|
133
|
-
}, pattern: "[0-9]", maxLength: 4, autoComplete: "bday-year" }) }));
|
|
126
|
+
}, hideErrors: true, onChangeText: year => { var _a, _b; return onChange({
|
|
127
|
+
day: (_a = value === null || value === void 0 ? void 0 : value.day) !== null && _a !== void 0 ? _a : "",
|
|
128
|
+
month: (_b = value === null || value === void 0 ? void 0 : value.month) !== null && _b !== void 0 ? _b : "",
|
|
129
|
+
year,
|
|
130
|
+
}); }, pattern: "[0-9]", maxLength: 4, autoComplete: "bday-year" }) }));
|
|
134
131
|
return (_jsxs(Box, { children: [order === "DMY" ? (_jsxs(Stack, { direction: "row", space: 4, children: [day, " ", month, " ", year] })) : (_jsxs(Stack, { direction: "row", space: 4, children: [month, " ", day, " ", year] })), _jsx(InputError, { message: error !== null && error !== void 0 ? error : externalError })] }));
|
|
135
132
|
} })) }) }));
|
|
136
133
|
};
|
|
@@ -24,8 +24,8 @@ type Props = {
|
|
|
24
24
|
onBlur?: () => void;
|
|
25
25
|
};
|
|
26
26
|
export declare const getInitialPhoneCountry: (phoneNumber: string | undefined, defaultCountry: Country) => {
|
|
27
|
-
readonly cca2: "
|
|
28
|
-
readonly cca3: "
|
|
27
|
+
readonly cca2: "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "XK" | "YE" | "YT" | "ZA" | "ZM" | "ZW";
|
|
28
|
+
readonly cca3: "ABW" | "AFG" | "AGO" | "AIA" | "ALA" | "ALB" | "AND" | "ARE" | "ARG" | "ARM" | "ASM" | "ATA" | "ATF" | "ATG" | "AUS" | "AUT" | "AZE" | "BDI" | "BEL" | "BEN" | "BES" | "BFA" | "BGD" | "BGR" | "BHR" | "BHS" | "BIH" | "BLM" | "BLR" | "BLZ" | "BMU" | "BOL" | "BRA" | "BRB" | "BRN" | "BTN" | "BVT" | "BWA" | "CAF" | "CAN" | "CCK" | "CHE" | "CHL" | "CHN" | "CIV" | "CMR" | "COD" | "COG" | "COK" | "COL" | "COM" | "CPV" | "CRI" | "CUB" | "CUW" | "CXR" | "CYM" | "CYP" | "CZE" | "DEU" | "DJI" | "DMA" | "DNK" | "DOM" | "DZA" | "ECU" | "EGY" | "ERI" | "ESH" | "ESP" | "EST" | "ETH" | "FIN" | "FJI" | "FLK" | "FRA" | "FRO" | "FSM" | "GAB" | "GBR" | "GEO" | "GGY" | "GHA" | "GIB" | "GIN" | "GLP" | "GMB" | "GNB" | "GNQ" | "GRC" | "GRD" | "GRL" | "GTM" | "GUF" | "GUM" | "GUY" | "HKG" | "HMD" | "HND" | "HRV" | "HTI" | "HUN" | "IDN" | "IMN" | "IND" | "IRL" | "IRN" | "IRQ" | "ISL" | "ISR" | "ITA" | "JAM" | "JEY" | "JOR" | "JPN" | "KAZ" | "KEN" | "KGZ" | "KHM" | "KIR" | "KNA" | "KOR" | "KWT" | "LAO" | "LBN" | "LBR" | "LBY" | "LCA" | "LIE" | "LKA" | "LSO" | "LTU" | "LUX" | "LVA" | "MAC" | "MAF" | "MAR" | "MCO" | "MDA" | "MDG" | "MDV" | "MEX" | "MHL" | "MKD" | "MLI" | "MLT" | "MMR" | "MNE" | "MNG" | "MNP" | "MOZ" | "MRT" | "MSR" | "MTQ" | "MUS" | "MWI" | "MYS" | "MYT" | "NAM" | "NCL" | "NER" | "NFK" | "NGA" | "NIC" | "NIU" | "NLD" | "NOR" | "NPL" | "NZL" | "OMN" | "PAK" | "PAN" | "PCN" | "PER" | "PHL" | "PLW" | "PNG" | "POL" | "PRI" | "PRK" | "PRT" | "PRY" | "PSE" | "PYF" | "QAT" | "REU" | "ROU" | "RUS" | "RWA" | "SAU" | "SDN" | "SEN" | "SGP" | "SGS" | "SLB" | "SLE" | "SLV" | "SMR" | "SOM" | "SPM" | "SRB" | "SSD" | "STP" | "SUR" | "SVK" | "SVN" | "SWE" | "SWZ" | "SYC" | "SYR" | "TCA" | "TCD" | "TGO" | "THA" | "TJK" | "TKM" | "TLS" | "TON" | "TTO" | "TUN" | "TUR" | "TUV" | "TWN" | "TZA" | "UGA" | "UKR" | "UMI" | "URY" | "USA" | "UZB" | "VAT" | "VCT" | "VEN" | "VGB" | "VIR" | "VNM" | "VUT" | "WLF" | "WSM" | "XKX" | "YEM" | "ZAF" | "ZMB" | "ZWE";
|
|
29
29
|
name: string;
|
|
30
30
|
deburr: string;
|
|
31
31
|
idd: string;
|
|
@@ -33,5 +33,5 @@ export declare const getInitialPhoneCountry: (phoneNumber: string | undefined, d
|
|
|
33
33
|
flag: string;
|
|
34
34
|
isNationality: boolean;
|
|
35
35
|
};
|
|
36
|
-
export declare const InputPhoneNumber: ({ ref, id, country, value, countries, error, help, valid, autofocus, disabled, readOnly, countryAriaLabel, hideErrors, onCountryChange, onChangeText, onSubmitEditing, onBlur, }: Props) => import("react
|
|
36
|
+
export declare const InputPhoneNumber: ({ ref, id, country, value, countries, error, help, valid, autofocus, disabled, readOnly, countryAriaLabel, hideErrors, onCountryChange, onChangeText, onSubmitEditing, onBlur, }: Props) => import("react").JSX.Element;
|
|
37
37
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from "@swan-io/lake/src/components/Box";
|
|
3
3
|
import { LakeText } from "@swan-io/lake/src/components/LakeText";
|
|
4
4
|
import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
|
|
@@ -11,4 +11,4 @@ export type LakeModalProps = {
|
|
|
11
11
|
maxWidth?: number;
|
|
12
12
|
onPressClose?: () => void;
|
|
13
13
|
};
|
|
14
|
-
export declare const LakeModal: ({ visible, icon, title, color, children, maxWidth, onPressClose, }: LakeModalProps) => import("react
|
|
14
|
+
export declare const LakeModal: ({ visible, icon, title, color, children, maxWidth, onPressClose, }: LakeModalProps) => import("react").JSX.Element | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FocusTrap } from "@swan-io/lake/src/components/FocusTrap";
|
|
3
3
|
import { Icon } from "@swan-io/lake/src/components/Icon";
|
|
4
4
|
import { LakeButton } from "@swan-io/lake/src/components/LakeButton";
|
|
@@ -10,5 +10,5 @@ type Props = {
|
|
|
10
10
|
error?: string;
|
|
11
11
|
ariaLabel?: string;
|
|
12
12
|
};
|
|
13
|
-
export declare const PhoneCountryPicker: ({ value, onValueChange, countries, style, disabled, readOnly, error, ariaLabel, }: Props) => import("react
|
|
13
|
+
export declare const PhoneCountryPicker: ({ value, onValueChange, countries, style, disabled, readOnly, error, ariaLabel, }: Props) => import("react").JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from "@swan-io/lake/src/components/Box";
|
|
3
3
|
import { FlatList } from "@swan-io/lake/src/components/FlatList";
|
|
4
4
|
import { Icon } from "@swan-io/lake/src/components/Icon";
|
|
@@ -40,6 +40,7 @@ const styles = StyleSheet.create({
|
|
|
40
40
|
triggerErrored: { borderColor: colors.negative[500] },
|
|
41
41
|
triggerDisabled: { borderColor: colors.gray[50] },
|
|
42
42
|
list: { height: 230 },
|
|
43
|
+
listDropdown: { width: 360 },
|
|
43
44
|
searchIcon: { position: "absolute", left: 16 },
|
|
44
45
|
searchInput: {
|
|
45
46
|
...texts.regular,
|
|
@@ -94,7 +95,7 @@ export const PhoneCountryPicker = ({ value, onValueChange, countries, style, dis
|
|
|
94
95
|
!visible && pressed && styles.triggerPressed,
|
|
95
96
|
(disabled || readOnly) && styles.triggerDisabled,
|
|
96
97
|
isNotNullishOrEmpty(error) && styles.triggerErrored,
|
|
97
|
-
], children: [_jsx(Flag, { code: value.cca2, width: 16 }), _jsx(Space, { width: 8 }), _jsxs(LakeText, { color: colors.gray[600], numberOfLines: 1, userSelect: "none", variant: "smallSemibold", children: ["+", value.idd] }), _jsx(Space, { width: 8 }), _jsx(Icon, { name: "chevron-down-filled", color: colors.gray[600], size: 16 })] }), _jsx(Popover, { referenceRef: referenceRef, visible: visible, onDismiss: close, matchReferenceWidth: false, children: _jsxs(View, { style: styles.list, children: [_jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(Icon, { name: "search-filled", color: colors.gray[300], size: 18, style: styles.searchIcon }), _jsx(TextInput, { ref: inputRef, inputMode: "search", style: styles.searchInput, onChangeText: handleOnChangeText, onSubmitEditing: () => {
|
|
98
|
+
], children: [_jsx(Flag, { code: value.cca2, width: 16 }), _jsx(Space, { width: 8 }), _jsxs(LakeText, { color: colors.gray[600], numberOfLines: 1, userSelect: "none", variant: "smallSemibold", children: ["+", value.idd] }), _jsx(Space, { width: 8 }), _jsx(Icon, { name: "chevron-down-filled", color: colors.gray[600], size: 16 })] }), _jsx(Popover, { referenceRef: referenceRef, visible: visible, onDismiss: close, matchReferenceWidth: false, children: ({ mode }) => (_jsxs(View, { style: [styles.list, mode === "dropdown" && styles.listDropdown], children: [_jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(Icon, { name: "search-filled", color: colors.gray[300], size: 18, style: styles.searchIcon }), _jsx(TextInput, { ref: inputRef, inputMode: "search", style: styles.searchInput, onChangeText: handleOnChangeText, onSubmitEditing: () => {
|
|
98
99
|
if (isNotNullish(filteredCountries[0])) {
|
|
99
100
|
onValueChange(filteredCountries[0]);
|
|
100
101
|
close();
|
|
@@ -106,5 +107,5 @@ export const PhoneCountryPicker = ({ value, onValueChange, countries, style, dis
|
|
|
106
107
|
], onPress: () => {
|
|
107
108
|
onValueChange(item);
|
|
108
109
|
close();
|
|
109
|
-
}, children: [_jsx(Flag, { code: item.cca2, width: 16 }), _jsx(Space, { width: 12 }), _jsx(LakeText, { numberOfLines: 1, style: styles.rowName, userSelect: "none", variant: "smallRegular", children: item.name }), item.uid === value.uid && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 12 }), _jsx(Icon, { name: "checkmark-filled", color: colors.positive[500], size: 16 })] })), _jsx(Space, { width: 12 }), _jsxs(LakeText, { userSelect: "none", variant: "smallRegular", children: ["+", item.idd] })] })) })] }) })] }));
|
|
110
|
+
}, children: [_jsx(Flag, { code: item.cca2, width: 16 }), _jsx(Space, { width: 12 }), _jsx(LakeText, { numberOfLines: 1, style: styles.rowName, userSelect: "none", variant: "smallRegular", children: item.name }), item.uid === value.uid && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 12 }), _jsx(Icon, { name: "checkmark-filled", color: colors.positive[500], size: 16 })] })), _jsx(Space, { width: 12 }), _jsxs(LakeText, { userSelect: "none", variant: "smallRegular", children: ["+", item.idd] })] })) })] })) })] }));
|
|
110
111
|
};
|
|
@@ -26,5 +26,5 @@ type Props = {
|
|
|
26
26
|
emptyResult: string;
|
|
27
27
|
apiKey?: string;
|
|
28
28
|
};
|
|
29
|
-
export declare const PlacekitAddressSearchInput: ({ inputRef, id, country, disabled, error, value, types, onValueChange, onSuggestion, language, placeholder, shouldDisplaySuggestions, emptyResult, apiKey, }: Props) => import("react
|
|
29
|
+
export declare const PlacekitAddressSearchInput: ({ inputRef, id, country, disabled, error, value, types, onValueChange, onSuggestion, language, placeholder, shouldDisplaySuggestions, emptyResult, apiKey, }: Props) => import("react").JSX.Element;
|
|
30
30
|
export {};
|
|
@@ -9,10 +9,7 @@ export const PlacekitAddressSearchInput = ({ inputRef, id, country, disabled, er
|
|
|
9
9
|
const loadSuggestions = useCallback((value) => {
|
|
10
10
|
if (placekit != null) {
|
|
11
11
|
const countries = Option.fromNullable(country)
|
|
12
|
-
.map(country => {
|
|
13
|
-
var _a;
|
|
14
|
-
return Array.filterMap((_a = countriesWithMultipleCCA3[country]) !== null && _a !== void 0 ? _a : [country], cca3 => Option.fromNullable(getCCA2forCCA3(cca3)));
|
|
15
|
-
})
|
|
12
|
+
.map(country => { var _a; return Array.filterMap((_a = countriesWithMultipleCCA3[country]) !== null && _a !== void 0 ? _a : [country], cca3 => Option.fromNullable(getCCA2forCCA3(cca3))); })
|
|
16
13
|
.getOr([]);
|
|
17
14
|
const cca2Countries = countries.length === 0 ? Option.None() : Option.Some(countries);
|
|
18
15
|
return Future.fromPromise(placekit.search(value, {
|
|
@@ -15,5 +15,5 @@ type Props = {
|
|
|
15
15
|
onLoadError: (error: unknown) => void;
|
|
16
16
|
apiKey?: string;
|
|
17
17
|
};
|
|
18
|
-
export declare const PlacekitCityInput: ({ value, onValueChange, country, disabled, placeholder, id, error, onSuggestion, onLoadError, apiKey, }: Props) => import("react
|
|
18
|
+
export declare const PlacekitCityInput: ({ value, onValueChange, country, disabled, placeholder, id, error, onSuggestion, onLoadError, apiKey, }: Props) => import("react").JSX.Element;
|
|
19
19
|
export {};
|
|
@@ -18,14 +18,11 @@ export const PlacekitCityInput = ({ value, onValueChange, country, disabled, pla
|
|
|
18
18
|
countries: countries.toUndefined(),
|
|
19
19
|
})).mapOk(({ results }) => results
|
|
20
20
|
.filter((result, index, self) => self.findIndex(r => r.name === result.name && r.zipcode[0] === result.zipcode[0]) === index)
|
|
21
|
-
.map(result => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
value: result,
|
|
27
|
-
});
|
|
28
|
-
}), true);
|
|
21
|
+
.map(result => { var _a; return ({
|
|
22
|
+
title: result.name,
|
|
23
|
+
subtitle: (_a = result.zipcode[0]) !== null && _a !== void 0 ? _a : "",
|
|
24
|
+
value: result,
|
|
25
|
+
}); }), true);
|
|
29
26
|
}
|
|
30
27
|
return Future.value(Result.Ok([]));
|
|
31
28
|
}, [placekit, country]);
|
package/src/components/RIB.d.ts
CHANGED
|
@@ -41,5 +41,5 @@ type RIBv1Props = {
|
|
|
41
41
|
bankNumber: string;
|
|
42
42
|
});
|
|
43
43
|
export type RIBProps = RIBv1Props;
|
|
44
|
-
export declare const RIB: (props: RIBProps) => import("react
|
|
44
|
+
export declare const RIB: (props: RIBProps) => import("react").JSX.Element;
|
|
45
45
|
export {};
|
package/src/components/RIB.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from "@swan-io/lake/src/components/Box";
|
|
3
3
|
import { LakeHeading } from "@swan-io/lake/src/components/LakeHeading";
|
|
4
4
|
import { Separator } from "@swan-io/lake/src/components/Separator";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const CONTENT_ID = "content";
|
|
2
|
-
export declare const SkipToContent: () => import("react
|
|
2
|
+
export declare const SkipToContent: () => import("react").JSX.Element | null;
|
|
@@ -14,7 +14,6 @@ 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):
|
|
18
17
|
useEffect(() => {
|
|
19
18
|
const script = document.createElement("script");
|
|
20
19
|
script.id = "ze-snippet";
|
|
@@ -38,7 +37,6 @@ export const SupportChat = ({ children, accentColor, type, additionalInfo }) =>
|
|
|
38
37
|
color: { theme: accentColor !== null && accentColor !== void 0 ? accentColor : "#26232f" },
|
|
39
38
|
};
|
|
40
39
|
}, [accentColor]);
|
|
41
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies(zE):
|
|
42
40
|
useEffect(() => {
|
|
43
41
|
const { firstName, lastName, email, projectName, ...fieldInfos } = additionalInfo;
|
|
44
42
|
const values = Dict.entries({ ...fieldInfos, email });
|
|
@@ -76,7 +74,6 @@ export const SupportChat = ({ children, accentColor, type, additionalInfo }) =>
|
|
|
76
74
|
}
|
|
77
75
|
});
|
|
78
76
|
}, [accentColor, additionalInfo]);
|
|
79
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies(zE):
|
|
80
77
|
const onPressShow = useCallback(() => {
|
|
81
78
|
try {
|
|
82
79
|
zE("webWidget", "show");
|
|
@@ -60,5 +60,5 @@ type Props<Purpose extends string> = {
|
|
|
60
60
|
getPurposeMetadata?: (purose: Purpose) => PurposeMetadata | undefined;
|
|
61
61
|
readonlyDocumentPurposes?: Purpose[];
|
|
62
62
|
};
|
|
63
|
-
export declare const SupportingDocumentCollection: <Purpose extends string>({ ref, documents, generateUpload, uploadFile, documentPurposes, templateLanguage, status, onChange, onRemoveFile, showIds, readOnly, getPurposeMetadata, companyCountry, readonlyDocumentPurposes, }: Props<Purpose>) => import("react
|
|
63
|
+
export declare const SupportingDocumentCollection: <Purpose extends string>({ ref, documents, generateUpload, uploadFile, documentPurposes, templateLanguage, status, onChange, onRemoveFile, showIds, readOnly, getPurposeMetadata, companyCountry, readonlyDocumentPurposes, }: Props<Purpose>) => import("react").JSX.Element;
|
|
64
64
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Array, Option } from "@swan-io/boxed";
|
|
3
3
|
import { Box } from "@swan-io/lake/src/components/Box";
|
|
4
4
|
import { Form } from "@swan-io/lake/src/components/Form";
|
|
@@ -37,14 +37,8 @@ const styles = StyleSheet.create({
|
|
|
37
37
|
});
|
|
38
38
|
const Help = (props) => {
|
|
39
39
|
return match(props)
|
|
40
|
-
.with({ type: "tooltip" }, ({ text, width }) => {
|
|
41
|
-
var _a;
|
|
42
|
-
return (_jsx(LakeTooltip, { content: text, width: width, togglableOnFocus: true, placement: "right", maxWidth: 400, children: _jsx(LakeButton, { mode: "tertiary", size: "small", color: "gray", icon: (_a = props.icon) !== null && _a !== void 0 ? _a : "question-circle-regular", disabled: true, style: [styles.button, styles.buttonWithDefaultCursor], ariaLabel: t("supportingDocuments.help.whatIsThis") }) }));
|
|
43
|
-
})
|
|
44
|
-
.with({ type: "button" }, ({ label, onPress }) => {
|
|
45
|
-
var _a;
|
|
46
|
-
return (_jsx(LakeButton, { mode: "secondary", size: "small", color: "gray", icon: (_a = props.icon) !== null && _a !== void 0 ? _a : "question-circle-regular", onPress: onPress, style: styles.button, ariaLabel: t("supportingDocuments.help.whatIsThis"), children: label }));
|
|
47
|
-
})
|
|
40
|
+
.with({ type: "tooltip" }, ({ text, width }) => { var _a; return (_jsx(LakeTooltip, { content: text, width: width, togglableOnFocus: true, placement: "right", maxWidth: 400, children: _jsx(LakeButton, { mode: "tertiary", size: "small", color: "gray", icon: (_a = props.icon) !== null && _a !== void 0 ? _a : "question-circle-regular", disabled: true, style: [styles.button, styles.buttonWithDefaultCursor], ariaLabel: t("supportingDocuments.help.whatIsThis") }) })); })
|
|
41
|
+
.with({ type: "button" }, ({ label, onPress }) => { var _a; return (_jsx(LakeButton, { mode: "secondary", size: "small", color: "gray", icon: (_a = props.icon) !== null && _a !== void 0 ? _a : "question-circle-regular", onPress: onPress, style: styles.button, ariaLabel: t("supportingDocuments.help.whatIsThis"), children: label })); })
|
|
48
42
|
.exhaustive();
|
|
49
43
|
};
|
|
50
44
|
const getSupportLink = (language, country) => match({ language, country })
|
|
@@ -15,5 +15,5 @@ type Props = {
|
|
|
15
15
|
label?: string;
|
|
16
16
|
placeholder?: string;
|
|
17
17
|
};
|
|
18
|
-
export declare const TaxIdentificationNumberInput: ({ ref, value, error, valid, disabled, onChange, onBlur, country, isCompany, required, label, placeholder, }: Props) => import("react
|
|
18
|
+
export declare const TaxIdentificationNumberInput: ({ ref, value, error, valid, disabled, onChange, onBlur, country, isCompany, required, label, placeholder, }: Props) => import("react").JSX.Element;
|
|
19
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const ToastStack: () => import("react
|
|
1
|
+
export declare const ToastStack: () => import("react").JSX.Element | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Array, Option } from "@swan-io/boxed";
|
|
3
3
|
import { Box } from "@swan-io/lake/src/components/Box";
|
|
4
4
|
import { Icon } from "@swan-io/lake/src/components/Icon";
|
|
@@ -13,7 +13,7 @@ import { setClipboardText } from "@swan-io/lake/src/utils/clipboard";
|
|
|
13
13
|
import { isNotNullishOrEmpty, isNullish } from "@swan-io/lake/src/utils/nullish";
|
|
14
14
|
import { memo, useEffect, useRef, useState } from "react";
|
|
15
15
|
import { StyleSheet, View } from "react-native";
|
|
16
|
-
import {
|
|
16
|
+
import { match, P } from "ts-pattern";
|
|
17
17
|
import { getErrorToRequestId, hideToast, useToasts, } from "../state/toasts";
|
|
18
18
|
import { t } from "../utils/i18n";
|
|
19
19
|
const styles = StyleSheet.create({
|
|
@@ -28,7 +28,7 @@ type TransactionStatementV1Props = {
|
|
|
28
28
|
creditorBankIdentifier?: string;
|
|
29
29
|
style?: StyleProp<ViewStyle>;
|
|
30
30
|
};
|
|
31
|
-
export declare const TransactionStatementV1: ({ partnerLogoUrl, generationDate, executionDate, type, amount, instructedAmount, amountCredited, targetTransferAmount, exchangeRate, fees, label, reference, debtorName, debtorAccountNumber, debtorBankName, debtorBankIdentifier, creditorName, creditorAccountNumber, creditorBankName, creditorBankIdentifier, style, }: TransactionStatementV1Props) => import("react
|
|
31
|
+
export declare const TransactionStatementV1: ({ partnerLogoUrl, generationDate, executionDate, type, amount, instructedAmount, amountCredited, targetTransferAmount, exchangeRate, fees, label, reference, debtorName, debtorAccountNumber, debtorBankName, debtorBankIdentifier, creditorName, creditorAccountNumber, creditorBankName, creditorBankIdentifier, style, }: TransactionStatementV1Props) => import("react").JSX.Element;
|
|
32
32
|
export type TransactionStatementProps = TransactionStatementV1Props;
|
|
33
|
-
export declare const TransactionStatement: (props: TransactionStatementProps) => import("react
|
|
33
|
+
export declare const TransactionStatement: (props: TransactionStatementProps) => import("react").JSX.Element;
|
|
34
34
|
export {};
|
|
@@ -1740,10 +1740,10 @@ export declare const getCCA2forCCA3: (cca3: CountryCCA3) => CountryCCA2;
|
|
|
1740
1740
|
export declare const getCCA3forCCA2: (cca2: CountryCCA2) => CountryCCA3;
|
|
1741
1741
|
export declare const companyWithUboCountries: readonly ["BEL", "DEU", "FRA", "ITA", "LTU", "LUX", "NLD"];
|
|
1742
1742
|
export type CompanyWithUboCountryCCA3 = (typeof companyWithUboCountries)[number];
|
|
1743
|
-
export declare const allCountries: ("
|
|
1743
|
+
export declare const allCountries: ("ABW" | "AFG" | "AGO" | "AIA" | "ALA" | "ALB" | "AND" | "ARE" | "ARG" | "ARM" | "ASM" | "ATA" | "ATF" | "ATG" | "AUS" | "AUT" | "AZE" | "BDI" | "BEL" | "BEN" | "BES" | "BFA" | "BGD" | "BGR" | "BHR" | "BHS" | "BIH" | "BLM" | "BLR" | "BLZ" | "BMU" | "BOL" | "BRA" | "BRB" | "BRN" | "BTN" | "BVT" | "BWA" | "CAF" | "CAN" | "CCK" | "CHE" | "CHL" | "CHN" | "CIV" | "CMR" | "COD" | "COG" | "COK" | "COL" | "COM" | "CPV" | "CRI" | "CUB" | "CUW" | "CXR" | "CYM" | "CYP" | "CZE" | "DEU" | "DJI" | "DMA" | "DNK" | "DOM" | "DZA" | "ECU" | "EGY" | "ERI" | "ESH" | "ESP" | "EST" | "ETH" | "FIN" | "FJI" | "FLK" | "FRA" | "FRO" | "FSM" | "GAB" | "GBR" | "GEO" | "GGY" | "GHA" | "GIB" | "GIN" | "GLP" | "GMB" | "GNB" | "GNQ" | "GRC" | "GRD" | "GRL" | "GTM" | "GUF" | "GUM" | "GUY" | "HKG" | "HMD" | "HND" | "HRV" | "HTI" | "HUN" | "IDN" | "IMN" | "IND" | "IRL" | "IRN" | "IRQ" | "ISL" | "ISR" | "ITA" | "JAM" | "JEY" | "JOR" | "JPN" | "KAZ" | "KEN" | "KGZ" | "KHM" | "KIR" | "KNA" | "KOR" | "KWT" | "LAO" | "LBN" | "LBR" | "LBY" | "LCA" | "LIE" | "LKA" | "LSO" | "LTU" | "LUX" | "LVA" | "MAC" | "MAF" | "MAR" | "MCO" | "MDA" | "MDG" | "MDV" | "MEX" | "MHL" | "MKD" | "MLI" | "MLT" | "MMR" | "MNE" | "MNG" | "MNP" | "MOZ" | "MRT" | "MSR" | "MTQ" | "MUS" | "MWI" | "MYS" | "MYT" | "NAM" | "NCL" | "NER" | "NFK" | "NGA" | "NIC" | "NIU" | "NLD" | "NOR" | "NPL" | "NZL" | "OMN" | "PAK" | "PAN" | "PCN" | "PER" | "PHL" | "PLW" | "PNG" | "POL" | "PRI" | "PRK" | "PRT" | "PRY" | "PSE" | "PYF" | "QAT" | "REU" | "ROU" | "RUS" | "RWA" | "SAU" | "SDN" | "SEN" | "SGP" | "SGS" | "SLB" | "SLE" | "SLV" | "SMR" | "SOM" | "SPM" | "SRB" | "SSD" | "STP" | "SUR" | "SVK" | "SVN" | "SWE" | "SWZ" | "SYC" | "SYR" | "TCA" | "TCD" | "TGO" | "THA" | "TJK" | "TKM" | "TLS" | "TON" | "TTO" | "TUN" | "TUR" | "TUV" | "TWN" | "TZA" | "UGA" | "UKR" | "UMI" | "URY" | "USA" | "UZB" | "VAT" | "VCT" | "VEN" | "VGB" | "VIR" | "VNM" | "VUT" | "WLF" | "WSM" | "XKX" | "YEM" | "ZAF" | "ZMB" | "ZWE")[];
|
|
1744
1744
|
export declare const france: {
|
|
1745
|
-
readonly cca2: "
|
|
1746
|
-
readonly cca3: "
|
|
1745
|
+
readonly cca2: "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "XK" | "YE" | "YT" | "ZA" | "ZM" | "ZW";
|
|
1746
|
+
readonly cca3: "ABW" | "AFG" | "AGO" | "AIA" | "ALA" | "ALB" | "AND" | "ARE" | "ARG" | "ARM" | "ASM" | "ATA" | "ATF" | "ATG" | "AUS" | "AUT" | "AZE" | "BDI" | "BEL" | "BEN" | "BES" | "BFA" | "BGD" | "BGR" | "BHR" | "BHS" | "BIH" | "BLM" | "BLR" | "BLZ" | "BMU" | "BOL" | "BRA" | "BRB" | "BRN" | "BTN" | "BVT" | "BWA" | "CAF" | "CAN" | "CCK" | "CHE" | "CHL" | "CHN" | "CIV" | "CMR" | "COD" | "COG" | "COK" | "COL" | "COM" | "CPV" | "CRI" | "CUB" | "CUW" | "CXR" | "CYM" | "CYP" | "CZE" | "DEU" | "DJI" | "DMA" | "DNK" | "DOM" | "DZA" | "ECU" | "EGY" | "ERI" | "ESH" | "ESP" | "EST" | "ETH" | "FIN" | "FJI" | "FLK" | "FRA" | "FRO" | "FSM" | "GAB" | "GBR" | "GEO" | "GGY" | "GHA" | "GIB" | "GIN" | "GLP" | "GMB" | "GNB" | "GNQ" | "GRC" | "GRD" | "GRL" | "GTM" | "GUF" | "GUM" | "GUY" | "HKG" | "HMD" | "HND" | "HRV" | "HTI" | "HUN" | "IDN" | "IMN" | "IND" | "IRL" | "IRN" | "IRQ" | "ISL" | "ISR" | "ITA" | "JAM" | "JEY" | "JOR" | "JPN" | "KAZ" | "KEN" | "KGZ" | "KHM" | "KIR" | "KNA" | "KOR" | "KWT" | "LAO" | "LBN" | "LBR" | "LBY" | "LCA" | "LIE" | "LKA" | "LSO" | "LTU" | "LUX" | "LVA" | "MAC" | "MAF" | "MAR" | "MCO" | "MDA" | "MDG" | "MDV" | "MEX" | "MHL" | "MKD" | "MLI" | "MLT" | "MMR" | "MNE" | "MNG" | "MNP" | "MOZ" | "MRT" | "MSR" | "MTQ" | "MUS" | "MWI" | "MYS" | "MYT" | "NAM" | "NCL" | "NER" | "NFK" | "NGA" | "NIC" | "NIU" | "NLD" | "NOR" | "NPL" | "NZL" | "OMN" | "PAK" | "PAN" | "PCN" | "PER" | "PHL" | "PLW" | "PNG" | "POL" | "PRI" | "PRK" | "PRT" | "PRY" | "PSE" | "PYF" | "QAT" | "REU" | "ROU" | "RUS" | "RWA" | "SAU" | "SDN" | "SEN" | "SGP" | "SGS" | "SLB" | "SLE" | "SLV" | "SMR" | "SOM" | "SPM" | "SRB" | "SSD" | "STP" | "SUR" | "SVK" | "SVN" | "SWE" | "SWZ" | "SYC" | "SYR" | "TCA" | "TCD" | "TGO" | "THA" | "TJK" | "TKM" | "TLS" | "TON" | "TTO" | "TUN" | "TUR" | "TUV" | "TWN" | "TZA" | "UGA" | "UKR" | "UMI" | "URY" | "USA" | "UZB" | "VAT" | "VCT" | "VEN" | "VGB" | "VIR" | "VNM" | "VUT" | "WLF" | "WSM" | "XKX" | "YEM" | "ZAF" | "ZMB" | "ZWE";
|
|
1747
1747
|
name: string;
|
|
1748
1748
|
deburr: string;
|
|
1749
1749
|
idd: string;
|
|
@@ -1751,10 +1751,10 @@ export declare const france: {
|
|
|
1751
1751
|
flag: string;
|
|
1752
1752
|
isNationality: boolean;
|
|
1753
1753
|
};
|
|
1754
|
-
export declare const phoneCountries: ("
|
|
1755
|
-
export declare const individualCountries: ("
|
|
1754
|
+
export declare const phoneCountries: ("ABW" | "AFG" | "AGO" | "AIA" | "ALA" | "ALB" | "AND" | "ARE" | "ARG" | "ARM" | "ASM" | "ATA" | "ATF" | "ATG" | "AUS" | "AUT" | "AZE" | "BDI" | "BEL" | "BEN" | "BES" | "BFA" | "BGD" | "BGR" | "BHR" | "BHS" | "BIH" | "BLM" | "BLR" | "BLZ" | "BMU" | "BOL" | "BRA" | "BRB" | "BRN" | "BTN" | "BVT" | "BWA" | "CAF" | "CAN" | "CCK" | "CHE" | "CHL" | "CHN" | "CIV" | "CMR" | "COD" | "COG" | "COK" | "COL" | "COM" | "CPV" | "CRI" | "CUB" | "CUW" | "CXR" | "CYM" | "CYP" | "CZE" | "DEU" | "DJI" | "DMA" | "DNK" | "DOM" | "DZA" | "ECU" | "EGY" | "ERI" | "ESH" | "ESP" | "EST" | "ETH" | "FIN" | "FJI" | "FLK" | "FRA" | "FRO" | "FSM" | "GAB" | "GBR" | "GEO" | "GGY" | "GHA" | "GIB" | "GIN" | "GLP" | "GMB" | "GNB" | "GNQ" | "GRC" | "GRD" | "GRL" | "GTM" | "GUF" | "GUM" | "GUY" | "HKG" | "HMD" | "HND" | "HRV" | "HTI" | "HUN" | "IDN" | "IMN" | "IND" | "IRL" | "IRN" | "IRQ" | "ISL" | "ISR" | "ITA" | "JAM" | "JEY" | "JOR" | "JPN" | "KAZ" | "KEN" | "KGZ" | "KHM" | "KIR" | "KNA" | "KOR" | "KWT" | "LAO" | "LBN" | "LBR" | "LBY" | "LCA" | "LIE" | "LKA" | "LSO" | "LTU" | "LUX" | "LVA" | "MAC" | "MAF" | "MAR" | "MCO" | "MDA" | "MDG" | "MDV" | "MEX" | "MHL" | "MKD" | "MLI" | "MLT" | "MMR" | "MNE" | "MNG" | "MNP" | "MOZ" | "MRT" | "MSR" | "MTQ" | "MUS" | "MWI" | "MYS" | "MYT" | "NAM" | "NCL" | "NER" | "NFK" | "NGA" | "NIC" | "NIU" | "NLD" | "NOR" | "NPL" | "NZL" | "OMN" | "PAK" | "PAN" | "PCN" | "PER" | "PHL" | "PLW" | "PNG" | "POL" | "PRI" | "PRK" | "PRT" | "PRY" | "PSE" | "PYF" | "QAT" | "REU" | "ROU" | "RUS" | "RWA" | "SAU" | "SDN" | "SEN" | "SGP" | "SGS" | "SLB" | "SLE" | "SLV" | "SMR" | "SOM" | "SPM" | "SRB" | "SSD" | "STP" | "SUR" | "SVK" | "SVN" | "SWE" | "SWZ" | "SYC" | "SYR" | "TCA" | "TCD" | "TGO" | "THA" | "TJK" | "TKM" | "TLS" | "TON" | "TTO" | "TUN" | "TUR" | "TUV" | "TWN" | "TZA" | "UGA" | "UKR" | "UMI" | "URY" | "USA" | "UZB" | "VAT" | "VCT" | "VEN" | "VGB" | "VIR" | "VNM" | "VUT" | "WLF" | "WSM" | "XKX" | "YEM" | "ZAF" | "ZMB" | "ZWE")[];
|
|
1755
|
+
export declare const individualCountries: ("AUT" | "BEL" | "BGR" | "CYP" | "CZE" | "DEU" | "DNK" | "ESP" | "EST" | "FIN" | "FRA" | "GRC" | "HRV" | "HUN" | "IRL" | "ISL" | "ITA" | "LIE" | "LTU" | "LUX" | "LVA" | "MLT" | "NLD" | "NOR" | "POL" | "PRT" | "ROU" | "SVK" | "SVN" | "SWE")[];
|
|
1756
1756
|
export type IndividualCountryCCA3 = (typeof individualCountries)[number];
|
|
1757
|
-
export declare const companyCountries: ("
|
|
1757
|
+
export declare const companyCountries: ("AUT" | "BEL" | "BGR" | "CYP" | "CZE" | "DEU" | "DNK" | "ESP" | "EST" | "FIN" | "FRA" | "GRC" | "HRV" | "HUN" | "IRL" | "ISL" | "ITA" | "LIE" | "LTU" | "LUX" | "LVA" | "MLT" | "NLD" | "NOR" | "POL" | "PRT" | "ROU" | "SVK" | "SVN" | "SWE")[];
|
|
1758
1758
|
export type CompanyCountryCCA3 = (typeof companyCountries)[number];
|
|
1759
1759
|
type TaxNumberValidationRule = {
|
|
1760
1760
|
pattern: RegExp;
|
|
@@ -1770,7 +1770,7 @@ export declare const isCountryCCA2: (value: unknown) => value is CountryCCA2;
|
|
|
1770
1770
|
export declare const isIndividualCountryCCA3: (value: unknown) => value is IndividualCountryCCA3;
|
|
1771
1771
|
export declare const isCompanyCountryCCA3: (value: unknown) => value is CompanyCountryCCA3;
|
|
1772
1772
|
export declare const isCompanyWithUboCountryCCA3: (value: unknown) => value is CompanyWithUboCountryCCA3;
|
|
1773
|
-
export declare const companyFallbackCountry: "
|
|
1774
|
-
export declare const individualFallbackCountry: "
|
|
1773
|
+
export declare const companyFallbackCountry: "AUT" | "BEL" | "BGR" | "CYP" | "CZE" | "DEU" | "DNK" | "ESP" | "EST" | "FIN" | "FRA" | "GRC" | "HRV" | "HUN" | "IRL" | "ISL" | "ITA" | "LIE" | "LTU" | "LUX" | "LVA" | "MLT" | "NLD" | "NOR" | "POL" | "PRT" | "ROU" | "SVK" | "SVN" | "SWE";
|
|
1774
|
+
export declare const individualFallbackCountry: "AUT" | "BEL" | "BGR" | "CYP" | "CZE" | "DEU" | "DNK" | "ESP" | "EST" | "FIN" | "FRA" | "GRC" | "HRV" | "HUN" | "IRL" | "ISL" | "ITA" | "LIE" | "LTU" | "LUX" | "LVA" | "MLT" | "NLD" | "NOR" | "POL" | "PRT" | "ROU" | "SVK" | "SVN" | "SWE";
|
|
1775
1775
|
export declare const getCountryName: (cca3: CountryCCA3) => string;
|
|
1776
1776
|
export {};
|
|
@@ -117,6 +117,7 @@ const defaultRegistrationNumbersConfig = {
|
|
|
117
117
|
registrationNumberLabel: t("registrationPage.defaultNumberLabel"),
|
|
118
118
|
};
|
|
119
119
|
export const getRegistrationNumbersConfig = ({ country, companyType, }) => {
|
|
120
|
-
var _a
|
|
120
|
+
var _a;
|
|
121
|
+
var _b;
|
|
121
122
|
return ((_b = (_a = registrationNumbersConfigByCountry[country]) === null || _a === void 0 ? void 0 : _a[companyType]) !== null && _b !== void 0 ? _b : defaultRegistrationNumbersConfig);
|
|
122
123
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { decodeBirthDate, encodeBirthDate, extractDate, formatExtractedDate
|
|
2
|
+
import { decodeBirthDate, encodeBirthDate, extractDate, formatExtractedDate } from "../date";
|
|
3
3
|
describe("decodeBirthDate converts a YYYY-MM-DD ISO date to a DD/MM/YYYY display string", () => {
|
|
4
4
|
it("formats a valid ISO date", () => {
|
|
5
5
|
expect(decodeBirthDate("1990-05-15")).toBe("15/05/1990");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BadStatusError } from "@swan-io/request";
|
|
2
2
|
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { formatCurrencyIso, formatCurrencySymbol, isTranslationKey, translateError, } from "../i18n";
|
|
3
|
+
import { formatCurrencyIso, formatCurrencySymbol, getRejectionReasonLabel, isTranslationKey, translateError, } from "../i18n";
|
|
4
4
|
// The i18n module reads `navigator.languages` at import time to pick its locale.
|
|
5
5
|
// In the Vitest jsdom environment, `navigator.languages` defaults to ["en-US"],
|
|
6
6
|
// so the module locks to English. Assertions below assume that locale.
|
|
@@ -44,6 +44,17 @@ describe("translateError maps an arbitrary error value to a translated message",
|
|
|
44
44
|
expect(translateError(new Error("boom"))).toBe("An error occurred");
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
|
+
describe("getRejectionReasonLabel maps a document rejection reason code to a translated label", () => {
|
|
48
|
+
it("translates a known reason code", () => {
|
|
49
|
+
expect(getRejectionReasonLabel("BadDocumentQuality")).toBe("The document quality is too low to read. Upload a higher-resolution scan or photo.");
|
|
50
|
+
});
|
|
51
|
+
it("falls back to the generic 'Other' label for an unknown or future reason code", () => {
|
|
52
|
+
expect(getRejectionReasonLabel("SomeFutureReasonCodeNotYetSupported")).toBe("See the reason and explanation provided by Swan.");
|
|
53
|
+
});
|
|
54
|
+
it("falls back to the generic 'Other' label for an empty string", () => {
|
|
55
|
+
expect(getRejectionReasonLabel("")).toBe("See the reason and explanation provided by Swan.");
|
|
56
|
+
});
|
|
57
|
+
});
|
|
47
58
|
describe("formatCurrencyIso formats an amount as a decimal followed by the currency code", () => {
|
|
48
59
|
it("formats a positive amount with two fraction digits", () => {
|
|
49
60
|
expect(formatCurrencyIso(1234.5, "EUR")).toBe("1,234.50 EUR");
|
package/src/utils/flags.d.ts
CHANGED
|
@@ -14,6 +14,6 @@ export declare const createFlagsProvider: <Flags extends Record<string, unknown>
|
|
|
14
14
|
FlagsProvider: ({ children, loader }: {
|
|
15
15
|
children: ReactNode;
|
|
16
16
|
loader?: ReactNode;
|
|
17
|
-
}) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean |
|
|
17
|
+
}) => string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null;
|
|
18
18
|
useFlag: <K extends keyof Flags>(flagName: K) => Flags[K];
|
|
19
19
|
};
|
package/src/utils/flags.js
CHANGED
|
@@ -42,7 +42,6 @@ export const createFlagsProvider = (client, flagDefaults) => {
|
|
|
42
42
|
return {
|
|
43
43
|
FlagsProvider: ({ children, loader = null }) => {
|
|
44
44
|
const [flags, setFlags] = useState(null);
|
|
45
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: we need to run this effect only once, when the component is mounted
|
|
46
45
|
useEffect(() => {
|
|
47
46
|
const listener = (flags) => {
|
|
48
47
|
setFlags(flags);
|
package/src/utils/i18n.js
CHANGED
|
@@ -16,7 +16,7 @@ import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
|
16
16
|
import relativeTime from "dayjs/plugin/relativeTime";
|
|
17
17
|
import utc from "dayjs/plugin/utc";
|
|
18
18
|
import { cloneElement, isValidElement } from "react";
|
|
19
|
-
import {
|
|
19
|
+
import { match, P } from "ts-pattern";
|
|
20
20
|
import translationDE from "../locales/de.json";
|
|
21
21
|
import translationEN from "../locales/en.json";
|
|
22
22
|
import translationES from "../locales/es.json";
|
|
@@ -25,7 +25,7 @@ import translationFR from "../locales/fr.json";
|
|
|
25
25
|
import translationIT from "../locales/it.json";
|
|
26
26
|
import translationNL from "../locales/nl.json";
|
|
27
27
|
import translationPT from "../locales/pt.json";
|
|
28
|
-
import {
|
|
28
|
+
import { getLanguagesHelpers, LANGUAGE_FALLBACK } from "./languages";
|
|
29
29
|
// https://day.js.org/docs/en/plugin/plugin
|
|
30
30
|
dayjs.extend(utc);
|
|
31
31
|
dayjs.extend(customParseFormat);
|
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)
|
|
@@ -26,6 +26,7 @@ export const getLanguagesHelpers = (languages) => {
|
|
|
26
26
|
setPreferredLanguage: (language) => {
|
|
27
27
|
try {
|
|
28
28
|
const domain = "." + window.location.hostname.split(".").slice(-2).join(".");
|
|
29
|
+
// biome-ignore lint/suspicious/noDocumentCookie: keep this exception for setting the preferred language cookie
|
|
29
30
|
document.cookie = `${PREFERRED_LANGUAGE_KEY}=${language}; path=/; max-age=31536000; SameSite=Lax; Secure; domain=${domain}`;
|
|
30
31
|
const url = new URL(window.location.href);
|
|
31
32
|
url.searchParams.delete("lang");
|
package/src/utils/validation.js
CHANGED
|
@@ -251,5 +251,5 @@ export const getCompanyTaxNumberPlaceholder = (country) => match({ country, lang
|
|
|
251
251
|
.with({ country: "ESP", lang: P.not("es") }, () => "Número de Identificación Fiscal")
|
|
252
252
|
.with({ country: "ITA", lang: P.not("it") }, () => "Codice fiscale")
|
|
253
253
|
.otherwise(() => undefined);
|
|
254
|
-
export const getCompanyTaxNumberHelp = (country) => { var _a
|
|
255
|
-
export const getIndividualTaxNumberHelp = (country) => { var _a
|
|
254
|
+
export const getCompanyTaxNumberHelp = (country) => { var _a; var _b; return (_b = (_a = TAX_NUMBER_REGEX.company[country]) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : ""; };
|
|
255
|
+
export const getIndividualTaxNumberHelp = (country) => { var _a; var _b; return (_b = (_a = TAX_NUMBER_REGEX.individual[country]) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : ""; };
|