@swan-io/shared-business 2.7.19 → 2.7.20

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": "2.7.19",
3
+ "version": "2.7.20",
4
4
  "engines": {
5
5
  "node": ">=18.0.0",
6
6
  "yarn": "^1.22.0"
@@ -49,9 +49,14 @@ const validateCca3CountryCode = value => {
49
49
  }
50
50
  };
51
51
  export const validateUbo = (editorState, accountCountry) => {
52
- const isAddressRequired = accountCountry === "DEU" || accountCountry === "ESP";
53
- const isBirthInfoRequired = accountCountry !== "DEU";
54
- const isTaxIdentificationNumberRequired = accountCountry === "DEU" && editorState.residencyAddressCountry === "DEU";
52
+ const isAddressRequired = match(accountCountry)
53
+ .with("DEU", "ESP", "NLD", () => true)
54
+ .otherwise(() => false);
55
+ const isBirthInfoRequired = match(accountCountry)
56
+ .with("ESP", "FRA", "NLD", () => true)
57
+ .otherwise(() => false);
58
+ const isTaxIdentificationNumberRequired = (accountCountry === "DEU" && editorState.residencyAddressCountry === "DEU") ||
59
+ accountCountry === "NLD";
55
60
  const validateTaxNumber = isTaxIdentificationNumberRequired
56
61
  ? combineValidators(validateNullableRequired, validateIndividualTaxNumber(accountCountry))
57
62
  : validateIndividualTaxNumber(accountCountry);
@@ -152,8 +157,12 @@ const requiredStepFields = [
152
157
  ];
153
158
  export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step, googleMapApiKey, onStepChange, onClose, onSave, onCityLoadError, }, ref) => {
154
159
  const [reference] = useState(() => initialState?.reference ?? uuid());
155
- const isAddressRequired = accountCountry === "DEU" || accountCountry === "ESP";
156
- const isBirthInfoRequired = accountCountry !== "DEU";
160
+ const isAddressRequired = match(accountCountry)
161
+ .with("DEU", "ESP", "NLD", () => true)
162
+ .otherwise(() => false);
163
+ const isBirthInfoRequired = match(accountCountry)
164
+ .with("ESP", "FRA", "NLD", () => true)
165
+ .otherwise(() => false);
157
166
  const initialAddress = useRef({
158
167
  residencyAddressLine1: initialState?.residencyAddressLine1,
159
168
  residencyAddressCity: initialState?.residencyAddressCity,
@@ -237,7 +246,7 @@ export const BeneficiaryForm = forwardRef(({ initialState, accountCountry, step,
237
246
  initialValue: initialState?.taxIdentificationNumber,
238
247
  validate: (value, { getFieldState }) => {
239
248
  const uboCountry = getFieldState("country").value;
240
- if (accountCountry === "DEU" && uboCountry === "DEU") {
249
+ if ((accountCountry === "DEU" && uboCountry === "DEU") || accountCountry === "NLD") {
241
250
  return combineValidators(validateNullableRequired, validateIndividualTaxNumber(accountCountry))(value);
242
251
  }
243
252
  return validateIndividualTaxNumber(accountCountry)(value);