@swan-io/shared-business 4.7.0 → 4.8.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": "4.7.0",
3
+ "version": "4.8.0",
4
4
  "engines": {
5
5
  "node": ">=18.0.0",
6
6
  "yarn": "^1.22.0"
@@ -24,5 +24,5 @@ export const AddressFormPart = ({ initialAddress, initialCity, initialPostalCode
24
24
  }
25
25
  setManualMode.on();
26
26
  }, [setManualMode, setFieldValue]);
27
- 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(PlacekitAddressSearchInput, { inputRef: ref, apiKey: apiKey, 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] }));
27
+ return (_jsxs(_Fragment, { children: [_jsx(Field, { name: "address", children: ({ ref, value, onChange, error }) => (_jsx(LakeLabel, { label: label !== null && label !== void 0 ? label : t("addressFormPart.addressLabel"), optionalLabel: optionalLabel, render: id => (_jsx(PlacekitAddressSearchInput, { inputRef: ref, apiKey: apiKey, emptyResultText: t("common.noResult"), placeholder: placeholder !== null && placeholder !== void 0 ? 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] }));
28
28
  };
@@ -49,6 +49,7 @@ const validateCca3CountryCode = value => {
49
49
  }
50
50
  };
51
51
  export const validateUbo = (editorState, accountCountry) => {
52
+ var _a, _b;
52
53
  const isAddressRequired = match(accountCountry)
53
54
  .with("DEU", "ESP", () => true)
54
55
  .otherwise(() => false);
@@ -74,7 +75,7 @@ export const validateUbo = (editorState, accountCountry) => {
74
75
  : undefined,
75
76
  type: validateNullableRequired(editorState.type),
76
77
  totalCapitalPercentage: editorState.type === "HasCapital"
77
- ? validateNullableRequired(editorState.totalCapitalPercentage?.toString())
78
+ ? validateNullableRequired((_a = editorState.totalCapitalPercentage) === null || _a === void 0 ? void 0 : _a.toString())
78
79
  : undefined,
79
80
  residencyAddressLine1: isAddressRequired
80
81
  ? validateNullableRequired(editorState.residencyAddressLine1)
@@ -88,7 +89,7 @@ export const validateUbo = (editorState, accountCountry) => {
88
89
  residencyAddressPostalCode: isAddressRequired
89
90
  ? validateNullableRequired(editorState.residencyAddressPostalCode)
90
91
  : undefined,
91
- taxIdentificationNumber: validateTaxNumber(editorState.taxIdentificationNumber ?? ""),
92
+ taxIdentificationNumber: validateTaxNumber((_b = editorState.taxIdentificationNumber) !== null && _b !== void 0 ? _b : ""),
92
93
  indirect: editorState.type !== "HasCapital" || editorState.direct === true
93
94
  ? undefined
94
95
  : validateBooleanRequired(editorState.indirect),
@@ -142,7 +143,7 @@ const CapitalTypeCheckboxes = ({ value, error, onChange }) => {
142
143
  .with({ indirect: false, value: "both" }, () => onChange("direct"))
143
144
  // other cases are impossible so we don't need to handle them
144
145
  .otherwise(noop);
145
- }, label: t("beneficiaryForm.beneficiary.indirectly"), isError: error != null })] }), _jsx(Space, { height: 4 }), _jsx(LakeText, { color: colors.negative[400], children: error ?? " " })] }));
146
+ }, label: t("beneficiaryForm.beneficiary.indirectly"), isError: error != null })] }), _jsx(Space, { height: 4 }), _jsx(LakeText, { color: colors.negative[400], children: error !== null && error !== void 0 ? error : " " })] }));
146
147
  };
147
148
  const formSteps = ["common", "address"];
