From abeb938bfdb109334835e795196fd14da9080577 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Wed, 29 Oct 2025 03:05:49 +0530 Subject: [PATCH] remove topup list if on hacker plan --- .../dashboard/i18n/locale/en/settings.json | 10 +++++++- .../dashboard/settings/billing-v2/IndexV2.vue | 24 +++++++++++++++++++ .../dashboard/settings/billing/Index.vue | 17 +++++++++++++ app/javascript/shared/store/globalConfig.js | 3 +++ 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/i18n/locale/en/settings.json b/app/javascript/dashboard/i18n/locale/en/settings.json index de4d7d94f..f3c58bb7e 100644 --- a/app/javascript/dashboard/i18n/locale/en/settings.json +++ b/app/javascript/dashboard/i18n/locale/en/settings.json @@ -382,6 +382,11 @@ "DESCRIPTION": "View your previous invoices, edit your billing details, or cancel your subscription.", "BUTTON_TXT": "Go to the billing portal" }, + "V2_BILLING_PORTAL": { + "TITLE": "Manage your billing", + "DESCRIPTION": "View your credits balance, top up, manage subscriptions, and view transactions.", + "BUTTON_TXT": "Go to billing dashboard" + }, "CAPTAIN": { "TITLE": "Captain", "DESCRIPTION": "Manage usage and credits for Captain AI.", @@ -431,6 +436,7 @@ "BLOCKED": "Blocked", "CANCELLING_TITLE": "Subscription Ending", "CANCELLING_MESSAGE": "Your subscription will be cancelled at the end of the current billing period. You can continue using your current plan until then.", + "CANCELLING_BLOCKED_INFO": "You cannot change plans or subscribe to new plans while your subscription is ending.", "ENDS_ON": "Subscription ends on", "NO_PLANS": "No pricing plans available.", "SUBSCRIBE_SUCCESS": "Successfully subscribed to the plan! Your credits have been updated.", @@ -447,7 +453,9 @@ "BUY_NOW": "Buy Now", "NO_OPTIONS": "No top-up options available.", "TOPUP_SUCCESS": "Credits added successfully! Your new balance is available now.", - "NO_PAYMENT_METHOD_ERROR": "No payment method found. Please add a payment method in your Stripe dashboard before making a purchase. Click the 'Open Stripe Dashboard' button above to add one." + "NO_PAYMENT_METHOD_ERROR": "No payment method found. Please add a payment method in your Stripe dashboard before making a purchase. Click the 'Open Stripe Dashboard' button above to add one.", + "UPGRADE_REQUIRED": "Upgrade your plan to purchase top-up credits.", + "UPGRADE_MESSAGE": "Top-ups are only available for Startup, Business, and Enterprise plans. Please upgrade your plan to purchase additional credits." }, "CREDIT_GRANTS": { "TITLE": "Credit History", diff --git a/app/javascript/dashboard/routes/dashboard/settings/billing-v2/IndexV2.vue b/app/javascript/dashboard/routes/dashboard/settings/billing-v2/IndexV2.vue index 051d83b90..cc54d60cb 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/billing-v2/IndexV2.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/billing-v2/IndexV2.vue @@ -12,6 +12,7 @@ import CreditGrants from './components/CreditGrants.vue'; import PricingPlans from './components/PricingPlans.vue'; import TopupOptions from './components/TopupOptions.vue'; import BillingHeader from '../billing/components/BillingHeader.vue'; +import BillingCard from '../billing/components/BillingCard.vue'; import ButtonV4 from 'next/button/Button.vue'; const router = useRouter(); @@ -33,6 +34,15 @@ const isLoading = computed(() => { ); }); +const canUseTopup = computed(() => { + const planName = currentAccount.value?.custom_attributes?.plan_name; + // Block topup if no plan or on Hacker plan + if (!planName || planName.toLowerCase() === 'hacker') { + return false; + } + return true; +}); + const handleInitialLoad = async () => { // If self-hosted, redirect to dashboard if (!isOnChatwootCloud.value) { @@ -112,11 +122,25 @@ onMounted(handleInitialLoad); + + +
+

+ {{ $t('BILLING_SETTINGS_V2.TOPUP_OPTIONS.UPGRADE_MESSAGE') }} +

+
+
+ { store.dispatch('accounts/checkout'); }; +const onClickV2BillingPortal = () => { + router.push({ name: 'billing_settings_v2_index' }); +}; + const onToggleChatWindow = () => { if (window.$chatwoot) { window.$chatwoot.toggle(); @@ -144,6 +149,18 @@ onMounted(handleBillingPageLogic);