add regular price and sale price flag to product apis and types
This commit is contained in:
parent
1b58098848
commit
72b5bff518
|
@ -27,6 +27,8 @@ export type SearchAPIProductType = {
|
|||
billing_period: string;
|
||||
billing_period_interval: number;
|
||||
currency: string;
|
||||
is_on_Sale: boolean;
|
||||
regular_price: number;
|
||||
};
|
||||
|
||||
export interface Product {
|
||||
|
@ -58,6 +60,8 @@ export interface Product {
|
|||
billingPeriod?: string;
|
||||
billingPeriodInterval?: number;
|
||||
currency: string;
|
||||
isOnSale: boolean;
|
||||
regularPrice: number;
|
||||
}
|
||||
|
||||
export interface ProductTracksData {
|
||||
|
|
|
@ -138,6 +138,8 @@ async function fetchSearchResults(
|
|||
url: product.link,
|
||||
// Due to backwards compatibility, raw_price is from search API, price is from featured API
|
||||
price: product.raw_price ?? product.price,
|
||||
regularPrice: product.regular_price,
|
||||
isOnSale: product.is_on_Sale,
|
||||
averageRating: product.rating ?? null,
|
||||
reviewsCount: product.reviews_count ?? null,
|
||||
isInstallable: product.is_installable,
|
||||
|
@ -408,6 +410,8 @@ const subscriptionToProduct = ( subscription: Subscription ): Product => {
|
|||
icon: subscription.product_icon,
|
||||
url: subscription.product_url,
|
||||
price: -1,
|
||||
regularPrice: -1,
|
||||
isOnSale: false,
|
||||
averageRating: null,
|
||||
reviewsCount: null,
|
||||
isInstallable: false,
|
||||
|
|
Loading…
Reference in New Issue