remove topup list if on hacker plan
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
<!-- Top-up Options -->
|
||||
<TopupOptions
|
||||
v-if="canUseTopup"
|
||||
:options="v2BillingData.topupOptions"
|
||||
:is-loading="v2BillingUIFlags.isFetchingTopupOptions"
|
||||
:is-processing="v2BillingUIFlags.isTopupInProcess"
|
||||
/>
|
||||
|
||||
<!-- Upgrade Notice for Hacker Plan -->
|
||||
<BillingCard
|
||||
v-else
|
||||
:title="$t('BILLING_SETTINGS_V2.TOPUP_OPTIONS.TITLE')"
|
||||
:description="$t('BILLING_SETTINGS_V2.TOPUP_OPTIONS.UPGRADE_REQUIRED')"
|
||||
>
|
||||
<div class="px-5 pb-5">
|
||||
<p class="text-sm text-n-600">
|
||||
{{ $t('BILLING_SETTINGS_V2.TOPUP_OPTIONS.UPGRADE_MESSAGE') }}
|
||||
</p>
|
||||
</div>
|
||||
</BillingCard>
|
||||
|
||||
<!-- Credit History -->
|
||||
<CreditGrants
|
||||
:grants="v2BillingData.creditGrants"
|
||||
|
||||
@@ -26,6 +26,7 @@ const {
|
||||
} = useCaptain();
|
||||
|
||||
const uiFlags = useMapGetter('accounts/getUIFlags');
|
||||
const isStripeBillingV2Enabled = useMapGetter('globalConfig/isStripeBillingV2Enabled');
|
||||
const store = useStore();
|
||||
|
||||
const BILLING_REFRESH_ATTEMPTED = 'billing_refresh_attempted';
|
||||
@@ -113,6 +114,10 @@ const onClickBillingPortal = () => {
|
||||
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);
|
||||
<template #body>
|
||||
<section class="grid gap-4">
|
||||
<BillingCard
|
||||
v-if="isStripeBillingV2Enabled"
|
||||
:title="$t('BILLING_SETTINGS.V2_BILLING_PORTAL.TITLE')"
|
||||
:description="$t('BILLING_SETTINGS.V2_BILLING_PORTAL.DESCRIPTION')"
|
||||
>
|
||||
<template #action>
|
||||
<ButtonV4 sm solid blue @click="onClickV2BillingPortal">
|
||||
{{ $t('BILLING_SETTINGS.V2_BILLING_PORTAL.BUTTON_TXT') }}
|
||||
</ButtonV4>
|
||||
</template>
|
||||
</BillingCard>
|
||||
<BillingCard
|
||||
v-else
|
||||
:title="$t('BILLING_SETTINGS.MANAGE_SUBSCRIPTION.TITLE')"
|
||||
:description="$t('BILLING_SETTINGS.MANAGE_SUBSCRIPTION.DESCRIPTION')"
|
||||
>
|
||||
|
||||
@@ -18,6 +18,7 @@ const {
|
||||
LOGO_DARK: logoDark,
|
||||
PRIVACY_URL: privacyURL,
|
||||
IS_ENTERPRISE: isEnterprise,
|
||||
STRIPE_BILLING_V2_ENABLED: stripeBillingV2Enabled,
|
||||
TERMS_URL: termsURL,
|
||||
WIDGET_BRAND_URL: widgetBrandURL,
|
||||
DISABLE_USER_PROFILE_UPDATE: disableUserProfileUpdate,
|
||||
@@ -46,6 +47,7 @@ const state = {
|
||||
termsURL,
|
||||
widgetBrandURL,
|
||||
isEnterprise: parseBoolean(isEnterprise),
|
||||
stripeBillingV2Enabled: parseBoolean(stripeBillingV2Enabled),
|
||||
};
|
||||
|
||||
export const getters = {
|
||||
@@ -53,6 +55,7 @@ export const getters = {
|
||||
isOnChatwootCloud: $state => $state.deploymentEnv === 'cloud',
|
||||
isACustomBrandedInstance: $state => $state.installationName !== 'Chatwoot',
|
||||
isAChatwootInstance: $state => $state.installationName === 'Chatwoot',
|
||||
isStripeBillingV2Enabled: $state => $state.stripeBillingV2Enabled,
|
||||
};
|
||||
|
||||
export const actions = {};
|
||||
|
||||
Reference in New Issue
Block a user