ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...
    • Check whether a given product (identified by URL + supplier name) is on the user's ignore list. Called from the supplier hot-path to drop results the user previously excluded. Returns false on any read error so a storage blip can't accidentally hide everything.

      Parameters

      • url: string

        Canonical product URL — same URL the supplier fetches.

      • supplierName: string

        Supplier name, e.g. "Loudwolf".

      Returns Promise<boolean>

      true if an entry exists for this (url, supplier) pair.

      if (await shouldExcludeProduct("https://example.com/acetone", "Loudwolf")) {
      return undefined; // skip this result
      }
      // => true (user previously right-click → Ignore)
      // => false (not ignored, or read failed)
      export async function shouldExcludeProduct(url: string, supplierName: string): Promise<boolean> {
      try {
      const map = await loadExcludedProducts();
      const key = getProductExclusionKey(url, supplierName);
      return map[key] !== undefined;
      } catch (error) {
      console.warn("Failed to check if product should be excluded", { error });
      return false;
      }
      }