[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
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
673acc8c95
Коммит
2dc55918c7
@@ -5,6 +5,7 @@ import React from 'react';
|
|||||||
import {useSelector} from 'react-redux';
|
import {useSelector} from 'react-redux';
|
||||||
|
|
||||||
import {getSubscriptionProduct, checkHadPriorTrial, getCloudSubscription} from 'mattermost-redux/selectors/entities/cloud';
|
import {getSubscriptionProduct, checkHadPriorTrial, getCloudSubscription} from 'mattermost-redux/selectors/entities/cloud';
|
||||||
|
import {cloudReverseTrial} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
|
|
||||||
import {CloudProducts} from 'utils/constants';
|
import {CloudProducts} from 'utils/constants';
|
||||||
|
|
||||||
@@ -27,17 +28,20 @@ type BillingSummaryProps = {
|
|||||||
const BillingSummary = ({isFreeTrial, daysLeftOnTrial, onUpgradeMattermostCloud}: BillingSummaryProps) => {
|
const BillingSummary = ({isFreeTrial, daysLeftOnTrial, onUpgradeMattermostCloud}: BillingSummaryProps) => {
|
||||||
const subscription = useSelector(getCloudSubscription);
|
const subscription = useSelector(getCloudSubscription);
|
||||||
const product = useSelector(getSubscriptionProduct);
|
const product = useSelector(getSubscriptionProduct);
|
||||||
|
const reverseTrial = useSelector(cloudReverseTrial);
|
||||||
|
|
||||||
let body = noBillingHistory;
|
let body = noBillingHistory;
|
||||||
|
|
||||||
const isPreTrial = subscription?.is_free_trial === 'false' && subscription?.trial_end_at === 0;
|
const isPreTrial = subscription?.is_free_trial === 'false' && subscription?.trial_end_at === 0;
|
||||||
const hasPriorTrial = useSelector(checkHadPriorTrial);
|
const hasPriorTrial = useSelector(checkHadPriorTrial);
|
||||||
const showTryEnterprise = product?.sku === CloudProducts.STARTER && isPreTrial;
|
const isStarterPreTrial = product?.sku === CloudProducts.STARTER && isPreTrial;
|
||||||
const showUpgradeProfessional = product?.sku === CloudProducts.STARTER && hasPriorTrial;
|
const isStarterPostTrial = product?.sku === CloudProducts.STARTER && hasPriorTrial;
|
||||||
|
|
||||||
if (showTryEnterprise) {
|
if (isStarterPreTrial && reverseTrial) {
|
||||||
|
body = <UpgradeToProfessionalCard/>;
|
||||||
|
} else if (isStarterPreTrial) {
|
||||||
body = tryEnterpriseCard;
|
body = tryEnterpriseCard;
|
||||||
} else if (showUpgradeProfessional) {
|
} else if (isStarterPostTrial) {
|
||||||
body = <UpgradeToProfessionalCard/>;
|
body = <UpgradeToProfessionalCard/>;
|
||||||
} else if (isFreeTrial) {
|
} else if (isFreeTrial) {
|
||||||
body = freeTrial(onUpgradeMattermostCloud, daysLeftOnTrial);
|
body = freeTrial(onUpgradeMattermostCloud, daysLeftOnTrial);
|
||||||
|
|||||||
@@ -300,6 +300,10 @@ export function deprecateCloudFree(state: GlobalState): boolean {
|
|||||||
return getFeatureFlagValue(state, 'DeprecateCloudFree') === 'true';
|
return getFeatureFlagValue(state, 'DeprecateCloudFree') === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function cloudReverseTrial(state: GlobalState): boolean {
|
||||||
|
return getFeatureFlagValue(state, 'CloudReverseTrial') === 'true';
|
||||||
|
}
|
||||||
|
|
||||||
export function appsSidebarCategoryEnabled(state: GlobalState): boolean {
|
export function appsSidebarCategoryEnabled(state: GlobalState): boolean {
|
||||||
return getFeatureFlagValue(state, 'AppsSidebarCategory') === 'true';
|
return getFeatureFlagValue(state, 'AppsSidebarCategory') === 'true';
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user