fix: align marketplace price filter parsing
This commit is contained in:
@@ -38,7 +38,7 @@ export interface EbayListingDetails {
|
||||
address?: string | null;
|
||||
}
|
||||
|
||||
const EBAY_PRICE_TEXT_RE = /^(?:\s*(?:CA|C)\s*\$|\s*[$£€¥])/u;
|
||||
const EBAY_PRICE_TEXT_RE = /^(?:\s*(?:CA|C|US)\s*\$|\s*[$£€¥])/u;
|
||||
|
||||
function canonicalizeEbayItemUrl(url: string): string {
|
||||
try {
|
||||
|
||||
@@ -218,6 +218,10 @@ function normalizeLookupKey(value: string): string {
|
||||
return value.toLowerCase().replace(/[\s-]+/g, "-");
|
||||
}
|
||||
|
||||
function centsToKijijiPriceParam(cents: number): number {
|
||||
return Math.floor(cents / 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve location ID from name or return numeric ID
|
||||
*/
|
||||
@@ -293,9 +297,13 @@ export function buildSearchUrl(
|
||||
: "relevancyDesc";
|
||||
const sortOrder = options.sortOrder === "asc" ? "ASC" : "DESC";
|
||||
const priceMinParam =
|
||||
typeof options.priceMin === "number" ? `&priceMin=${options.priceMin}` : "";
|
||||
typeof options.priceMin === "number"
|
||||
? `&priceMin=${centsToKijijiPriceParam(options.priceMin)}`
|
||||
: "";
|
||||
const priceMaxParam =
|
||||
typeof options.priceMax === "number" ? `&priceMax=${options.priceMax}` : "";
|
||||
typeof options.priceMax === "number"
|
||||
? `&priceMax=${centsToKijijiPriceParam(options.priceMax)}`
|
||||
: "";
|
||||
const pageParam =
|
||||
options.page && options.page > 1 ? `&page=${options.page}` : "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user