From 0ce1b6c12c36a4bc55dc1ae37730d7108c039e37 Mon Sep 17 00:00:00 2001 From: Conor Macpherson Date: Mon, 3 Apr 2023 17:02:54 -0400 Subject: [PATCH] move self hosted purchase modals into one folder for shared resources, update banners to redirect to the self hosted purchase modal (in the case of air gapped, link to CWS. In the future, this will be a modal). --- .../enterprise_edition_left_panel.tsx | 16 ++- .../overage_users_banner/index.tsx | 15 ++- .../useControlSelfHostedExpansionModal.ts | 4 +- .../useControlSelfHostedPurchaseModal.ts | 4 +- .../overage_users_banner_notice/index.tsx | 31 ++++- .../purchase_in_progress_modal/index.test.tsx | 2 +- .../self_hosted_expansion_modal/constants.tsx | 4 - .../address.tsx | 0 .../constants.ts | 1 + .../contact_sales_link.tsx | 0 .../error_page.scss | 0 .../error_page.tsx | 5 +- .../expansion_card.scss | 0 .../expansion_card.tsx | 0 .../index.test.tsx | 0 .../self_hosted_expansion_modal/index.tsx | 30 +++-- .../self_hosted_expansion_modal.scss | 4 + .../submitting.tsx | 122 ++++++++++++++++++ .../success_page.scss | 0 .../success_page.tsx | 0 .../self_hosted_purchase_modal/error.tsx | 0 .../self_hosted_purchase_modal/index.test.tsx | 2 +- .../self_hosted_purchase_modal/index.tsx | 10 +- .../self_hosted_card.tsx | 4 +- .../self_hosted_purchase_modal.scss | 0 .../self_hosted_purchase_modal/submitting.tsx | 0 .../success_page.scss | 0 .../success_page.tsx | 0 .../self_hosted_purchase_modal/terms.tsx | 0 .../self_hosted_purchase_modal/types.ts | 0 .../self_hosted_purchase_modal/useNoEscape.ts | 0 .../stripe_provider.tsx | 0 32 files changed, 214 insertions(+), 40 deletions(-) delete mode 100644 webapp/channels/src/components/self_hosted_expansion_modal/constants.tsx rename webapp/channels/src/components/{self_hosted_purchase_modal => self_hosted_purchases}/address.tsx (100%) rename webapp/channels/src/components/{self_hosted_purchase_modal => self_hosted_purchases}/constants.ts (71%) rename webapp/channels/src/components/{self_hosted_purchase_modal => self_hosted_purchases}/contact_sales_link.tsx (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_expansion_modal/error_page.scss (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_expansion_modal/error_page.tsx (95%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_expansion_modal/expansion_card.scss (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_expansion_modal/expansion_card.tsx (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_expansion_modal/index.test.tsx (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_expansion_modal/index.tsx (94%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_expansion_modal/self_hosted_expansion_modal.scss (98%) create mode 100644 webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/submitting.tsx rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_expansion_modal/success_page.scss (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_expansion_modal/success_page.tsx (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/error.tsx (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/index.test.tsx (99%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/index.tsx (99%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/self_hosted_card.tsx (97%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/self_hosted_purchase_modal.scss (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/submitting.tsx (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/success_page.scss (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/success_page.tsx (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/terms.tsx (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/types.ts (100%) rename webapp/channels/src/components/{ => self_hosted_purchases}/self_hosted_purchase_modal/useNoEscape.ts (100%) rename webapp/channels/src/components/{self_hosted_purchase_modal => self_hosted_purchases}/stripe_provider.tsx (100%) diff --git a/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx b/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx index 0d4a422a27..aea8e93cb5 100644 --- a/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx +++ b/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx @@ -23,6 +23,8 @@ import useOpenPricingModal from 'components/common/hooks/useOpenPricingModal'; import useCanSelfHostedExpand from 'components/common/hooks/useCanSelfHostedExpand'; import {getExpandSeatsLink} from 'selectors/cloud'; import useControlSelfHostedExpansionModal from 'components/common/hooks/useControlSelfHostedExpansionModal'; +import {useQuery} from 'utils/http_utils'; +import {STORAGE_KEY_EXPANSION_IN_PROGRESS} from 'components/self_hosted_purchases/constants'; const DAYS_UNTIL_EXPIRY_WARNING_DISPLAY_THRESHOLD = 30; const DAYS_UNTIL_EXPIRY_DANGER_DISPLAY_THRESHOLD = 5; @@ -58,6 +60,19 @@ const EnterpriseEditionLeftPanel = ({ const canExpand = useCanSelfHostedExpand(); const selfHostedExpansionModal = useControlSelfHostedExpansionModal({trackingLocation: 'license_settings_add_seats'}); const expandableLink = useSelector(getExpandSeatsLink); + const isSelfHostedExpansionEnabled = useSelector(getConfig)?.ServiceSettings?.SelfHostedExpansion; + + const query = useQuery(); + const actionQueryParam = query.get('action'); + + useEffect(() => { + console.log(actionQueryParam); + if (actionQueryParam === 'show_expansion_modal' && canExpand && isSelfHostedExpansionEnabled) { + console.log("Open modal!"); + selfHostedExpansionModal.open(); + query.set('action', ''); + } + }, []) useEffect(() => { async function fetchUnSanitizedLicense() { @@ -73,7 +88,6 @@ const EnterpriseEditionLeftPanel = ({ const skuName = getSkuDisplayName(unsanitizedLicense.SkuShortName, unsanitizedLicense.IsGovSku === 'true'); const expirationDays = getRemainingDaysFromFutureTimestamp(parseInt(unsanitizedLicense.ExpiresAt, 10)); - const isSelfHostedExpansionEnabled = useSelector(getConfig)?.ServiceSettings?.SelfHostedExpansion; const viewPlansButton = (