|
|
|
@ -682,6 +682,7 @@ export const handleNotification = (title, _options) => {
|
|
|
|
|
* - All phone numbers in Argentina (country code "54") should have a "9" between the country code and area code. The prefix "15" must be removed so the final number will have 13 digits total: +54 9 XXX XXX XXXX
|
|
|
|
|
* - Phone numbers in Mexico (country code "52") need to have "1" after "+52", even if they're Nextel numbers.
|
|
|
|
|
* - 巴西号码: 13位的话删除国家地区码后面的`9`
|
|
|
|
|
* - UK: 号码部分10位, 前缀`7`补全
|
|
|
|
|
*/
|
|
|
|
|
export const phoneNumberToWAID = (input) => {
|
|
|
|
|
// Remove any non-digit characters
|
|
|
|
@ -694,11 +695,7 @@ export const phoneNumberToWAID = (input) => {
|
|
|
|
|
const isArgentina = countryCode === '54';
|
|
|
|
|
const isMexico = countryCode === '52';
|
|
|
|
|
const isBrazil = countryCode === '55';
|
|
|
|
|
|
|
|
|
|
// if (!isArgentina && !isMexico) {
|
|
|
|
|
if (!isArgentina) {
|
|
|
|
|
return cleanedInput; // Return the cleaned input as is
|
|
|
|
|
}
|
|
|
|
|
const isUK = countryCode === '44';
|
|
|
|
|
|
|
|
|
|
// Remove leading 0s and special calling codes
|
|
|
|
|
let formattedNumber = cleanedInput.replace(/^0+/, '');
|
|
|
|
@ -721,6 +718,10 @@ export const phoneNumberToWAID = (input) => {
|
|
|
|
|
if (cleanedInput.length > 12) {
|
|
|
|
|
formattedNumber = cleanedInput.slice(0, 4) + cleanedInput.slice(-8);
|
|
|
|
|
}
|
|
|
|
|
} else if (isUK) {
|
|
|
|
|
if (cleanedInput.length < 12) {
|
|
|
|
|
formattedNumber = `44 7 ${cleanedInput.slice(2)}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove any non-digit characters
|
|
|
|
|