Skip to content

Commit a93ad1c

Browse files
committed
chore: updated contact validation message with regex
1 parent 77e756b commit a93ad1c

File tree

8 files changed

+12
-15
lines changed

8 files changed

+12
-15
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@
5454
"lodash.uniq": "^4.5.0",
5555
"nanoid": "^5.0.9",
5656
"papaparse": "^5.4.1",
57-
"phone": "^3.1.57",
58-
"qs": "^6.13.1",
57+
"qs": "^6.12.3",
5958
"react": "^18.2.0",
6059
"react-dom": "^18.2.0",
6160
"react-dropzone": "^14.2.10",

src/assets/locales/de/main.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,8 +1281,7 @@
12811281
"providerPhoneContact": "Provider Phone Contact",
12821282
"pleaseEnterValidHomePageURL": "Please enter a valid url - eg: https://catena-x.net",
12831283
"pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail",
1284-
"pleaseEnterValidPhone": "Bitte geben Sie eine gültige Kundenkontakt Telefonnummer ein",
1285-
"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.",
1284+
"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",
12861285
"privacyInformation": "Privacy Information",
12871286
"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”.",
12881287
"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
@@ -1278,11 +1278,10 @@
12781278
"providerDetails": "Provider Details",
12791279
"providerHomePage": "Provider Homepage",
12801280
"providerContactEmail": "Contact (E-Mail)",
1281-
"providerPhoneContact": "Contac (Phone Number)",
1281+
"providerPhoneContact": "Contact (Phone Number)",
12821282
"pleaseEnterValidHomePageURL": "Please enter a valid url - eg: https://catena-x.net",
12831283
"pleaseEnterValidEmail": "Please enter a valid Customer Contact E-Mail",
1284-
"pleaseEnterValidPhone": "Please enter a valid Customer Contact Number",
1285-
"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.",
1284+
"pleaseEnterValidContact": "Please enter a valid phone number in one of the following formats: '+xx xxxxxxxxxx' or '+xxxxxxxxxx'. Note: Avoid double spaces or special characters.",
12861285
"privacyInformation": "Privacy Information",
12871286
"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”.",
12881287
"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
import { useFetchDocumentByIdMutation } from 'features/apps/apiSlice'
7271
import { download } from 'utils/downloadUtils'
7372
import { extractFileData } from 'utils/fileUtils'
@@ -679,9 +678,10 @@ export default function AppPage() {
679678
}}
680679
name="providerPhoneContact"
681680
label={t('content.apprelease.appPage.providerPhoneContact')}
682-
validate={(value: string) =>
683-
value === '' || phone(value.replace(/^00/, '+')).isValid
684-
}
681+
pattern={Patterns.PHONE}
682+
ruleMessage={t(
683+
'content.apprelease.appPage.pleaseEnterValidContact'
684+
)}
685685
/>
686686
{errors.providerPhoneContact &&
687687
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
@@ -432,7 +432,7 @@ export default function OfferPage({
432432
name="providerPhoneContact"
433433
label={t('step2.providerContactPhone')}
434434
pattern={Patterns.PHONE}
435-
ruleMessage={t('step2.pleaseEnterValidPhone')}
435+
ruleMessage={t('step2.pleaseEnterValidContact')}
436436
/>
437437
</div>
438438
</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)