Update billing schema and plan picker logic

Modified the logic in create-billing-schema.ts so if a plan contains more than one line item, it no longer returns true but false. In plan-picker.tsx, added a condition to check if a product is selected before setting the 'planId'. Also, the 'planId' is now set based on the selected plan's id rather than an empty string.
This commit is contained in:
giancarlo
2024-04-07 19:20:03 +08:00
parent ab1e90f093
commit c77c9295c3
2 changed files with 12 additions and 9 deletions

View File

@@ -215,13 +215,13 @@ const BillingSchema = z
for (const product of schema.products) {
for (const plan of product.plans) {
if (plan.lineItems.length > 1) {
return true;
return false;
}
}
}
return true;
}
return true;
},
{
message: 'Lemon Squeezy only supports one line item per plan',