mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 14:37:41 +00:00
a21740942b
Co-authored-by: Evan Gentis <evan.gentis@gmail.com> Co-authored-by: Jef LeCompte <jeffreylec@gmail.com>
27 lines
727 B
TypeScript
27 lines
727 B
TypeScript
import {Config} from '../config';
|
|
import sendEmail from './email';
|
|
import sendSlaskMessage from './slack';
|
|
import sendSMS from './sms';
|
|
import playSound from './sound';
|
|
|
|
export default function sendNotification(cartUrl: string) {
|
|
if (Config.notifications.email.username && Config.notifications.email.password) {
|
|
sendEmail(cartUrl);
|
|
}
|
|
|
|
if (Config.notifications.slack.channel && Config.notifications.slack.token) {
|
|
sendSlaskMessage(cartUrl);
|
|
}
|
|
|
|
if (Config.notifications.phone.number) {
|
|
const carrier = Config.notifications.phone.carrier.toLowerCase();
|
|
if (carrier && Config.notifications.phone.availableCarriers.has(carrier)) {
|
|
sendSMS(cartUrl);
|
|
}
|
|
}
|
|
|
|
if (Config.notifications.playSound) {
|
|
playSound();
|
|
}
|
|
}
|