Merge branch 'master' into MM-50966-in-product-expansion-backend
Этот коммит содержится в:
@@ -78,6 +78,8 @@ type FeatureFlags struct {
|
||||
DeprecateCloudFree bool
|
||||
|
||||
AppsSidebarCategory bool
|
||||
|
||||
CloudReverseTrial bool
|
||||
}
|
||||
|
||||
func (f *FeatureFlags) SetDefaults() {
|
||||
@@ -108,6 +110,7 @@ func (f *FeatureFlags) SetDefaults() {
|
||||
f.OnboardingAutoShowLinkedBoard = false
|
||||
f.OnboardingTourTips = true
|
||||
f.AppsSidebarCategory = false
|
||||
f.CloudReverseTrial = false
|
||||
}
|
||||
|
||||
func (f *FeatureFlags) Plugins() map[string]string {
|
||||
|
||||
@@ -142,7 +142,7 @@ TEMPLATES_DIR=templates
|
||||
PLUGIN_PACKAGES ?= mattermost-plugin-antivirus-v0.1.2
|
||||
PLUGIN_PACKAGES += mattermost-plugin-autolink-v1.2.2
|
||||
PLUGIN_PACKAGES += mattermost-plugin-aws-SNS-v1.2.0
|
||||
PLUGIN_PACKAGES += mattermost-plugin-calls-v0.15.0
|
||||
PLUGIN_PACKAGES += mattermost-plugin-calls-v0.15.1
|
||||
PLUGIN_PACKAGES += mattermost-plugin-channel-export-v1.0.0
|
||||
PLUGIN_PACKAGES += mattermost-plugin-confluence-v1.3.0
|
||||
PLUGIN_PACKAGES += mattermost-plugin-custom-attributes-v1.3.1
|
||||
|
||||
@@ -18,6 +18,8 @@ import PricingModal from 'components/pricing_modal';
|
||||
|
||||
import {ModalData} from 'types/actions';
|
||||
|
||||
import {AlertCircleOutlineIcon, AlertOutlineIcon} from '@mattermost/compass-icons/components';
|
||||
|
||||
import {
|
||||
Preferences,
|
||||
CloudBanners,
|
||||
@@ -38,6 +40,7 @@ type Props = {
|
||||
daysLeftOnTrial: number;
|
||||
isCloud: boolean;
|
||||
subscription?: Subscription;
|
||||
reverseTrial: boolean;
|
||||
actions: {
|
||||
savePreferences: (userId: string, preferences: PreferenceType[]) => void;
|
||||
getCloudSubscription: () => void;
|
||||
@@ -132,7 +135,7 @@ class CloudTrialAnnouncementBar extends React.PureComponent<Props> {
|
||||
return null;
|
||||
}
|
||||
|
||||
const trialMoreThan3DaysMsg = (
|
||||
let trialMoreThan7DaysMsg = (
|
||||
<FormattedMessage
|
||||
id='admin.billing.subscription.cloudTrial.moreThan3Days'
|
||||
defaultMessage='Your trial has started! There are {daysLeftOnTrial} days left'
|
||||
@@ -140,7 +143,26 @@ class CloudTrialAnnouncementBar extends React.PureComponent<Props> {
|
||||
/>
|
||||
);
|
||||
|
||||
const trialLessThan3DaysMsg = (
|
||||
let modalButtonText = t('admin.billing.subscription.cloudTrial.subscribeButton');
|
||||
let modalButtonDefaultText = 'Upgrade Now';
|
||||
|
||||
if (this.props.reverseTrial) {
|
||||
modalButtonText = t('admin.billing.subscription.cloudReverseTrial.subscribeButton');
|
||||
modalButtonDefaultText = 'Review your options';
|
||||
}
|
||||
|
||||
if (this.props.reverseTrial) {
|
||||
const trialEnd = getLocaleDateFromUTC((this.props.subscription?.trial_end_at as number / 1000), 'MMMM Do');
|
||||
trialMoreThan7DaysMsg = (
|
||||
<FormattedMessage
|
||||
id='admin.billing.subscription.cloudTrial.moreThan3Days'
|
||||
defaultMessage='Your 30 day Enterprise trial has started! Purchase before {trialEnd} to keep your workspace.'
|
||||
values={{trialEnd}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
let trialLessThan7DaysMsg = (
|
||||
<FormattedMessage
|
||||
id='admin.billing.subscription.cloudTrial.daysLeftOnTrial'
|
||||
defaultMessage='There are {daysLeftOnTrial} days left on your free trial'
|
||||
@@ -148,10 +170,20 @@ class CloudTrialAnnouncementBar extends React.PureComponent<Props> {
|
||||
/>
|
||||
);
|
||||
|
||||
const userEndTrialDate = getLocaleDateFromUTC((this.props.subscription?.trial_end_at as number / 1000), 'MMMM Do YYYY');
|
||||
const userEndTrialHour = getLocaleDateFromUTC((this.props.subscription?.trial_end_at as number / 1000), 'HH:mm:ss', this.props.currentUser.timezone?.automaticTimezone as string);
|
||||
if (this.props.reverseTrial) {
|
||||
trialLessThan7DaysMsg = (
|
||||
<FormattedMessage
|
||||
id='admin.billing.subscription.cloudReverseTrial.daysLeftOnTrial'
|
||||
defaultMessage='{daysLeftOnTrial} days left on your trial. Purchase a plan or contact sales to keep your workspace.'
|
||||
values={{daysLeftOnTrial}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const trialLastDaysMsg = (
|
||||
const userEndTrialDate = getLocaleDateFromUTC((this.props.subscription?.trial_end_at as number / 1000), 'MMMM Do YYYY');
|
||||
const userEndTrialHour = getLocaleDateFromUTC((this.props.subscription?.trial_end_at as number / 1000), 'HH:mm', this.props.currentUser.timezone?.automaticTimezone as string);
|
||||
|
||||
let trialLastDaysMsg = (
|
||||
<FormattedMessage
|
||||
id='admin.billing.subscription.cloudTrial.lastDay'
|
||||
defaultMessage='This is the last day of your free trial. Your access will expire on {userEndTrialDate} at {userEndTrialHour}.'
|
||||
@@ -159,21 +191,28 @@ class CloudTrialAnnouncementBar extends React.PureComponent<Props> {
|
||||
/>
|
||||
);
|
||||
|
||||
if (this.props.reverseTrial) {
|
||||
trialLastDaysMsg = (
|
||||
<FormattedMessage
|
||||
id='admin.billing.subscription.cloudReverseTrial.lastDay'
|
||||
defaultMessage='This is the last day of your trial. Purchase a plan before {userEndTrialHour} or contact sales'
|
||||
values={{userEndTrialHour}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
let bannerMessage;
|
||||
let icon;
|
||||
switch (daysLeftOnTrial) {
|
||||
case TrialPeriodDays.TRIAL_WARNING_THRESHOLD:
|
||||
case TrialPeriodDays.TRIAL_2_DAYS:
|
||||
bannerMessage = trialLessThan3DaysMsg;
|
||||
break;
|
||||
case TrialPeriodDays.TRIAL_1_DAY:
|
||||
case TrialPeriodDays.TRIAL_0_DAYS:
|
||||
|
||||
if (daysLeftOnTrial >= TrialPeriodDays.TRIAL_2_DAYS && daysLeftOnTrial <= TrialPeriodDays.TRIAL_WARNING_THRESHOLD) {
|
||||
bannerMessage = trialLessThan7DaysMsg;
|
||||
icon = <AlertCircleOutlineIcon size={18}/>;
|
||||
} else if (daysLeftOnTrial <= TrialPeriodDays.TRIAL_1_DAY && daysLeftOnTrial >= TrialPeriodDays.TRIAL_0_DAYS) {
|
||||
bannerMessage = trialLastDaysMsg;
|
||||
break;
|
||||
default:
|
||||
bannerMessage = trialMoreThan3DaysMsg;
|
||||
icon = <i className='icon-check-outline-circle'/>;
|
||||
break;
|
||||
icon = <AlertOutlineIcon size={18}/>;
|
||||
} else {
|
||||
bannerMessage = trialMoreThan7DaysMsg;
|
||||
icon = <AlertCircleOutlineIcon size={18}/>;
|
||||
}
|
||||
|
||||
const dismissable = this.isDismissable();
|
||||
@@ -184,8 +223,8 @@ class CloudTrialAnnouncementBar extends React.PureComponent<Props> {
|
||||
showCloseButton={dismissable}
|
||||
handleClose={this.handleClose}
|
||||
onButtonClick={this.showModal}
|
||||
modalButtonText={t('admin.billing.subscription.cloudTrial.subscribeButton')}
|
||||
modalButtonDefaultText={'Upgrade Now'}
|
||||
modalButtonText={modalButtonText}
|
||||
modalButtonDefaultText={modalButtonDefaultText}
|
||||
message={bannerMessage}
|
||||
showLinkAsButton={true}
|
||||
icon={icon}
|
||||
|
||||
@@ -21,6 +21,7 @@ import {Preferences, TrialPeriodDays} from 'utils/constants';
|
||||
import {getRemainingDaysFromFutureTimestamp} from 'utils/utils';
|
||||
|
||||
import CloudTrialAnnouncementBar from './cloud_trial_announcement_bar';
|
||||
import {getConfig} from 'mattermost-redux/selectors/entities/admin';
|
||||
|
||||
function mapStateToProps(state: GlobalState) {
|
||||
const getCategory = makeGetCategory();
|
||||
@@ -29,6 +30,7 @@ function mapStateToProps(state: GlobalState) {
|
||||
const isCloud = getLicense(state).Cloud === 'true';
|
||||
let isFreeTrial = false;
|
||||
let daysLeftOnTrial = 0;
|
||||
const config = getConfig(state);
|
||||
|
||||
if (isCloud && subscription?.is_free_trial === 'true') {
|
||||
isFreeTrial = true;
|
||||
@@ -46,6 +48,7 @@ function mapStateToProps(state: GlobalState) {
|
||||
isCloud,
|
||||
subscription,
|
||||
preferences: getCategory(state, Preferences.CLOUD_TRIAL_BANNER),
|
||||
reverseTrial: Boolean(config.FeatureFlags?.CloudReverseTrial),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -304,6 +304,9 @@
|
||||
"admin.billing.subscription.cancelSubscriptionSection.description": "At this time, deleting a workspace can only be done with the help of a customer support representative.",
|
||||
"admin.billing.subscription.cancelSubscriptionSection.title": "Cancel your subscription",
|
||||
"admin.billing.subscription.cloudMonthlyBadge": "Monthly",
|
||||
"admin.billing.subscription.cloudReverseTrial.daysLeftOnTrial": "{daysLeftOnTrial} days left on your trial. Purchase a plan or contact sales to keep your workspace.",
|
||||
"admin.billing.subscription.cloudReverseTrial.lastDay": "This is the last day of your trial. Purchase a plan before {userEndTrialHour} or contact sales",
|
||||
"admin.billing.subscription.cloudReverseTrial.subscribeButton": "Review your options",
|
||||
"admin.billing.subscription.cloudTrial.daysLeftOnTrial": "There are {daysLeftOnTrial} days left on your free trial",
|
||||
"admin.billing.subscription.cloudTrial.lastDay": "This is the last day of your free trial. Your access will expire on {userEndTrialDate} at {userEndTrialHour}.",
|
||||
"admin.billing.subscription.cloudTrial.moreThan3Days": "Your trial has started! There are {daysLeftOnTrial} days left",
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
height: 24px;
|
||||
box-sizing: border-box;
|
||||
padding: 4px 8px;
|
||||
padding-top: 2px;
|
||||
border: 1px solid #fff;
|
||||
margin-left: 8px;
|
||||
background-color: inherit !important;
|
||||
|
||||
@@ -177,7 +177,7 @@ export const Unique = {
|
||||
export const TrialPeriodDays = {
|
||||
TRIAL_30_DAYS: 30,
|
||||
TRIAL_14_DAYS: 14,
|
||||
TRIAL_WARNING_THRESHOLD: 3,
|
||||
TRIAL_WARNING_THRESHOLD: 7,
|
||||
TRIAL_2_DAYS: 2,
|
||||
TRIAL_1_DAY: 1,
|
||||
TRIAL_0_DAYS: 0,
|
||||
|
||||
Ссылка в новой задаче
Block a user