diff --git a/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue b/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue index 5c1c79d23..bd0f645cf 100644 --- a/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue +++ b/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue @@ -85,7 +85,12 @@ export default { useAlert(this.$t('EMAIL_TRANSCRIPT.SEND_EMAIL_SUCCESS')); this.onCancel(); } catch (error) { - useAlert(this.$t('EMAIL_TRANSCRIPT.SEND_EMAIL_ERROR')); + const status = error?.response?.status; + if (status === 402) { + useAlert(this.$t('EMAIL_TRANSCRIPT.SEND_EMAIL_PAYMENT_REQUIRED')); + } else { + useAlert(this.$t('EMAIL_TRANSCRIPT.SEND_EMAIL_ERROR')); + } } finally { this.isSubmitting = false; } diff --git a/app/javascript/dashboard/i18n/locale/en/conversation.json b/app/javascript/dashboard/i18n/locale/en/conversation.json index 951a46993..23552a162 100644 --- a/app/javascript/dashboard/i18n/locale/en/conversation.json +++ b/app/javascript/dashboard/i18n/locale/en/conversation.json @@ -305,6 +305,7 @@ "CANCEL": "Cancel", "SEND_EMAIL_SUCCESS": "The chat transcript was sent successfully", "SEND_EMAIL_ERROR": "There was an error, please try again", + "SEND_EMAIL_PAYMENT_REQUIRED": "Email transcript is not available on your current plan. Please upgrade to use this feature.", "FORM": { "SEND_TO_CONTACT": "Send the transcript to the customer", "SEND_TO_AGENT": "Send the transcript to the assigned agent", diff --git a/app/javascript/dashboard/store/modules/conversations/actions.js b/app/javascript/dashboard/store/modules/conversations/actions.js index 0c4c084e0..c6a197d85 100644 --- a/app/javascript/dashboard/store/modules/conversations/actions.js +++ b/app/javascript/dashboard/store/modules/conversations/actions.js @@ -457,11 +457,7 @@ const actions = { }, sendEmailTranscript: async (_, { conversationId, email }) => { - try { - await ConversationApi.sendEmailTranscript({ conversationId, email }); - } catch (error) { - throw new Error(error); - } + await ConversationApi.sendEmailTranscript({ conversationId, email }); }, updateCustomAttributes: async (