diff --git a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json index 24207cef2..8e10078fa 100644 --- a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json @@ -800,6 +800,10 @@ "WHATSAPP_TEMPLATES_SYNC_SUBHEADER": "Manually sync message templates from WhatsApp to update your available templates.", "WHATSAPP_TEMPLATES_SYNC_BUTTON": "Sync Templates", "WHATSAPP_TEMPLATES_SYNC_SUCCESS": "Templates sync initiated successfully. It may take a couple of minutes to update.", + "WHATSAPP_CALLING_ENABLED": { + "LABEL": "Enable voice calling", + "DESCRIPTION": "Allow agents to start and receive WhatsApp voice calls on this inbox. Available only on embedded-signup WhatsApp Cloud channels with calling permission granted by Meta." + }, "UPDATE_PRE_CHAT_FORM_SETTINGS": "Update Pre Chat Form Settings" }, "HELP_CENTER": { diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/ConfigurationPage.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/ConfigurationPage.vue index 9cd1665bf..f3fe54448 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/ConfigurationPage.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/ConfigurationPage.vue @@ -44,6 +44,7 @@ export default { allowedDomains: '', isUpdatingAllowedDomains: false, isSettingDefaults: false, + whatsAppCallingEnabled: false, }; }, validations: { @@ -71,6 +72,10 @@ export default { if (!this.isSettingDefaults && this.isAWebWidgetInbox) this.handleHmacFlag(); }, + whatsAppCallingEnabled() { + if (!this.isSettingDefaults && this.isEmbeddedSignupWhatsApp) + this.updateWhatsAppCallingEnabled(); + }, }, mounted() { this.setDefaults(); @@ -83,6 +88,9 @@ export default { this.inbox.selected_feature_flags || [] ).includes('allow_mobile_webview'); this.allowedDomains = this.inbox.allowed_domains || ''; + this.whatsAppCallingEnabled = Boolean( + this.inbox.provider_config?.calling_enabled + ); this.$nextTick(() => { this.isSettingDefaults = false; }); @@ -147,6 +155,24 @@ export default { this.isUpdatingAllowedDomains = false; } }, + async updateWhatsAppCallingEnabled() { + try { + const payload = { + id: this.inbox.id, + formData: false, + channel: { + provider_config: { + ...this.inbox.provider_config, + calling_enabled: this.whatsAppCallingEnabled, + }, + }, + }; + await this.$store.dispatch('inboxes/updateInbox', payload); + useAlert(this.$t('INBOX_MGMT.EDIT.API.SUCCESS_MESSAGE')); + } catch (error) { + useAlert(this.$t('INBOX_MGMT.EDIT.API.ERROR_MESSAGE')); + } + }, async updateWhatsAppInboxAPIKey() { try { const payload = { @@ -374,6 +400,15 @@ export default { +