From 89bd85eb4b714d0f057ed6896b02dd0920143027 Mon Sep 17 00:00:00 2001 From: maxblamauer Date: Thu, 9 Oct 2025 13:39:56 -0400 Subject: [PATCH] Add bundle support --- src/utils/plans.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/plans.ts b/src/utils/plans.ts index 2b31221..b8b19cb 100644 --- a/src/utils/plans.ts +++ b/src/utils/plans.ts @@ -94,8 +94,12 @@ export const customButtonLabel = ({ * @returns The highest discount for the plan, or undefined if none found */ export const highestDiscount = ({ plan }: { plan: Plan }): Discount | undefined => { - return plan.discounts?.length > 0 - ? plan.discounts.reduce((prev, current) => + const discounts = [ + ...(plan.discounts || []), + ...(plan?.bundleDiscounts || []), + ]; + return discounts?.length > 0 + ? discounts.reduce((prev, current) => prev.discountedAmount < current.discountedAmount ? prev : current ) : undefined;