Skip to content

Commit 82811f9

Browse files
committed
chore: updated contact validation message with regex
1 parent db9908b commit 82811f9

File tree

8 files changed

+11
-14
lines changed

8 files changed

+11
-14
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"lodash.uniq": "^4.5.0",
5555
"nanoid": "^5.0.8",
5656
"papaparse": "^5.4.1",
57-
"phone": "^3.1.53",
5857
"qs": "^6.12.3",
5958
"react": "^18.2.0",
6059
"react-dom": "^18.2.0",

src/assets/locales/de/main.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,8 +1315,7 @@
13151315
"providerPhoneContact": "Provider Phone Contact",
13161316
"pleaseEnterValidHomePageURL": "Please enter a valid url - eg: https://catena-x.net",
13171317
"pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail",
1318-
"pleaseEnterValidPhone": "Bitte geben Sie eine gültige Kundenkontakt Telefonnummer ein",
1319-
"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.",
1318+
"pleaseEnterValidContact": "Bitte geben Sie eine gültige Telefonnummer in einem der folgenden Formate ein: '+xx xxxxxxxxxx' oder '+xxxxxxxxxx'. Hinweis: Vermeiden Sie bitte doppelte Leerzeichen und Sonderzeichen",
13201319
"privacyInformation": "Privacy Information",
13211320
"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”.",
13221321
"privacyInfoError": "Error - values couldn't get fetched. Please try it later again or contact your administrator.",

src/assets/locales/de/servicerelease.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"providerContactPhone": "Kundenkontakt Telefon",
5454
"pleaseEnterValidHomePageURL": "Bitte geben Sie eine gültige URL ein - eg: https://catena-x.net",
5555
"pleaseEnterValidEmail": "Bitte geben Sie eine gültige Email an",
56-
"pleaseEnterValidPhone": "Bitte geben Sie eine gültige Kundenkontakt Telefonnummer ein"
56+
"pleaseEnterValidContact": "Bitte geben Sie eine gültige Telefonnummer in einem der folgenden Formate ein: '+xx xxxxxxxxxx' oder '+xxxxxxxxxx'. Hinweis: Vermeiden Sie bitte doppelte Leerzeichen und Sonderzeichen"
5757
},
5858
"step3": {
5959
"headerTitle": "Agreements and Consent",

src/assets/locales/en/main.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,11 +1281,10 @@
12811281
"providerDetails": "Provider Details",
12821282
"providerHomePage": "Provider Homepage",
12831283
"providerContactEmail": "Contact (E-Mail)",
1284-
"providerPhoneContact": "Contac (Phone Number)",
1284+
"providerPhoneContact": "Contact (Phone Number)",
12851285
"pleaseEnterValidHomePageURL": "Please enter a valid url - eg: https://catena-x.net",
12861286
"pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail",
1287-
"pleaseEnterValidPhone": "Please enter a valid Customer Contact Number",
1288-
"pleaseEnterValidContact": "Please add a valid phone number and in the following format: “+ xx xxxx xxxxxx”, “+ xxx xxxx-xxxx”, “+xx xxxxxxxxxx”. Note: more formats are allowed, mentioned formats are the most used formats.",
1287+
"pleaseEnterValidContact": "Please enter a valid phone number in one of the following formats: '+xx xxxxxxxxxx' or '+xxxxxxxxxx'. Note: Avoid double spaces or special characters.",
12891288
"privacyInformation": "Privacy Information",
12901289
"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”.",
12911290
"privacyInfoError": "Error - values couldn't get fetched. Please try it later again or contact your administrator.",

src/assets/locales/en/servicerelease.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"providerContactPhone": "Customer Contact Phone",
5454
"pleaseEnterValidHomePageURL": "Please enter a valid url - eg: https://catena-x.net",
5555
"pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail",
56-
"pleaseEnterValidPhone": "Please enter a valid Customer Contact Phone Number"
56+
"pleaseEnterValidContact": "Please enter a valid phone number in one of the following formats: '+xx xxxxxxxxxx' or '+xxxxxxxxxx'. Note: Avoid double spaces or special characters."
5757
},
5858
"step3": {
5959
"headerTitle": "Agreements and Consent",

src/components/shared/basic/ReleaseProcess/AppPage/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import {
6767
} from 'features/appManagement/types'
6868
import { ButtonLabelTypes } from '..'
6969
import { PrivacyPolicyType } from 'features/adminBoard/adminBoardApiSlice'
70-
import { phone } from 'phone'
7170

7271
type FormDataType = {
7372
longDescriptionEN: string
@@ -650,9 +649,10 @@ export default function AppPage() {
650649
}}
651650
name="providerPhoneContact"
652651
label={t('content.apprelease.appPage.providerPhoneContact')}
653-
validate={(value: string) =>
654-
value === '' || phone(value.replace(/^00/, '+')).isValid
655-
}
652+
pattern={Patterns.PHONE}
653+
ruleMessage={t(
654+
'content.apprelease.appPage.pleaseEnterValidContact'
655+
)}
656656
/>
657657
{errors.providerPhoneContact &&
658658
errors?.providerPhoneContact.type === 'validate' && (

src/components/shared/basic/ReleaseProcess/OfferPage/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ export default function OfferPage({
407407
name="providerPhoneContact"
408408
label={t('step2.providerContactPhone')}
409409
pattern={Patterns.PHONE}
410-
ruleMessage={t('step2.pleaseEnterValidPhone')}
410+
ruleMessage={t('step2.pleaseEnterValidContact')}
411411
/>
412412
</div>
413413
</form>

src/types/Patterns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const Patterns = {
4141
LABEL: /^[a-z0-9-_ ]{1,80}$/i,
4242
BPN: /^BPNL[0-9A-Z]{12}$/i,
4343
MAIL: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*))@(([a-z0-9-]+\.)+[a-z]{2,})$/,
44-
PHONE: /^(\+?\d{1,3})?\s?\(?\d{3}\)?[.\s-]?\d{3}[.\s-]?\d{4,7}$/,
44+
PHONE: /^\+([1-9][0-9]{0,2})\s?[0-9]{6,14}$/,
4545
DOMAIN: new RegExp(`^${DOMAIN.source}$`, 'i'),
4646
PATH: new RegExp(`^${URLPATH.source}$`, 'i'),
4747
URL: urlPattern,

0 commit comments

Comments
 (0)