|
|
|
@ -681,6 +681,7 @@ export const handleNotification = (title, _options) => {
|
|
|
|
|
* - Make sure to remove any leading 0s or special calling codes.
|
|
|
|
|
* - 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`
|
|
|
|
|
*/
|
|
|
|
|
export const phoneNumberToWAID = (input) => {
|
|
|
|
|
// Remove any non-digit characters
|
|
|
|
@ -692,6 +693,7 @@ export const phoneNumberToWAID = (input) => {
|
|
|
|
|
const countryCode = cleanedInput.slice(0, 2);
|
|
|
|
|
const isArgentina = countryCode === '54';
|
|
|
|
|
const isMexico = countryCode === '52';
|
|
|
|
|
const isBrazil = countryCode === '55';
|
|
|
|
|
|
|
|
|
|
// if (!isArgentina && !isMexico) {
|
|
|
|
|
if (!isArgentina) {
|
|
|
|
@ -715,6 +717,10 @@ export const phoneNumberToWAID = (input) => {
|
|
|
|
|
// formattedNumber = formattedNumber.replace(/^52 ?0/, '52');
|
|
|
|
|
// Insert "1" after the country code
|
|
|
|
|
// formattedNumber = `52 1 ${formattedNumber.slice(2)}`;
|
|
|
|
|
} else if (isBrazil) {
|
|
|
|
|
if (cleanedInput.length > 12) {
|
|
|
|
|
formattedNumber = cleanedInput.slice(0, 4) + cleanedInput.slice(-8);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove any non-digit characters
|
|
|
|
|