148
149
  const requiredStepFields = [
@@ -155,7 +156,8 @@ const requiredStepFields = [
155
156
  "type",
156
157
  ];
157
158
  export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step, placekitApiKey, onStepChange, onClose, onSave, onCityLoadError, }, ref) => {
158
- const [reference] = useState(() => initialState?.reference ?? uuid());
159
+ var _a, _b, _c, _d, _e, _f, _g;
160
+ const [reference] = useState(() => { var _a; return (_a = initialState === null || initialState === void 0 ? void 0 : initialState.reference) !== null && _a !== void 0 ? _a : uuid(); });
159
161
  const isAddressRequired = match(accountCountry)
160
162
  .with("DEU", "ESP", () => true)
161
163
  .otherwise(() => false);
@@ -163,50 +165,50 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
163
165
  .with("ESP", "FRA", "NLD", () => true)
164
166
  .otherwise(() => false);
165
167
  const initialAddress = useRef({
166
- residencyAddressLine1: initialState?.residencyAddressLine1,
167
- residencyAddressCity: initialState?.residencyAddressCity,
168
- residencyAddressPostalCode: initialState?.residencyAddressPostalCode,
168
+ residencyAddressLine1: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressLine1,
169
+ residencyAddressCity: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressCity,
170
+ residencyAddressPostalCode: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressPostalCode,
169
171
  });
170
172
  const commonStepValues = useRef();
171
- const initialBirthDate = initialState?.birthDate;
173
+ const initialBirthDate = initialState === null || initialState === void 0 ? void 0 : initialState.birthDate;
172
174
  const { Field, FieldsListener, setFieldValue, submitForm, listenFields, validateField } = useForm({
173
175
  firstName: {
174
- initialValue: initialState?.firstName ?? "",
176
+ initialValue: (_a = initialState === null || initialState === void 0 ? void 0 : initialState.firstName) !== null && _a !== void 0 ? _a : "",
175
177
  validate: validateNullableRequired,
176
- sanitize: value => value?.trim(),
178
+ sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
177
179
  },
178
180
  lastName: {
179
- initialValue: initialState?.lastName ?? "",
181
+ initialValue: (_b = initialState === null || initialState === void 0 ? void 0 : initialState.lastName) !== null && _b !== void 0 ? _b : "",
180
182
  validate: validateNullableRequired,
181
- sanitize: value => value?.trim(),
183
+ sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
182
184
  },
183
185
  birthDate: {
184
186
  initialValue: isNotNullishOrEmpty(initialBirthDate)
185
187
  ? decodeBirthDate(initialBirthDate)
186
188
  : "",
187
189
  validate: isBirthInfoRequired ? validateNullableRequired : undefined,
188
- sanitize: value => value?.trim(),
190
+ sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
189
191
  },
190
192
  birthCountryCode: {
191
- initialValue: initialState?.birthCountryCode ?? accountCountry,
193
+ initialValue: (_c = initialState === null || initialState === void 0 ? void 0 : initialState.birthCountryCode) !== null && _c !== void 0 ? _c : accountCountry,
192
194
  validate: validateNullableRequired,
193
195
  },
194
196
  birthCity: {
195
- initialValue: initialState?.birthCity ?? "",
197
+ initialValue: (_d = initialState === null || initialState === void 0 ? void 0 : initialState.birthCity) !== null && _d !== void 0 ? _d : "",
196
198
  validate: isBirthInfoRequired ? validateNullableRequired : undefined,
197
- sanitize: value => value?.trim(),
199
+ sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
198
200
  },
199
201
  birthCityPostalCode: {
200
- initialValue: initialState?.birthCityPostalCode ?? "",
202
+ initialValue: (_e = initialState === null || initialState === void 0 ? void 0 : initialState.birthCityPostalCode) !== null && _e !== void 0 ? _e : "",
201
203
  validate: isBirthInfoRequired ? validateNullableRequired : undefined,
202
- sanitize: value => value?.trim(),
204
+ sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
203
205
  },
204
206
  type: {
205
- initialValue: initialState?.type ?? "HasCapital",
207
+ initialValue: (_f = initialState === null || initialState === void 0 ? void 0 : initialState.type) !== null && _f !== void 0 ? _f : "HasCapital",
206
208
  validate: validateRequired,
207
209
  },
208
210
  capitalType: {
209
- initialValue: getCapitalType(initialState?.direct, initialState?.indirect),
211
+ initialValue: getCapitalType(initialState === null || initialState === void 0 ? void 0 : initialState.direct, initialState === null || initialState === void 0 ? void 0 : initialState.indirect),
210
212
  validate: (value, { getFieldState }) => {
211
213
  const type = getFieldState("type");
212
214
  if (type.value === "HasCapital" && value === "none") {
@@ -216,33 +218,33 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
216
218
  },
217
219
  },
218
220
  totalCapitalPercentage: {
219
- initialValue: initialState?.totalCapitalPercentage?.toString(),
221
+ initialValue: (_g = initialState === null || initialState === void 0 ? void 0 : initialState.totalCapitalPercentage) === null || _g === void 0 ? void 0 : _g.toString(),
220
222
  validate: validateNullableRequired,
221
- sanitize: value => value?.trim(),
223
+ sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
222
224
  },
223
225
  address: {
224
- initialValue: initialState?.residencyAddressLine1,
226
+ initialValue: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressLine1,
225
227
  validate: isAddressRequired ? validateNullableRequired : undefined,
226
- sanitize: value => value?.trim(),
228
+ sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
227
229
  },
228
230
  city: {
229
- initialValue: initialState?.residencyAddressCity,
231
+ initialValue: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressCity,
230
232
  validate: isAddressRequired ? validateNullableRequired : undefined,
231
- sanitize: value => value?.trim(),
233
+ sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
232
234
  },
233
235
  postalCode: {
234
- initialValue: initialState?.residencyAddressPostalCode,
236
+ initialValue: initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressPostalCode,
235
237
  validate: isAddressRequired ? validateNullableRequired : undefined,
236
- sanitize: value => value?.trim(),
238
+ sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
237
239
  },
238
240
  country: {
239
- initialValue: isCountryCCA3(initialState?.residencyAddressCountry)
240
- ? initialState?.residencyAddressCountry
241
+ initialValue: isCountryCCA3(initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressCountry)
242
+ ? initialState === null || initialState === void 0 ? void 0 : initialState.residencyAddressCountry
241
243
  : accountCountry,
242
244
  validate: isAddressRequired ? validateNullableRequired : undefined,
243
245
  },
244
246
  taxIdentificationNumber: {
245
- initialValue: initialState?.taxIdentificationNumber,
247
+ initialValue: initialState === null || initialState === void 0 ? void 0 : initialState.taxIdentificationNumber,
246
248
  validate: (value, { getFieldState }) => {
247
249
  const uboCountry = getFieldState("country").value;
248
250
  if (accountCountry === "DEU" && uboCountry === "DEU") {
@@ -250,7 +252,7 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
250
252
  }
251
253
  return validateIndividualTaxNumber(accountCountry)(value);
252
254
  },
253
- sanitize: value => value?.trim(),
255
+ sanitize: value => value === null || value === void 0 ? void 0 : value.trim(),
254
256
  },
255
257
  });
256
258
  const hasBeenSubmittedOnce = useRef(false);
@@ -265,9 +267,9 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
265
267
  // without this, address form part initial values stays empty and city and postal code aren't automatically mounted
266
268
  return listenFields(["address", "city", "postalCode"], ({ address, city, postalCode }) => {
267
269
  initialAddress.current = {
268
- residencyAddressLine1: address?.value,
269
- residencyAddressCity: city?.value,
270
- residencyAddressPostalCode: postalCode?.value,
270
+ residencyAddressLine1: address === null || address === void 0 ? void 0 : address.value,
271
+ residencyAddressCity: city === null || city === void 0 ? void 0 : city.value,
272
+ residencyAddressPostalCode: postalCode === null || postalCode === void 0 ? void 0 : postalCode.value,
271
273
  };
272
274
  });
273
275
  });
