From d2c619c7255c0cdb40f0534a16d9eca31eb9197f Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Tue, 13 Oct 2020 23:36:21 +0200 Subject: [PATCH] Automated cherry pick of #6731 (#6761) Co-authored-by: Mattermod Co-authored-by: Maria A Nunez --- .circleci/config.yml | 4 +- .../admin_console/billing/billing_history.tsx | 6 +- .../billing/billing_subscriptions.tsx | 121 ++++++++++-------- .../admin_console/billing/billing_summary.tsx | 6 +- .../admin_console/billing/plan_details.tsx | 13 +- components/purchase_modal/index.ts | 10 +- components/purchase_modal/purchase_modal.tsx | 11 +- i18n/en.json | 3 +- package-lock.json | 4 +- package.json | 2 +- selectors/cloud.ts | 23 ++++ utils/constants.jsx | 4 + 12 files changed, 133 insertions(+), 74 deletions(-) create mode 100644 selectors/cloud.ts diff --git a/.circleci/config.yml b/.circleci/config.yml index 379740beb9be..496e5c988c09 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,10 +13,10 @@ executors: aliases: - &restore_cache restore_cache: - key: dependencies-{{ .Branch }}-{{ checksum "package-lock.json" }}-4 + key: dependencies-{{ .Branch }}-{{ checksum "package-lock.json" }}-5 - &save_cache save_cache: - key: dependencies-{{ .Branch }}-{{ checksum "package-lock.json" }}-4 + key: dependencies-{{ .Branch }}-{{ checksum "package-lock.json" }}-5 paths: - ~/mattermost/mattermost-webapp/node_modules diff --git a/components/admin_console/billing/billing_history.tsx b/components/admin_console/billing/billing_history.tsx index 179633ddbe10..624db239e23a 100644 --- a/components/admin_console/billing/billing_history.tsx +++ b/components/admin_console/billing/billing_history.tsx @@ -8,6 +8,8 @@ import FormattedAdminHeader from 'components/widgets/admin_console/formatted_adm import FormattedMarkdownMessage from 'components/formatted_markdown_message'; import noBillingHistoryGraphic from 'images/no_billing_history_graphic.svg'; +import {CloudLinks} from 'utils/constants'; + import './billing_history.scss'; type Props = { @@ -27,9 +29,9 @@ const noBillingHistorySection = ( /> ( -
-
- -
-
- -
-
- -
- -
-); - -const privateCloudCard = () => ( -
-
-
- -
-
- -
- -
-
- -
-
-); +import './billing_subscriptions.scss'; const WARNING_THRESHOLD = 3; @@ -112,6 +59,8 @@ const BillingSubscriptions: React.FC = () => { const getCategory = makeGetCategory(); const preferences = useSelector((state) => getCategory(state, Preferences.ADMIN_CLOUD_UPGRADE_PANEL)); + const contactSalesLink = useSelector((state: GlobalState) => getCloudContactUsLink(state, InquiryType.Sales)); + useEffect(() => { getCloudSubscription()(dispatch, store.getState()); getCloudProducts()(dispatch, store.getState()); @@ -159,6 +108,66 @@ const BillingSubscriptions: React.FC = () => { ])); }; + const upgradeMattermostCloud = () => ( +
+
+ +
+
+ +
+
+ +
+ +
+ ); + + const privateCloudCard = () => ( +
+
+
+ +
+
+ +
+
+
+
+ +
+
+ ); + return (
+ + + )} diff --git a/components/purchase_modal/index.ts b/components/purchase_modal/index.ts index 27ad97dbf494..ab26191f3236 100644 --- a/components/purchase_modal/index.ts +++ b/components/purchase_modal/index.ts @@ -3,24 +3,24 @@ import {connect} from 'react-redux'; import {bindActionCreators, Dispatch, ActionCreatorsMapObject} from 'redux'; +import {Stripe} from '@stripe/stripe-js'; import {getConfig} from 'mattermost-redux/selectors/entities/general'; import {GenericAction, ActionFunc} from 'mattermost-redux/types/actions'; -import {Stripe} from '@stripe/stripe-js'; - import {getCloudProducts, getCloudSubscription} from 'mattermost-redux/actions/cloud'; import {getClientConfig} from 'mattermost-redux/actions/general'; +import {GlobalState} from 'types/store'; import {BillingDetails} from 'types/cloud/sku'; import {isModalOpen} from 'selectors/views/modals'; +import {getCloudContactUsLink, InquiryType} from 'selectors/cloud'; + import {ModalIdentifiers} from 'utils/constants'; import {closeModal} from 'actions/views/modals'; import {completeStripeAddPaymentMethod} from 'actions/cloud'; -import {GlobalState} from 'types/store'; - import PurchaseModal from './purchase_modal'; function mapStateToProps(state: GlobalState) { @@ -28,6 +28,8 @@ function mapStateToProps(state: GlobalState) { show: isModalOpen(state, ModalIdentifiers.CLOUD_PURCHASE), products: state.entities.cloud!.products, isDevMode: getConfig(state).EnableDeveloper === 'true', + contactSupportLink: getCloudContactUsLink(state, InquiryType.Technical), + contactSalesLink: getCloudContactUsLink(state, InquiryType.Sales), }; } type Actions = { diff --git a/components/purchase_modal/purchase_modal.tsx b/components/purchase_modal/purchase_modal.tsx index 350ad2cd23ee..5dd206db971e 100644 --- a/components/purchase_modal/purchase_modal.tsx +++ b/components/purchase_modal/purchase_modal.tsx @@ -15,19 +15,20 @@ import blueDotes from 'images/cloud/blue.svg'; import LowerBlueDots from 'images/cloud/blue-lower.svg'; import cloudLogo from 'images/cloud/mattermost-cloud.svg'; import {trackEvent, pageVisited} from 'actions/telemetry_actions'; -import {TELEMETRY_CATEGORIES} from 'utils/constants'; import {STRIPE_CSS_SRC, STRIPE_PUBLIC_KEY} from 'components/payment_form/stripe'; import RootPortal from 'components/root_portal'; import FullScreenModal from 'components/widgets/modals/full_screen_modal'; import {areBillingDetailsValid, BillingDetails} from 'types/cloud/sku'; import {getNextBillingDate} from 'utils/utils'; +import {CloudLinks, TELEMETRY_CATEGORIES} from 'utils/constants'; import PaymentForm from '../payment_form/payment_form'; +import ProcessPaymentSetup from './process_payment_setup'; + import './purchase.scss'; import 'components/payment_form/payment_form.scss'; -import ProcessPaymentSetup from './process_payment_setup'; const stripePromise = loadStripe(STRIPE_PUBLIC_KEY); @@ -180,7 +181,11 @@ export default class PurchaseModal extends React.PureComponent { /> {'\u00A0'} - +