@swan-io/shared-business 1.4.3 → 1.5.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/shared-business",
3
- "version": "1.4.3",
3
+ "version": "1.5.0",
4
4
  "engines": {
5
5
  "node": ">=14.0.0",
6
6
  "yarn": "^1.20.0"
@@ -32,12 +32,16 @@
32
32
  "@formatjs/intl": "^2.6.9",
33
33
  "@googlemaps/js-api-loader": "^1.15.1",
34
34
  "@swan-io/boxed": "^0.12.1",
35
+ "dayjs": "^1.11.7",
35
36
  "react": "^18.2.0",
36
37
  "react-atomic-state": "^1.2.7",
37
38
  "react-dom": "^18.2.0",
38
- "react-native-web": "^0.18.12",
39
+ "react-dropzone": "^14.2.3",
40
+ "react-native-web": "^0.19.1",
39
41
  "react-ux-form": "^1.3.0",
40
- "ts-pattern": "^4.2.1"
42
+ "rifm": "^0.12.1",
43
+ "ts-pattern": "^4.2.1",
44
+ "uuid": "^9.0.0"
41
45
  },
42
46
  "devDependencies": {
43
47
  "@swan-io/lake": "^1.3.2",
@@ -46,7 +50,7 @@
46
50
  "@types/google.maps": "^3.52.3",
47
51
  "@types/react": "^18.0.28",
48
52
  "@types/react-dom": "^18.0.11",
49
- "@types/react-native": "^0.70.12",
53
+ "@types/react-native": "^0.71.5",
50
54
  "@types/uuid": "^9.0.1",
51
55
  "jsdom": "^21.1.1",
52
56
  "vitest": "^0.29.7"
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { CountryCCA3 } from "../constants/countries";
3
2
  import { Form } from "react-ux-form";
3
+ import { CountryCCA3 } from "../constants/countries";
4
4
  type AddressField = {
5
5
  address: string;
6
6
  city: string;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AddressSearchInput } from "./AddressSearchInput";
3
2
  import { LakeButton } from "@swan-io/lake/src/components/LakeButton";
4
3
  import { LakeLabel } from "@swan-io/lake/src/components/LakeLabel";
5
4
  import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
@@ -7,6 +6,7 @@ import { Space } from "@swan-io/lake/src/components/Space";
7
6
  import { useBoolean } from "@swan-io/lake/src/hooks/useBoolean";
8
7
  import { useCallback, useEffect } from "react";
9
8
  import { locale, t } from "../utils/i18n";
9
+ import { AddressSearchInput } from "./AddressSearchInput";
10
10
  export const AddressFormPart = ({ initialAddress, initialCity, initialPostalCode, country, label, optionalLabel, placeholder, Field, setFieldValue, listenFields, isLarge, }) => {
11
11
  const [manualModeEnabled, setManualMode] = useBoolean(initialAddress !== "" || initialCity !== "" || initialPostalCode !== "");
12
12
  useEffect(() => {
@@ -22,5 +22,5 @@ export const AddressFormPart = ({ initialAddress, initialCity, initialPostalCode
22
22
  setFieldValue("postalCode", place.postalCode);
23
23
  setManualMode.on();
24
24
  }, [setManualMode, setFieldValue]);
25
- return (_jsxs(_Fragment, { children: [_jsx(Field, { name: "address", children: ({ ref, value, onChange, error }) => (_jsx(LakeLabel, { label: label ?? t("addressFormPart.addressLabel"), optionalLabel: optionalLabel, render: id => (_jsx(AddressSearchInput, { inputRef: ref, emptyResultText: t("common.noResult"), placeholder: placeholder ?? t("addressFormPart.placeholder"), language: locale.language, id: id, country: country, value: value, error: error, onValueChange: onChange, onSuggestion: onSuggestion })), actions: !manualModeEnabled && isLarge ? (_jsx(LakeButton, { mode: "secondary", size: "small", onPress: setManualMode.on, children: t("addressFormPart.setManual") })) : null })) }), !manualModeEnabled && !isLarge ? (_jsx(LakeButton, { mode: "secondary", size: "small", onPress: setManualMode.on, children: t("addressFormPart.setManual") })) : null, manualModeEnabled ? (_jsxs(_Fragment, { children: [_jsx(Space, { height: 12 }), _jsx(Field, { name: "city", children: ({ ref, value, valid, error, onChange }) => (_jsx(LakeLabel, { label: t("addressFormPart.cityLabel"), render: id => (_jsx(LakeTextInput, { ref: ref, nativeID: id, value: value, valid: valid, error: error, onChangeText: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(Field, { name: "postalCode", children: ({ ref, value, valid, error, onChange }) => (_jsx(LakeLabel, { label: t("addressFormPart.postCodeLabel"), render: id => (_jsx(LakeTextInput, { ref: ref, nativeID: id, value: value, valid: valid, error: error, onChangeText: onChange })) })) })] })) : null] }));
25
+ return (_jsxs(_Fragment, { children: [_jsx(Field, { name: "address", children: ({ ref, value, onChange, error }) => (_jsx(LakeLabel, { label: label ?? t("addressFormPart.addressLabel"), optionalLabel: optionalLabel, render: id => (_jsx(AddressSearchInput, { inputRef: ref, emptyResultText: t("common.noResult"), placeholder: placeholder ?? t("addressFormPart.placeholder"), language: locale.language, id: id, country: country, value: value, error: error, onValueChange: onChange, onSuggestion: onSuggestion })), actions: !manualModeEnabled && isLarge ? (_jsx(LakeButton, { mode: "secondary", size: "small", onPress: setManualMode.on, children: t("addressFormPart.setManual") })) : null })) }), !manualModeEnabled && !isLarge ? (_jsx(LakeButton, { mode: "secondary", size: "small", onPress: setManualMode.on, children: t("addressFormPart.setManual") })) : null, manualModeEnabled ? (_jsxs(_Fragment, { children: [_jsx(Space, { height: 12 }), _jsx(Field, { name: "city", children: ({ ref, value, valid, error, onChange }) => (_jsx(LakeLabel, { label: t("addressFormPart.cityLabel"), render: id => (_jsx(LakeTextInput, { ref: ref, id: id, value: value, valid: valid, error: error, onChangeText: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(Field, { name: "postalCode", children: ({ ref, value, valid, error, onChange }) => (_jsx(LakeLabel, { label: t("addressFormPart.postCodeLabel"), render: id => (_jsx(LakeTextInput, { ref: ref, id: id, value: value, valid: valid, error: error, onChangeText: onChange })) })) })] })) : null] }));
26
26
  };
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { AsyncData, Future } from "@swan-io/boxed";
3
- import { countriesWithMultipleCCA3, getCCA3forCCA2, } from "@swan-io/shared-business/src/constants/countries";
4
3
  import { AutoWidthImage } from "@swan-io/lake/src/components/AutoWidthImage";
5
4
  import { Box } from "@swan-io/lake/src/components/Box";
6
5
  import { LakeCombobox } from "@swan-io/lake/src/components/LakeCombobox";
@@ -8,6 +7,7 @@ import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
8
7
  import { colors } from "@swan-io/lake/src/constants/colors";
9
8
  import { typography } from "@swan-io/lake/src/constants/typography";
10
9
  import { useFirstMountState } from "@swan-io/lake/src/hooks/useFirstMountState";
10
+ import { countriesWithMultipleCCA3, getCCA3forCCA2, } from "@swan-io/shared-business/src/constants/countries";
11
11
  import { useEffect, useMemo, useRef, useState } from "react";
12
12
  import { StyleSheet, Text } from "react-native";
13
13
  import { match } from "ts-pattern";
@@ -17,10 +17,12 @@ const styles = StyleSheet.create({
17
17
  itemTitle: {
18
18
  ...typography.bodyLarge,
19
19
  lineHeight: typography.lineHeights.title,
20
+ userSelect: "none",
20
21
  },
21
22
  itemSubtitle: {
22
23
  ...typography.bodySmall,
23
24
  color: colors.gray[50],
25
+ userSelect: "none",
24
26
  },
25
27
  poweredByGoogle: {
26
28
  paddingVertical: 8,
@@ -103,16 +105,12 @@ export const AddressSearchInput = ({ inputRef, id, country, disabled, error, val
103
105
  onSuggestion?.(result);
104
106
  });
105
107
  };
106
- return (_jsx(LakeCombobox, { inputRef: inputRef, nativeID: id, placeholder: placeholder, value: value, items: state, icon: "search-filled", disabled: disabled, error: error, ListFooterComponent: _jsx(Box, { direction: "row", justifyContent: "end", style: styles.poweredByGoogle, children: _jsx(AutoWidthImage, { height: 14, sourceUri: poweredByGoogle }) }), onSelectItem: suggestion => selectAddress(suggestion), onValueChange: value => {
108
+ return (_jsx(LakeCombobox, { inputRef: inputRef, id: id, placeholder: placeholder, value: value, items: state, icon: "search-filled", disabled: disabled, error: error, ListFooterComponent: _jsx(Box, { direction: "row", justifyContent: "end", style: styles.poweredByGoogle, children: _jsx(AutoWidthImage, { height: 14, sourceUri: poweredByGoogle }) }), onSelectItem: suggestion => selectAddress(suggestion), onValueChange: value => {
107
109
  setValue(value);
108
110
  onValueChange(value);
109
- }, keyExtractor: item => item.value, emptyResultText: emptyResultText, renderItem: item => (_jsxs(_Fragment, { children: [_jsx(Text, { numberOfLines: 1, selectable: false, style: styles.itemTitle, children: item.prediction.structured_formatting.main_text }), _jsx(Text, { numberOfLines: 1, selectable: false, style: styles.itemSubtitle, children: item.prediction.structured_formatting.secondary_text })] })) }));
111
+ }, keyExtractor: item => item.value, emptyResultText: emptyResultText, renderItem: item => (_jsxs(_Fragment, { children: [_jsx(Text, { numberOfLines: 1, style: styles.itemTitle, children: item.prediction.structured_formatting.main_text }), _jsx(Text, { numberOfLines: 1, style: styles.itemSubtitle, children: item.prediction.structured_formatting.secondary_text })] })) }));
110
112
  }
111
- return (_jsx(LakeTextInput
112
- // @ts-expect-error
113
- , {
114
- // @ts-expect-error
115
- ref: inputRef, nativeID: id, placeholder: placeholder, value: value, icon: "search-filled", disabled: disabled, error: error, onChangeText: value => {
113
+ return (_jsx(LakeTextInput, { ref: inputRef, id: id, placeholder: placeholder, value: value, icon: "search-filled", disabled: disabled, error: error, onChangeText: value => {
116
114
  setValue(value);
117
115
  onValueChange(value);
118
116
  } }));
@@ -17,7 +17,7 @@ import { hasDefinedKeys, useForm } from "react-ux-form";
17
17
  import { Rifm } from "rifm";
18
18
  import { match } from "ts-pattern";
19
19
  import { v4 as uuid } from "uuid";
20
- import { individualCountriesItems, isCountryCCA3 } from "../constants/countries";
20
+ import { allCountriesItems, individualCountriesItems, isCountryCCA3, } from "../constants/countries";
21
21
  import { decodeBirthDate, encodeBirthDate } from "../utils/date";
22
22
  import { locale, rifmDateProps, t } from "../utils/i18n";
23
23
  import { validateBooleanRequired, validateIndividualTaxNumber, validateNullableRequired, validateRequired, } from "../utils/validation";
@@ -242,7 +242,7 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
242
242
  }
243
243
  const allStepsValues = { ...commonStepValues.current, ...values };
244
244
  if (hasDefinedKeys(allStepsValues, requiredStepFields)) {
245
- const [direct, indirect] = getDirectAndIndirect(values.capitalType ?? "none");
245
+ const [direct, indirect] = getDirectAndIndirect(allStepsValues.capitalType ?? "none");
246
246
  return onSave({
247
247
  reference,
248
248
  firstName: allStepsValues.firstName,
@@ -269,14 +269,14 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
269
269
  };
270
270
  });
271
271
  return (_jsx(ResponsiveContainer, { breakpoint: breakpoints.tiny, children: ({ small, large }) => (_jsxs(_Fragment, { children: [match(step)
272
- .with("common", () => (_jsxs(View, { accessibilityRole: "form", children: [_jsxs(Box, { direction: small ? "column" : "row", children: [_jsx(Field, { name: "firstName", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.firstName"), style: styles.inputContainer, render: id => (_jsx(LakeTextInput, { error: error, placeholder: t("beneficiaryForm.beneficiary.firstNamePlaceholder"), nativeID: id, value: value, onChangeText: onChange })) })) }), _jsx(Space, { width: 12 }), _jsx(Field, { name: "lastName", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.lastName"), style: styles.inputContainer, render: id => (_jsx(LakeTextInput, { error: error, placeholder: t("beneficiaryForm.beneficiary.lastNamePlaceholder"), nativeID: id, value: value, onChangeText: onChange })) })) })] }), _jsxs(Box, { direction: small ? "column" : "row", children: [_jsx(Field, { name: "birthDate", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthDate"), style: styles.inputContainer, render: id => (_jsx(Rifm, { value: value ?? "", onChange: onChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { error: error, placeholder: locale.datePlaceholder, nativeID: id, value: value, onChange: onChange })) })) })) }), _jsx(Space, { width: 12 }), _jsx(Field, { name: "birthCountryCode", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthCountry"), style: styles.inputContainer, render: id => (_jsx(CountryPicker, { nativeID: id, error: error, value: value, placeholder: t("beneficiaryForm.beneficiary.birthCountryPlaceholder"), items: individualCountriesItems, onValueChange: onChange })) })) })] }), _jsx(Box, { direction: small ? "column" : "row", children: _jsx(FieldsListener, { names: ["birthCountryCode"], children: ({ birthCountryCode }) => (_jsxs(_Fragment, { children: [_jsx(Field, { name: "birthCity", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthCity"), style: styles.inputContainer, render: id => (_jsx(LakeCityInput, { nativeID: id, error: error, country: birthCountryCode.value, value: value ?? "", onValueChange: onChange, placeholder: birthCountryCode.value == null
272
+ .with("common", () => (_jsxs(View, { role: "form", children: [_jsxs(Box, { direction: small ? "column" : "row", children: [_jsx(Field, { name: "firstName", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.firstName"), style: styles.inputContainer, render: id => (_jsx(LakeTextInput, { error: error, placeholder: t("beneficiaryForm.beneficiary.firstNamePlaceholder"), id: id, value: value, onChangeText: onChange })) })) }), _jsx(Space, { width: 12 }), _jsx(Field, { name: "lastName", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.lastName"), style: styles.inputContainer, render: id => (_jsx(LakeTextInput, { error: error, placeholder: t("beneficiaryForm.beneficiary.lastNamePlaceholder"), id: id, value: value, onChangeText: onChange })) })) })] }), _jsxs(Box, { direction: small ? "column" : "row", children: [_jsx(Field, { name: "birthDate", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthDate"), style: styles.inputContainer, render: id => (_jsx(Rifm, { value: value ?? "", onChange: onChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { error: error, placeholder: locale.datePlaceholder, id: id, value: value, onChange: onChange })) })) })) }), _jsx(Space, { width: 12 }), _jsx(Field, { name: "birthCountryCode", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthCountry"), style: styles.inputContainer, render: id => (_jsx(CountryPicker, { id: id, error: error, value: value, placeholder: t("beneficiaryForm.beneficiary.birthCountryPlaceholder"), items: allCountriesItems, onValueChange: onChange })) })) })] }), _jsx(Box, { direction: small ? "column" : "row", children: _jsx(FieldsListener, { names: ["birthCountryCode"], children: ({ birthCountryCode }) => (_jsxs(_Fragment, { children: [_jsx(Field, { name: "birthCity", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthCity"), style: styles.inputContainer, render: id => (_jsx(LakeCityInput, { id: id, error: error, country: birthCountryCode.value, value: value ?? "", onValueChange: onChange, placeholder: birthCountryCode.value == null
273
273
  ? t("beneficiaryForm.beneficiary.fillBirthCountry")
274
274
  : t("beneficiaryForm.beneficiary.birthCityPlaceholder"), onSuggestion: place => {
275
275
  onChange(place.city);
276
276
  setFieldValue("birthCityPostalCode", place.postalCode);
277
277
  }, onLoadError: onCityLoadError })) })) }), _jsx(Space, { width: 12 }), _jsx(Field, { name: "birthCityPostalCode", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthPostalCode"), style: styles.inputContainer, render: id => (_jsx(LakeTextInput, { error: error, placeholder: birthCountryCode.value == null
278
278
  ? t("beneficiaryForm.beneficiary.fillBirthCountry")
279
- : t("beneficiaryForm.beneficiary.birthPostalCodePlaceholder"), nativeID: id, disabled: birthCountryCode.value === undefined, value: value, onChangeText: onChange })) })) })] })) }) }), _jsx(Field, { name: "type", children: ({ value, onChange }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.type"), type: "radioGroup", render: () => (_jsx(RadioGroup, { direction: "row", value: value, onValueChange: onChange, items: beneficiaryTypes })) })) }), _jsx(FieldsListener, { names: ["type"], children: ({ type }) => type.value === "HasCapital" ? (_jsxs(_Fragment, { children: [_jsx(Field, { name: "totalCapitalPercentage", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.totalCapitalPercentage"), render: id => (_jsx(LakeTextInput, { error: error, unit: "%", keyboardType: "decimal-pad", accessibilityValueMin: 0, accessibilityValueMax: 100, nativeID: id, value: value, onChangeText: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(Field, { name: "capitalType", children: ({ value, error, onChange }) => (_jsx(CapitalTypeCheckboxes, { value: value ?? "none", error: error, onChange: onChange })) })] })) : null })] })))
280
- .with("address", () => (_jsxs(View, { accessibilityRole: "form", children: [_jsx(Field, { name: "country", children: ({ value, onChange }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.country"), render: id => (_jsx(CountryPicker, { nativeID: id, value: value, items: individualCountriesItems, onValueChange: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(FieldsListener, { names: ["country"], children: ({ country }) => (_jsxs(_Fragment, { children: [_jsx(AddressFormPart, { initialAddress: initialState?.residencyAddressLine1 ?? "", initialCity: initialState?.residencyAddressCity ?? "", initialPostalCode: initialState?.residencyAddressPostalCode ?? "", country: country?.value ?? accountCountry, label: t("beneficiaryForm.beneficiary.address"), Field: Field, setFieldValue: setFieldValue, listenFields: listenFields, isLarge: large }), country?.value === "DEU" && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 12 }), _jsx(Field, { name: "taxIdentificationNumber", children: ({ value, error, valid, onChange }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.taxIdentificationNumber"), optionalLabel: t("common.optional"), render: id => (_jsx(LakeTextInput, { nativeID: id, placeholder: t("beneficiaryForm.beneficiary.taxIdentificationNumberPlaceholder"), value: value, error: error, valid: valid, onChangeText: onChange })) })) })] }))] })) })] })))
279
+ : t("beneficiaryForm.beneficiary.birthPostalCodePlaceholder"), id: id, disabled: birthCountryCode.value === undefined, value: value, onChangeText: onChange })) })) })] })) }) }), _jsx(Field, { name: "type", children: ({ value, onChange }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.type"), type: "radioGroup", render: () => (_jsx(RadioGroup, { direction: "row", value: value, onValueChange: onChange, items: beneficiaryTypes })) })) }), _jsx(FieldsListener, { names: ["type"], children: ({ type }) => type.value === "HasCapital" ? (_jsxs(_Fragment, { children: [_jsx(Field, { name: "totalCapitalPercentage", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.totalCapitalPercentage"), render: id => (_jsx(LakeTextInput, { error: error, unit: "%", inputMode: "decimal", "aria-valuemin": 0, "aria-valuemax": 100, id: id, value: value, onChangeText: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(Field, { name: "capitalType", children: ({ value, error, onChange }) => (_jsx(CapitalTypeCheckboxes, { value: value ?? "none", error: error, onChange: onChange })) })] })) : null })] })))
280
+ .with("address", () => (_jsxs(View, { role: "form", children: [_jsx(Field, { name: "country", children: ({ value, onChange }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.country"), render: id => (_jsx(CountryPicker, { id: id, value: value, items: individualCountriesItems, onValueChange: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(FieldsListener, { names: ["country"], children: ({ country }) => (_jsxs(_Fragment, { children: [_jsx(AddressFormPart, { initialAddress: initialState?.residencyAddressLine1 ?? "", initialCity: initialState?.residencyAddressCity ?? "", initialPostalCode: initialState?.residencyAddressPostalCode ?? "", country: country?.value ?? accountCountry, label: t("beneficiaryForm.beneficiary.address"), Field: Field, setFieldValue: setFieldValue, listenFields: listenFields, isLarge: large }), country?.value === "DEU" && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 12 }), _jsx(Field, { name: "taxIdentificationNumber", children: ({ value, error, valid, onChange }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.taxIdentificationNumber"), optionalLabel: t("common.optional"), render: id => (_jsx(LakeTextInput, { id: id, placeholder: t("beneficiaryForm.beneficiary.taxIdentificationNumberPlaceholder"), value: value, error: error, valid: valid, onChangeText: onChange })) })) })] }))] })) })] })))
281
281
  .exhaustive(), isAddressRequired && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 12 }), _jsx(StepDots, { currentStep: step, steps: formSteps })] }))] })) }));