@@ -293,6 +295,7 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
293
295
  submit: () => {
294
296
  hasBeenSubmittedOnce.current = true;
295
297
  submitForm(values => {
298
+ var _a;
296
299
  if (step === "common" &&
297
300
  isAddressRequired &&
298
301
  hasDefinedKeys(values, requiredStepFields)) {
@@ -302,7 +305,7 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
302
305
  }
303
306
  const allStepsValues = { ...commonStepValues.current, ...values };
304
307
  if (hasDefinedKeys(allStepsValues, requiredStepFields)) {
305
- const [direct, indirect] = getDirectAndIndirect(allStepsValues.capitalType ?? "none");
308
+ const [direct, indirect] = getDirectAndIndirect((_a = allStepsValues.capitalType) !== null && _a !== void 0 ? _a : "none");
306
309
  return onSave({
307
310
  reference,
308
311
  firstName: allStepsValues.firstName,
@@ -329,7 +332,7 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
329
332
  };
330
333
  });
331
334
  return (_jsx(ResponsiveContainer, { breakpoint: breakpoints.tiny, children: ({ small, large }) => (_jsxs(_Fragment, { children: [match(step)
332
- .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"), optionalLabel: isBirthInfoRequired ? undefined : t("common.optional"), 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"), countries: allCountries, 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"), optionalLabel: isBirthInfoRequired ? undefined : t("common.optional"), style: styles.inputContainer, render: id => (_jsx(PlacekitCityInput, { id: id, apiKey: placekitApiKey, error: error, country: birthCountryCode.value, value: value ?? "", onValueChange: onChange, placeholder: birthCountryCode.value == null
335
+ .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"), optionalLabel: isBirthInfoRequired ? undefined : t("common.optional"), style: styles.inputContainer, render: id => (_jsx(Rifm, { value: value !== null && value !== void 0 ? 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"), countries: allCountries, 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"), optionalLabel: isBirthInfoRequired ? undefined : t("common.optional"), style: styles.inputContainer, render: id => (_jsx(PlacekitCityInput, { id: id, apiKey: placekitApiKey, error: error, country: birthCountryCode.value, value: value !== null && value !== void 0 ? value : "", onValueChange: onChange, placeholder: birthCountryCode.value == null
333
336
  ? t("beneficiaryForm.beneficiary.fillBirthCountry")
334
337
  : t("beneficiaryForm.beneficiary.birthCityPlaceholder"), onSuggestion: place => {
335
338
  onChange(place.city);
@@ -338,10 +341,13 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
338
341
  }
339
342
  }, onLoadError: onCityLoadError })) })) }), _jsx(Space, { width: 12 }), _jsx(Field, { name: "birthCityPostalCode", children: ({ value, onChange, error }) => (_jsx(LakeLabel, { label: t("beneficiaryForm.beneficiary.birthPostalCode"), optionalLabel: isBirthInfoRequired ? undefined : t("common.optional"), style: styles.inputContainer, render: id => (_jsx(LakeTextInput, { error: error, placeholder: birthCountryCode.value == null
340
343
  ? t("beneficiaryForm.beneficiary.fillBirthCountry")
341
- : 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 })] })))
342
- .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, countries: allCountries, onValueChange: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(FieldsListener, { names: ["country"], children: ({ country }) => (_jsxs(_Fragment, { children: [_jsx(AddressFormPart, { apiKey: placekitApiKey, initialAddress: initialAddress.current.residencyAddressLine1 ?? "", initialCity: initialAddress.current.residencyAddressCity ?? "", initialPostalCode: initialAddress.current.residencyAddressPostalCode ?? "", country: country?.value ?? accountCountry, label: t("beneficiaryForm.beneficiary.address"), Field: Field, setFieldValue: setFieldValue, listenFields: listenFields, isLarge: large }), ((accountCountry === "DEU" && country?.value === "DEU") ||
343
- accountCountry === "ESP") && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 12 }), _jsx(Field, { name: "taxIdentificationNumber", children: ({ value, error, valid, onChange }) => (_jsx(TaxIdentificationNumberInput, { value: value ?? "", error: error, valid: valid, onChange: onChange, accountCountry: accountCountry, isCompany: false,
344
- // is mandatory for German accounts with UBO living in Germany
345
- required: accountCountry === "DEU" && country?.value === "DEU" })) })] }))] })) })] })))
344
+ : 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 !== null && value !== void 0 ? value : "none", error: error, onChange: onChange })) })] })) : null })] })))
345
+ .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, countries: allCountries, onValueChange: onChange })) })) }), _jsx(Space, { height: 12 }), _jsx(FieldsListener, { names: ["country"], children: ({ country }) => {
346
+ var _a, _b, _c, _d;
347
+ return (_jsxs(_Fragment, { children: [_jsx(AddressFormPart, { apiKey: placekitApiKey, initialAddress: (_a = initialAddress.current.residencyAddressLine1) !== null && _a !== void 0 ? _a : "", initialCity: (_b = initialAddress.current.residencyAddressCity) !== null && _b !== void 0 ? _b : "", initialPostalCode: (_c = initialAddress.current.residencyAddressPostalCode) !== null && _c !== void 0 ? _c : "", country: (_d = country === null || country === void 0 ? void 0 : country.value) !== null && _d !== void 0 ? _d : accountCountry, label: t("beneficiaryForm.beneficiary.address"), Field: Field, setFieldValue: setFieldValue, listenFields: listenFields, isLarge: large }), ((accountCountry === "DEU" && (country === null || country === void 0 ? void 0 : country.value) === "DEU") ||
348
+ accountCountry === "ESP") && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 12 }), _jsx(Field, { name: "taxIdentificationNumber", children: ({ value, error, valid, onChange }) => (_jsx(TaxIdentificationNumberInput, { value: value !== null && value !== void 0 ? value : "", error: error, valid: valid, onChange: onChange, accountCountry: accountCountry, isCompany: false,
349
+ // is mandatory for German accounts with UBO living in Germany
350
+ required: accountCountry === "DEU" && (country === null || country === void 0 ? void 0 : country.value) === "DEU" })) })] }))] }));
351
+ } })] })))
346
352
  .exhaustive(), isAddressRequired && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 12 }), _jsx(StepDots, { currentStep: step, steps: formSteps })] }))] })) }));
347
353
  });
@@ -144,6 +144,7 @@ export const ChoicePicker = ({ items, getId = identity, large = false, renderIte
144
144
  }
145
145
  };
