Whxuan0701/true-cost-chrome-extension

Evidence-first current cost and return-risk Chrome extension MVP

★ 2Forks 0JavaScriptGitHub ↗Compare

README

True Cost

True Cost is a local-first Manifest V3 Chrome extension for an evidence-first purchase decision bar. It reads the active eBay listing or Shopify product page and separates purchase information into:

  • Confirmed: a numeric value visible on the current page.
  • Estimated: a value calculated from an explicit estimate (reserved for future tariff/rate rules).
  • Unknown: not visible or not safely parseable; never treated as zero.

The popup shows product price, shipping, page-visible tax/fees, a confirmed total, an optional estimate total, and the discovered return-policy source. Same-origin policy pages are read only after analysis and are summarized with visible return window, return-shipping responsibility, refund method, and exclusions. Each item keeps its source URL, original excerpt, and capture timestamp.

Scope

  • Default destination: Germany. France and the Netherlands are available as local settings.
  • Display currencies: EUR, GBP, USD. The MVP does not fetch FX rates; mixed currencies are not summed.
  • Site adapters: eBay and Shopify-style product pages.
  • No price database, external AI, affiliate links, backend, automatic purchase, account orders, cookies, CAPTCHA bypass, or tax/legal guarantee.

Install Unpacked

  1. Run npm install if Node package metadata needs to be initialized. This project has no runtime dependencies.
  2. Run npm run build.
  3. Open chrome://extensions and enable Developer mode.
  4. Choose Load unpacked and select the generated dist/ directory.
  5. Open an eBay listing or Shopify product page, click the True Cost toolbar icon, choose the destination/currency, and click Analyze current page.

Development

npm test
npm run lint
npm run build

The test suite uses Node's built-in test runner and exercises the same dependency-free core module injected into the page.

Manual Test Matrix

  • eBay listing with visible price and shipping: confirmed product and shipping rows, calculated confirmed total.
  • eBay listing with no visible shipping: shipping is unknown and excluded from the confirmed total.
  • Shopify product with JSON-LD Product/Offer: product price is extracted from structured data.
  • Store with a same-origin return policy: source URL and policy fields are shown when rules are visible.
  • Unsupported page such as a news article: explicit unsupported empty state, no broad permission request.
  • Change country/currency, close the popup, reopen it: settings remain in local storage.

Known Limitations

  • Tax, customs, payment fees, membership prices, address-based shipping, and variant changes may only appear at checkout and therefore remain unknown.
  • Cross-origin policy pages are linked but not fetched by the MVP.
  • The MVP does not convert currencies or maintain tariff/rate data.
  • DOM selectors are intentionally conservative and may require a site adapter update when merchants change layouts.

Issues