From 3ddab3ab26e82c5649b93953b4f40c1027e56160 Mon Sep 17 00:00:00 2001 From: Vishnu Narayanan Date: Thu, 26 Feb 2026 12:54:40 +0530 Subject: [PATCH] fix: show upgrade prompt when email transcript returns 402 (#13650) - Show a specific upgrade prompt when free-plan users attempt to send an email transcript and the API returns a 402 Payment Required error - Previously, a generic "There was an error, please try again" message was shown for all failures, including plan restrictions Fixes https://linear.app/chatwoot/issue/CW-6538/show-ui-feedback-for-email-transcript-402-plan-restriction --- .../widgets/conversation/EmailTranscriptModal.vue | 7 ++++++- app/javascript/dashboard/i18n/locale/en/conversation.json | 1 + .../dashboard/store/modules/conversations/actions.js | 6 +----- 3 files changed, 8 insertions(+), 6 deletions(-) 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 (