146
146
  const onPressPrevious = () => {
147
+ var _a;
147
148
  const scrollContainer = containerRef.current;
148
149
  if (scrollContainer instanceof HTMLDivElement) {
149
150
  const scrollLeft = scrollContainer.scrollLeft;
@@ -152,7 +153,7 @@ export const ChoicePicker = ({ items, getId = identity, large = false, renderIte
152
153
  const previousIndex = Math.max(0, index - 1);
153
154
  // remove scroll snap during scroll animation to avoid weird behavior on older browsers
154
155
  scrollContainer.style.scrollSnapType = "none";
155
- containerRef.current?.scrollTo({ x: previousIndex * width, animated: true });
156
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({ x: previousIndex * width, animated: true });
156
157
  detectScrollAnimationEnd(scrollContainer).onResolve(() => {
157
158
  // set back scroll snap
158
159
  // @ts-expect-error
@@ -161,6 +162,7 @@ export const ChoicePicker = ({ items, getId = identity, large = false, renderIte
161
162
  }
162
163
  };
163
164
  const onPressNext = () => {
165
+ var _a;
164
166
  const scrollContainer = containerRef.current;
165
167
  if (scrollContainer instanceof HTMLDivElement) {
166
168
  const scrollLeft = scrollContainer.scrollLeft;
@@ -169,7 +171,7 @@ export const ChoicePicker = ({ items, getId = identity, large = false, renderIte
169
171
  const nextIndex = Math.min(items.length - 1, index + 1);
170
172
  // remove scroll snap during scroll animation to avoid weird behavior on older browsers
171
173
  scrollContainer.style.scrollSnapType = "none";
172
- containerRef.current?.scrollTo({ x: nextIndex * width, animated: true });
174
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({ x: nextIndex * width, animated: true });
173
175
  detectScrollAnimationEnd(scrollContainer).onResolve(() => {
174
176
  // set back scroll snap
175
177
  // @ts-expect-error
@@ -12,5 +12,5 @@ const styles = StyleSheet.create({
12
12
  },
13
13
  });
14
14
  export const ConfirmModal = ({ visible, title, message, confirmText, cancelText, color = "partner", icon, loading, onConfirm, onCancel, }) => {
15
- return (_jsxs(LakeModal, { visible: visible, title: title, icon: icon, color: color, children: [message != null && _jsx(LakeText, { children: message }), _jsx(Space, { height: 48 }), _jsxs(Box, { direction: "row", children: [_jsx(LakeButton, { style: styles.confirmButton, mode: "secondary", onPress: onCancel, children: cancelText ?? t("common.cancel") }), _jsx(Space, { width: 24 }), _jsx(LakeButton, { style: styles.confirmButton, color: color, onPress: onConfirm, loading: loading, children: confirmText })] })] }));
15
+ return (_jsxs(LakeModal, { visible: visible, title: title, icon: icon, color: color, children: [message != null && _jsx(LakeText, { children: message }), _jsx(Space, { height: 48 }), _jsxs(Box, { direction: "row", children: [_jsx(LakeButton, { style: styles.confirmButton, mode: "secondary", onPress: onCancel, children: cancelText !== null && cancelText !== void 0 ? cancelText : t("common.cancel") }), _jsx(Space, { width: 24 }), _jsx(LakeButton, { style: styles.confirmButton, color: color, onPress: onConfirm, loading: loading, children: confirmText })] })] }));
16
16
  };
@@ -477,18 +477,18 @@ export const DatePicker = ({ label, value, error, format, firstWeekDay, isSelect
477
477
  const ref = useRef(null);
478
478
  const [isOpened, { open, close }] = useDisclosure(false);
479
479
  const popoverId = useId();
480
- return (_jsxs(_Fragment, { children: [_jsx(Box, { direction: "row", alignItems: "end", children: _jsx(LakeLabel, { label: label, style: styles.label, actions: _jsx(LakeButton, { mode: "secondary", icon: "calendar-ltr-regular", size: "small", onPress: open, ariaLabel: t("common.open") }), render: id => (_jsx(Rifm, { value: value ?? "", onChange: onChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { ref: ref, id: id, placeholder: format, value: value, error: error, onChange: onChange, ariaExpanded: isOpened })) })) }) }), _jsx(Popover, { id: popoverId, role: "dialog", onDismiss: close, referenceRef: ref, visible: isOpened, field: true, children: _jsx(View, { style: desktop ? styles.popoverDesktop : styles.popover, children: _jsx(DatePickerPopoverContent, { value: value, format: format, firstWeekDay: firstWeekDay, desktop: desktop, isSelectable: isSelectable, onChange: onChange }) }) })] }));
480
+ return (_jsxs(_Fragment, { children: [_jsx(Box, { direction: "row", alignItems: "end", children: _jsx(LakeLabel, { label: label, style: styles.label, actions: _jsx(LakeButton, { mode: "secondary", icon: "calendar-ltr-regular", size: "small", onPress: open, ariaLabel: t("common.open") }), render: id => (_jsx(Rifm, { value: value !== null && value !== void 0 ? value : "", onChange: onChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { ref: ref, id: id, placeholder: format, value: value, error: error, onChange: onChange, ariaExpanded: isOpened })) })) }) }), _jsx(Popover, { id: popoverId, role: "dialog", onDismiss: close, referenceRef: ref, visible: isOpened, field: true, children: _jsx(View, { style: desktop ? styles.popoverDesktop : styles.popover, children: _jsx(DatePickerPopoverContent, { value: value, format: format, firstWeekDay: firstWeekDay, desktop: desktop, isSelectable: isSelectable, onChange: onChange }) }) })] }));
481
481
  };
482
482
  export const DatePickerModal = ({ value, format, firstWeekDay, isSelectable, onChange, visible, label, cancelLabel, confirmLabel, validate, onDissmiss, }) => {
483
483
  const { desktop } = useResponsive(DATE_PICKER_MOBILE_THRESHOLD);
484
484
  const { Field, submitForm, setFieldValue, resetField } = useForm({
485
485
  date: {
486
- initialValue: value ?? "",
486
+ initialValue: value !== null && value !== void 0 ? value : "",
487
487
  validate,
488
488
  },
489
489
  });
490
490
  const handleCancel = () => {
491
- setFieldValue("date", value ?? "");
491
+ setFieldValue("date", value !== null && value !== void 0 ? value : "");
492
492
  onDissmiss();
493
493
  };
494
494
  const handleConfirm = () => {
@@ -616,7 +616,7 @@ export const DateRangePicker = ({ value, error, format, startLabel, endLabel, fi
616
616
  const handleEndChange = useCallback((end) => {
617
617
  onChange({ start: value.start, end });
618
618
  }, [value, onChange]);
619
- return (_jsxs(View, { children: [_jsxs(Box, { direction: "row", alignItems: "end", children: [_jsx(LakeLabel, { label: startLabel, style: styles.label, render: id => (_jsx(Rifm, { value: value.start, onChange: handleStartChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { ref: ref, id: id, placeholder: format, value: value, onChange: onChange, error: error, hideErrors: true, ariaExpanded: isOpened })) })) }), _jsx(Space, { width: 12 }), _jsx(Box, { style: styles.arrowContainer, justifyContent: "center", children: _jsx(Icon, { name: "arrow-right-filled", size: 20 }) }), _jsx(Space, { width: 12 }), _jsx(LakeLabel, { label: endLabel, style: styles.label, render: id => (_jsx(Rifm, { value: value.end, onChange: handleEndChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { id: id, placeholder: format, value: value, onChange: onChange, error: error, hideErrors: true, ariaExpanded: isOpened })) })) }), _jsx(Space, { width: 12 }), _jsx(LakeButton, { mode: "secondary", icon: "calendar-ltr-regular", size: "small", onPress: open, ariaLabel: t("common.open") })] }), _jsx(Space, { height: 4 }), _jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], children: error ?? " " }), _jsx(DateModal, { visible: isOpened, maxWidth: 900, withCloseButton: true, onPressClose: close, children: _jsx(DateRangePickerModalContent, { value: value, format: format, firstWeekDay: firstWeekDay, desktop: desktop, displayTwoCalendar: displayTwoCalendar, isSelectable: isSelectable, onChange: onChange }) })] }));
619
+ return (_jsxs(View, { children: [_jsxs(Box, { direction: "row", alignItems: "end", children: [_jsx(LakeLabel, { label: startLabel, style: styles.label, render: id => (_jsx(Rifm, { value: value.start, onChange: handleStartChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { ref: ref, id: id, placeholder: format, value: value, onChange: onChange, error: error, hideErrors: true, ariaExpanded: isOpened })) })) }), _jsx(Space, { width: 12 }), _jsx(Box, { style: styles.arrowContainer, justifyContent: "center", children: _jsx(Icon, { name: "arrow-right-filled", size: 20 }) }), _jsx(Space, { width: 12 }), _jsx(LakeLabel, { label: endLabel, style: styles.label, render: id => (_jsx(Rifm, { value: value.end, onChange: handleEndChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { id: id, placeholder: format, value: value, onChange: onChange, error: error, hideErrors: true, ariaExpanded: isOpened })) })) }), _jsx(Space, { width: 12 }), _jsx(LakeButton, { mode: "secondary", icon: "calendar-ltr-regular", size: "small", onPress: open, ariaLabel: t("common.open") })] }), _jsx(Space, { height: 4 }), _jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], children: error !== null && error !== void 0 ? error : " " }), _jsx(DateModal, { visible: isOpened, maxWidth: 900, withCloseButton: true, onPressClose: close, children: _jsx(DateRangePickerModalContent, { value: value, format: format, firstWeekDay: firstWeekDay, desktop: desktop, displayTwoCalendar: displayTwoCalendar, isSelectable: isSelectable, onChange: onChange }) })] }));
620
620
  };
