diff --git a/src/pricing.test.ts b/src/pricing.test.ts index 889fe7d..e5c920e 100644 --- a/src/pricing.test.ts +++ b/src/pricing.test.ts @@ -682,6 +682,8 @@ describe('getRecurrencesWithEstimatedPrices', () => { type: 'recurring', billing_period: 'monthly', _price: { + type: 'recurring', + billing_period: 'monthly', price_display_in_journeys: 'estimated_price' } } @@ -689,6 +691,7 @@ describe('getRecurrencesWithEstimatedPrices', () => { const oneTimeEstimateComponent = { type: 'one_time', _price: { + type: 'one_time', price_display_in_journeys: 'estimated_price' } } @@ -697,6 +700,8 @@ describe('getRecurrencesWithEstimatedPrices', () => { type: 'recurring', billing_period: 'monthly', _price: { + type: 'recurring', + billing_period: 'monthly', price_display_in_journeys: 'show_price' } } @@ -704,6 +709,7 @@ describe('getRecurrencesWithEstimatedPrices', () => { const oneTimeComponent = { type: 'one_time', _price: { + type: 'one_time', price_display_in_journeys: 'show_price' } } diff --git a/src/pricing.ts b/src/pricing.ts index af4cfdf..7e682bb 100644 --- a/src/pricing.ts +++ b/src/pricing.ts @@ -1269,7 +1269,8 @@ export const getRecurrencesWithEstimatedPrices = (lineItems: PriceItems | undefi } }); } else { - const recurrence = lineItem.type === 'recurring' ? lineItem.billing_period : lineItem.type; + const recurrence = + lineItem._price?.type === 'recurring' ? lineItem._price?.billing_period : lineItem._price?.type; if (recurrence !== undefined) { recurrences[recurrence] =