INSR-10111: Fix error handling, better phone regex

This commit is contained in:
Alex Humphries 2026-06-29 13:21:57 -04:00
parent 27df36a1a7
commit 3a4083a9fc
2 changed files with 6 additions and 3 deletions

View file

@ -327,8 +327,11 @@ function mapStringToState(str) {
*/
export function mapStringToPhoneNumber(str) {
// Expected token format: {phoneNumber:##########} (or 11 digits).
const regexExp = new RegExp(`\\{${dynamicStrings.PHONE_NUMBER}:([^{}]*?)\\}`, 'g');
return str.replace(regexExp, (_match, phoneNumber) => toDisplayPhoneNumber(phoneNumber));
const regexExp = new RegExp(`\\{${dynamicStrings.PHONE_NUMBER}:([^}]*)\\}`, 'g');
return str.replace(regexExp, (_match, rawValue) => {
const digits = (rawValue.match(/\d+/g) ?? []).join('');
return toDisplayPhoneNumber(digits);
});
}
/**

View file

@ -232,7 +232,7 @@ export default {
// Set order account number from the issConfig.
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 };
},