From 3a975749bd90a6026ded41eb6292fe648a23dba5 Mon Sep 17 00:00:00 2001 From: Nick Grato Date: Tue, 19 Dec 2023 10:55:06 -0800 Subject: [PATCH] more plan logic --- .../modules/hubs/HubFormCard/HubFormCard.tsx | 6 ++--- .../side-panel/BookMeeting/BookMeeting.tsx | 4 ++-- .../side-panel/SidePanel/SidePanel.tsx | 6 ++--- .../side-panel/SupportGrid/SupportGrid.tsx | 23 +++++++++++++++---- client/services/routeGuard.service.ts | 6 +++-- lib/dash/plan_state_machine.ex | 1 - 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/client/components/modules/hubs/HubFormCard/HubFormCard.tsx b/client/components/modules/hubs/HubFormCard/HubFormCard.tsx index d1b05003..0699da91 100644 --- a/client/components/modules/hubs/HubFormCard/HubFormCard.tsx +++ b/client/components/modules/hubs/HubFormCard/HubFormCard.tsx @@ -12,7 +12,7 @@ import { StoreContext, SubdomainRetryT } from 'contexts/StoreProvider'; import { RoutesE } from 'types/Routes'; import { useFormik } from 'formik'; import validate, { FormValues } from './validate'; -import { useIsProfessional } from 'hooks/usePlans'; +import { useIsProfessionalUp } from 'hooks/usePlans'; import Hub from 'classes/Hub'; import { HubT } from 'types/General'; import SecretCopy from '@Shared/SecretCopy/SecretCopy'; @@ -38,7 +38,7 @@ const HubFormCard = ({ hub: _hub, classProp = '' }: HubFormCardPropsT) => { useState(''); const [isEditingDomain, setIsEditingDomain] = useState(false); const router = useRouter(); - const isProfessional = useIsProfessional(); + const isProfessionalUp = useIsProfessionalUp(); const hub = useMemo(() => new Hub(_hub), [_hub]); /** @@ -281,7 +281,7 @@ const HubFormCard = ({ hub: _hub, classProp = '' }: HubFormCardPropsT) => { ) : null} - {isProfessional && ( + {isProfessionalUp && (

Custom Domain

diff --git a/client/components/modules/side-panel/BookMeeting/BookMeeting.tsx b/client/components/modules/side-panel/BookMeeting/BookMeeting.tsx index 50cbee84..e70aeed4 100644 --- a/client/components/modules/side-panel/BookMeeting/BookMeeting.tsx +++ b/client/components/modules/side-panel/BookMeeting/BookMeeting.tsx @@ -2,7 +2,7 @@ import styles from './BookMeeting.module.scss'; import Card from '@Shared/Card/Card'; import { Button } from '@mozilla/lilypad-ui'; -const BookMeeting = () => ( +const BookMeeting = ({ href }: { href: string }) => (
@@ -15,7 +15,7 @@ const BookMeeting = () => ( text="Book Now" label="book meeting with team" target="_blank" - href="https://calendly.com/mhmorran/onboarding " + href={href} />
diff --git a/client/components/modules/side-panel/SidePanel/SidePanel.tsx b/client/components/modules/side-panel/SidePanel/SidePanel.tsx index 4128e041..8393edf5 100644 --- a/client/components/modules/side-panel/SidePanel/SidePanel.tsx +++ b/client/components/modules/side-panel/SidePanel/SidePanel.tsx @@ -9,7 +9,7 @@ import GettingStartedPanel from '../GettingStartedPanel/GettingStartedPanel'; import { useMobileDown } from 'hooks/useMediaQuery'; import { useSelector } from 'react-redux'; import { selectAccount } from 'store/accountSlice'; -import { useIsProfessional } from 'hooks/usePlans'; +import { useIsBusiness } from 'hooks/usePlans'; export type SidePanelPropsT = { fullDomain: string; @@ -24,7 +24,7 @@ const SidePanel = ({ }: SidePanelPropsT) => { const account = useSelector(selectAccount); const isMobile = useMobileDown(); - const isProfessional = useIsProfessional(); + const isBusiness = useIsBusiness(); return (
@@ -55,7 +55,7 @@ const SidePanel = ({ {account.hasSubscription && subscription.isCancelled && ( )} - {!isProfessional && } + {!isBusiness && } diff --git a/client/components/modules/side-panel/SupportGrid/SupportGrid.tsx b/client/components/modules/side-panel/SupportGrid/SupportGrid.tsx index 0e8fffe8..f6096d95 100644 --- a/client/components/modules/side-panel/SupportGrid/SupportGrid.tsx +++ b/client/components/modules/side-panel/SupportGrid/SupportGrid.tsx @@ -1,19 +1,34 @@ import ExpansionPanel from '@Shared/ExpansionPanel/ExpansionPanel'; import SupportLink from '@Shared/SupportLink/SupportLink'; import styles from './SupportGrid.module.scss'; -import { useIsStarter } from 'hooks/usePlans'; +import { + useIsProfessionalUp, + useIsBusiness, + useIsProfessional, +} from 'hooks/usePlans'; import mailCircle from 'public/mail_circle.png'; import messageCircle from 'public/message_circle.png'; import questionCircle from 'public/question_circle.png'; import BookMeeting from '../BookMeeting/BookMeeting'; const SupportGrid = () => { - const isStarter = useIsStarter(); + const isProfessionalUp = useIsProfessionalUp(); + const isBusiness = useIsBusiness(); + const isProfessional = useIsProfessional(); + const businessCal = 'https://calendly.com/mhmorran/onboarding/busi'; + const professionalCal = 'https://calendly.com/mhmorran/onboarding/pers'; + + const meetingHref = () => { + let href = ''; + if (isBusiness) href = businessCal; + if (isProfessional) href = professionalCal; + return href; + }; + return (
- {!isStarter && } - + {isProfessionalUp && }
{ const { req } = context; + // Only these plans can see custom client screen + const approvedPlans = [PlansE.PROFESSIONAL, PlansE.BUSINESS]; + // If no errors user is authenticated try { const account: AccountT = await getAccount( req.headers as AxiosRequestHeaders ); - // only b1 can get to this page - if (account.planName !== PlansE.PROFESSIONAL) { + if (!approvedPlans.includes(account.planName as PlansE)) { return redirectToDashboard(); } diff --git a/lib/dash/plan_state_machine.ex b/lib/dash/plan_state_machine.ex index 217d66d9..73a481ed 100644 --- a/lib/dash/plan_state_machine.ex +++ b/lib/dash/plan_state_machine.ex @@ -413,7 +413,6 @@ defmodule Dash.PlanStateMachine do end # BUSINESS PLAN - def handle_event( nil, {:subscribe_business, %DateTime{} = subscribed_at},