From 4e58a2a91d68f5259b720db2979430e5c64729a2 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Fri, 28 Mar 2025 14:58:17 +0530 Subject: [PATCH] feat: Upgrade page instead of banner (#11202) # Pull Request Template ## Description This PR will replace the upgrade banner with an upgrade page view. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? ### Loom video https://www.loom.com/share/0f2b4b09acdd4404bf3211184a470227?sid=7ed60a99-0299-4642-b907-2af8c4dcc643 ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Pranav --- app/helpers/billing_helper.rb | 4 + app/javascript/dashboard/App.vue | 3 - .../i18n/locale/en/generalSettings.json | 7 + .../dashboard/routes/dashboard/Dashboard.vue | 47 ++++-- .../routes/dashboard/upgrade/UpgradePage.vue | 145 ++++++++++++++++++ app/policies/account_policy.rb | 2 +- .../enterprise/api/v1/accounts_controller.rb | 45 +++--- .../api/v1/accounts_controller_spec.rb | 50 ++++-- 8 files changed, 255 insertions(+), 48 deletions(-) create mode 100644 app/javascript/dashboard/routes/dashboard/upgrade/UpgradePage.vue diff --git a/app/helpers/billing_helper.rb b/app/helpers/billing_helper.rb index 26669e38d..e2ada7e86 100644 --- a/app/helpers/billing_helper.rb +++ b/app/helpers/billing_helper.rb @@ -18,4 +18,8 @@ module BillingHelper def non_web_inboxes(account) account.inboxes.where.not(channel_type: Channel::WebWidget.to_s).count end + + def agents(account) + account.users.count + end end diff --git a/app/javascript/dashboard/App.vue b/app/javascript/dashboard/App.vue index ae50055fb..e51958e9e 100644 --- a/app/javascript/dashboard/App.vue +++ b/app/javascript/dashboard/App.vue @@ -4,7 +4,6 @@ import AddAccountModal from '../dashboard/components/layout/sidebarComponents/Ad import LoadingState from './components/widgets/LoadingState.vue'; import NetworkNotification from './components/NetworkNotification.vue'; import UpdateBanner from './components/app/UpdateBanner.vue'; -import UpgradeBanner from './components/app/UpgradeBanner.vue'; import PaymentPendingBanner from './components/app/PaymentPendingBanner.vue'; import PendingEmailVerificationBanner from './components/app/PendingEmailVerificationBanner.vue'; import vueActionCable from './helper/actionCable'; @@ -31,7 +30,6 @@ export default { UpdateBanner, PaymentPendingBanner, WootSnackbarBox, - UpgradeBanner, PendingEmailVerificationBanner, }, setup() { @@ -146,7 +144,6 @@ export default { diff --git a/app/javascript/dashboard/i18n/locale/en/generalSettings.json b/app/javascript/dashboard/i18n/locale/en/generalSettings.json index 9ad4e4b57..4e28e0b2f 100644 --- a/app/javascript/dashboard/i18n/locale/en/generalSettings.json +++ b/app/javascript/dashboard/i18n/locale/en/generalSettings.json @@ -1,5 +1,11 @@ { "GENERAL_SETTINGS": { + "LIMIT_MESSAGES": { + "CONVERSATION": "You have exceeded the conversation limit. Hacker plan allows only 500 conversations.", + "INBOXES": "You have exceeded the inbox limit. Hacker plan only supports website live-chat. Additional inboxes like email, WhatsApp etc. require a paid plan.", + "AGENTS": "You have exceeded the agent limit. Hacker plan allows only 2 agents.", + "NON_ADMIN": "Please contact your administrator to upgrade the plan and continue using all features." + }, "TITLE": "Account settings", "SUBMIT": "Update settings", "BACK": "Back", @@ -51,6 +57,7 @@ "UPDATE_CHATWOOT": "An update {latestChatwootVersion} for Chatwoot is available. Please update your instance.", "LEARN_MORE": "Learn more", "PAYMENT_PENDING": "Your payment is pending. Please update your payment information to continue using Chatwoot", + "UPGRADE": "Upgrade to continue using Chatwoot", "LIMITS_UPGRADE": "Your account has exceeded the usage limits, please upgrade your plan to continue using Chatwoot", "OPEN_BILLING": "Open billing" }, diff --git a/app/javascript/dashboard/routes/dashboard/Dashboard.vue b/app/javascript/dashboard/routes/dashboard/Dashboard.vue index 4d4c5e8df..7de36102b 100644 --- a/app/javascript/dashboard/routes/dashboard/Dashboard.vue +++ b/app/javascript/dashboard/routes/dashboard/Dashboard.vue @@ -1,6 +1,6 @@ + +