diff --git a/src/assets/locales/de/main.json b/src/assets/locales/de/main.json index 7cdedd29b..a3487e5cb 100644 --- a/src/assets/locales/de/main.json +++ b/src/assets/locales/de/main.json @@ -1308,7 +1308,11 @@ "providerPhoneContact": "Provider Phone Contact", "pleaseEnterValidHomePageURL": "Please enter a valid url - eg: https://catena-x.net", "pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail", +<<<<<<< HEAD "pleaseEnterValidPhone": "Bitte geben Sie eine gültige Kundenkontakt Telefonnummer ein", +======= + "pleaseEnterValidPhone": "Please enter a valid Customer Contact Number", +>>>>>>> e39c0f9e (new: introduced new field of customer contact in service) "pleaseEnterValidContact": "Bitte fügen Sie eine gültige Telefonnummer im folgenden Format hinzu: „+ xx xxxx xxxxxx“, „+ xxx xxxx-xxxx“, „+xx xxxxxxxxxx“. Hinweis: Es sind weitere Formate zulässig. Die genannten Formate sind die am häufigsten verwendeten Formate.", "privacyInformation": "Privacy Information", "privacyInformationDescription": "The privacy information is used to display data types the app may collect on the app detail page. You may select several options OR select “none”.", diff --git a/src/assets/locales/en/servicerelease.json b/src/assets/locales/en/servicerelease.json index d542a9021..3941750ff 100644 --- a/src/assets/locales/en/servicerelease.json +++ b/src/assets/locales/en/servicerelease.json @@ -53,7 +53,11 @@ "providerContactPhone": "Customer Contact Phone", "pleaseEnterValidHomePageURL": "Please enter a valid url - eg: https://catena-x.net", "pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail", +<<<<<<< HEAD "pleaseEnterValidPhone": "Please enter a valid Customer Contact Phone Number" +======= + "pleaseEnterValidPhone": "Please enter a valid Customer Contact Phonenumber" +>>>>>>> e39c0f9e (new: introduced new field of customer contact in service) }, "step3": { "headerTitle": "Agreements and Consent", diff --git a/src/components/pages/ServiceReleaseProcess/components/ServiceDetails.tsx b/src/components/pages/ServiceReleaseProcess/components/ServiceDetails.tsx index 93e8535cd..abd91e907 100644 --- a/src/components/pages/ServiceReleaseProcess/components/ServiceDetails.tsx +++ b/src/components/pages/ServiceReleaseProcess/components/ServiceDetails.tsx @@ -271,8 +271,12 @@ export default function ServiceDetails() { body: [ [fetchServiceStatus?.providerUri], [fetchServiceStatus?.contactEmail], +<<<<<<< HEAD // TODO: contactNumber is null atm and causing build failure. Once BE resolve the issue then will un-comment this line // [fetchServiceStatus?.contactNumber], +======= + [fetchServiceStatus?.contactNumber], +>>>>>>> e39c0f9e (new: introduced new field of customer contact in service) ], }} horizontal={true} diff --git a/src/types/Patterns.test.ts b/src/types/Patterns.test.ts index de9938ad9..312272b52 100644 --- a/src/types/Patterns.test.ts +++ b/src/types/Patterns.test.ts @@ -71,8 +71,14 @@ const TESTDATA = { ], }, PHONE: { - valid: ['+1 1234567890', '015208561328', '00491522345678'], - invalid: ['12345', '12345123aa'], + valid: [ + '+1 123-456-7890', + '+49 152 08561111', + '+1 (123) 456-7890', + '0152 08561111', + '015208561111', + ], + invalid: ['+49 1520856', '+1 (12345) 7890', '+49 1234 567890123', '12345'], }, DOMAIN: { valid: [ @@ -379,4 +385,12 @@ describe('Input Pattern Tests', () => { expect(isValidAppOverviewSearch(expr)).toBe(false) }) }) + it('validate phone number', () => { + TESTDATA.PHONE.valid.forEach((expr) => { + expect(isValidPhone(expr)).toBe(true) + }) + TESTDATA.CLIENTID.invalid.forEach((expr) => { + expect(isValidPhone(expr)).toBe(false) + }) + }) }) diff --git a/src/types/Patterns.ts b/src/types/Patterns.ts index 209a70913..13a272416 100644 --- a/src/types/Patterns.ts +++ b/src/types/Patterns.ts @@ -41,7 +41,7 @@ export const Patterns = { LABEL: /^[a-z0-9-_ ]{1,80}$/i, BPN: /^BPNL[0-9A-Z]{12}$/i, MAIL: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*))@(([a-z0-9-]+\.)+[a-z]{2,})$/, - PHONE: /^(\+|00)?(?:\d\s?){6,14}\d$/, + PHONE: /^(\+?\d{1,3}\s?)?(\(?\d{3}\)?[-.\s]?)?\d{3}[-.\s]?\d{4,7}$/, DOMAIN: new RegExp(`^${DOMAIN.source}$`, 'i'), PATH: new RegExp(`^${URLPATH.source}$`, 'i'), URL: urlPattern,