diff --git a/packages/server/src/services/Dashboard/DashboardService.ts b/packages/server/src/services/Dashboard/DashboardService.ts index 81c24a026..e8411b1bf 100644 --- a/packages/server/src/services/Dashboard/DashboardService.ts +++ b/packages/server/src/services/Dashboard/DashboardService.ts @@ -1,7 +1,8 @@ +import { Inject, Service } from 'typedi'; import { IFeatureAllItem, ISystemUser } from '@/interfaces'; import { FeaturesManager } from '@/services/Features/FeaturesManager'; import HasTenancyService from '@/services/Tenancy/TenancyService'; -import { Inject, Service } from 'typedi'; +import config from '@/config'; interface IRoleAbility { subject: string; @@ -11,15 +12,16 @@ interface IRoleAbility { interface IDashboardBootMeta { abilities: IRoleAbility[]; features: IFeatureAllItem[]; + isBigcapitalCloud: boolean; } @Service() export default class DashboardService { @Inject() - tenancy: HasTenancyService; + private tenancy: HasTenancyService; @Inject() - featuresManager: FeaturesManager; + private featuresManager: FeaturesManager; /** * Retrieve dashboard meta. @@ -39,6 +41,7 @@ export default class DashboardService { return { abilities, features, + isBigcapitalCloud: config.hostedOnBigcapitalCloud }; }; diff --git a/packages/webapp/src/components/Dashboard/TopbarUser.tsx b/packages/webapp/src/components/Dashboard/TopbarUser.tsx index b20401868..3cf8bb03c 100644 --- a/packages/webapp/src/components/Dashboard/TopbarUser.tsx +++ b/packages/webapp/src/components/Dashboard/TopbarUser.tsx @@ -15,7 +15,7 @@ import { useAuthActions } from '@/hooks/state'; import withDialogActions from '@/containers/Dialog/withDialogActions'; -import { useAuthenticatedAccount } from '@/hooks/query'; +import { useAuthenticatedAccount, useDashboardMeta } from '@/hooks/query'; import { firstLettersArgs, compose } from '@/utils'; /** @@ -31,6 +31,9 @@ function DashboardTopbarUser({ // Retrieve authenticated user information. const { data: user } = useAuthenticatedAccount(); + const { data: dashboardMeta } = useDashboardMeta({ + keepPreviousData: true, + }); const onClickLogout = () => { setLogout(); }; @@ -58,7 +61,12 @@ function DashboardTopbarUser({ } /> - history.push('/billing')} /> + {dashboardMeta.is_bigcapital_cloud && ( + history.push('/billing')} + /> + )} } onClick={onKeyboardShortcut} diff --git a/packages/webapp/src/containers/Subscriptions/BillingPage.tsx b/packages/webapp/src/containers/Subscriptions/BillingPage.tsx index 29979db3b..f9719e896 100644 --- a/packages/webapp/src/containers/Subscriptions/BillingPage.tsx +++ b/packages/webapp/src/containers/Subscriptions/BillingPage.tsx @@ -1,12 +1,21 @@ // @ts-nocheck import * as R from 'ramda'; -import { Button } from '@blueprintjs/core'; -import withAlertActions from '../Alert/withAlertActions'; +import { Redirect } from 'react-router-dom'; import { BillingPageBoot } from './BillingPageBoot'; import { BillingPageContent } from './BillingPageContent'; import { DashboardInsider } from '@/components'; +import { useDashboardMeta } from '@/hooks/query'; +import withAlertActions from '../Alert/withAlertActions'; function BillingPageRoot({ openAlert }) { + const { data: dashboardMeta } = useDashboardMeta({ + keepPreviousData: true, + }); + + // In case the edition is not Bigcapital Cloud, redirect to the homepage. + if (!dashboardMeta.is_bigcapital_cloud) { + return ; + } return ( diff --git a/packages/webapp/src/containers/Subscriptions/BillingPageContent.tsx b/packages/webapp/src/containers/Subscriptions/BillingPageContent.tsx index dee9d0159..66fc3ec57 100644 --- a/packages/webapp/src/containers/Subscriptions/BillingPageContent.tsx +++ b/packages/webapp/src/containers/Subscriptions/BillingPageContent.tsx @@ -15,9 +15,7 @@ export function BillingPageContent() { return ( - Transactions locking has the ability to lock all organization - transactions so users can’t edit, delete or create new transactions - during the past period. + Only pay for what you really need. All plans come with 24/7 customer support. diff --git a/packages/webapp/src/containers/Subscriptions/BillingSubscription.tsx b/packages/webapp/src/containers/Subscriptions/BillingSubscription.tsx index ff63c6ca4..c39093095 100644 --- a/packages/webapp/src/containers/Subscriptions/BillingSubscription.tsx +++ b/packages/webapp/src/containers/Subscriptions/BillingSubscription.tsx @@ -61,9 +61,8 @@ function SubscriptionRoot({ openAlert, openDrawer }) { - Transactions locking has the ability to lock all organization - transactions so users can’t edit, delete or create new transactions - during the past period. + Control your business bookkeeping with automated accounting, to run + intelligent reports for faster decision-making. diff --git a/packages/webapp/src/containers/Subscriptions/alerts/CancelMainSubscriptionAlert.tsx b/packages/webapp/src/containers/Subscriptions/alerts/CancelMainSubscriptionAlert.tsx index 9e2b5979c..ca0c6a905 100644 --- a/packages/webapp/src/containers/Subscriptions/alerts/CancelMainSubscriptionAlert.tsx +++ b/packages/webapp/src/containers/Subscriptions/alerts/CancelMainSubscriptionAlert.tsx @@ -37,7 +37,7 @@ function CancelMainSubscriptionAlert({ cancelSubscription() .then(() => { AppToaster.show({ - message: 'The subscription has been cancel.', + message: 'The subscription has been canceled.', intent: Intent.SUCCESS, }); }) @@ -63,7 +63,14 @@ function CancelMainSubscriptionAlert({ onConfirm={handleConfirm} loading={isLoading} > -

asdfsadf asdf asdfdsaf

+

+ The subscription for this organization will end. +

+ +

+ It will no longer be accessible to you or any other users. Make sure any + data has already been exported. +

); } diff --git a/packages/webapp/src/containers/Subscriptions/alerts/ResumeMainSubscriptionAlert.tsx b/packages/webapp/src/containers/Subscriptions/alerts/ResumeMainSubscriptionAlert.tsx index 33149e752..c8d8d0734 100644 --- a/packages/webapp/src/containers/Subscriptions/alerts/ResumeMainSubscriptionAlert.tsx +++ b/packages/webapp/src/containers/Subscriptions/alerts/ResumeMainSubscriptionAlert.tsx @@ -62,7 +62,13 @@ function ResumeMainSubscriptionAlert({ onConfirm={handleConfirm} loading={isLoading} > -

asdfsadf asdf asdfdsaf

+

+ The subscription for this organization will resume. + +

+ Are you sure want to resume the subscription of this organization? +

+

); }