INSR-10111: Fix error handling, better phone regex
This commit is contained in:
parent
27df36a1a7
commit
3a4083a9fc
2 changed files with 6 additions and 3 deletions
|
|
@ -327,8 +327,11 @@ function mapStringToState(str) {
|
||||||
*/
|
*/
|
||||||
export function mapStringToPhoneNumber(str) {
|
export function mapStringToPhoneNumber(str) {
|
||||||
// Expected token format: {phoneNumber:##########} (or 11 digits).
|
// Expected token format: {phoneNumber:##########} (or 11 digits).
|
||||||
const regexExp = new RegExp(`\\{${dynamicStrings.PHONE_NUMBER}:([^{}]*?)\\}`, 'g');
|
const regexExp = new RegExp(`\\{${dynamicStrings.PHONE_NUMBER}:([^}]*)\\}`, 'g');
|
||||||
return str.replace(regexExp, (_match, phoneNumber) => toDisplayPhoneNumber(phoneNumber));
|
return str.replace(regexExp, (_match, rawValue) => {
|
||||||
|
const digits = (rawValue.match(/\d+/g) ?? []).join('');
|
||||||
|
return toDisplayPhoneNumber(digits);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ export default {
|
||||||
|
|
||||||
// Set order account number from the issConfig.
|
// Set order account number from the issConfig.
|
||||||
mainStore.order.parentAccountNumber = mainStore.issConfig.parentAccountNumber;
|
mainStore.order.parentAccountNumber = mainStore.issConfig.parentAccountNumber;
|
||||||
mainStore.getCarrierAccountInfo().catch((error) => console.error(`Error in getCarrierAccountInfo ${error}`));
|
mainStore.getCarrierAccountInfo().catch((error) => console.error('Error in getCarrierAccountInfo', error));
|
||||||
|
|
||||||
return { mainStore };
|
return { mainStore };
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue