-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nick Grato
committed
Dec 18, 2023
1 parent
85cb969
commit 0a10142
Showing
15 changed files
with
384 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
client/components/modules/plans/plan-cards/BusinessPlanCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { useCallback } from 'react'; | ||
import { Button } from '@mozilla/lilypad-ui'; | ||
import { BUSINESS_COPY } from '../plan.const'; | ||
import BasePlanCard, { Price } from './BasePlanCard'; | ||
import { getPricePageData } from 'util/utilities'; | ||
import { useSelector } from 'react-redux'; | ||
import { selectRegion } from 'store/regionSlice'; | ||
import { BillingPeriodE, PlansE } from 'types/General'; | ||
import styles from './BasePlanCard.module.scss'; | ||
|
||
type BusinessPlanCardPropsT = { | ||
billingPeriod: BillingPeriodE; | ||
}; | ||
|
||
const BusinessPlanCard = ({ billingPeriod }: BusinessPlanCardPropsT) => { | ||
const { regionCode } = useSelector(selectRegion); | ||
const { planPrice, planUrl, taxDescription, currencySymbol } = | ||
getPricePageData(regionCode, PlansE.BUSINESS, billingPeriod); | ||
|
||
/** | ||
* Handle routing user to correct payment plan | ||
*/ | ||
const handleSubscribeClick = useCallback(() => { | ||
window.open(planUrl); | ||
}, [planUrl]); | ||
|
||
return ( | ||
<BasePlanCard | ||
plan={PlansE.BUSINESS} | ||
title="Professional" | ||
color="rainbow" | ||
price={ | ||
<Price | ||
price={`${currencySymbol}${planPrice}`} | ||
billingPeriod={`per ${ | ||
billingPeriod === BillingPeriodE.YEARLY ? 'year' : 'month' | ||
}`} | ||
/> | ||
} | ||
infoCopyList={BUSINESS_COPY} | ||
showDisclaimer={false} | ||
additionalContent={ | ||
<div className="flex-align-center my-20"> | ||
<span className={styles.circle}></span> | ||
<span>Always on — no pausing</span> | ||
</div> | ||
} | ||
confirmButton={ | ||
<Button | ||
label="Subscribe to hubs" | ||
text="Get Started" | ||
onClick={handleSubscribeClick} | ||
/> | ||
} | ||
/> | ||
); | ||
}; | ||
|
||
export default BusinessPlanCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { default as PersonalPlanCard } from './PersonalPlanCard'; | ||
export { default as StarterPlanCard } from './StarterPlanCard'; | ||
export { default as ProfessionalPlanCard } from './ProfessionalPlanCard'; | ||
export { default as BusinessPlanCard } from './BusinessPlanCard'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import { | |
PersonalPlanCard, | ||
StarterPlanCard, | ||
ProfessionalPlanCard, | ||
BusinessPlanCard, | ||
} from '@Modules/plans/plan-cards'; | ||
import { BillingPeriodE } from 'types/General'; | ||
|
||
|
@@ -25,18 +26,27 @@ const Subscribe = () => { | |
|
||
<main> | ||
<div className={styles.wrapper}> | ||
<div className={styles.header}> | ||
<h1>Choose your plan</h1> | ||
</div> | ||
<div> | ||
<div className={styles.header}> | ||
<h1>Choose your plan</h1> | ||
</div> | ||
|
||
<div className={styles.cards}> | ||
<StarterPlanCard /> | ||
<PersonalPlanCard billingPeriod={billingPeriod} /> | ||
<ProfessionalPlanCard billingPeriod={billingPeriod} /> | ||
<ContactCard | ||
email="[email protected]" | ||
subject="Subscription inquiries" | ||
/> | ||
<div className="flex-justify-center flex-wrap"> | ||
<div className="flex-justify-center flex-wrap"> | ||
<StarterPlanCard /> | ||
<PersonalPlanCard billingPeriod={billingPeriod} /> | ||
</div> | ||
<div className="flex-justify-center flex-wrap"> | ||
<ProfessionalPlanCard billingPeriod={billingPeriod} /> | ||
<BusinessPlanCard billingPeriod={billingPeriod} /> | ||
</div> | ||
</div> | ||
<div className="flex"> | ||
<ContactCard | ||
email="[email protected]" | ||
subject="Subscription inquiries" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</main> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,6 +265,42 @@ export function SubscribeRG(gssp: Function): GetServerSideProps { | |
}; | ||
} | ||
|
||
export function analyticsRG(gssp: Function): GetServerSideProps | Redirect { | ||
return async (context: GetServerSidePropsContext) => { | ||
const { req } = context; | ||
|
||
if (didSetTurkeyauthCookie(context)) { | ||
return redirectToDashboard(); | ||
} | ||
|
||
// If no errors user is authenticated | ||
try { | ||
const account: AccountT = await getAccount( | ||
req.headers as AxiosRequestHeaders | ||
); | ||
|
||
const emails = [ | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
]; | ||
|
||
// User is authenticated | ||
if (emails.includes(account.email)) { | ||
return await gssp(context); | ||
} | ||
|
||
return redirectToDashboard(); | ||
} catch (error) { | ||
return handleUnauthenticatedRedirects( | ||
error as AxiosError, | ||
req.url as RoutesE | ||
); | ||
} | ||
}; | ||
} | ||
|
||
/************************** | ||
* LOCAL DEV UTILITIES | ||
**************************/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,8 @@ | |
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.flex-wrap { | ||
display: flex; | ||
flex-wrap: wrap; | ||
} |
Oops, something went wrong.