282
282
  });
@@ -12,9 +12,9 @@ type Props<T extends CountryCCA3> = {
12
12
  error?: string;
13
13
  placeholder?: string;
14
14
  readOnly?: boolean;
15
- nativeID?: string;
15
+ id?: string;
16
16
  disabled?: boolean;
17
17
  hideErrors?: boolean;
18
18
  };
19
- export declare function CountryPicker<T extends CountryCCA3>({ onValueChange, value, items, readOnly, nativeID, error, placeholder, disabled, hideErrors, }: Props<T>): JSX.Element;
19
+ export declare function CountryPicker<T extends CountryCCA3>({ onValueChange, value, items, readOnly, id, error, placeholder, disabled, hideErrors, }: Props<T>): JSX.Element;
20
20
  export {};
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Flag } from "@swan-io/lake/src/components/Flag";
3
3
  import { LakeSelect } from "@swan-io/lake/src/components/LakeSelect";
4
4
  import { useMemo } from "react";
5
- export function CountryPicker({ onValueChange, value, items, readOnly, nativeID, error, placeholder, disabled, hideErrors, }) {
5
+ export function CountryPicker({ onValueChange, value, items, readOnly, id, error, placeholder, disabled, hideErrors, }) {
6
6
  const countries = useMemo(() => {
7
7
  const hasIntl = "Intl" in window && "DisplayNames" in window.Intl;
8
8
  const countryResolver = hasIntl && Intl.DisplayNames.supportedLocalesOf(["en"]).length
@@ -22,5 +22,5 @@ export function CountryPicker({ onValueChange, value, items, readOnly, nativeID,
22
22
  }))
23
23
  .sort((a, b) => a.name.localeCompare(b.name));
24
24
  }, [items]);
25
- return (_jsx(LakeSelect, { readOnly: readOnly, nativeID: nativeID, error: error, items: countries, placeholder: placeholder, value: value, onValueChange: onValueChange, disabled: disabled, hideErrors: hideErrors }));
25
+ return (_jsx(LakeSelect, { readOnly: readOnly, id: id, error: error, items: countries, placeholder: placeholder, value: value, onValueChange: onValueChange, disabled: disabled, hideErrors: hideErrors }));
26
26
  }
