|
|
@ -33,6 +33,21 @@ export function extractUserFromJid(jid: string): string {
|
|
|
|
return normalizeUserIdentifier(phoneNumber);
|
|
|
|
return normalizeUserIdentifier(phoneNumber);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function formatUserMention(phoneNumber: string): string {
|
|
|
|
export function formatUserMention(phoneNumber?: string): string {
|
|
|
|
return `@${phoneNumber.replace('@', '')}`;
|
|
|
|
if (!phoneNumber) {
|
|
|
|
|
|
|
|
return '@unknown';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handle full JID format
|
|
|
|
|
|
|
|
if (phoneNumber.includes('@s.whatsapp.net')) {
|
|
|
|
|
|
|
|
return `@${phoneNumber.split('@')[0]}`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handle already formatted mentions
|
|
|
|
|
|
|
|
if (phoneNumber.startsWith('@')) {
|
|
|
|
|
|
|
|
return phoneNumber;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handle raw numbers
|
|
|
|
|
|
|
|
return `@${phoneNumber.replace(/\D/g, '')}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|