13 lines
458 B
TypeScript
13 lines
458 B
TypeScript
import type { MessagingGateway } from '@/application/messaging/ports';
|
|
import { RESTAURANT_CONTACT } from '@/domain/shared/constants';
|
|
|
|
export class BrowserWhatsAppGateway implements MessagingGateway {
|
|
openWhatsApp(message: string): void {
|
|
if (typeof window === 'undefined') return;
|
|
const encoded = encodeURIComponent(message);
|
|
window.open(
|
|
`https://wa.me/${RESTAURANT_CONTACT.whatsappNumber}?text=${encoded}`,
|
|
'_blank'
|
|
);
|
|
}
|
|
} |