@@ -10,11 +10,11 @@ type Props = {
10
10
  country?: CountryCCA3;
11
11
  disabled?: boolean;
12
12
  error?: string;
13
- nativeID?: string;
13
+ id?: string;
14
14
  placeholder?: string;
15
15
  onSuggestion?: (place: PlaceDetail) => void;
16
16
  onLoadError: (error: unknown) => void;
17
17
  apiKey?: string;
18
18
  };
19
- export declare const LakeCityInput: ({ value, onValueChange, country, disabled, placeholder, nativeID, error, onSuggestion, onLoadError, apiKey, }: Props) => JSX.Element | null;
19
+ export declare const LakeCityInput: ({ value, onValueChange, country, disabled, placeholder, id, error, onSuggestion, onLoadError, apiKey, }: Props) => JSX.Element | null;
20
20
  export {};
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { AsyncData, Future } from "@swan-io/boxed";
3
- import { useGoogleMapSDK } from "../hooks/useGoogleMapSDK";
4
3
  import { AutoWidthImage } from "@swan-io/lake/src/components/AutoWidthImage";
5
4
  import { Box } from "@swan-io/lake/src/components/Box";
6
5
  import { LakeCombobox } from "@swan-io/lake/src/components/LakeCombobox";
@@ -12,22 +11,25 @@ import { StyleSheet, Text } from "react-native";
12
11
  import { match } from "ts-pattern";
13
12
  import poweredByGoogle from "../assets/images/powered_by_google_on_white_hdpi.png";
14
13
  import { countriesWithMultipleCCA3 } from "../constants/countries";
14
+ import { useGoogleMapSDK } from "../hooks/useGoogleMapSDK";
15
15
  import { t } from "../utils/i18n";
16
16
  const styles = StyleSheet.create({
17
17
  itemTitle: {
18
18
  ...typography.bodyLarge,
19
19
  lineHeight: typography.lineHeights.title,
20
+ userSelect: "none",
20
21
  },
21
22
  itemSubtitle: {
22
23
  ...typography.bodySmall,
23
24
  color: colors.gray[400],
25
+ userSelect: "none",
24
26
  },
25
27
  poweredByGoogle: {
26
28
  paddingVertical: 8,
27
29
  paddingHorizontal: 16,
28
30
  },
29
31
  });
30
- export const LakeCityInput = ({ value, onValueChange, country, disabled, placeholder, nativeID, error, onSuggestion, onLoadError, apiKey, }) => {
32
+ export const LakeCityInput = ({ value, onValueChange, country, disabled, placeholder, id, error, onSuggestion, onLoadError, apiKey, }) => {
31
33
  const [state, setState] = useState(AsyncData.NotAsked());
32
34
  const comboboxRef = useRef(null);
33
35
  const sdk = useGoogleMapSDK({ apiKey });
@@ -80,7 +82,7 @@ export const LakeCityInput = ({ value, onValueChange, country, disabled, placeho
80
82
  }
81
83
  });
82
84
  };
83
- return (_jsx(LakeCombobox, { ref: comboboxRef, placeholder: placeholder, value: value, items: state, icon: "search-filled", disabled: isNullish(country) || disabled, error: error, onValueChange: onValueChange, nativeID: nativeID, ListFooterComponent: _jsx(Box, { direction: "row", justifyContent: "end", style: styles.poweredByGoogle, children: _jsx(AutoWidthImage, { height: 14, sourceUri: poweredByGoogle }) }), onSelectItem: selectAddress, emptyResultText: t("common.noResult"), keyExtractor: item => item.value, renderItem: item => (_jsxs(_Fragment, { children: [_jsx(Text, { numberOfLines: 1, selectable: false, style: styles.itemTitle, children: item.prediction.structured_formatting.main_text }), _jsx(Text, { numberOfLines: 1, selectable: false, style: styles.itemSubtitle, children: item.prediction.structured_formatting.secondary_text })] })) }));
85
+ return (_jsx(LakeCombobox, { ref: comboboxRef, placeholder: placeholder, value: value, items: state, icon: "search-filled", disabled: isNullish(country) || disabled, error: error, onValueChange: onValueChange, id: id, ListFooterComponent: _jsx(Box, { direction: "row", justifyContent: "end", style: styles.poweredByGoogle, children: _jsx(AutoWidthImage, { height: 14, sourceUri: poweredByGoogle }) }), onSelectItem: selectAddress, emptyResultText: t("common.noResult"), keyExtractor: item => item.value, renderItem: item => (_jsxs(_Fragment, { children: [_jsx(Text, { numberOfLines: 1, style: styles.itemTitle, children: item.prediction.structured_formatting.main_text }), _jsx(Text, { numberOfLines: 1, style: styles.itemSubtitle, children: item.prediction.structured_formatting.secondary_text })] })) }));
84
86
  },
85
87
  });
86
88
  };
@@ -5,9 +5,9 @@ export type Document = {
5
5
  downloadUrl?: string;
6
6
  purpose: SupportingDocumentPurpose;
7
7
  };