621
621
  export const DateRangePickerModal = ({ value, error, format, firstWeekDay, isSelectable, onChange, visible, startLabel, endLabel, cancelLabel, confirmLabel, onDissmiss, }) => {
622
622
  const { desktop } = useResponsive(MODALE_MOBILE_THRESHOLD);
@@ -639,5 +639,5 @@ export const DateRangePickerModal = ({ value, error, format, firstWeekDay, isSel
639
639
  onChange(localeValue);
640
640
  onDissmiss();
641
641
  };
642
- return (_jsxs(DateModal, { visible: visible, maxWidth: 900, onPressClose: handleCancel, children: [_jsxs(View, { children: [_jsxs(Box, { direction: "row", alignItems: "end", children: [_jsx(LakeLabel, { label: startLabel, style: styles.label, render: id => (_jsx(Rifm, { value: localeValue.start, onChange: handleStartChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { id: id, placeholder: format, value: value, onChange: onChange, error: error, hideErrors: true })) })) }), _jsx(Space, { width: 12 }), _jsx(Box, { style: styles.arrowContainer, justifyContent: "center", children: _jsx(Icon, { name: "arrow-right-filled", size: 20 }) }), _jsx(Space, { width: 12 }), _jsx(LakeLabel, { label: endLabel, style: styles.label, render: id => (_jsx(Rifm, { value: localeValue.end, onChange: handleEndChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { id: id, placeholder: format, value: value, onChange: onChange, error: error, hideErrors: true })) })) })] }), _jsx(Space, { height: 4 }), _jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], children: error ?? " " })] }), _jsx(DateRangePickerModalContent, { value: localeValue, format: format, firstWeekDay: firstWeekDay, desktop: desktop, displayTwoCalendar: displayTwoCalendar, isSelectable: isSelectable, onChange: setLocaleValue }), _jsx(Space, { height: 24 }), _jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(LakeButton, { mode: "secondary", size: "small", onPress: handleCancel, style: styles.button, children: cancelLabel }), _jsx(Space, { width: 24 }), _jsx(LakeButton, { color: "current", size: "small", onPress: handleConfirm, style: styles.button, children: confirmLabel })] })] }));
642
+ return (_jsxs(DateModal, { visible: visible, maxWidth: 900, onPressClose: handleCancel, children: [_jsxs(View, { children: [_jsxs(Box, { direction: "row", alignItems: "end", children: [_jsx(LakeLabel, { label: startLabel, style: styles.label, render: id => (_jsx(Rifm, { value: localeValue.start, onChange: handleStartChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { id: id, placeholder: format, value: value, onChange: onChange, error: error, hideErrors: true })) })) }), _jsx(Space, { width: 12 }), _jsx(Box, { style: styles.arrowContainer, justifyContent: "center", children: _jsx(Icon, { name: "arrow-right-filled", size: 20 }) }), _jsx(Space, { width: 12 }), _jsx(LakeLabel, { label: endLabel, style: styles.label, render: id => (_jsx(Rifm, { value: localeValue.end, onChange: handleEndChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { id: id, placeholder: format, value: value, onChange: onChange, error: error, hideErrors: true })) })) })] }), _jsx(Space, { height: 4 }), _jsx(LakeText, { variant: "smallRegular", color: colors.negative[500], children: error !== null && error !== void 0 ? error : " " })] }), _jsx(DateRangePickerModalContent, { value: localeValue, format: format, firstWeekDay: firstWeekDay, desktop: desktop, displayTwoCalendar: displayTwoCalendar, isSelectable: isSelectable, onChange: setLocaleValue }), _jsx(Space, { height: 24 }), _jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(LakeButton, { mode: "secondary", size: "small", onPress: handleCancel, style: styles.button, children: cancelLabel }), _jsx(Space, { width: 24 }), _jsx(LakeButton, { color: "current", size: "small", onPress: handleConfirm, style: styles.button, children: confirmLabel })] })] }));
643
643
  };
