@@ -134,7 +134,11 @@ export const typeDefs = /* GraphQL */ `
134134 pricePreviews: PricePreviews! @auth
135135 corePricePreviews: PricePreviews! @auth
136136 pricingMetadata(type: PricingType): [ProductPricingMetadata!]! @auth
137- pricingPreview(type: PricingType, locale: String): [ProductPricingPreview!]!
137+ pricingPreview(
138+ type: PricingType
139+ locale: String
140+ discountId: String
141+ ): [ProductPricingPreview!]!
138142 pricingPreviewByIds(
139143 """
140144 The IDs of the prices to preview
@@ -323,6 +327,7 @@ export interface GQLCustomData {
323327interface PaddlePricingPreviewArgs {
324328 type ?: PurchaseType ;
325329 locale ?: string ;
330+ discountId ?: string ;
326331}
327332
328333interface PaddlePricingPreviewByIdsArgs {
@@ -445,15 +450,19 @@ export const resolvers: IResolvers<unknown, AuthContext> = traceResolvers<
445450 ) : Promise < BasePricingMetadata [ ] > => getPricingMetadata ( ctx , type ) ,
446451 pricingPreview : async (
447452 _ ,
448- { type = PurchaseType . Plus , locale } : PaddlePricingPreviewArgs ,
453+ {
454+ type = PurchaseType . Plus ,
455+ locale,
456+ discountId,
457+ } : PaddlePricingPreviewArgs ,
449458 ctx ,
450459 ) : Promise < BasePricingPreview [ ] > => {
451460 const metadata = await getPricingMetadata ( ctx , type ) ;
452461 const ids = metadata
453462 . map ( ( { idMap } ) => idMap . paddle )
454463 . filter ( Boolean ) as string [ ] ;
455464
456- const preview = await getPlusPricePreview ( ctx , ids ) ;
465+ const preview = await getPlusPricePreview ( ctx , ids , discountId ) ;
457466
458467 // consolidate the preview data and metadata
459468 const consolidated = metadata . map ( ( meta ) => {
0 commit comments