From 13fe1663bea59e309df5411a6e3b851ec35bac71 Mon Sep 17 00:00:00 2001 From: "m.usman" Date: Thu, 10 Oct 2024 18:33:21 +0200 Subject: [PATCH] new: introduced new field of customer contact in service --- src/assets/locales/de/main.json | 4 ++++ src/assets/locales/en/servicerelease.json | 4 ++++ .../components/ServiceDetails.tsx | 4 ++++ src/types/Patterns.test.ts | 18 ++++++++++++++++-- src/types/Patterns.ts | 2 +- 5 files changed, 29 insertions(+), 3 deletions(-) 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 a8d5172d0..1fb73fc9c 100644 --- a/src/types/Patterns.test.ts +++ b/src/types/Patterns.test.ts @@ -72,8 +72,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: [ @@ -388,4 +394,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,