@@ -7,8 +7,9 @@ import { usePlacekit } from "../hooks/usePlacekit";
7
7
  export const PlacekitAddressSearchInput = ({ inputRef, id, country, disabled, error, value, onValueChange, onSuggestion, language, placeholder, shouldDisplaySuggestions = true, emptyResultText, apiKey, }) => {
8
8
  const placekit = usePlacekit({ apiKey });
9
9
  const loadSuggestions = useCallback((value) => {
10
+ var _a;
10
11
  if (placekit != null) {
11
- const countries = Array.filterMap(countriesWithMultipleCCA3[country] ?? [country], cca3 => Option.fromNullable(getCCA2forCCA3(cca3)));
12
+ const countries = Array.filterMap((_a = countriesWithMultipleCCA3[country]) !== null && _a !== void 0 ? _a : [country], cca3 => Option.fromNullable(getCCA2forCCA3(cca3)));
12
13
  const cca2Countries = countries.length === 0 ? Option.None() : Option.Some(countries);
13
14
  return Future.fromPromise(placekit.search(value, {
14
15
  types: ["street"],
@@ -23,7 +24,7 @@ export const PlacekitAddressSearchInput = ({ inputRef, id, country, disabled, er
23
24
  return Future.value(Result.Ok([]));
24
25
  }, [placekit, country, language]);
25
26
  const onSuggestionSelected = useCallback((suggestion) => {
26
- onSuggestion?.({
27
+ onSuggestion === null || onSuggestion === void 0 ? void 0 : onSuggestion({
27
28
  completeAddress: suggestion.value.name,
28
29
  postalCode: suggestion.value.zipcode[0],
29
30
  city: suggestion.value.city,
@@ -10,7 +10,7 @@ export const PlacekitCityInput = ({ value, onValueChange, country, disabled, pla
10
10
  const loadSuggestions = useCallback((value) => {
11
11
  if (placekit != null) {
12
12
  const countries = Option.fromNullable(country)
13
- .map(country => countriesWithMultipleCCA3[country] ?? [country])
13
+ .map(country => { var _a; return (_a = countriesWithMultipleCCA3[country]) !== null && _a !== void 0 ? _a : [country]; })
14
14
  .map(cca3Codes => Array.filterMap(cca3Codes, cca3 => Option.fromNullable(getCCA2forCCA3(cca3))))
15
15
  .flatMap(array => (array.length === 0 ? Option.None() : Option.Some(array)));
16
16
  return Future.fromPromise(placekit.search(value, {
@@ -25,7 +25,7 @@ export const PlacekitCityInput = ({ value, onValueChange, country, disabled, pla
25
25
  return Future.value(Result.Ok([]));
26
26
  }, [placekit, country]);
27
27
  const onSuggestionSelected = useCallback((suggestion) => {
28
- onSuggestion?.({
28
+ onSuggestion === null || onSuggestion === void 0 ? void 0 : onSuggestion({
29
29
  city: suggestion.value.city,
30
30
  postalCode: suggestion.value.zipcode[0],
31
31
  });
@@ -34,7 +34,7 @@ export const SupportChat = ({ children, accentColor, type, additionalInfo }) =>
34
34
  useEffect(() => {
35
35
  // @ts-expect-error
36
36
  window.zESettings = {
37
- color: { theme: accentColor ?? "#26232f" },
37
+ color: { theme: accentColor !== null && accentColor !== void 0 ? accentColor : "#26232f" },
38
38
  };
39
39
  }, [accentColor]);
40
40
  useEffect(() => {
@@ -43,7 +43,7 @@ export const SupportChat = ({ children, accentColor, type, additionalInfo }) =>
43
43
  zendeskApi.onResolve(() => {
44
44
  try {
45
45
  zE("webWidget", "updateSettings", {
46
- color: { theme: accentColor ?? "#26232f" },
46
+ color: { theme: accentColor !== null && accentColor !== void 0 ? accentColor : "#26232f" },
47
47
  webWidget: {
48
48
  contactForm: {
49
49
  fields: Array.filterMap(values, ([key, value]) => value != null
@@ -47,11 +47,13 @@ const Help = (props) => {
47
47
  .exhaustive();
48
48
  };
49
49
  export const SupportingDocument = forwardRef(({ documents, getAwsUrl, onChange, requiredDocumentTypes, onboardingLanguage = locale.language }, externalRef) => {
50
+ var _a, _b, _c, _d, _e, _f, _g, _h;
50
51
  const initialValues = useMemo(() => documents.reduce((acc, doc) => {
52
+ var _a;
51
53
  return {
52
54
  ...acc,
53
55
  [doc.purpose]: [
54
- ...(acc[doc.purpose] ?? []),
56
+ ...((_a = acc[doc.purpose]) !== null && _a !== void 0 ? _a : []),
55
57
  {
56
58
  status: "finished",
57
59
  id: doc.id,
@@ -65,35 +67,35 @@ export const SupportingDocument = forwardRef(({ documents, getAwsUrl, onChange,
65
67
  const [showSwornStatementModal, setShowSwornStatementModal] = useState(false);
66
68
  const { Field, setFieldValue, getFieldState, listenFields, submitForm } = useForm({
67
69
  CompanyRegistration: {
68
- initialValue: initialValues["CompanyRegistration"] ?? [],
70
+ initialValue: (_a = initialValues["CompanyRegistration"]) !== null && _a !== void 0 ? _a : [],
69
71
  validate: validateNotEmpty,
70
72
  },
71
73
  AssociationRegistration: {
72
- initialValue: initialValues["AssociationRegistration"] ?? [],
74
+ initialValue: (_b = initialValues["AssociationRegistration"]) !== null && _b !== void 0 ? _b : [],
73
75
  validate: validateNotEmpty,
74
76
  },
75
77
  SignedStatus: {
76
- initialValue: initialValues["SignedStatus"] ?? [],
78
+ initialValue: (_c = initialValues["SignedStatus"]) !== null && _c !== void 0 ? _c : [],
77
79
  validate: validateNotEmpty,
78
80
  },
79
81
  ProofOfIdentity: {
80
- initialValue: initialValues["ProofOfIdentity"] ?? [],
82
+ initialValue: (_d = initialValues["ProofOfIdentity"]) !== null && _d !== void 0 ? _d : [],
81
83
  validate: validateNotEmpty,
82
84
  },
83
85
  UBODeclaration: {
84
- initialValue: initialValues["UBODeclaration"] ?? [],
86
+ initialValue: (_e = initialValues["UBODeclaration"]) !== null && _e !== void 0 ? _e : [],
85
87
  validate: validateNotEmpty,
86
88
  },
87
89
  PowerOfAttorney: {
88
- initialValue: initialValues["PowerOfAttorney"] ?? [],
90
+ initialValue: (_f = initialValues["PowerOfAttorney"]) !== null && _f !== void 0 ? _f : [],
89
91
  validate: validateNotEmpty,
90
92
  },
91
93
  SwornStatement: {
92
- initialValue: initialValues["SwornStatement"] ?? [],
94
+ initialValue: (_g = initialValues["SwornStatement"]) !== null && _g !== void 0 ? _g : [],
93
95
  validate: validateNotEmpty,
94
96
  },
95
97
  GeneralAssemblyMinutes: {
96
- initialValue: initialValues["GeneralAssemblyMinutes"] ?? [],
98
+ initialValue: (_h = initialValues["GeneralAssemblyMinutes"]) !== null && _h !== void 0 ? _h : [],
97
99
  validate: validateNotEmpty,
98
100
  },
99
101
  });
@@ -110,7 +112,7 @@ export const SupportingDocument = forwardRef(({ documents, getAwsUrl, onChange,
110
112
  Object.entries(state).forEach(([key, { value: values }]) => {
111
113
  documents = [
112
114
  ...documents,
113
- ...(values ?? []).map(v => ({
115
+ ...(values !== null && values !== void 0 ? values : []).map(v => ({
114
116
  id: v.id,
115
117
  name: v.name,
116
118
  downloadUrl: v.fileUrl,
@@ -118,7 +120,7 @@ export const SupportingDocument = forwardRef(({ documents, getAwsUrl, onChange,
118
120
  })),
119
121
  ];
120
122
  });
121
- onChange?.(documents);
123
+ onChange === null || onChange === void 0 ? void 0 : onChange(documents);
122
124
  });
123
125
  return () => removeListener();
124
126
  }, [listenFields, onChange]);
@@ -122,6 +122,7 @@ const UploadAreaPreview = ({ file }) => {
122
122
  return _jsx(View, { style: [styles.preview, { backgroundImage: `url("${url}")` }] });
123
123
  };
124
124
  export const UploadArea = ({ icon, accept, value, documents = [], disabled = false, onRemoveFile, onRemoveDocument, onDropAccepted, onDropRejected, layout = "vertical", description, error, maxSize, }) => {
125
+ var _a;
125
126
  const [isHovered, setIsHovered] = useBoolean(false);
126
127
  const { getRootProps, getInputProps, isDragActive, fileRejections } = useDropzone({
127
128
  accept: accept.reduce((acc, item) => ({ ...acc, [item]: [] }), {}),
@@ -142,7 +143,7 @@ export const UploadArea = ({ icon, accept, value, documents = [], disabled = fal
142
143
  browse: _jsx(Text, { style: styles.browse, children: t("uploadArea.browse") }),
143
144
  }) }), isNotNullish(error) ? (_jsxs(_Fragment, { children: [_jsx(Space, { height: 4 }), _jsx(LakeText, { color: colors.negative[400], align: layout === "horizontal" ? "left" : "center", children: error })] })) : (!disabled &&
144
145
  isNotNullish(description) && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 4 }), _jsx(LakeText, { align: layout === "horizontal" ? "left" : "center", children: description })] })))] })] }));
145
- return (_jsxs(View, { style: commonStyles.fill, children: [_jsx("div", { ...getRootProps(), onMouseEnter: setIsHovered.on, onMouseLeave: setIsHovered.off, children: _jsxs(View, { "aria-errormessage": error ?? fileRejections[0]?.errors.join(", "), style: [
146
+ return (_jsxs(View, { style: commonStyles.fill, children: [_jsx("div", { ...getRootProps(), onMouseEnter: setIsHovered.on, onMouseLeave: setIsHovered.off, children: _jsxs(View, { "aria-errormessage": error !== null && error !== void 0 ? error : (_a = fileRejections[0]) === null || _a === void 0 ? void 0 : _a.errors.join(", "), style: [
146
147
  styles.container,
147
148
  disabled && styles.disabled,
148
149
  layout === "horizontal" && styles.horizontalContainer,
@@ -157,8 +158,14 @@ export const UploadArea = ({ icon, accept, value, documents = [], disabled = fal
157
158
  })
158
159
  : browseElement] }) }), documents.map(({ ...document }, index) => {
159
160
  return (_jsxs(Fragment, { children: [_jsx(Space, { height: index === 0 ? 8 : 4 }), match(document)
160
- .with({ status: "finished" }, () => (_jsx(FileTile, { name: document.name ?? t("uploadArea.unknownFileName"), url: document.fileUrl, onRemove: onRemoveDocument ? () => onRemoveDocument(document.id) : undefined })))
161
- .with({ status: "failed" }, ({ error }) => (_jsx(FileTile, { name: document.name ?? t("uploadArea.unknownFileName"), url: document.fileUrl, onRemove: () => (onRemoveDocument ? onRemoveDocument(document.id) : undefined), variant: "refused", title: error })))
161
+ .with({ status: "finished" }, () => {
162
+ var _a;
163
+ return (_jsx(FileTile, { name: (_a = document.name) !== null && _a !== void 0 ? _a : t("uploadArea.unknownFileName"), url: document.fileUrl, onRemove: onRemoveDocument ? () => onRemoveDocument(document.id) : undefined }));
164
+ })
165
+ .with({ status: "failed" }, ({ error }) => {
166
+ var _a;
167
+ return (_jsx(FileTile, { name: (_a = document.name) !== null && _a !== void 0 ? _a : t("uploadArea.unknownFileName"), url: document.fileUrl, onRemove: () => (onRemoveDocument ? onRemoveDocument(document.id) : undefined), variant: "refused", title: error }));
168
+ })
162
169
  .with({ status: "uploading" }, ({ progress }) => (_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}%` }] }) })] })))
163
170
  .exhaustive()] }, document.id));
164
171
  })] }));
@@ -1,3 +1,4 @@
1
+ var _a, _b;
1
2
  import { Result } from "@swan-io/boxed";
2
3
  import { deburr } from "@swan-io/lake/src/utils/string";
3
4
  import { locale } from "../utils/i18n";
@@ -1744,7 +1745,7 @@ const countryNameResolver = Result.fromExecution(() => {
1744
1745
  export const countries = readonlyCountries
1745
1746
  .map(country => {
1746
1747
  const name = countryNameResolver.match({
1747
- Ok: resolver => resolver.of(country.cca2) ?? country.name,
1748
+ Ok: resolver => { var _a; return (_a = resolver.of(country.cca2)) !== null && _a !== void 0 ? _a : country.name; },
1748
1749
  Error: () => country.name,
1749
1750
  });
1750
1751
  return {
@@ -1757,8 +1758,8 @@ export const countries = readonlyCountries
1757
1758
  .sort((countryA, countryB) => {
1758
1759
  return countryA.name.localeCompare(countryB.name);
1759
1760
  });
1760
- export const getCCA2forCCA3 = (cca3) => countries.find(country => country.cca3 === cca3)?.cca2;
1761
- export const getCCA3forCCA2 = (cca2) => countries.find(country => country.cca2 === cca2)?.cca3;
1761
+ export const getCCA2forCCA3 = (cca3) => { var _a; return (_a = countries.find(country => country.cca3 === cca3)) === null || _a === void 0 ? void 0 : _a.cca2; };
1762
+ export const getCCA3forCCA2 = (cca2) => { var _a; return (_a = countries.find(country => country.cca2 === cca2)) === null || _a === void 0 ? void 0 : _a.cca3; };
1762
1763
  export const companyWithUboCountries = ["BEL", "DEU", "FRA", "ITA", "LTU", "LUX", "NLD"];
1763
1764
  export const allCountries = countries.map(country => country.cca3);
1764
1765
  export const france = countries.find(country => country.cca3 === "FRA");
@@ -1845,6 +1846,6 @@ const navigatorCountries = navigator.languages.reduce((acc, lang) => {
1845
1846
  }
1846
1847
  return acc;
1847
1848
  }, []);
1848
- export const companyFallbackCountry = companyCountries.find(cca3 => navigatorCountries.includes(cca3)) ?? "FRA";
1849
- export const individualFallbackCountry = individualCountries.find(cca3 => navigatorCountries.includes(cca3)) ?? "FRA";
1850
- export const getCountryName = (cca3) => countries.find(country => country.cca3 === cca3)?.name ?? cca3;
1849
+ export const companyFallbackCountry = (_a = companyCountries.find(cca3 => navigatorCountries.includes(cca3))) !== null && _a !== void 0 ? _a : "FRA";
1850
+ export const individualFallbackCountry = (_b = individualCountries.find(cca3 => navigatorCountries.includes(cca3))) !== null && _b !== void 0 ? _b : "FRA";
1851
+ export const getCountryName = (cca3) => { var _a, _b; return (_b = (_a = countries.find(country => country.cca3 === cca3)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : cca3; };
@@ -117,5 +117,6 @@ const defaultRegistrationNumbersConfig = {
117
117
  registrationNumberLabel: t("registrationPage.defaultNumberLabel"),
118
118
  };
119
119
  export const getRegistrationNumbersConfig = ({ country, companyType, }) => {
120
- return (registrationNumbersConfigByCountry[country]?.[companyType] ?? defaultRegistrationNumbersConfig);
120
+ var _a, _b;
121
+ return ((_b = (_a = registrationNumbersConfigByCountry[country]) === null || _a === void 0 ? void 0 : _a[companyType]) !== null && _b !== void 0 ? _b : defaultRegistrationNumbersConfig);
121
122
  };
@@ -20,10 +20,11 @@ const termsAndConditions = {
20
20
  };
21
21
  const defaultTerms = termsAndConditions.FRA;
22
22
  export const getTermsAndConditionsPathByAccountCountryAndLocale = ({ rootUrl, accountCountry, locale, }) => {
23
+ var _a;
23
24
  const rootUrlWithSlash = rootUrl.endsWith("/") ? rootUrl : rootUrl + "/";
24
25
  if (accountCountry == null) {
25
26
  return rootUrlWithSlash + defaultTerms[locale];
26
27
  }
27
- const termsByLocale = termsAndConditions[accountCountry] ?? defaultTerms;
28
+ const termsByLocale = (_a = termsAndConditions[accountCountry]) !== null && _a !== void 0 ? _a : defaultTerms;
28
29
  return rootUrlWithSlash + termsByLocale[locale];
29
30
  };
@@ -8,11 +8,12 @@ export const getLanguagesHelpers = (languages) => {
8
8
  supportedLanguages = isNullish(supportedLanguages)
9
9
  ? languages
10
10
  : intersection(supportedLanguages, languages);
11
- const isSupportedLanguage = (language) => (supportedLanguages ?? []).includes(language);
12
- const getFirstSupportedLanguage = (languages) => languages.find(isSupportedLanguage) ?? LANGUAGE_FALLBACK;
11
+ const isSupportedLanguage = (language) => (supportedLanguages !== null && supportedLanguages !== void 0 ? supportedLanguages : []).includes(language);
12
+ const getFirstSupportedLanguage = (languages) => { var _a; return (_a = languages.find(isSupportedLanguage)) !== null && _a !== void 0 ? _a : LANGUAGE_FALLBACK; };
13
13
  const getPreferredLanguage = () => {
14
+ var _a;
14
15
  try {
15
- return localStorage.getItem(PREFERRED_LANGUAGE_KEY) ?? undefined;
16
+ return (_a = localStorage.getItem(PREFERRED_LANGUAGE_KEY)) !== null && _a !== void 0 ? _a : undefined;
16
17
  }
17
18
  catch {
18
19
  return;
@@ -32,8 +33,9 @@ export const getLanguagesHelpers = (languages) => {
32
33
  }
33
34
  },
34
35
  getBestLocale: (locales) => {
36
+ var _a;
35
37
  const searchParams = new URLSearchParams(document.location.search);
36
- const langParam = searchParams.get("lang")?.split("-")[0];
38
+ const langParam = (_a = searchParams.get("lang")) === null || _a === void 0 ? void 0 : _a.split("-")[0];
37
39
  if (isNotNullish(langParam) && isSupportedLanguage(langParam)) {
38
40
  return locales[langParam]();
39
41
  }