[MM-52287] - Cloud Free should not show the ability to start a trial (#23073)

* [MM-52287] - Cloud Free should not show the ability to start a trial

* fix logic
Этот коммит содержится в:
Allan Guwatudde
2023-04-24 16:37:22 +03:00
коммит произвёл GitHub
родитель 673acc8c95
Коммит 2dc55918c7
2 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@@ -5,6 +5,7 @@ import React from 'react';
import {useSelector} from 'react-redux';
import {getSubscriptionProduct, checkHadPriorTrial, getCloudSubscription} from 'mattermost-redux/selectors/entities/cloud';
import {cloudReverseTrial} from 'mattermost-redux/selectors/entities/preferences';
import {CloudProducts} from 'utils/constants';
@@ -27,17 +28,20 @@ type BillingSummaryProps = {
const BillingSummary = ({isFreeTrial, daysLeftOnTrial, onUpgradeMattermostCloud}: BillingSummaryProps) => {
const subscription = useSelector(getCloudSubscription);
const product = useSelector(getSubscriptionProduct);
const reverseTrial = useSelector(cloudReverseTrial);
let body = noBillingHistory;
const isPreTrial = subscription?.is_free_trial === 'false' && subscription?.trial_end_at === 0;
const hasPriorTrial = useSelector(checkHadPriorTrial);
const showTryEnterprise = product?.sku === CloudProducts.STARTER && isPreTrial;
const showUpgradeProfessional = product?.sku === CloudProducts.STARTER && hasPriorTrial;
const isStarterPreTrial = product?.sku === CloudProducts.STARTER && isPreTrial;
const isStarterPostTrial = product?.sku === CloudProducts.STARTER && hasPriorTrial;
if (showTryEnterprise) {
if (isStarterPreTrial && reverseTrial) {
body = <UpgradeToProfessionalCard/>;
} else if (isStarterPreTrial) {
body = tryEnterpriseCard;
} else if (showUpgradeProfessional) {
} else if (isStarterPostTrial) {
body = <UpgradeToProfessionalCard/>;
} else if (isFreeTrial) {
body = freeTrial(onUpgradeMattermostCloud, daysLeftOnTrial);

Просмотреть файл

@@ -300,6 +300,10 @@ export function deprecateCloudFree(state: GlobalState): boolean {
return getFeatureFlagValue(state, 'DeprecateCloudFree') === 'true';
}
export function cloudReverseTrial(state: GlobalState): boolean {
return getFeatureFlagValue(state, 'CloudReverseTrial') === 'true';
}
export function appsSidebarCategoryEnabled(state: GlobalState): boolean {
return getFeatureFlagValue(state, 'AppsSidebarCategory') === 'true';
}