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: string;
|
||||||
billing_period_interval: number;
|
billing_period_interval: number;
|
||||||
currency: string;
|
currency: string;
|
||||||
|
is_on_Sale: boolean;
|
||||||
|
regular_price: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface Product {
|
export interface Product {
|
||||||
|
@ -58,6 +60,8 @@ export interface Product {
|
||||||
billingPeriod?: string;
|
billingPeriod?: string;
|
||||||
billingPeriodInterval?: number;
|
billingPeriodInterval?: number;
|
||||||
currency: string;
|
currency: string;
|
||||||
|
isOnSale: boolean;
|
||||||
|
regularPrice: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductTracksData {
|
export interface ProductTracksData {
|
||||||
|
|
|
@ -138,6 +138,8 @@ async function fetchSearchResults(
|
||||||
url: product.link,
|
url: product.link,
|
||||||
// Due to backwards compatibility, raw_price is from search API, price is from featured API
|
// Due to backwards compatibility, raw_price is from search API, price is from featured API
|
||||||
price: product.raw_price ?? product.price,
|
price: product.raw_price ?? product.price,
|
||||||
|
regularPrice: product.regular_price,
|
||||||
|
isOnSale: product.is_on_Sale,
|
||||||
averageRating: product.rating ?? null,
|
averageRating: product.rating ?? null,
|
||||||
reviewsCount: product.reviews_count ?? null,
|
reviewsCount: product.reviews_count ?? null,
|
||||||
isInstallable: product.is_installable,
|
isInstallable: product.is_installable,
|
||||||
|
@ -408,6 +410,8 @@ const subscriptionToProduct = ( subscription: Subscription ): Product => {
|
||||||
icon: subscription.product_icon,
|
icon: subscription.product_icon,
|
||||||
url: subscription.product_url,
|
url: subscription.product_url,
|
||||||
price: -1,
|
price: -1,
|
||||||
|
regularPrice: -1,
|
||||||
|
isOnSale: false,
|
||||||
averageRating: null,
|
averageRating: null,
|
||||||
reviewsCount: null,
|
reviewsCount: null,
|
||||||
isInstallable: false,
|
isInstallable: false,
|
||||||
|
|
Loading…
Reference in New Issue