Merge branch 'master' into MM-50966-in-product-expansion-backend

Этот коммит содержится в:
Mattermost Build
2023-04-12 22:55:38 +03:00
коммит произвёл GitHub
родитель dab14be745 3089b8b06d
Коммит de3ada24dc
7 изменённых файлов: 70 добавлений и 21 удалений

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

@@ -78,6 +78,8 @@ type FeatureFlags struct {
DeprecateCloudFree bool DeprecateCloudFree bool
AppsSidebarCategory bool AppsSidebarCategory bool
CloudReverseTrial bool
} }
func (f *FeatureFlags) SetDefaults() { func (f *FeatureFlags) SetDefaults() {
@@ -108,6 +110,7 @@ func (f *FeatureFlags) SetDefaults() {
f.OnboardingAutoShowLinkedBoard = false f.OnboardingAutoShowLinkedBoard = false
f.OnboardingTourTips = true f.OnboardingTourTips = true
f.AppsSidebarCategory = false f.AppsSidebarCategory = false
f.CloudReverseTrial = false
} }
func (f *FeatureFlags) Plugins() map[string]string { 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-antivirus-v0.1.2
PLUGIN_PACKAGES += mattermost-plugin-autolink-v1.2.2 PLUGIN_PACKAGES += mattermost-plugin-autolink-v1.2.2
PLUGIN_PACKAGES += mattermost-plugin-aws-SNS-v1.2.0 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-channel-export-v1.0.0
PLUGIN_PACKAGES += mattermost-plugin-confluence-v1.3.0 PLUGIN_PACKAGES += mattermost-plugin-confluence-v1.3.0
PLUGIN_PACKAGES += mattermost-plugin-custom-attributes-v1.3.1 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 {ModalData} from 'types/actions';
import {AlertCircleOutlineIcon, AlertOutlineIcon} from '@mattermost/compass-icons/components';
import { import {
Preferences, Preferences,
CloudBanners, CloudBanners,
@@ -38,6 +40,7 @@ type Props = {
daysLeftOnTrial: number; daysLeftOnTrial: number;
isCloud: boolean; isCloud: boolean;
subscription?: Subscription; subscription?: Subscription;
reverseTrial: boolean;
actions: { actions: {
savePreferences: (userId: string, preferences: PreferenceType[]) => void; savePreferences: (userId: string, preferences: PreferenceType[]) => void;
getCloudSubscription: () => void; getCloudSubscription: () => void;
@@ -132,7 +135,7 @@ class CloudTrialAnnouncementBar extends React.PureComponent<Props> {
return null; return null;
} }
const trialMoreThan3DaysMsg = ( let trialMoreThan7DaysMsg = (
<FormattedMessage <FormattedMessage
id='admin.billing.subscription.cloudTrial.moreThan3Days' id='admin.billing.subscription.cloudTrial.moreThan3Days'
defaultMessage='Your trial has started! There are {daysLeftOnTrial} days left' 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 <FormattedMessage
id='admin.billing.subscription.cloudTrial.daysLeftOnTrial' id='admin.billing.subscription.cloudTrial.daysLeftOnTrial'
defaultMessage='There are {daysLeftOnTrial} days left on your free trial' 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'); if (this.props.reverseTrial) {
const userEndTrialHour = getLocaleDateFromUTC((this.props.subscription?.trial_end_at as number / 1000), 'HH:mm:ss', this.props.currentUser.timezone?.automaticTimezone as string); 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 <FormattedMessage
id='admin.billing.subscription.cloudTrial.lastDay' id='admin.billing.subscription.cloudTrial.lastDay'
defaultMessage='This is the last day of your free trial. Your access will expire on {userEndTrialDate} at {userEndTrialHour}.' 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 bannerMessage;
let icon; let icon;
switch (daysLeftOnTrial) {
case TrialPeriodDays.TRIAL_WARNING_THRESHOLD: if (daysLeftOnTrial >= TrialPeriodDays.TRIAL_2_DAYS && daysLeftOnTrial <= TrialPeriodDays.TRIAL_WARNING_THRESHOLD) {
case TrialPeriodDays.TRIAL_2_DAYS: bannerMessage = trialLessThan7DaysMsg;
bannerMessage = trialLessThan3DaysMsg; icon = <AlertCircleOutlineIcon size={18}/>;
break; } else if (daysLeftOnTrial <= TrialPeriodDays.TRIAL_1_DAY && daysLeftOnTrial >= TrialPeriodDays.TRIAL_0_DAYS) {
case TrialPeriodDays.TRIAL_1_DAY:
case TrialPeriodDays.TRIAL_0_DAYS:
bannerMessage = trialLastDaysMsg; bannerMessage = trialLastDaysMsg;
break; icon = <AlertOutlineIcon size={18}/>;
default: } else {
bannerMessage = trialMoreThan3DaysMsg; bannerMessage = trialMoreThan7DaysMsg;
icon = <i className='icon-check-outline-circle'/>; icon = <AlertCircleOutlineIcon size={18}/>;
break;
} }
const dismissable = this.isDismissable(); const dismissable = this.isDismissable();
@@ -184,8 +223,8 @@ class CloudTrialAnnouncementBar extends React.PureComponent<Props> {
showCloseButton={dismissable} showCloseButton={dismissable}
handleClose={this.handleClose} handleClose={this.handleClose}
onButtonClick={this.showModal} onButtonClick={this.showModal}
modalButtonText={t('admin.billing.subscription.cloudTrial.subscribeButton')} modalButtonText={modalButtonText}
modalButtonDefaultText={'Upgrade Now'} modalButtonDefaultText={modalButtonDefaultText}
message={bannerMessage} message={bannerMessage}
showLinkAsButton={true} showLinkAsButton={true}
icon={icon} icon={icon}

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

@@ -21,6 +21,7 @@ import {Preferences, TrialPeriodDays} from 'utils/constants';
import {getRemainingDaysFromFutureTimestamp} from 'utils/utils'; import {getRemainingDaysFromFutureTimestamp} from 'utils/utils';
import CloudTrialAnnouncementBar from './cloud_trial_announcement_bar'; import CloudTrialAnnouncementBar from './cloud_trial_announcement_bar';
import {getConfig} from 'mattermost-redux/selectors/entities/admin';
function mapStateToProps(state: GlobalState) { function mapStateToProps(state: GlobalState) {
const getCategory = makeGetCategory(); const getCategory = makeGetCategory();
@@ -29,6 +30,7 @@ function mapStateToProps(state: GlobalState) {
const isCloud = getLicense(state).Cloud === 'true'; const isCloud = getLicense(state).Cloud === 'true';
let isFreeTrial = false; let isFreeTrial = false;
let daysLeftOnTrial = 0; let daysLeftOnTrial = 0;
const config = getConfig(state);
if (isCloud && subscription?.is_free_trial === 'true') { if (isCloud && subscription?.is_free_trial === 'true') {
isFreeTrial = true; isFreeTrial = true;
@@ -46,6 +48,7 @@ function mapStateToProps(state: GlobalState) {
isCloud, isCloud,
subscription, subscription,
preferences: getCategory(state, Preferences.CLOUD_TRIAL_BANNER), 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.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.cancelSubscriptionSection.title": "Cancel your subscription",
"admin.billing.subscription.cloudMonthlyBadge": "Monthly", "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.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.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", "admin.billing.subscription.cloudTrial.moreThan3Days": "Your trial has started! There are {daysLeftOnTrial} days left",

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

@@ -104,6 +104,7 @@
height: 24px; height: 24px;
box-sizing: border-box; box-sizing: border-box;
padding: 4px 8px; padding: 4px 8px;
padding-top: 2px;
border: 1px solid #fff; border: 1px solid #fff;
margin-left: 8px; margin-left: 8px;
background-color: inherit !important; background-color: inherit !important;

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

@@ -177,7 +177,7 @@ export const Unique = {
export const TrialPeriodDays = { export const TrialPeriodDays = {
TRIAL_30_DAYS: 30, TRIAL_30_DAYS: 30,
TRIAL_14_DAYS: 14, TRIAL_14_DAYS: 14,
TRIAL_WARNING_THRESHOLD: 3, TRIAL_WARNING_THRESHOLD: 7,
TRIAL_2_DAYS: 2, TRIAL_2_DAYS: 2,
TRIAL_1_DAY: 1, TRIAL_1_DAY: 1,
TRIAL_0_DAYS: 0, TRIAL_0_DAYS: 0,