diff --git a/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.test.tsx b/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.test.tsx index e8589a0c09..b59e778bd6 100644 --- a/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.test.tsx +++ b/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.test.tsx @@ -31,6 +31,7 @@ describe('components/feature_discovery', () => { hadPrevCloudTrial={false} isSubscriptionLoaded={true} isPaidSubscription={false} + cloudFreeDeprecated={false} actions={{ getPrevTrialLicense: jest.fn(), getCloudSubscription: jest.fn(), @@ -58,6 +59,7 @@ describe('components/feature_discovery', () => { isCloudTrial={false} hadPrevCloudTrial={false} isPaidSubscription={false} + cloudFreeDeprecated={false} isSubscriptionLoaded={true} actions={{ getPrevTrialLicense: jest.fn(), @@ -87,6 +89,7 @@ describe('components/feature_discovery', () => { isCloudTrial={false} hadPrevCloudTrial={false} isSubscriptionLoaded={false} + cloudFreeDeprecated={false} isPaidSubscription={false} actions={{ getPrevTrialLicense: jest.fn(), diff --git a/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.tsx b/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.tsx index e2faca2227..902e1a1187 100644 --- a/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.tsx +++ b/webapp/channels/src/components/admin_console/feature_discovery/feature_discovery.tsx @@ -59,6 +59,7 @@ type Props = { isSubscriptionLoaded: boolean; isPaidSubscription: boolean; customer?: CloudCustomer; + cloudFreeDeprecated: boolean; } type State = { @@ -205,6 +206,23 @@ export default class FeatureDiscovery extends React.PureComponent extraClass='btn btn-primary' /> ); + if (this.props.cloudFreeDeprecated) { + ctaPrimaryButton = ( + + ); + } } else if (hadPrevCloudTrial) { // if it is cloud, but this account already had a free trial, then the cta button must be Upgrade now ctaPrimaryButton = ( @@ -259,7 +277,7 @@ export default class FeatureDiscovery extends React.PureComponent /> {gettingTrialError} - {(!this.props.isCloud || canRequestCloudFreeTrial) &&

+ {((!this.props.isCloud || canRequestCloudFreeTrial) && !this.props.cloudFreeDeprecated) &&

{canRequestCloudFreeTrial ? ( state.entities.admin.prevTrialLicense); const hasSelfHostedPriorTrial = prevTrialLicense.IsLicensed === 'true'; @@ -100,7 +102,7 @@ const FeatureRestrictedModal = ({ const getTitle = () => { if (isSystemAdmin) { - return hasPriorTrial ? titleAdminPostTrial : titleAdminPreTrial; + return (hasPriorTrial || cloudFreeDeprecated) ? titleAdminPostTrial : titleAdminPreTrial; } return titleEndUser; @@ -108,13 +110,13 @@ const FeatureRestrictedModal = ({ const getMessage = () => { if (isSystemAdmin) { - return hasPriorTrial ? messageAdminPostTrial : messageAdminPreTrial; + return (hasPriorTrial || cloudFreeDeprecated) ? messageAdminPostTrial : messageAdminPreTrial; } return messageEndUser; }; - const showStartTrial = isSystemAdmin && !hasPriorTrial; + const showStartTrial = isSystemAdmin && !hasPriorTrial && !cloudFreeDeprecated; // define what is the secondary button text and action, by default will be the View Plan button let secondaryBtnMsg = formatMessage({id: 'feature_restricted_modal.button.plans', defaultMessage: 'View plans'}); diff --git a/webapp/channels/src/components/invitation_modal/invite_as.tsx b/webapp/channels/src/components/invitation_modal/invite_as.tsx index aabcb2674e..a7e552c024 100644 --- a/webapp/channels/src/components/invitation_modal/invite_as.tsx +++ b/webapp/channels/src/components/invitation_modal/invite_as.tsx @@ -14,6 +14,7 @@ import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/user import {getSubscriptionProduct, checkHadPriorTrial} from 'mattermost-redux/selectors/entities/cloud'; import {DispatchFunc} from 'mattermost-redux/types/actions'; import {getPrevTrialLicense} from 'mattermost-redux/actions/admin'; +import {deprecateCloudFree} from 'mattermost-redux/selectors/entities/preferences'; import {closeModal, openModal} from 'actions/views/modals'; @@ -43,6 +44,7 @@ export type Props = { export default function InviteAs(props: Props) { const {formatMessage} = useIntl(); const license = useSelector(getLicense); + const cloudFreeDeprecated = useSelector(deprecateCloudFree); const dispatch = useDispatch(); useEffect(() => { @@ -85,7 +87,7 @@ export default function InviteAs(props: Props) { if (isFreeTrial) { ctaExtraContentMsg = formatMessage({id: 'free.professional_feature.professional', defaultMessage: 'Professional feature'}); } else { - ctaExtraContentMsg = hasPriorTrial ? formatMessage({id: 'free.professional_feature.upgrade', defaultMessage: 'Upgrade'}) : formatMessage({id: 'free.professional_feature.try_free', defaultMessage: 'Professional feature- try it out free'}); + ctaExtraContentMsg = (hasPriorTrial || cloudFreeDeprecated) ? formatMessage({id: 'free.professional_feature.upgrade', defaultMessage: 'Upgrade'}) : formatMessage({id: 'free.professional_feature.try_free', defaultMessage: 'Professional feature- try it out free'}); } const restrictedIndicator = ( diff --git a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.test.tsx b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.test.tsx index e9dd3a2147..2194f15855 100644 --- a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.test.tsx +++ b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.test.tsx @@ -33,6 +33,12 @@ describe('components/learn_more_trial_modal/learn_more_trial_modal', () => { entities: { users: { currentUserId: 'current_user_id', + profiles: { + current_user_id: { + id: 'current_user_id', + roles: '', + }, + }, }, admin: { analytics: { diff --git a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.tsx b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.tsx index d3a81f9690..c50aa6caa8 100644 --- a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.tsx +++ b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React, {useCallback, useEffect, useMemo, useState} from 'react'; -import {useIntl} from 'react-intl'; +import {FormattedMessage, useIntl} from 'react-intl'; import {useSelector, useDispatch} from 'react-redux'; import {trackEvent} from 'actions/telemetry_actions'; @@ -16,10 +16,13 @@ import MonitorImacLikeSVG from 'components/common/svg_images_components/monitor_ import SystemRolesSVG from 'components/admin_console/feature_discovery/features/images/system_roles_svg'; import CloudStartTrialButton from 'components/cloud_start_trial/cloud_start_trial_btn'; import {BtnStyle} from 'components/common/carousel/carousel_button'; +import useOpenSalesLink from 'components/common/hooks/useOpenSalesLink'; +import ExternalLink from 'components/external_link'; import {closeModal} from 'actions/views/modals'; import {DispatchFunc} from 'mattermost-redux/types/actions'; import {getLicense} from 'mattermost-redux/selectors/entities/general'; +import {deprecateCloudFree} from 'mattermost-redux/selectors/entities/preferences'; import StartTrialBtn from './start_trial_btn'; @@ -43,8 +46,11 @@ const LearnMoreTrialModal = ( const [embargoed, setEmbargoed] = useState(false); const dispatch = useDispatch(); + const [, salesLink] = useOpenSalesLink(); + // Cloud conditions const license = useSelector(getLicense); + const cloudFreeDeprecated = useSelector(deprecateCloudFree); const isCloud = license?.Cloud === 'true'; const handleEmbargoError = useCallback(() => { @@ -78,6 +84,20 @@ const LearnMoreTrialModal = ( extraClass={'btn btn-primary start-cloud-trial-btn'} /> ); + if (cloudFreeDeprecated) { + startTrialBtn = ( + + + + ); + } } const handleOnClose = useCallback(() => { diff --git a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal_step.tsx b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal_step.tsx index b9b3bbba43..3b721fea0b 100644 --- a/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal_step.tsx +++ b/webapp/channels/src/components/learn_more_trial_modal/learn_more_trial_modal_step.tsx @@ -2,10 +2,11 @@ // See LICENSE.txt for license information. import React from 'react'; - +import {useSelector} from 'react-redux'; import {FormattedMessage} from 'react-intl'; import TrialBenefitsModalStepMore from 'components/trial_benefits_modal/trial_benefits_modal_step_more'; +import {deprecateCloudFree} from 'mattermost-redux/selectors/entities/preferences'; import './learn_more_trial_modal_step.scss'; import {AboutLinks, LicenseLinks} from 'utils/constants'; @@ -35,6 +36,7 @@ const LearnMoreTrialModalStep = ( buttonLabel, handleOnClose, }: LearnMoreTrialModalStepProps) => { + const cloudFreeDeprecated = useSelector(deprecateCloudFree); return (

)} -
- - ( - - {msg} - - ), - linkPrivacy: (msg: React.ReactNode) => ( - - {msg} - - ), - }} - /> - -
+ { + cloudFreeDeprecated ? '' : ( +
+ + ( + + {msg} + + ), + linkPrivacy: (msg: React.ReactNode) => ( + + {msg} + + ), + }} + /> + +
+ ) + } {bottomLeftMessage && (
{bottomLeftMessage} diff --git a/webapp/channels/src/components/widgets/menu/menu_items/menu_cloud_trial.tsx b/webapp/channels/src/components/widgets/menu/menu_items/menu_cloud_trial.tsx index 4cee71725a..82aab4eab2 100644 --- a/webapp/channels/src/components/widgets/menu/menu_items/menu_cloud_trial.tsx +++ b/webapp/channels/src/components/widgets/menu/menu_items/menu_cloud_trial.tsx @@ -14,6 +14,7 @@ import {DispatchFunc} from 'mattermost-redux/types/actions'; import {getLicense} from 'mattermost-redux/selectors/entities/general'; import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users'; import {getCloudSubscription, getSubscriptionProduct} from 'mattermost-redux/selectors/entities/cloud'; +import {deprecateCloudFree} from 'mattermost-redux/selectors/entities/preferences'; import {openModal} from 'actions/views/modals'; @@ -32,6 +33,7 @@ const MenuCloudTrial = ({id}: Props): JSX.Element | null => { const subscription = useSelector(getCloudSubscription); const subscriptionProduct = useSelector(getSubscriptionProduct); const license = useSelector(getLicense); + const cloudFreeDeprecated = useSelector(deprecateCloudFree); const dispatch = useDispatch(); const isCloud = license?.Cloud === 'true'; @@ -109,7 +111,7 @@ const MenuCloudTrial = ({id}: Props): JSX.Element | null => { ); // menu option displayed when the workspace is not running any trial - const noFreeTrialContent = noPriorTrial ? ( + const noFreeTrialContent = (noPriorTrial && !cloudFreeDeprecated) ? (