Skip to content

Commit db80bf2

Browse files
authored
Merge pull request #2323 from useautumn/charlie/normalize-product-response-main
fix(catalog): normalize missing product prices
2 parents ad024b3 + 2d4fb04 commit db80bf2

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

server/src/internal/products/productUtils/productResponseUtils/getPlanResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const getPlanResponse = async ({
6464
}): Promise<ApiPlanV1> => {
6565
// 1. Convert prices/entitlements to items
6666
const rawItems = mapToProductItems({
67-
prices: product.prices,
67+
prices: product.prices ?? [],
6868
entitlements: product.entitlements ?? [],
6969
features: features,
7070
});

server/src/internal/products/productUtils/productResponseUtils/getProductResponse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ const getProductProperties = ({
152152
is_one_off: isOneOffProduct({ product }),
153153
interval_group: largestInterval?.interval,
154154
has_trial: hasFreeTrial,
155-
updateable: product.prices.some(
155+
updateable: (product.prices ?? []).some(
156156
(p: Price) =>
157157
isPrepaidPrice(p) && p.config.interval !== BillingInterval.OneOff,
158158
),
@@ -178,7 +178,7 @@ export const getProductResponse = async ({
178178
}) => {
179179
// 1. Get items with display
180180
const rawItems = mapToProductItems({
181-
prices: product.prices,
181+
prices: product.prices ?? [],
182182
entitlements: product.entitlements ?? [],
183183
features: features,
184184
});

0 commit comments

Comments
 (0)