Skip to content

Commit

Permalink
remove requestTrial flow, use cloud pricing flow instead
Browse files Browse the repository at this point in the history
  • Loading branch information
cpoile committed Jun 9, 2022
1 parent beaf37e commit a1f127a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 336 deletions.
28 changes: 1 addition & 27 deletions webapp/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ import {getPluginPath} from 'src/utils';

import {modals, openPricingModal} from 'src/webapp_globals';
import {
CloudFreeTrialErrorModal,
CloudFreeTrialModalAdmin,
CloudFreeTrialModalUser,
CloudFreeTrialSuccessModal,
IDAdmin, IDError,
IDSuccess,
IDAdmin,
IDUser,
} from 'src/cloud_pricing/modals';

Expand Down Expand Up @@ -142,29 +139,6 @@ export const displayCloudPricing = () => {
};
};

export const requestTrial = () => {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
const isAdmin = isCurrentUserSystemAdmin(getState());
if (!isAdmin) {
return {};
}

const success = await requestCloudTrial();
if (success) {
dispatch(modals.openModal({
modalId: IDSuccess,
dialogType: CloudFreeTrialSuccessModal,
}));
} else {
dispatch(modals.openModal({
modalId: IDError,
dialogType: CloudFreeTrialErrorModal,
}));
}
return {};
};
};

export const endCall = (channelID: string) => {
return axios.post(`${getPluginPath()}/calls/${channelID}/end`, null,
{headers: {'X-Requested-With': 'XMLHttpRequest'}});
Expand Down
79 changes: 2 additions & 77 deletions webapp/src/cloud_pricing/modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ import {useDispatch, useSelector} from 'react-redux';
import {Thunk} from 'mattermost-redux/types/actions';

import GenericModal from 'src/components/generic_modal';
import {displayCloudPricing, notifyAdminCloudFreeTrial, requestTrial} from 'src/actions';
import RaisedHandsIllustration from 'src/cloud_pricing/raised_hands_illustration';
import UpgradeErrorIllustrationSvg from 'src/cloud_pricing/upgrade_error_illustration_svg';
import {displayCloudPricing, notifyAdminCloudFreeTrial} from 'src/actions';
import {isCloudTrialCompleted} from 'src/selectors';

export const IDUser = 'cloud_free_trial_user';
export const IDAdmin = 'cloud_free_trial_admin';
export const IDSuccess = 'cloud_free_trial_success';
export const IDError = 'cloud_free_trial_failure';

type Props = Partial<ComponentProps<typeof GenericModal>>;

Expand Down Expand Up @@ -58,7 +54,7 @@ export const CloudFreeTrialModalAdmin = (modalProps: Props) => {
let headerText = formatMessage({defaultMessage: 'Try channel calls with a free trial'});
let confirmButtonText = formatMessage({defaultMessage: 'Try free for 30 days'});
let bodyText = formatMessage({defaultMessage: 'Calls are a quick, audio-first way of interacting with your colleagues. Get the full calls experience when you start a free, 30-day trial.'});
let confirmThunk: Thunk = requestTrial();
let confirmThunk: Thunk = displayCloudPricing();

if (trialTaken) {
headerText = formatMessage({defaultMessage: 'Upgrade to use calls in Channels'});
Expand All @@ -85,58 +81,6 @@ export const CloudFreeTrialModalAdmin = (modalProps: Props) => {
);
};

export const CloudFreeTrialSuccessModal = (modalProps: Props) => {
const {formatMessage} = useIntl();

return (
<SizedGenericModal
id={IDSuccess}
{...modalProps}
confirmButtonText={formatMessage({defaultMessage: 'Done'})}
handleConfirm={() => null}
onHide={() => null}
>
<div>
<Centered>
<SuccessImage/>
</Centered>
<Heading>
{formatMessage({defaultMessage: 'Your trial has started!'})}
<p>{formatMessage({defaultMessage: 'Explore the benefits of Enterprise'})}</p>
</Heading>
{formatMessage({defaultMessage: 'Welcome to your Mattermost Enterprise trial! You now have access to guest accounts, automated compliance reports, and mobile secure-ID push notifications, among many other features. [View a list of features on our pricing page](https://mattermost.com/pricing/). Ready to dive in? [Visit our documentation to get started](https://docs.mattermost.com/overview/index.html).'})}
</div>
</SizedGenericModal>
);
};

export const CloudFreeTrialErrorModal = (modalProps: Props) => {
const {formatMessage} = useIntl();

return (
<SizedGenericModal
id={IDError}
{...modalProps}
confirmButtonText={formatMessage({defaultMessage: 'Contact Support'})}
handleConfirm={() => window.open('https://mattermost.com/pricing-cloud')}
cancelButtonText={formatMessage({defaultMessage: 'Close'})}
showCancel={true}
onHide={() => null}
>
<div>
<Centered>
<ErrorImage/>
</Centered>
<Heading>
{formatMessage({defaultMessage: 'We encountered an error'})}
</Heading>
<VerticalSpacer size={12}/>
{formatMessage({defaultMessage: 'Please see the system logs for more information, and contact support.'})}
</div>
</SizedGenericModal>
);
};

const SizedGenericModal = styled(GenericModal)`
width: 512px;
height: 404px;
Expand All @@ -148,25 +92,6 @@ const FooterContainer = styled.div`
justify-content: space-between;
`;

const Heading = styled.div`
font-weight: 600;
font-size: 22px;
line-height: 28px;
text-align: center;
`;

const Centered = styled.div`
text-align: center;
`;

const VerticalSpacer = styled.div<{ size: number }>`
margin-top: ${(props) => props.size}px;
`;

const SuccessImage = styled(RaisedHandsIllustration)`
margin: 32px;
`;

const ErrorImage = styled(UpgradeErrorIllustrationSvg)`
width: 360px;
`;
96 changes: 0 additions & 96 deletions webapp/src/cloud_pricing/raised_hands_illustration.tsx

This file was deleted.

Loading

0 comments on commit a1f127a

Please sign in to comment.