Add hidden product option to billing components (#136)

- Introduced `hidden` field in product schema to control product visibility
- Updated PlanPicker and PricingTable to filter out hidden products
- Ensures hidden products are not displayed to users
This commit is contained in:
Giancarlo Buomprisco
2025-02-04 06:27:43 +07:00
committed by GitHub
parent 3553422e42
commit b319ceb5bb
3 changed files with 15 additions and 2 deletions

View File

@@ -108,6 +108,11 @@ export function PlanPicker(
const isRecurringPlan =
selectedPlan?.paymentType === 'recurring' || !selectedPlan;
// Always filter out hidden products
const visibleProducts = props.config.products.filter(
(product) => !product.hidden,
);
return (
<Form {...form}>
<div
@@ -211,7 +216,7 @@ export function PlanPicker(
<FormControl>
<RadioGroup value={field.value} name={field.name}>
{props.config.products.map((product) => {
{visibleProducts.map((product) => {
const plan = product.plans.find((item) => {
if (item.paymentType === 'one-time') {
return true;