8
- export type TypeOfRepresentation = "LegalRepresentative" | "PowerOfAttorney";
9
- export type SupportingDocumentPurpose = "AssociationRegistration" | "CompanyRegistration" | "ProofOfIdentity" | "Other" | "SignedStatus";
10
- type SupportingDocumentPurposeEnum = "AssociationRegistration" | "Banking" | "CompanyRegistration" | "Other" | "PowerOfAttorney" | "ProofOfCompanyAddress" | "ProofOfCompanyIncome" | "ProofOfIdentity" | "ProofOfIndividualAddress" | "ProofOfIndividualIncome" | "ProofOfOriginOfFunds" | "SignedStatus" | "UBODeclaration";
8
+ type SupportingDocumentPurposeEnum = "AssociationRegistration" | "Banking" | "CompanyRegistration" | "Other" | "PowerOfAttorney" | "ProofOfCompanyAddress" | "ProofOfCompanyIncome" | "ProofOfIdentity" | "ProofOfIndividualAddress" | "ProofOfIndividualIncome" | "ProofOfOriginOfFunds" | "SignedStatus" | "SwornStatement" | "UBODeclaration";
9
+ export declare const uploadableDocumentTypes: ("AssociationRegistration" | "CompanyRegistration" | "PowerOfAttorney" | "ProofOfIdentity" | "SignedStatus" | "SwornStatement" | "UBODeclaration")[];
10
+ export type SupportingDocumentPurpose = (typeof uploadableDocumentTypes)[number];
11
11
  type Props = {
12
12
  getAwsUrl: (file: File, purpose: SupportingDocumentPurpose) => Promise<{
13
13
  upload: {
@@ -22,7 +22,6 @@ type Props = {
22
22
  documents: Document[];
23
23
  requiredDocumentTypes: SupportingDocumentPurposeEnum[];
24
24
  onChange?: (documents: Document[]) => void;
25
- withoutRepresentationRadio?: boolean;
26
25
  onboardingLanguage?: string;
27
26
  };
28
27
  export type SupportingDocumentRef = {
@@ -1,24 +1,30 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Box } from "@swan-io/lake/src/components/Box";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  import { Form } from "@swan-io/lake/src/components/Form";
4
3
  import { LakeButton, LakeButtonGroup } from "@swan-io/lake/src/components/LakeButton";
5
4
  import { LakeLabel } from "@swan-io/lake/src/components/LakeLabel";
6
5
  import { LakeModal } from "@swan-io/lake/src/components/LakeModal";
7
- import { LakeRadio } from "@swan-io/lake/src/components/LakeRadio";
8
6
  import { LakeText } from "@swan-io/lake/src/components/LakeText";
9
7
  import { LakeTooltip } from "@swan-io/lake/src/components/LakeTooltip";
10
- import { Pressable } from "@swan-io/lake/src/components/Pressable";
11
8
  import { Space } from "@swan-io/lake/src/components/Space";
12
- import { UploadArea } from "./UploadArea";
13
- import { isNotNullish, isNullish } from "@swan-io/lake/src/utils/nullish";
9
+ import { isNullish } from "@swan-io/lake/src/utils/nullish";
14
10
  import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from "react";
15
11
  import { StyleSheet } from "react-native";
16
12
  import { useForm } from "react-ux-form";
17
13
  import { match } from "ts-pattern";
18
14
  import { MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE } from "../constants/uploads";
19
15
  import { locale, t } from "../utils/i18n";
16
+ import { UploadArea } from "./UploadArea";
20
17
  const ACCEPTED_FORMATS = ["application/pdf", "image/png", "image/jpeg"];
21
18
  const NO_ID_YET = "NO_ID_YET";
19
+ export const uploadableDocumentTypes = [
20
+ "AssociationRegistration",
21
+ "CompanyRegistration",
22
+ "ProofOfIdentity",
23
+ "SignedStatus",
24
+ "PowerOfAttorney",
25
+ "SwornStatement",
26
+ "UBODeclaration",
27
+ ];
22
28
  const validateNotEmpty = value => {
23
29
  if (value.length === 0) {
24
30
  return t("error.requiredField");
@@ -35,11 +41,11 @@ const styles = StyleSheet.create({
35
41
  });
36
42
  const Help = (props) => {
37
43
  return match(props)
38
- .with({ type: "tooltip" }, ({ text, width }) => (_jsx(LakeTooltip, { content: t(text), width: width, togglableOnFocus: true, placement: "top", children: _jsx(LakeButton, { mode: "tertiary", size: "small", color: "gray", icon: "question-circle-regular", disabled: true, style: [styles.button, styles.buttonWithDefaultCursor], accessibilityLabel: t("supportingDoc.whatIsThis") }) })))
39
- .with({ type: "button" }, ({ label, onPress }) => (_jsx(LakeButton, { mode: "tertiary", size: "small", color: "gray", icon: "question-circle-regular", onPress: onPress, style: styles.button, accessibilityLabel: t("supportingDoc.whatIsThis"), children: label })))
44
+ .with({ type: "tooltip" }, ({ text, width }) => (_jsx(LakeTooltip, { content: t(text), width: width, togglableOnFocus: true, placement: "top", children: _jsx(LakeButton, { mode: "tertiary", size: "small", color: "gray", icon: "question-circle-regular", disabled: true, style: [styles.button, styles.buttonWithDefaultCursor], ariaLabel: t("supportingDoc.whatIsThis") }) })))
45
+ .with({ type: "button" }, ({ label, onPress }) => (_jsx(LakeButton, { mode: "tertiary", size: "small", color: "gray", icon: "question-circle-regular", onPress: onPress, style: styles.button, ariaLabel: t("supportingDoc.whatIsThis"), children: label })))
40
46
  .exhaustive();
41
47
  };
42
- export const SupportingDocument = forwardRef(({ documents, getAwsUrl, onChange, requiredDocumentTypes, onboardingLanguage = locale.language, withoutRepresentationRadio, }, externalRef) => {
48
+ export const SupportingDocument = forwardRef(({ documents, getAwsUrl, onChange, requiredDocumentTypes, onboardingLanguage = locale.language }, externalRef) => {
43
49
  const initialValues = useMemo(() => documents.reduce((acc, doc) => {
44
50
  return {
45
51
  ...acc,
@@ -55,7 +61,9 @@ export const SupportingDocument = forwardRef(({ documents, getAwsUrl, onChange,
55
61
  };
56
62
  }, {}), [documents]);
57
63
  const [showPowerOfAttorneyModal, setShowPowerOfAttorneyModal] = useState(false);
58
- const [isOther, setIsOther] = useState(isNotNullish(initialValues["Other"]) || isNotNullish(initialValues["ProofOfIdentity"]));
64
+ const [showSwornStatementModal, setShowSwornStatementModal] = useState(false);
65
+ const initialPowerOfAttorneyDocuments = initialValues["PowerOfAttorney"] ?? [];
66
+ const initialOtherDocuments = initialValues["Other"] ?? [];
59
67
  const { Field, setFieldValue, getFieldState, listenFields, submitForm } = useForm({
60
68
  CompanyRegistration: {
61
69
  initialValue: initialValues["CompanyRegistration"] ?? [],
@@ -73,8 +81,18 @@ export const SupportingDocument = forwardRef(({ documents, getAwsUrl, onChange,
73
81
  initialValue: initialValues["ProofOfIdentity"] ?? [],
74
82
  validate: validateNotEmpty,
75
83
  },
76
- Other: {
77
- initialValue: initialValues["Other"] ?? [],
84
+ UBODeclaration: {
85
+ initialValue: initialValues["UBODeclaration"] ?? [],
86
+ validate: validateNotEmpty,
87
+ },
88
+ PowerOfAttorney: {
89
+ // we keep initialOtherDocuments because it was the key for legacy onboarding
90
+ // this should be replaced by initialValues["PowerOfAttorney"] ?? [] in may 2023
91
+ initialValue: [...initialPowerOfAttorneyDocuments, ...initialOtherDocuments],
92
+ validate: validateNotEmpty,
93
+ },
94
+ SwornStatement: {
95
+ initialValue: initialValues["SwornStatement"] ?? [],
78
96
  validate: validateNotEmpty,
79
97
  },
80
98
  });
@@ -86,13 +104,7 @@ export const SupportingDocument = forwardRef(({ documents, getAwsUrl, onChange,
86
104
  };
87
105
  });
88
106
  useEffect(() => {
89
- const removeListener = listenFields([
90
- "CompanyRegistration",
91
- "AssociationRegistration",
92
- "SignedStatus",
93
- "Other",
94
- "ProofOfIdentity",
95
- ], state => {
107
+ const removeListener = listenFields(uploadableDocumentTypes, state => {
96
108
  let documents = [];
97
109
  Object.entries(state).forEach(([key, { value: values }]) => {
98
110
  documents = [
@@ -151,24 +163,30 @@ export const SupportingDocument = forwardRef(({ documents, getAwsUrl, onChange,
151
163
  })
152
164
  .catch(console.error);
153
165
  };
154
- return (_jsxs(Form, { children: [withoutRepresentationRadio !== true && (_jsx(LakeLabel, { label: t("supportingDoc.whoAreYou"), render: () => (_jsxs(LakeButtonGroup, { children: [_jsx(Pressable, { onPress: () => setIsOther(false), children: _jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(LakeRadio, { value: !isOther, color: "current" }), _jsx(Space, { width: 12 }), _jsx(LakeText, { children: t("supportingDoc.legalRepresentative") })] }) }), _jsx(Space, { width: 24 }), _jsx(Pressable, { onPress: () => setIsOther(true), children: _jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(LakeRadio, { value: isOther, color: "current" }), _jsx(Space, { width: 12 }), _jsx(LakeText, { children: t("supportingDoc.other") })] }) })] })) })), requiredDocumentTypes.some(t => t === "CompanyRegistration") && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.companyRegistration"), help: _jsx(Help, { type: "tooltip", text: "supportingDoc.companyRegistration.description" }), render: () => (_jsx(Field, { name: "CompanyRegistration", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", error: error, onDropAccepted: files => {
166
+ return (_jsxs(Form, { children: [requiredDocumentTypes.includes("CompanyRegistration") && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.companyRegistration"), help: _jsx(Help, { type: "tooltip", text: "supportingDoc.companyRegistration.description" }), render: () => (_jsx(Field, { name: "CompanyRegistration", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", error: error, onDropAccepted: files => {
155
167
  onChange([...value, { id: NO_ID_YET }]);
156
168
  handleUpload(files, "CompanyRegistration");
157
- }, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), requiredDocumentTypes.some(t => t === "AssociationRegistration") && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.associationRegistration"), help: _jsx(Help, { type: "tooltip", text: "supportingDoc.associationRegistration.description" }), render: () => (_jsx(Field, { name: "AssociationRegistration", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", onDropAccepted: files => {
169
+ }, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), requiredDocumentTypes.includes("AssociationRegistration") && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.associationRegistration"), help: _jsx(Help, { type: "tooltip", text: "supportingDoc.associationRegistration.description" }), render: () => (_jsx(Field, { name: "AssociationRegistration", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", onDropAccepted: files => {
158
170
  onChange([...value, { id: NO_ID_YET }]);
159
171
  handleUpload(files, "AssociationRegistration");
160
- }, error: error, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), requiredDocumentTypes.some(t => t === "SignedStatus") && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.signedStatus"), help: _jsx(Help, { type: "tooltip", text: "supportingDoc.signedStatus.description" }), render: () => (_jsx(Field, { name: "SignedStatus", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", onDropAccepted: files => {
172
+ }, error: error, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), requiredDocumentTypes.includes("SignedStatus") && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.signedStatus"), help: _jsx(Help, { type: "tooltip", text: "supportingDoc.signedStatus.description" }), render: () => (_jsx(Field, { name: "SignedStatus", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", onDropAccepted: files => {
161
173
  onChange([...value, { id: NO_ID_YET }]);
162
174
  handleUpload(files, "SignedStatus");
163
- }, error: error, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), (requiredDocumentTypes.some(t => t === "ProofOfIdentity") || isOther) && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.proofOfIdentity"), help: _jsx(Help, { type: "tooltip", width: 600, text: "supportingDoc.proofOfIdentity.description" }), render: () => (_jsx(Field, { name: "ProofOfIdentity", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", onDropAccepted: files => {
175
+ }, error: error, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), requiredDocumentTypes.includes("UBODeclaration") && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.UBODeclaration"), help: _jsx(Help, { type: "tooltip", text: "supportingDoc.UBODeclaration.description" }), render: () => (_jsx(Field, { name: "UBODeclaration", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", onDropAccepted: files => {
176
+ onChange([...value, { id: NO_ID_YET }]);
177
+ handleUpload(files, "UBODeclaration");
178
+ }, error: error, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), requiredDocumentTypes.includes("ProofOfIdentity") && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.proofOfIdentity"), help: _jsx(Help, { type: "tooltip", width: 600, text: "supportingDoc.proofOfIdentity.description" }), render: () => (_jsx(Field, { name: "ProofOfIdentity", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", onDropAccepted: files => {
164
179
  onChange([...value, { id: NO_ID_YET }]);
165
180
  handleUpload(files, "ProofOfIdentity");
166
- }, error: error, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), (requiredDocumentTypes.some(t => t === "PowerOfAttorney") || isOther) && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.powerAttornySigned"), help: _jsx(Help, { type: "button", label: t("supportingDoc.whatIsThis"), onPress: () => setShowPowerOfAttorneyModal(true) }), render: () => (_jsx(Field, { name: "Other", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", onDropAccepted: files => {
181
+ }, error: error, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), requiredDocumentTypes.includes("PowerOfAttorney") && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.powerAttornySigned"), help: _jsx(Help, { type: "button", label: t("supportingDoc.whatIsThis"), onPress: () => setShowPowerOfAttorneyModal(true) }), render: () => (_jsx(Field, { name: "PowerOfAttorney", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", onDropAccepted: files => {
182
+ onChange([...value, { id: NO_ID_YET }]);
183
+ handleUpload(files, "PowerOfAttorney");
184
+ }, error: error, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), requiredDocumentTypes.includes("SwornStatement") && (_jsxs(_Fragment, { children: [_jsx(LakeLabel, { label: t("supportingDoc.swornStatementDeclaration"), help: _jsx(Help, { type: "button", label: t("supportingDoc.whatIsThis"), onPress: () => setShowSwornStatementModal(true) }), render: () => (_jsx(Field, { name: "SwornStatement", children: ({ value, onChange, error }) => (_jsx(UploadArea, { layout: "horizontal", onDropAccepted: files => {
167
185
  onChange([...value, { id: NO_ID_YET }]);
168
- handleUpload(files, "Other");
169
- }, error: error, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), requiredDocumentTypes.length === 0 && (!isOther || withoutRepresentationRadio === true) ? (_jsxs(_Fragment, { children: [_jsx(Space, { height: 24 }), _jsx(LakeText, { children: t("supportingDoc.noRequiredDocuments") }), _jsx(Space, { height: 24 })] })) : null, _jsxs(LakeModal, { visible: showPowerOfAttorneyModal, title: t("supportingDoc.powerAttorney"), icon: "document-regular", onPressClose: () => setShowPowerOfAttorneyModal(false), children: [_jsx(LakeText, { children: t("supportingDoc.powerAttornySigned.description") }), _jsx(Space, { height: 16 }), _jsx(LakeButtonGroup, { paddingBottom: 0, children: _jsx(LakeButton, { grow: true, color: "current", onPress: () => window.open(`/power-of-attorney-template/${match(onboardingLanguage)
186
+ handleUpload(files, "SwornStatement");
187
+ }, error: error, documents: value, accept: ACCEPTED_FORMATS, icon: "document-regular", description: t("supportingDoc.documentTypes"), maxSize: MAX_SUPPORTING_DOCUMENT_UPLOAD_SIZE })) })) }), _jsx(Space, { height: 24 })] })), requiredDocumentTypes.length === 0 ? (_jsxs(_Fragment, { children: [_jsx(Space, { height: 24 }), _jsx(LakeText, { children: t("supportingDoc.noRequiredDocuments") }), _jsx(Space, { height: 24 })] })) : null, _jsxs(LakeModal, { visible: showPowerOfAttorneyModal, title: t("supportingDoc.powerAttorney"), icon: "document-regular", onPressClose: () => setShowPowerOfAttorneyModal(false), children: [_jsx(LakeText, { children: t("supportingDoc.powerAttornySigned.description") }), _jsx(Space, { height: 16 }), _jsx(LakeButtonGroup, { paddingBottom: 0, children: _jsx(LakeButton, { grow: true, color: "current", onPress: () => window.open(`/power-of-attorney-template/${match(onboardingLanguage)
170
188
  .with("fr", () => "fr")
171
189
  .with("de", () => "de")
172
190
  .with("es", () => "es")
173
- .otherwise(() => "en")}.pdf`), children: t("supportingDoc.downloadTemplate") }) })] })] }));
191
+ .otherwise(() => "en")}.pdf`), children: t("supportingDoc.downloadTemplate") }) })] }), _jsxs(LakeModal, { visible: showSwornStatementModal, title: t("supportingDoc.swornStatementDeclaration"), icon: "document-regular", onPressClose: () => setShowSwornStatementModal(false), children: [_jsx(LakeText, { children: t("supportingDoc.swornStatementDeclaration.description") }), _jsx(Space, { height: 16 }), _jsx(LakeButtonGroup, { paddingBottom: 0, children: _jsx(LakeButton, { grow: true, color: "current", onPress: () => window.open("/sworn-statement-template/es.pdf"), children: t("supportingDoc.downloadTemplate") }) })] })] }));
174
192
  });
@@ -1,19 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { formatNestedMessage, t } from "../utils/i18n";
3
2
  import { Box } from "@swan-io/lake/src/components/Box";
3
+ import { FileTile } from "@swan-io/lake/src/components/FileTile";
4
4
  import { Icon } from "@swan-io/lake/src/components/Icon";
5
5
  import { LakeHeading } from "@swan-io/lake/src/components/LakeHeading";
6
6
  import { LakeText } from "@swan-io/lake/src/components/LakeText";
7
7
  import { Space } from "@swan-io/lake/src/components/Space";
8
+ import { commonStyles } from "@swan-io/lake/src/constants/commonStyles";
8
9
  import { backgroundColor, colors, gray75, radii, shadows, spacings, } from "@swan-io/lake/src/constants/design";
10
+ import { useBoolean } from "@swan-io/lake/src/hooks/useBoolean";
11
+ import { getIconNameFromFilename } from "@swan-io/lake/src/utils/file";
9
12
  import { isNotNullish, isNullish } from "@swan-io/lake/src/utils/nullish";
10
13
  import { Fragment, useLayoutEffect, useRef } from "react";
11
14
  import { useDropzone } from "react-dropzone";
12
15
  import { StyleSheet, Text, View } from "react-native";
13
- import { commonStyles } from "@swan-io/lake/src/constants/commonStyles";
14
- import { useBoolean } from "@swan-io/lake/src/hooks/useBoolean";
15
- import { getIconNameFromFilename } from "@swan-io/lake/src/utils/file";
16
- import { FileTile } from "@swan-io/lake/src/components/FileTile";
16
+ import { formatNestedMessage, t } from "../utils/i18n";
17
17
  const styles = StyleSheet.create({
18
18
  container: {
19
19
  backgroundColor: backgroundColor.accented,
@@ -54,28 +54,28 @@ const styles = StyleSheet.create({
54
54
  bottom: 0,
55
55
  left: "50%",
56
56
  opacity: 0,
57
- transform: [{ translateX: "-50%" }, { scale: 0.6 }],
57
+ transform: "translateX(-50%) scale(0.6)",
58
58
  transitionProperty: ["opacity", "transform"],
59
59
  transitionDuration: "300ms",
60
60
  transitionTimingFunction: "ease-in-out",
61
61
  },
62
62
  decorativeIconLeftHovered: {
63
63
  opacity: 0.3,
64
- transform: [{ translateX: "-50%" }, { translateX: -24 }, { scale: 0.6 }, { rotate: "-5deg" }],
64
+ transform: "translateX(-50%) translateX(-24px) scale(0.6) rotate(-5deg)",
65
65
  },
66
66
  decorativeIconRight: {
67
67
  position: "absolute",
68
68
  bottom: 0,
69
69
  left: "50%",
70
70
  opacity: 0,
71
- transform: [{ translateX: "-50%" }, { scale: 0.6 }],
71
+ transform: "translateX(-50%) scale(0.6)",
72
72
  transitionProperty: ["opacity", "transform"],
73
73
  transitionDuration: "300ms",
74
74
  transitionTimingFunction: "ease-in-out",
75
75
  },
76
76
  decorativeIconRightHovered: {
77
77
  opacity: 0.3,
78
- transform: [{ translateX: "-50%" }, { translateX: 24 }, { scale: 0.6 }, { rotate: "5deg" }],
78
+ transform: "translateX(-50%) translateX(24px) scale(0.6) rotate(5deg)",
79
79
  },
80
80
  progressBar: {
81
81
  flex: 1,
@@ -136,14 +136,14 @@ export const UploadArea = ({ icon, accept, value, documents = [], disabled = fal
136
136
  disabled,
137
137
  maxSize,
138
138
  });
139
- return (_jsxs(View, { style: commonStyles.fill, children: [_jsx("div", { ...getRootProps(), onMouseEnter: setIsHovered.on, onMouseLeave: setIsHovered.off, children: _jsxs(View, { style: [
139
+ return (_jsxs(View, { style: commonStyles.fill, children: [_jsx("div", { ...getRootProps(), onMouseEnter: setIsHovered.on, onMouseLeave: setIsHovered.off, children: _jsxs(View, { "aria-errormessage": error != null ? error : fileRejections[0]?.errors.join(", "), style: [
140
140
  styles.container,
141
141
  disabled && styles.disabled,
142
142
  layout === "horizontal" && styles.horizontalContainer,
143
143
  !disabled && isHovered && styles.hoveredContainer,
144
144
  isDragActive && styles.activeContainer,
145
145
  (error != null || fileRejections.length > 0) && styles.errorContainer,
146
- ], accessibilityErrorMessage: error != null ? error : fileRejections[0]?.errors.join(", "), children: [_jsx("input", { ...getInputProps() }), isNotNullish(value) ? (value instanceof Element ? (_jsx(UploadAreaPreview, { value: value })) : (_jsxs(_Fragment, { children: [_jsx(Icon, { name: getIconNameFromFilename(value.name), size: 48, color: disabled ? colors.gray[200] : colors.current[500] }), _jsx(Space, { width: layout === "horizontal" ? 48 : 16, height: layout === "horizontal" ? 48 : 16 }), _jsxs(View, { style: styles.browseBlock, children: [_jsx(LakeHeading, { level: 5, variant: "h5", align: layout === "horizontal" ? "left" : "center", children: t("uploadArea.droppedFile") }), _jsx(Space, { height: 4 }), _jsx(LakeText, { variant: "smallRegular", color: colors.gray[200], children: value.name })] })] }))) : (_jsxs(_Fragment, { children: [_jsxs(View, { style: styles.icon, children: [_jsx(Icon, { name: icon, size: 48, color: disabled ? colors.gray[200] : colors.current[500], style: [
146
+ ], children: [_jsx("input", { ...getInputProps() }), isNotNullish(value) ? (value instanceof Element ? (_jsx(UploadAreaPreview, { value: value })) : (_jsxs(_Fragment, { children: [_jsx(Icon, { name: getIconNameFromFilename(value.name), size: 48, color: disabled ? colors.gray[200] : colors.current[500] }), _jsx(Space, { width: layout === "horizontal" ? 48 : 16, height: layout === "horizontal" ? 48 : 16 }), _jsxs(View, { style: styles.browseBlock, children: [_jsx(LakeHeading, { level: 5, variant: "h5", align: layout === "horizontal" ? "left" : "center", children: t("uploadArea.droppedFile") }), _jsx(Space, { height: 4 }), _jsx(LakeText, { variant: "smallRegular", color: colors.gray[200], children: value.name })] })] }))) : (_jsxs(_Fragment, { children: [_jsxs(View, { style: styles.icon, children: [_jsx(Icon, { name: icon, size: 48, color: disabled ? colors.gray[200] : colors.current[500], style: [
147
147
  styles.decorativeIconLeft,
148
148
  (isDragActive || isHovered) && styles.decorativeIconLeftHovered,
149
149
  ] }), _jsx(Icon, { name: icon, size: 48, color: disabled ? colors.gray[200] : colors.current[500], style: [
@@ -156,6 +156,6 @@ export const UploadArea = ({ icon, accept, value, documents = [], disabled = fal
156
156
  }) }), isNotNullish(error) ? (_jsxs(_Fragment, { children: [_jsx(Space, { height: 4 }), _jsx(LakeText, { color: colors.negative[400], align: layout === "horizontal" ? "left" : "center", children: error })] })) : (!disabled &&
157
157
  isNotNullish(description) && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 4 }), _jsx(LakeText, { align: layout === "horizontal" ? "left" : "center", children: description })] })))] })] }))] }) }), documents.map(({ finished = false, ...document }, index) => {
158
158
  const progress = Math.max(document.progress ?? 0, 3);
159
- return (_jsxs(Fragment, { children: [_jsx(Space, { height: index === 0 ? 8 : 4 }), finished ? (_jsx(FileTile, { name: document.name ?? t("uploadArea.unknownFileName"), url: document.fileUrl, onRemove: isNullish(onRemoveFile) ? undefined : () => onRemoveFile(document.id) })) : (_jsxs(Box, { direction: "row", alignItems: "center", style: styles.item, children: [_jsx(LakeText, { numberOfLines: 1, color: colors.gray[700], children: t("uploadArea.uploading") }), _jsx(Space, { width: 20 }), _jsx(View, { accessibilityRole: "progressbar", style: styles.progressBar, children: _jsx(View, { style: [styles.progress, { width: `${progress}%` }] }) })] }))] }, document.id));
159
+ return (_jsxs(Fragment, { children: [_jsx(Space, { height: index === 0 ? 8 : 4 }), finished ? (_jsx(FileTile, { name: document.name ?? t("uploadArea.unknownFileName"), url: document.fileUrl, onRemove: isNullish(onRemoveFile) ? undefined : () => onRemoveFile(document.id) })) : (_jsxs(Box, { direction: "row", alignItems: "center", style: styles.item, children: [_jsx(LakeText, { numberOfLines: 1, color: colors.gray[700], children: t("uploadArea.uploading") }), _jsx(Space, { width: 20 }), _jsx(View, { role: "progressbar", style: styles.progressBar, children: _jsx(View, { style: [styles.progress, { width: `${progress}%` }] }) })] }))] }, document.id));
160
160
  })] }));
161
161
  };
@@ -1985,18 +1985,19 @@ export declare const getCCA3forCCA2: (cca2: CountryCCA2) => "ALA" | "ASM" | "AND
1985
1985
  export declare const getCountryNameByCCA3: (cca3: string) => string;
1986
1986
  export declare const companyWithUboCountries: readonly ["BEL", "DEU", "FRA", "ITA", "LTU", "LUX", "NLD"];
1987
1987
  export type CompanyWithUboCountryCCA3 = (typeof companyWithUboCountries)[number];
1988
- declare const individualCountries: ("BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR")[];
1988
+ export declare const allCountriesItems: CountryItem<CountryCCA3>[];
1989
+ declare const individualCountries: ("BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "MCO" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR")[];
1989
1990
  export type IndividualCountryCCA3 = (typeof individualCountries)[number];
1990
1991
  export declare const individualCountriesItems: CountryItem<IndividualCountryCCA3>[];
1991
- declare const companyCountries: ("BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR")[];
1992
+ declare const companyCountries: ("BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "MCO" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR")[];
1992
1993
  export type CompanyCountryCCA3 = (typeof companyCountries)[number];
1993
1994
  export declare const companyCountriesItems: CountryItem<CompanyCountryCCA3>[];
1994
1995
  export declare const countriesWithMultipleCCA3: Partial<Record<CountryCCA3, string[]>>;
1995
1996
  export declare const isCountryCCA3: (value: unknown) => value is "ALA" | "ASM" | "AND" | "AGO" | "AIA" | "ATA" | "ATG" | "ARG" | "ABW" | "AUS" | "AZE" | "BHS" | "BGD" | "BRB" | "BEL" | "BLZ" | "BEN" | "BMU" | "BOL" | "BES" | "BIH" | "BWA" | "BVT" | "BRA" | "VGB" | "BFA" | "BDI" | "CPV" | "CMR" | "CAN" | "CYM" | "CZE" | "CHL" | "CXR" | "CCK" | "COL" | "COK" | "CRI" | "CIV" | "CUB" | "CUW" | "DNK" | "DEU" | "DJI" | "DMA" | "ECU" | "EST" | "IRL" | "SLV" | "ESP" | "FLK" | "FJI" | "FRO" | "FRA" | "GAB" | "GMB" | "GHA" | "GIB" | "GRD" | "GLP" | "GUM" | "GTM" | "GGY" | "GNB" | "GNQ" | "GIN" | "GUY" | "GUF" | "HTI" | "HMD" | "HND" | "HRV" | "IDN" | "ISL" | "IMN" | "ITA" | "JAM" | "JEY" | "GRL" | "KHM" | "KAZ" | "KEN" | "KIR" | "CAF" | "COM" | "REU" | "LVA" | "LSO" | "LBR" | "LIE" | "LTU" | "LUX" | "MDG" | "HUN" | "MHL" | "MWI" | "MYS" | "MDV" | "MLI" | "MLT" | "MTQ" | "MUS" | "MYT" | "MEX" | "FSM" | "MOZ" | "MDA" | "MCO" | "MSR" | "NAM" | "NLD" | "BRN" | "NZL" | "NIC" | "NER" | "NGA" | "NIU" | "NFK" | "NOR" | "MNP" | "NCL" | "AUT" | "UZB" | "PAK" | "PLW" | "PAN" | "PNG" | "PRY" | "PER" | "PHL" | "PCN" | "POL" | "PYF" | "PRT" | "PRI" | "DOM" | "UNK" | "COD" | "COG" | "ROU" | "RWA" | "KNA" | "LCA" | "VCT" | "BLM" | "MAF" | "SPM" | "WSM" | "SMR" | "STP" | "CHE" | "SEN" | "SYC" | "ALB" | "SLE" | "SGP" | "SVN" | "SVK" | "SLB" | "SOM" | "ZAF" | "SGS" | "SSD" | "LKA" | "FIN" | "SUR" | "SWE" | "SWZ" | "TZA" | "TCD" | "ATF" | "TLS" | "TGO" | "TON" | "TTO" | "TUR" | "TKM" | "TCA" | "TUV" | "UGA" | "GBR" | "USA" | "UMI" | "VIR" | "URY" | "VUT" | "VAT" | "VEN" | "VNM" | "WLF" | "ZMB" | "ZWE" | "BTN" | "GRC" | "CYP" | "BLR" | "BGR" | "KGZ" | "MKD" | "MNG" | "RUS" | "SRB" | "TJK" | "UKR" | "MNE" | "ARM" | "ISR" | "AFG" | "JOR" | "DZA" | "SDN" | "ESH" | "IRQ" | "SAU" | "KWT" | "MAR" | "YEM" | "IRN" | "TUN" | "ARE" | "SYR" | "OMN" | "PSE" | "QAT" | "LBN" | "EGY" | "MRT" | "NPL" | "IND" | "THA" | "LAO" | "MMR" | "GEO" | "ETH" | "ERI" | "BHR" | "LBY" | "CHN" | "JPN" | "MAC" | "TWN" | "HKG" | "KOR" | "PRK";
1996
1997
  export declare const isCountryCCA2: (value: unknown) => value is "AX" | "AS" | "AD" | "AO" | "AI" | "AQ" | "AG" | "AR" | "AW" | "AU" | "AZ" | "BS" | "BD" | "BB" | "BE" | "BZ" | "BJ" | "BM" | "BO" | "BQ" | "BA" | "BW" | "BV" | "BR" | "VG" | "BF" | "BI" | "CV" | "CM" | "CA" | "KY" | "CZ" | "CL" | "CX" | "CC" | "CO" | "CK" | "CR" | "CI" | "CU" | "CW" | "DK" | "DE" | "DJ" | "DM" | "EC" | "EE" | "IE" | "SV" | "ES" | "FK" | "FJ" | "FO" | "FR" | "GA" | "GM" | "GH" | "GI" | "GD" | "GP" | "GU" | "GT" | "GG" | "GW" | "GQ" | "GN" | "GY" | "GF" | "HT" | "HM" | "HN" | "HR" | "ID" | "IS" | "IM" | "IT" | "JM" | "JE" | "GL" | "KH" | "KZ" | "KE" | "KI" | "CF" | "KM" | "RE" | "LV" | "LS" | "LR" | "LI" | "LT" | "LU" | "MG" | "HU" | "MH" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MU" | "YT" | "MX" | "FM" | "MZ" | "MD" | "MC" | "MS" | "NA" | "NL" | "BN" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "NO" | "MP" | "NC" | "AT" | "UZ" | "PK" | "PW" | "PA" | "PG" | "PY" | "PE" | "PH" | "PN" | "PL" | "PF" | "PT" | "PR" | "DO" | "XK" | "CD" | "CG" | "RO" | "RW" | "KN" | "LC" | "VC" | "BL" | "MF" | "PM" | "WS" | "SM" | "ST" | "CH" | "SN" | "SC" | "AL" | "SL" | "SG" | "SI" | "SK" | "SB" | "SO" | "ZA" | "GS" | "SS" | "LK" | "FI" | "SR" | "SE" | "SZ" | "TZ" | "TD" | "TF" | "TL" | "TG" | "TO" | "TT" | "TR" | "TM" | "TC" | "TV" | "UG" | "GB" | "US" | "UM" | "VI" | "UY" | "VU" | "VA" | "VE" | "VN" | "WF" | "ZM" | "ZW" | "BT" | "GR" | "CY" | "BY" | "BG" | "KG" | "MK" | "MN" | "RU" | "RS" | "TJ" | "UA" | "ME" | "AM" | "IL" | "AF" | "JO" | "DZ" | "SD" | "EH" | "IQ" | "SA" | "KW" | "MA" | "YE" | "IR" | "TN" | "AE" | "SY" | "OM" | "PS" | "QA" | "LB" | "EG" | "MR" | "NP" | "IN" | "TH" | "LA" | "MM" | "GE" | "ET" | "ER" | "BH" | "LY" | "CN" | "JP" | "MO" | "TW" | "HK" | "KR" | "KP";
1997
- export declare const isIndividualCountryCCA3: (value: unknown) => value is "BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR";
1998
- export declare const isCompanyCountryCCA3: (value: unknown) => value is "BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR";
1998
+ export declare const isIndividualCountryCCA3: (value: unknown) => value is "BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "MCO" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR";
1999
+ export declare const isCompanyCountryCCA3: (value: unknown) => value is "BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "MCO" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR";
1999
2000
  export declare const isCompanyWithUboCountryCCA3: (value: unknown) => value is "BEL" | "DEU" | "FRA" | "ITA" | "LTU" | "LUX" | "NLD";
2000
- export declare const individualFallbackCountry: "BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR";
2001
- export declare const companyFallbackCountry: "BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR";
2001
+ export declare const individualFallbackCountry: "BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "MCO" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR";
2002
+ export declare const companyFallbackCountry: "BEL" | "CZE" | "DNK" | "DEU" | "EST" | "IRL" | "ESP" | "FRA" | "HRV" | "ISL" | "ITA" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "MCO" | "NLD" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR";
2002
2003
  export {};
@@ -2220,6 +2220,7 @@ const readonlyCountries = [
2220
2220
  export const countries = readonlyCountries.concat([]);
2221
2221
  export const getCCA2forCCA3 = (cca3) => countries.find(country => country.cca3 === cca3)?.cca2;
2222
2222
  export const getCCA3forCCA2 = (cca2) => countries.find(country => country.cca2 === cca2)?.cca3;
2223
+ const isTranslatedCountry = (value) => Object.keys(names).includes(value);
2223
2224
  export const getCountryNameByCCA3 = (cca3) => {
2224
2225
  if (isTranslatedCountry(cca3)) {
2225
2226
  return names[cca3];
@@ -2250,6 +2251,7 @@ const names = {
2250
2251
  LUX: t("country.LUX"),
2251
2252
  LVA: t("country.LVA"),
2252
2253
  MLT: t("country.MLT"),
2254
+ MCO: t("country.MCO"),
2253
2255
  NLD: t("country.NLD"),
2254
2256
  NOR: t("country.NOR"),
2255
2257
  POL: t("country.POL"),
@@ -2259,6 +2261,13 @@ const names = {
2259
2261
  SVN: t("country.SVN"),
2260
2262
  SWE: t("country.SWE"),
2261
2263
  };
2264
+ export const allCountriesItems = countries
2265
+ .map(country => ({
2266
+ name: getCountryNameByCCA3(country.cca3),
2267
+ cca3: country.cca3,
2268
+ cca2: country.cca2,
2269
+ }))
2270
+ .sort((a, b) => a.name.localeCompare(b.name));
2262
2271
  const individualCountries = [
2263
2272
  "AUT",
2264
2273
  "BEL",
@@ -2290,6 +2299,7 @@ const individualCountries = [
2290
2299
  "ROU",
2291
2300
  "SWE",
2292
2301
  "BGR",
2302
+ "MCO",
2293
2303
  ];
2294
2304
  export const individualCountriesItems = individualCountries
2295
2305
  .map(cca3 => ({
@@ -2329,6 +2339,7 @@ const companyCountries = [
2329
2339
  "BGR",
2330
2340
  "CYP",
2331
2341
  "NOR",
2342
+ "MCO",
2332
2343
  ];
2333
2344
  export const companyCountriesItems = companyCountries
2334
2345
  .map(cca3 => ({
@@ -2346,7 +2357,6 @@ export const isCountryCCA2 = (value) => countries.some(({ cca2 }) => cca2 === va
2346
2357
  export const isIndividualCountryCCA3 = (value) => individualCountries.includes(value);
2347
2358
  export const isCompanyCountryCCA3 = (value) => companyCountries.includes(value);
2348
2359
  export const isCompanyWithUboCountryCCA3 = (value) => companyWithUboCountries.includes(value);
2349
- const isTranslatedCountry = (value) => Object.keys(names).includes(value);
2350
2360
  const getBestNavigatorCountryIndividual = () => {
2351
2361
  const navigatorCountries = navigator.languages
2352
2362
  .map(lang => lang.split("-")[1])
@@ -20,9 +20,10 @@ const termsAndConditions = {
20
20
  };
21
21
  const defaultTerms = termsAndConditions.FRA;
22
22
  export const getTermsAndConditionsPathByAccountCountryAndLocale = ({ rootUrl, accountCountry, locale, }) => {
23
+ const rootUrlWithSlash = rootUrl.endsWith("/") ? rootUrl : rootUrl + "/";
23
24
  if (accountCountry == null) {
24
- return new URL(defaultTerms[locale], rootUrl).toString();
25
+ return rootUrlWithSlash + defaultTerms[locale];
25
26
  }
26
27
  const termsByLocale = termsAndConditions[accountCountry] ?? defaultTerms;
27
- return new URL(termsByLocale[locale], rootUrl).toString();
28
+ return rootUrlWithSlash + termsByLocale[locale];
28
29
  };
@@ -1,7 +1,7 @@
1
+ import { Loader } from "@googlemaps/js-api-loader";
1
2
  import { AsyncData } from "@swan-io/boxed";
2
3
  import { useEffect } from "react";
3
4
  import { atom, useAtom } from "react-atomic-state";
4
- import { Loader } from "@googlemaps/js-api-loader";
5
5
  const sdk = atom(AsyncData.NotAsked());
6
6
  export const useGoogleMapSDK = ({ language, apiKey }) => {
7
7
  const googleSdk = useAtom(sdk);
@@ -71,6 +71,7 @@
71
71
  "country.LTU": "Litauen",
72
72
  "country.LUX": "Luxemburg",
73
73
  "country.LVA": "Lettland",
74
+ "country.MCO": "Monaco",
74
75
  "country.MLT": "Malta",
75
76
  "country.NLD": "Niederlande",
76
77
  "country.NOR": "Norwegen",
@@ -88,6 +89,8 @@
88
89
  "registrationPage.defaultNumberLabel": "Registrierungsnummer",
89
90
  "registrationPage.withOrganismLabel": "Ist Ihre Firma bereits im {organismName} eingetragen?",
90
91
  "registrationPage.withoutOrganismNameLabel": "Sind Sie registriert?",
92
+ "supportingDoc.UBODeclaration": "Wirtschaftlicher Eigentümer Erklärung",
93
+ "supportingDoc.UBODeclaration.description": "Wirtschaftlicher Eigentümer Erklärung",
91
94
  "supportingDoc.associationRegistration": "Nachweis der Registrierung",
92
95
  "supportingDoc.associationRegistration.description": "Offizielles Dokument zum Nachweis der Registrierung Ihrer Vereinigung. (weniger als 3 Monate alt)",
93
96
  "supportingDoc.companyRegistration": "Nachweis der Unternehmensregistrierung (weniger als 3 Monate alt)",
@@ -71,6 +71,7 @@
71
71
  "country.LTU": "Lithuania",
72
72
  "country.LUX": "Luxembourg",
73
73
  "country.LVA": "Latvia",
74
+ "country.MCO": "Monaco",
74
75
  "country.MLT": "Malta",
75
76
  "country.NLD": "Netherlands",
76
77
  "country.NOR": "Norway",
@@ -88,6 +89,8 @@
88
89
  "registrationPage.defaultNumberLabel": "Registration number",
89
90
  "registrationPage.withOrganismLabel": "Are you registered to {organismName}?",
90
91
  "registrationPage.withoutOrganismNameLabel": "Are you registered?",
92
+ "supportingDoc.UBODeclaration": "UBO Declaration",
93
+ "supportingDoc.UBODeclaration.description": "Ultimate Beneficial Owners declaration of the organization",
91
94
  "supportingDoc.associationRegistration": "Proof of registration",
92
95
  "supportingDoc.associationRegistration.description": "Official document proving the registration of your association. (< 3 months old)",
93
96
  "supportingDoc.companyRegistration": "Proof of company registration (< 3 months old)",
@@ -104,6 +107,8 @@
104
107
  "supportingDoc.proofOfIdentity.description": "Authorized documents: Passport, ID card (only applicable to citizens of member country of the EEE zone), Residence permit (only applicable to residents of member country of the EEE zone)",
105
108
  "supportingDoc.signedStatus": "Statutes and By-laws",
106
109
  "supportingDoc.signedStatus.description": "The rules your company put in place to regulate members and maintain civility.",
110
+ "supportingDoc.swornStatementDeclaration": "Sworn Statement UBO Declaration",
111
+ "supportingDoc.swornStatementDeclaration.description": "For regulatory reason we need a sworn statement of the UBO declaration",
107
112
  "supportingDoc.whatIsThis": "What is this?",
108
113
  "supportingDoc.whoAreYou": "Who are you?",
109
114
  "uploadArea.browse": "browse",
@@ -71,6 +71,7 @@
71
71
  "country.LTU": "Lituania",
72
72
  "country.LUX": "Luxemburgo",
73
73
  "country.LVA": "Letonia",
74
+ "country.MCO": "Mónaco",
74
75
  "country.MLT": "Malta",
75
76
  "country.NLD": "Países Bajos",
76
77
  "country.NOR": "Noruega",
@@ -88,6 +89,8 @@
88
89
  "registrationPage.defaultNumberLabel": "Número de registro",
89
90
  "registrationPage.withOrganismLabel": "¿Está usted registrado en {organismName}?",
90
91
  "registrationPage.withoutOrganismNameLabel": "¿Está usted registrado?",
92
+ "supportingDoc.UBODeclaration": "Declaración de titular real",
93
+ "supportingDoc.UBODeclaration.description": "Declaración de titular real",
91
94
  "supportingDoc.associationRegistration": "Prueba de registro",
92
95
  "supportingDoc.associationRegistration.description": "Documento oficial que acredite el registro de tu asociación. (< 3 meses)",
93
96
  "supportingDoc.companyRegistration": "Comprobante de registro de la empresa (< 3 meses de antigüedad)",
@@ -71,6 +71,7 @@
71
71
  "country.LTU": "Lituanie",
72
72
  "country.LUX": "Luxembourg",
73
73
  "country.LVA": "Lettonie",
74
+ "country.MCO": "Monaco",
74
75
  "country.MLT": "Malte",
75
76
  "country.NLD": "Pays-Bas",
76
77
  "country.NOR": "Norvège",
@@ -88,6 +89,8 @@
88
89
  "registrationPage.defaultNumberLabel": "Numéro d'immatriculation",
89
90
  "registrationPage.withOrganismLabel": "Êtes-vous immatriculé au {organismName}?",
90
91
  "registrationPage.withoutOrganismNameLabel": "Êtes-vous immatriculé?",
92
+ "supportingDoc.UBODeclaration": "Déclaration des bénéficiares effectifs",
93
+ "supportingDoc.UBODeclaration.description": "Déclaration des bénéficiares effectifs",
91
94
  "supportingDoc.associationRegistration": "Preuve d'enregistrement",
92
95
  "supportingDoc.associationRegistration.description": "Document officiel prouvant l'enregistrement de votre association. (de moins de 3 mois)",
93
96
  "supportingDoc.companyRegistration": "Preuve d'enregistrement de l'entreprise (de moins de 3 mois)",
@@ -71,6 +71,7 @@
71
71
  "country.LTU": "Lituania",
72
72
  "country.LUX": "Lussemburgo",
73
73
  "country.LVA": "Lettonia",
74
+ "country.MCO": "Monaco",
74
75
  "country.MLT": "Malta",
75
76
  "country.NLD": "Paesi Bassi",
76
77
  "country.NOR": "Norvegia",
@@ -88,6 +89,8 @@
88
89
  "registrationPage.defaultNumberLabel": "Numero di registrazione",
89
90
  "registrationPage.withOrganismLabel": "Sei registrato a {organismName}?",
90
91
  "registrationPage.withoutOrganismNameLabel": "Sei registrato?",
92
+ "supportingDoc.UBODeclaration": "Dichiarazione di titolare effettivo",
93
+ "supportingDoc.UBODeclaration.description": "Dichiarazione di titolare effettivo",
91
94
  "supportingDoc.associationRegistration": "Prova di registrazione",
92
95
  "supportingDoc.associationRegistration.description": "Documento ufficiale attestante la registrazione della tua associazione. (< 3 mesi)",
93
96
  "supportingDoc.companyRegistration": "Prova di registrazione della società (< 3 mesi)",
@@ -71,6 +71,7 @@
71
71
  "country.LTU": "Lithouwen",
72
72
  "country.LUX": "Luxemburg",
73
73
  "country.LVA": "Letland",
74
+ "country.MCO": "Monaco",
74
75
  "country.MLT": "Malta",
75
76
  "country.NLD": "Nederland",
76
77
  "country.NOR": "Noorwegen",
@@ -88,6 +89,8 @@
88
89
  "registrationPage.defaultNumberLabel": "Registratienummer",
89
90
  "registrationPage.withOrganismLabel": "Bent u geregistreerd bij {organismName}?",
90
91
  "registrationPage.withoutOrganismNameLabel": "Bent u geregistreerd?",
92
+ "supportingDoc.UBODeclaration": "Uiteindelijk begunstigde verklaring",
93
+ "supportingDoc.UBODeclaration.description": "Uiteindelijk begunstigde verklaring",
91
94
  "supportingDoc.associationRegistration": "Bewijs van inschrijving",
92
95
  "supportingDoc.associationRegistration.description": "Officieel document waaruit de registratie van uw vereniging blijkt. (minder dan 3 maanden oud)",
93
96
  "supportingDoc.companyRegistration": "Uittreksel van het handelsregister (KVK document, minder dan 3 maanden oud)",
@@ -71,6 +71,7 @@
71
71
  "country.LTU": "Lituânia",
72
72
  "country.LUX": "Luxemburgo",
73
73
  "country.LVA": "Letónia",
74
+ "country.MCO": "Mónaco",
74
75
  "country.MLT": "Malta",
75
76
  "country.NLD": "Paises Baixos",
76
77
  "country.NOR": "Noruega",
@@ -88,6 +89,8 @@
88
89
  "registrationPage.defaultNumberLabel": "Número de registo",
89
90
  "registrationPage.withOrganismLabel": "Você está registado no {organismName}?",
90
91
  "registrationPage.withoutOrganismNameLabel": "Você está registado?",
92
+ "supportingDoc.UBODeclaration": "Declaração dos beneficiários efetivos",
93
+ "supportingDoc.UBODeclaration.description": "Declaração dos beneficiários efetivos",
91
94
  "supportingDoc.associationRegistration": "Prova de registo",
92
95
  "supportingDoc.associationRegistration.description": "Documento oficial comprovando o registo da sua associação. (< 3 meses)",
93
96
  "supportingDoc.companyRegistration": "Prova de registo da empresa (< 3 meses)",
@@ -1,3 +1,2 @@
1
1
  export declare const decodeBirthDate: (value: string) => string;
2
- export declare const isValidBirthDate: (value: string) => boolean;
3
2
  export declare const encodeBirthDate: (value: string) => string;
package/src/utils/date.js CHANGED
@@ -3,10 +3,6 @@ export const decodeBirthDate = (value) => {
3
3
  const date = dayjs.utc(value, "YYYY-MM-DD");
4
4
  return date.isValid() ? date.format("DD/MM/YYYY") : "";
5
5
  };
6
- export const isValidBirthDate = (value) => {
7
- const date = dayjs.utc(value, "DD/MM/YYYY");
8
- return date.isValid() && date.isBefore(dayjs.utc());
9
- };
10
6
  export const encodeBirthDate = (value) => {
11
7
  const date = dayjs.utc(value, "DD/MM/YYYY");
12
8
  return date.isValid() ? date.format("YYYY-MM-DD") : "";
@@ -2,7 +2,7 @@ import { RifmProps } from "@swan-io/lake/src/utils/rifm";
2
2
  import { ReactElement, ReactNode } from "react";
3
3
  import translationEN from "../locales/en.json";
4
4
  declare const supportedLanguages: readonly ["en", "es", "de", "fr", "it", "nl", "pt"];
5
- type SupportedLanguage = typeof supportedLanguages[number];
5
+ type SupportedLanguage = (typeof supportedLanguages)[number];
6
6
  type TranslationParams = Record<string, string | number>;
7
7
  export type TranslationKey = keyof typeof translationEN;
8
8
  type Locale = {
package/src/utils/i18n.js CHANGED
@@ -20,7 +20,7 @@ import translationFR from "../locales/fr.json";
20
20
  import translationIT from "../locales/it.json";
21
21
  import translationNL from "../locales/nl.json";
22
22
  import translationPT from "../locales/pt.json";
23
- import { getLanguagesHelpers, LANGUAGE_FALLBACK } from "./languages";
23
+ import { LANGUAGE_FALLBACK, getLanguagesHelpers } from "./languages";
24
24
  // https://day.js.org/docs/en/plugin/plugin
25
25
  dayjs.extend(utc);
26
26
  dayjs.extend(customParseFormat);