2023-04-04 13:36:07 +00:00
|
|
|
import React from "react";
|
|
|
|
import { inject, observer } from "mobx-react";
|
|
|
|
import { withRouter } from "react-router";
|
|
|
|
import ArticleTeamTrainingAlert from "./article-team-training";
|
|
|
|
import ArticlePaymentAlert from "./article-payment-alert";
|
2023-05-16 07:44:44 +00:00
|
|
|
import ArticleEnterpriseAlert from "./article-enterprise-alert";
|
2023-04-04 13:36:07 +00:00
|
|
|
import { StyledArticleAlertsComponent } from "../styled-article";
|
|
|
|
|
|
|
|
const ArticleAlerts = ({
|
|
|
|
showText,
|
|
|
|
isNonProfit,
|
|
|
|
isGracePeriod,
|
|
|
|
isFreeTariff,
|
|
|
|
isPaymentPageAvailable,
|
|
|
|
isTeamTrainingAlertAvailable,
|
2023-05-16 07:44:44 +00:00
|
|
|
isLicenseExpiring,
|
2023-05-24 12:25:05 +00:00
|
|
|
isLicenseDateExpired,
|
2023-05-16 07:44:44 +00:00
|
|
|
isEnterprise,
|
2023-05-16 09:07:52 +00:00
|
|
|
isTrial,
|
2023-05-17 14:37:55 +00:00
|
|
|
standalone,
|
2023-04-04 13:36:07 +00:00
|
|
|
}) => {
|
2023-05-17 14:37:55 +00:00
|
|
|
const paymentsAlertsComponent = () => {
|
|
|
|
if (!standalone) {
|
|
|
|
return (
|
|
|
|
isPaymentPageAvailable &&
|
2023-04-04 13:36:07 +00:00
|
|
|
!isNonProfit &&
|
|
|
|
(isFreeTariff || isGracePeriod) &&
|
2023-05-17 14:37:55 +00:00
|
|
|
showText && <ArticlePaymentAlert isFreeTariff={isFreeTariff} />
|
|
|
|
);
|
|
|
|
}
|
2023-04-04 13:36:07 +00:00
|
|
|
|
2023-05-25 08:01:33 +00:00
|
|
|
const isVisibleStandaloneAlert =
|
|
|
|
isTrial || isLicenseExpiring || isLicenseDateExpired;
|
2023-05-16 07:44:44 +00:00
|
|
|
|
2023-05-17 14:37:55 +00:00
|
|
|
return (
|
|
|
|
isPaymentPageAvailable &&
|
|
|
|
isEnterprise &&
|
|
|
|
isVisibleStandaloneAlert &&
|
|
|
|
showText && <ArticleEnterpriseAlert />
|
|
|
|
);
|
|
|
|
};
|
2023-05-16 09:07:52 +00:00
|
|
|
|
2023-05-17 14:37:55 +00:00
|
|
|
return (
|
|
|
|
<StyledArticleAlertsComponent>
|
|
|
|
{paymentsAlertsComponent()}
|
2023-04-04 13:36:07 +00:00
|
|
|
{isTeamTrainingAlertAvailable && showText && <ArticleTeamTrainingAlert />}
|
|
|
|
</StyledArticleAlertsComponent>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default withRouter(
|
|
|
|
inject(({ auth }) => {
|
|
|
|
const {
|
|
|
|
currentQuotaStore,
|
|
|
|
settingsStore,
|
|
|
|
isPaymentPageAvailable,
|
|
|
|
isTeamTrainingAlertAvailable,
|
|
|
|
currentTariffStatusStore,
|
2023-05-16 07:44:44 +00:00
|
|
|
isEnterprise,
|
2023-04-04 13:36:07 +00:00
|
|
|
} = auth;
|
2023-05-16 09:07:52 +00:00
|
|
|
const { isFreeTariff, isNonProfit, isTrial } = currentQuotaStore;
|
2023-05-16 07:44:44 +00:00
|
|
|
const {
|
|
|
|
isGracePeriod,
|
|
|
|
isLicenseExpiring,
|
2023-05-24 12:25:05 +00:00
|
|
|
isLicenseDateExpired,
|
2023-05-16 07:44:44 +00:00
|
|
|
} = currentTariffStatusStore;
|
2023-05-17 14:37:55 +00:00
|
|
|
const { showText, standalone } = settingsStore;
|
2023-04-04 13:36:07 +00:00
|
|
|
|
|
|
|
return {
|
2023-05-16 07:44:44 +00:00
|
|
|
isEnterprise,
|
2023-04-04 13:36:07 +00:00
|
|
|
showText,
|
|
|
|
isNonProfit,
|
|
|
|
isGracePeriod,
|
|
|
|
isFreeTariff,
|
|
|
|
isPaymentPageAvailable,
|
|
|
|
isTeamTrainingAlertAvailable,
|
2023-05-16 07:44:44 +00:00
|
|
|
isLicenseExpiring,
|
2023-05-24 12:25:05 +00:00
|
|
|
isLicenseDateExpired,
|
2023-05-16 09:07:52 +00:00
|
|
|
isTrial,
|
2023-05-17 14:37:55 +00:00
|
|
|
standalone,
|
2023-04-04 13:36:07 +00:00
|
|
|
};
|
|
|
|
})(observer(ArticleAlerts))
|
|
|
|
);
|