Files
portifolio-evandrodevbr/lib/whatsapp.ts
T

18 lines
543 B
TypeScript

const COUNTRY = ["5", "5"];
const AREA = ["4", "7"];
const NINE = ["9"];
const FIRST = ["9", "2", "7", "4"];
const LAST = ["2", "3", "6", "5"];
export function getWhatsAppNumber() {
return [...COUNTRY, ...AREA, ...NINE, ...FIRST, ...LAST].join("");
}
export function getWhatsAppDisplayNumber() {
return `+${COUNTRY.join("")} ${AREA.join("")} ${NINE.join("")}${FIRST.join("")}-${LAST.join("")}`;
}
export function buildWhatsAppUrl(message: string) {
return `https://wa.me/${getWhatsAppNumber()}?text=${encodeURIComponent(message)}`;
}