Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(er-next): Pricing component and "/buy" page #1462

Merged
merged 9 commits into from Mar 21, 2024
Merged

Conversation

DrShpongle
Copy link
Contributor

@DrShpongle DrShpongle commented Mar 20, 2024

This adds /buy page:

For individuals
For Teams

Known issues:

Not sure how to turn off 'bulk purchases' for the Standard and Basic tiers
No Features block implemented yet (absent in sanity)
When `PricingTiers` component is used we get multiple div's with same `id` (the same situation in TT)

Swipe Up Elon Musk GIF

Copy link

vercel bot commented Mar 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
badass-turbo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 10:58pm
colt-steele ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 10:58pm
devrel-fyi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 10:58pm
epic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 10:58pm
pro-aws ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 10:58pm
pro-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 10:58pm
skill-stack-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 10:58pm
testing-javascript ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 10:58pm
total-typescript-turbo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 20, 2024 10:58pm

[PRODUCT_PRO_ID]: 2,
[PRODUCT_STANDARD_ID]: 3,
}
const sortedProducts = [...products].sort(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort products in the following order: Basic --> Pro --> Standard

const sortedProducts = [...products].sort(
(a, b) => productsSortOrder[a.productId] - productsSortOrder[b.productId],
)
const filteredProducts = removeModuleBySlug(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "Welcome to Epic React" module from the modules array of product object. It's not shown in the Pricing components as part of tier at original ER.

purchases={purchases}
couponIdFromCoupon={couponIdFromCoupon}
couponFromCode={couponFromCode}
allowPurchase={true}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded true value here because it comes as false by default from commerceProps. @jbranchaud take a look please

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to configure this to true via the NEXT_PUBLIC_SELLING_LIVE env var in something like .env.local

const allowPurchase =
Boolean(process.env.NEXT_PUBLIC_SELLING_LIVE === 'true') ||
Boolean(query.allowPurchase)

@@ -598,7 +598,10 @@ export const Pricing: React.FC<React.PropsWithChildren<PricingProps>> = ({
{product.description &&
(isSellingLive || allowPurchase) &&
!purchased && (
<div className="prose prose-sm mx-auto max-w-sm px-5 sm:prose-base prose-p:text-gray-200">
<div
data-product-description=""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add data- attribute to be able to style this element

@kodiakhq kodiakhq bot merged commit 784d054 into main Mar 21, 2024
13 checks passed
@kodiakhq kodiakhq bot deleted the en/er-next-buy-page branch March 21, 2024 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants