301301 </tbody >
302302 </template >
303303 </v-simple-table >
304+ <h5 id =" email-notifications" class =" text-h4 mb-3 mt-12" >
305+ Email Notifications
306+ </h5 >
307+ <p class =" text--secondary" >
308+ Manage the email notifications which you receive from httpSMS.
309+ Feel free to turn on/off individual notifications anytime so you
310+ don't get overloaded with emails
311+ </p >
312+ <v-switch
313+ v-model =" notificationSettings.heartbeat_enabled"
314+ label =" Heartbeat emails"
315+ :disabled =" updatingEmailNotifications"
316+ hint =" This switch controls email notifications we send when we don't receive a heartbeat from your phone for 1 hour."
317+ persistent-hint
318+ ></v-switch >
319+ <v-switch
320+ v-model =" notificationSettings.webhook_enabled"
321+ label =" Webhook and discord emails"
322+ :disabled =" updatingEmailNotifications"
323+ hint =" This switch controls email notifications we send when we can't forward events to your discord server or to your webhook."
324+ persistent-hint
325+ ></v-switch >
326+ <v-switch
327+ v-model =" notificationSettings.message_status_enabled"
328+ label =" Message status emails"
329+ :disabled =" updatingEmailNotifications"
330+ hint =" This switch controls email notifications we send when we your message is failed or expired."
331+ persistent-hint
332+ ></v-switch >
333+ <v-btn
334+ color =" primary"
335+ :loading =" updatingEmailNotifications"
336+ class =" mt-4"
337+ @click =" saveEmailNotifications"
338+ >
339+ <v-icon ></v-icon >
340+ Save Notification Settings
341+ </v-btn >
304342 </v-col >
305343 </v-row >
306344 </v-container >
@@ -671,6 +709,12 @@ export default Vue.extend({
671709 server_id: ' ' ,
672710 incoming_channel_id: ' ' ,
673711 },
712+ updatingEmailNotifications: false ,
713+ notificationSettings: {
714+ webhook_enabled: true ,
715+ message_status_enabled: true ,
716+ heartbeat_enabled: true ,
717+ },
674718 updatingWebhook: false ,
675719 loadingWebhooks: false ,
676720 discords: [],
@@ -691,7 +735,7 @@ export default Vue.extend({
691735 },
692736 head () {
693737 return {
694- title: ' Settings - Http SMS ' ,
738+ title: ' Settings - httpSMS ' ,
695739 }
696740 },
697741 computed: {
@@ -710,15 +754,31 @@ export default Vue.extend({
710754 })
711755 },
712756 },
713- mounted () {
714- this .$store .dispatch (' clearAxiosError' )
715- this .$store .dispatch (' loadUser' )
716- this .$store .dispatch (' loadPhones' )
757+ async mounted () {
758+ await Promise .all ([
759+ this .$store .dispatch (' clearAxiosError' ),
760+ this .$store .dispatch (' loadUser' ),
761+ this .$store .dispatch (' loadPhones' ),
762+ ])
717763 this .loadWebhooks ()
718764 this .loadDiscordIntegrations ()
765+ this .updateEmailNotifications ()
766+ if (this .$route .hash ) {
767+ await this .$vuetify .goTo (this .$route .hash )
768+ }
719769 },
720770
721771 methods: {
772+ updateEmailNotifications () {
773+ this .notificationSettings = {
774+ webhook_enabled:
775+ this .$store .getters .getUser .notification_webhook_enabled ,
776+ message_status_enabled:
777+ this .$store .getters .getUser .notification_message_status_enabled ,
778+ heartbeat_enabled:
779+ this .$store .getters .getUser .notification_heartbeat_enabled ,
780+ }
781+ },
722782 showEditPhone (phoneId ) {
723783 const phone = this .$store .getters .getPhones .find ((x ) => x .id === phoneId)
724784 if (! phone) {
@@ -794,7 +854,7 @@ export default Vue.extend({
794854 },
795855
796856 async updatePhone () {
797- this . updatingPhone = true
857+ thisPhone = true
798858 await this .$store .dispatch (' clearAxiosError' )
799859 this .$store .dispatch (' updatePhone' , this .activePhone ).finally (() => {
800860 if (! this .$store .getters .getAxiosError ) {
@@ -830,6 +890,22 @@ export default Vue.extend({
830890 })
831891 },
832892
893+ saveEmailNotifications () {
894+ this .updatingEmailNotifications = true
895+ this .$store
896+ .dispatch (' saveEmailNotifications' , this .notificationSettings )
897+ .then (() => {
898+ this .$store .dispatch (' addNotification' , {
899+ message: ' Email notifications saved successfully' ,
900+ type: ' success' ,
901+ })
902+ this .updateEmailNotifications ()
903+ })
904+ .finally (() => {
905+ this .updatingEmailNotifications = false
906+ })
907+ },
908+
833909 updateDiscord () {
834910 this .resetErrors ()
835911 this .updatingDiscord = true
0 commit comments