@swan-io/shared-business 13.1.10 → 13.2.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": "13.1.10",
3
+ "version": "13.2.0",
4
4
  "engines": {
5
5
  "node": "^22.12.0"
6
6
  },
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
- "@swan-io/lake": "13.1.10"
28
+ "@swan-io/lake": "13.2.0"
29
29
  },
30
30
  "dependencies": {
31
31
  "@formatjs/intl": "^3.1.6",
@@ -50,6 +50,6 @@
50
50
  "@types/react-dom": "^19.1.7",
51
51
  "@types/react-native": "^0.72.8",
52
52
  "type-fest": "^4.41.0",
53
- "@swan-io/lake": "13.1.10"
53
+ "@swan-io/lake": "13.2.0"
54
54
  }
55
55
  }
@@ -132,14 +132,12 @@ export const SupportingDocumentCollection = ({ ref, documents, generateUpload, u
132
132
  var _a, _b;
133
133
  const metadata = getPurposeMetadata === null || getPurposeMetadata === void 0 ? void 0 : getPurposeMetadata(purpose);
134
134
  const label = (_a = purposeDescriptionLabelOverrides === null || purposeDescriptionLabelOverrides === void 0 ? void 0 : purposeDescriptionLabelOverrides[purpose]) !== null && _a !== void 0 ? _a : getSupportingDocumentPurposeDescriptionLabel(purpose);
135
- return (_jsxs(Fragment, { children: [_jsx(LakeLabel, { label: (_b = purposeLabelOverrides === null || purposeLabelOverrides === void 0 ? void 0 : purposeLabelOverrides[purpose]) !== null && _b !== void 0 ? _b : getSupportingDocumentPurposeLabel(purpose), description: label, help: isNotNullish(metadata) ? (purpose === "CompanyRegistration" ? (_jsx(LakeButton, { size: "small", mode: "tertiary", icon: "question-circle-regular", onPress: () => window.open(getSupportLink(locale.language)), ariaLabel: t("supportingDocuments.help.howToSendAGoodDocument"), children: t("supportingDocuments.help.howToSendAGoodDocument") })) : (_jsx(Help, { type: "button", label: metadata.title, onPress: () => setCurrentMetadata(metadata) }))) : (match(purpose)
136
- .with("PowerOfAttorney", () => (_jsx(Help, { type: "button", icon: "arrow-down-filled", label: t("supportingDocuments.help.downloadTemplate"), onPress: () => setShowPowerOfAttorneyModal(true) })))
137
- .with("SwornStatement", () => (_jsx(Help, { type: "button", icon: "arrow-down-filled", label: t("supportingDocuments.help.downloadTemplate"), onPress: () => setShowSwornStatementModal(true) })))
138
- .with("CompanyRegistration", () => (_jsx(LakeButton, { size: "small", mode: "tertiary", icon: "question-circle-regular", onPress: () => window.open(getSupportLink(locale.language)), ariaLabel: t("supportingDocuments.help.howToSendAGoodDocument"), children: t("supportingDocuments.help.howToSendAGoodDocument") })))
139
- .otherwise(() => null)), render: () => (_jsxs(_Fragment, { children: [_jsx(Box, { direction: "row", children: match(purpose)
140
- .with("PowerOfAttorney", () => (_jsx(Help, { type: "button", icon: "arrow-down-filled", label: t("supportingDocuments.help.downloadTemplate"), onPress: () => setShowPowerOfAttorneyModal(true) })))
141
- .with("SwornStatement", () => (_jsx(Help, { type: "button", icon: "arrow-down-filled", label: t("supportingDocuments.help.downloadTemplate"), onPress: () => setShowSwornStatementModal(true) })))
142
- .otherwise(() => null) }), _jsx(Space, { height: 16 }), _jsx(FilesUploader, { ref: ref => {
135
+ return (_jsxs(Fragment, { children: [_jsx(LakeLabel, { label: (_b = purposeLabelOverrides === null || purposeLabelOverrides === void 0 ? void 0 : purposeLabelOverrides[purpose]) !== null && _b !== void 0 ? _b : getSupportingDocumentPurposeLabel(purpose), description: label, render: () => (_jsxs(_Fragment, { children: [_jsxs(Box, { direction: "row", children: [_jsx(Box, { direction: "row", children: isNotNullish(metadata) ? (purpose === "CompanyRegistration" ? (_jsxs(_Fragment, { children: [_jsx(LakeButton, { size: "small", mode: "secondary", icon: "question-circle-regular", onPress: () => window.open(getSupportLink(locale.language)), ariaLabel: t("supportingDocuments.help.howToSendAGoodDocument"), children: t("supportingDocuments.help.howToSendAGoodDocument") }), _jsx(Space, { width: 8 })] })) : (_jsxs(_Fragment, { children: [_jsx(Help, { type: "button", label: metadata.title, onPress: () => setCurrentMetadata(metadata) }), _jsx(Space, { width: 8 })] }))) : (match(purpose)
136
+ .with("CompanyRegistration", () => (_jsx(LakeButton, { size: "small", mode: "secondary", icon: "question-circle-regular", onPress: () => window.open(getSupportLink(locale.language)), ariaLabel: t("supportingDocuments.help.howToSendAGoodDocument"), children: t("supportingDocuments.help.howToSendAGoodDocument") })))
137
+ .otherwise(() => null)) }), match(purpose)
138
+ .with("PowerOfAttorney", () => (_jsx(Help, { type: "button", icon: "arrow-down-filled", label: t("supportingDocuments.help.downloadTemplate"), onPress: () => setShowPowerOfAttorneyModal(true) })))
139
+ .with("SwornStatement", () => (_jsx(Help, { type: "button", icon: "arrow-down-filled", label: t("supportingDocuments.help.downloadTemplate"), onPress: () => setShowSwornStatementModal(true) })))
140
+ .otherwise(() => null)] }), _jsx(Space, { height: 16 }), _jsx(FilesUploader, { ref: ref => {
143
141
  filesUploaderRefByPurpose.current[purpose] = ref;
144
142
  },
145
143
  // Only allow uploading is the Supporting Document Collection awaits for docs
@@ -1,6 +1,6 @@
1
1
  import { Ref } from "react";
2
2
  import { TextInput } from "react-native";
3
- import { AccountCountry } from "../utils/templateTranslations";
3
+ import { CompanyCountryCCA3, IndividualCountryCCA3 } from "../constants/countries";
4
4
  type Props = {
5
5
  ref?: Ref<TextInput>;
6
6
  value: string;
@@ -9,11 +9,11 @@ type Props = {
9
9
  disabled?: boolean;
10
10
  onChange: (value: string) => void;
11
11
  onBlur?: () => void;
12
- accountCountry: AccountCountry;
12
+ country: IndividualCountryCCA3 | CompanyCountryCCA3;
13
13
  isCompany: boolean;
14
14
  required?: boolean;
15
15
  label?: string;
16
16
  placeholder?: string;
17
17
  };
18
- export declare const TaxIdentificationNumberInput: ({ ref, value, error, valid, disabled, onChange, onBlur, accountCountry, isCompany, required, label, placeholder, }: Props) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const TaxIdentificationNumberInput: ({ ref, value, error, valid, disabled, onChange, onBlur, country, isCompany, required, label, placeholder, }: Props) => import("react/jsx-runtime").JSX.Element;
19
19
  export {};
@@ -6,11 +6,9 @@ import { LakeTooltip } from "@swan-io/lake/src/components/LakeTooltip";
6
6
  import { colors } from "@swan-io/lake/src/constants/design";
7
7
  import { t } from "../utils/i18n";
8
8
  import { getCompanyTaxNumberHelp, getCompanyTaxNumberPlaceholder, getIndividualTaxNumberHelp, getIndividualTaxNumberPlaceholder, getTaxNumberTooltip, } from "../utils/templateTranslations";
9
- export const TaxIdentificationNumberInput = ({ ref, value, error, valid, disabled, onChange, onBlur, accountCountry, isCompany, required, label = t("taxIdentificationNumber.label"), placeholder = isCompany
10
- ? getCompanyTaxNumberPlaceholder(accountCountry)
11
- : getIndividualTaxNumberPlaceholder(accountCountry), }) => {
12
- const tooltipContents = getTaxNumberTooltip(accountCountry);
13
- return (_jsx(LakeLabel, { label: label, optionalLabel: required === true ? undefined : t("common.optional"), help: tooltipContents != null ? (_jsx(LakeTooltip, { content: tooltipContents, placement: "right", width: accountCountry === "DEU" ? 800 : undefined, children: _jsx(Icon, { name: "question-circle-regular", size: 16, color: colors.gray[600] }) })) : null, render: id => (_jsx(LakeTextInput, { id: id, ref: ref, placeholder: placeholder, help: isCompany
14
- ? getCompanyTaxNumberHelp(accountCountry)
15
- : getIndividualTaxNumberHelp(accountCountry), value: value, error: error, valid: valid, disabled: disabled, onChangeText: onChange, onBlur: onBlur })) }));
9
+ export const TaxIdentificationNumberInput = ({ ref, value, error, valid, disabled, onChange, onBlur, country, isCompany, required, label = t("taxIdentificationNumber.label"), placeholder = isCompany
10
+ ? getCompanyTaxNumberPlaceholder(country)
11
+ : getIndividualTaxNumberPlaceholder(country), }) => {
12
+ const tooltipContents = getTaxNumberTooltip(country);
13
+ return (_jsx(LakeLabel, { label: label, optionalLabel: required === true ? undefined : t("common.optional"), help: tooltipContents != null ? (_jsx(LakeTooltip, { content: tooltipContents, placement: "right", width: country === "DEU" ? 800 : undefined, children: _jsx(Icon, { name: "question-circle-regular", size: 16, color: colors.gray[600] }) })) : null, render: id => (_jsx(LakeTextInput, { id: id, ref: ref, placeholder: placeholder, help: isCompany ? getCompanyTaxNumberHelp(country) : getIndividualTaxNumberHelp(country), value: value, error: error, valid: valid, disabled: disabled, onChangeText: onChange, onBlur: onBlur })) }));
16
14
  };
@@ -295,6 +295,7 @@
295
295
  "supportingDocuments.downloadTemplate": "Vorlage herunterladen",
296
296
  "supportingDocuments.errorUpload": "Datei konnte nicht hochgeladen werden",
297
297
  "supportingDocuments.help.downloadTemplate": "Vorlage herunterladen",
298
+ "supportingDocuments.help.howToSendAGoodDocument": "Wie sende ich ein gutes Dokument?",
298
299
  "supportingDocuments.help.whatIsThis": "Was ist das?",
299
300
  "supportingDocuments.informations": "Details zum Dokument",
300
301
  "supportingDocuments.noDocuments": "Keine Dokumente.",
@@ -295,6 +295,7 @@
295
295
  "supportingDocuments.downloadTemplate": "Descargar una plantilla",
296
296
  "supportingDocuments.errorUpload": "No se ha podido cargar el archivo",
297
297
  "supportingDocuments.help.downloadTemplate": "Descargar una plantilla",
298
+ "supportingDocuments.help.howToSendAGoodDocument": "¿Cómo enviar un buen documento?",
298
299
  "supportingDocuments.help.whatIsThis": "¿Qué es esto?",
299
300
  "supportingDocuments.informations": "Detalles del documento",
300
301
  "supportingDocuments.noDocuments": "Sin documentos.",
@@ -295,6 +295,7 @@
295
295
  "supportingDocuments.downloadTemplate": "Lataa malli",
296
296
  "supportingDocuments.errorUpload": "Tiedoston lataaminen epäonnistui",
297
297
  "supportingDocuments.help.downloadTemplate": "Lataa malli",
298
+ "supportingDocuments.help.howToSendAGoodDocument": "Kuinka lähettää hyvä asiakirja?",
298
299
  "supportingDocuments.help.whatIsThis": "Mikä tämä on?",
299
300
  "supportingDocuments.informations": "Asiakirjan tiedot",
300
301
  "supportingDocuments.noDocuments": "Ei asiakirjoja.",
@@ -295,6 +295,7 @@
295
295
  "supportingDocuments.downloadTemplate": "Télécharger un modèle",
296
296
  "supportingDocuments.errorUpload": "Le téléchargement du fichier a échoué",
297
297
  "supportingDocuments.help.downloadTemplate": "Télécharger un modèle",
298
+ "supportingDocuments.help.howToSendAGoodDocument": "Comment envoyer un bon document ?",
298
299
  "supportingDocuments.help.whatIsThis": "Qu'est-ce que c'est ?",
299
300
  "supportingDocuments.informations": "Détails du document",
300
301
  "supportingDocuments.noDocuments": "Aucun document.",
@@ -295,6 +295,7 @@
295
295
  "supportingDocuments.downloadTemplate": "Scarica modello",
296
296
  "supportingDocuments.errorUpload": "Impossibile caricare file",
297
297
  "supportingDocuments.help.downloadTemplate": "Scarica un modello",
298
+ "supportingDocuments.help.howToSendAGoodDocument": "Come inviare un buon documento?",
298
299
  "supportingDocuments.help.whatIsThis": "Che cos'è?",
299
300
  "supportingDocuments.informations": "Dettagli documento",
300
301
  "supportingDocuments.noDocuments": "Nessun documento.",
@@ -295,6 +295,7 @@
295
295
  "supportingDocuments.downloadTemplate": "Een sjabloon downloaden",
296
296
  "supportingDocuments.errorUpload": "Bestand uploaden mislukt",
297
297
  "supportingDocuments.help.downloadTemplate": "Een sjabloon downloaden",
298
+ "supportingDocuments.help.howToSendAGoodDocument": "Hoe stuur ik een goed document?",
298
299
  "supportingDocuments.help.whatIsThis": "Wat is dit?",
299
300
  "supportingDocuments.informations": "Documentgegevens",
300
301
  "supportingDocuments.noDocuments": "Geen documenten.",
@@ -295,6 +295,7 @@
295
295
  "supportingDocuments.downloadTemplate": "Descarregar um modelo",
296
296
  "supportingDocuments.errorUpload": "Falha ao carregar ficheiro",
297
297
  "supportingDocuments.help.downloadTemplate": "Descarregar um modelo",
298
+ "supportingDocuments.help.howToSendAGoodDocument": "Como enviar um bom documento?",
298
299
  "supportingDocuments.help.whatIsThis": "O que é isto?",
299
300
  "supportingDocuments.informations": "Detalhes do documento",
300
301
  "supportingDocuments.noDocuments": "Sem documentos.",
@@ -1,6 +1,7 @@
1
+ import { CompanyCountryCCA3, IndividualCountryCCA3 } from "../constants/countries";
1
2
  export type AccountCountry = "DEU" | "ESP" | "FRA" | "NLD" | "ITA" | "BEL";
2
- export declare const getIndividualTaxNumberPlaceholder: (accountCountry: AccountCountry) => string;
3
- export declare const getCompanyTaxNumberPlaceholder: (accountCountry: AccountCountry) => string;
4
- export declare const getTaxNumberTooltip: (accountCountry: AccountCountry) => string | undefined;
5
- export declare const getCompanyTaxNumberHelp: (accountCountry: AccountCountry) => string;
6
- export declare const getIndividualTaxNumberHelp: (accountCountry: AccountCountry) => string;
3
+ export declare const getIndividualTaxNumberPlaceholder: (country: IndividualCountryCCA3 | CompanyCountryCCA3) => string;
4
+ export declare const getCompanyTaxNumberPlaceholder: (country: IndividualCountryCCA3 | CompanyCountryCCA3) => string;
5
+ export declare const getTaxNumberTooltip: (country: IndividualCountryCCA3 | CompanyCountryCCA3) => string | undefined;
6
+ export declare const getCompanyTaxNumberHelp: (country: IndividualCountryCCA3 | CompanyCountryCCA3) => string;
7
+ export declare const getIndividualTaxNumberHelp: (country: IndividualCountryCCA3 | CompanyCountryCCA3) => string;
@@ -1,27 +1,37 @@
1
1
  import { match } from "ts-pattern";
2
2
  import { t } from "./i18n";
3
- export const getIndividualTaxNumberPlaceholder = (accountCountry) => match(accountCountry)
3
+ export const getIndividualTaxNumberPlaceholder = (country) => match(country)
4
4
  .with("DEU", () => `${t("common.form.taxIdentificationNumber.placeholder")} (Steueridentifikationsnummer)`)
5
5
  .with("ESP", () => `${t("common.form.taxIdentificationNumber.placeholder")} (Número de Identificación Fiscal)`)
6
6
  .with("ITA", () => `${t("common.form.taxIdentificationNumber.placeholder")} (Codice fiscale)`)
7
7
  .otherwise(() => t("common.form.taxIdentificationNumber.placeholder"));
8
- export const getCompanyTaxNumberPlaceholder = (accountCountry) => match(accountCountry)
8
+ export const getCompanyTaxNumberPlaceholder = (country) => match(country)
9
9
  .with("DEU", () => `${t("common.form.taxIdentificationNumber.placeholder")} (Steuer-Nummer)`)
10
10
  .with("ESP", () => `${t("common.form.taxIdentificationNumber.placeholder")} (Número de Identificación Fiscal)`)
11
11
  .with("ITA", () => `${t("common.form.taxIdentificationNumber.placeholder")} (Codice fiscale)`)
12
12
  .otherwise(() => t("common.form.taxIdentificationNumber.placeholder"));
13
- export const getTaxNumberTooltip = (accountCountry) => match(accountCountry)
13
+ export const getTaxNumberTooltip = (country) => match(country)
14
14
  .with("DEU", () => t("common.form.taxIdentificationNumber.tooltip.deu"))
15
15
  .with("ESP", () => "Número de Identificación Fiscal") // no need to translate
16
16
  .with("ITA", () => t("common.form.taxIdentificationNumber.tooltip.ita"))
17
17
  .otherwise(() => undefined);
18
- export const getCompanyTaxNumberHelp = (accountCountry) => match(accountCountry)
18
+ export const getCompanyTaxNumberHelp = (country) => match(country)
19
+ .with("BEL", () => t("common.form.help.nbDigits", { nbDigits: "10-12" }))
19
20
  .with("DEU", () => t("common.form.help.nbDigits", { nbDigits: "10-13" }))
21
+ .with("FIN", () => t("common.form.help.nbCharacters", { nbCharacters: "8-9" }))
22
+ .with("FRA", () => t("common.form.help.nbDigits", { nbDigits: "9" }))
20
23
  .with("ESP", () => t("common.form.help.nbCharacters", { nbCharacters: "9" }))
21
24
  .with("ITA", () => t("common.form.help.nbCharacters", { nbCharacters: "11" }))
25
+ .with("NLD", () => t("common.form.help.nbDigits", { nbDigits: "9" }))
26
+ .with("PRT", () => t("common.form.help.nbDigits", { nbDigits: "9" }))
22
27
  .otherwise(() => "");
23
- export const getIndividualTaxNumberHelp = (accountCountry) => match(accountCountry)
28
+ export const getIndividualTaxNumberHelp = (country) => match(country)
29
+ .with("BEL", () => t("common.form.help.nbDigits", { nbDigits: "10" }))
24
30
  .with("DEU", () => t("common.form.help.nbDigits", { nbDigits: "11" }))
25
31
  .with("ESP", () => t("common.form.help.nbCharacters", { nbCharacters: "9" }))
32
+ .with("FIN", () => t("common.form.help.nbCharacters", { nbCharacters: "11" }))
33
+ .with("FRA", () => t("common.form.help.nbDigits", { nbDigits: "13" }))
26
34
  .with("ITA", () => t("common.form.help.nbCharacters", { nbCharacters: "16" }))
35
+ .with("NLD", () => t("common.form.help.nbDigits", { nbDigits: "9" }))
36
+ .with("PRT", () => t("common.form.help.nbDigits", { nbDigits: "9" }))
27
37
  .otherwise(() => "");
@@ -1,13 +1,13 @@
1
1
  import { Validator } from "@swan-io/use-form";
2
+ import { CompanyCountryCCA3, IndividualCountryCCA3 } from "../constants/countries";
2
3
  import { ExtractedDate } from "./date";
3
- import { AccountCountry } from "./templateTranslations";
4
4
  export declare const isValidVatNumber: (maybeVat: string) => boolean;
5
5
  export declare const isValidEmail: (maybeEmail: string) => boolean;
6
6
  export declare const validateNullableRequired: Validator<string | undefined>;
7
7
  export declare const validateRequired: Validator<string>;
8
8
  export declare const validateBooleanRequired: Validator<boolean | undefined>;
9
- export declare const validateIndividualTaxNumber: (accountCountry: AccountCountry) => Validator<string | undefined>;
10
- export declare const validateCompanyTaxNumber: (accountCountry: AccountCountry) => Validator<string | undefined>;
9
+ export declare const validateIndividualTaxNumber: (country: IndividualCountryCCA3) => Validator<string | undefined>;
10
+ export declare const validateCompanyTaxNumber: (country: CompanyCountryCCA3) => Validator<string | undefined>;
11
11
  export { printFormat as printIbanFormat } from "iban";
12
12
  export declare const validateIban: (iban: string) => string | undefined;
13
13
  export declare const validateDate: (value: ExtractedDate | undefined) => string | undefined;
@@ -55,11 +55,17 @@ export const validateBooleanRequired = value => {
55
55
  return t("error.requiredField");
56
56
  }
57
57
  };
58
- export const validateIndividualTaxNumber = (accountCountry) => value => {
58
+ export const validateIndividualTaxNumber = (country) => value => {
59
59
  if (value == null || !value) {
60
60
  return;
61
61
  }
62
- return match(accountCountry)
62
+ return match(country)
63
+ .with("BEL", () => {
64
+ // accept 10 digits
65
+ if (!/^\d{10}$/.test(value)) {
66
+ return t("common.form.invalidTaxIdentificationNumber");
67
+ }
68
+ })
63
69
  .with("DEU", () => {
64
70
  // accept 11 digits
65
71
  if (!/^\d{11}$/.test(value)) {
@@ -71,20 +77,50 @@ export const validateIndividualTaxNumber = (accountCountry) => value => {
71
77
  if (!/^[a-zA-Z0-9]{9}$/.test(value)) {
72
78
  return t("common.form.invalidTaxIdentificationNumber");
73
79
  }
80
+ })
81
+ .with("FIN", () => {
82
+ // accept 11 characters
83
+ if (!/^[a-zA-Z0-9]{11}$/.test(value)) {
84
+ return t("common.form.invalidTaxIdentificationNumber");
85
+ }
86
+ })
87
+ .with("FRA", () => {
88
+ // accept 13 digits
89
+ if (!/^\d{13}$/.test(value)) {
90
+ return t("common.form.invalidTaxIdentificationNumber");
91
+ }
74
92
  })
75
93
  .with("ITA", () => {
76
94
  // accept 16 characters
77
95
  if (!/^[a-zA-Z0-9]{16}$/.test(value)) {
78
96
  return t("common.form.invalidTaxIdentificationNumber");
79
97
  }
98
+ })
99
+ .with("NLD", () => {
100
+ // accept 9 digits
101
+ if (!/^\d{9}$/.test(value)) {
102
+ return t("common.form.invalidTaxIdentificationNumber");
103
+ }
104
+ })
105
+ .with("PRT", () => {
106
+ // accept 9 digits
107
+ if (!/^\d{9}$/.test(value)) {
108
+ return t("common.form.invalidTaxIdentificationNumber");
109
+ }
80
110
  })
81
111
  .otherwise(noop);
82
112
  };
83
- export const validateCompanyTaxNumber = (accountCountry) => value => {
113
+ export const validateCompanyTaxNumber = (country) => value => {
84
114
  if (value == null || !value) {
85
115
  return;
86
116
  }
87
- return match(accountCountry)
117
+ return match(country)
118
+ .with("BEL", () => {
119
+ // accept 10 to 12 digits
120
+ if (!/^\d{10,12}$/.test(value)) {
121
+ return t("common.form.invalidTaxIdentificationNumber");
122
+ }
123
+ })
88
124
  .with("DEU", () => {
89
125
  // accept 10 to 13 digits
90
126
  if (!/^\d{10,13}$/.test(value)) {
@@ -96,12 +132,36 @@ export const validateCompanyTaxNumber = (accountCountry) => value => {
96
132
  if (!/^[a-zA-Z0-9]{9}$/.test(value)) {
97
133
  return t("common.form.invalidTaxIdentificationNumber");
98
134
  }
135
+ })
136
+ .with("FIN", () => {
137
+ // accept 8 to 9 characters
138
+ if (!/^[a-zA-Z0-9]{8,9}$/.test(value)) {
139
+ return t("common.form.invalidTaxIdentificationNumber");
140
+ }
141
+ })
142
+ .with("FRA", () => {
143
+ // accept 9 digits
144
+ if (!/^\d{9}$/.test(value)) {
145
+ return t("common.form.invalidTaxIdentificationNumber");
146
+ }
99
147
  })
100
148
  .with("ITA", () => {
101
149
  // accept 11 characters
102
150
  if (!/^[a-zA-Z0-9]{11}$/.test(value)) {
103
151
  return t("common.form.invalidTaxIdentificationNumber");
104
152
  }
153
+ })
154
+ .with("NLD", () => {
155
+ // accept 9 digits
156
+ if (!/^\d{9}$/.test(value)) {
157
+ return t("common.form.invalidTaxIdentificationNumber");
158
+ }
159
+ })
160
+ .with("PRT", () => {
161
+ // accept 9 digits
162
+ if (!/^\d{9}$/.test(value)) {
163
+ return t("common.form.invalidTaxIdentificationNumber");
164
+ }
105
165
  })
106
166
  .otherwise(noop);
107
167
  };