fix: align marketplace price filter parsing

This commit is contained in:
2026-04-23 11:14:57 -04:00
parent 10c2856bf6
commit 0f77155c8d
4 changed files with 48 additions and 7 deletions

View File

@@ -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 {

View File

@@ -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}` : "";