ChemPal Documentation - v1.6.0
    Preparing search index...
    • Type guard for a per-variation (or master) product page (GET …/products/{id}). Verifies the fields the enrichment step reads first — productId and the forSale stock flag.

      Parameters

      • response: unknown

        The value to validate

      Returns response is EpagesProductPage

      Type predicate indicating whether response is an EpagesProductPage

      const json = await httpGetJson({ path: variation.link.href });
      if (isEpagesProductPage(json) && json.forSale) {
      console.log(json.priceInfo?.price?.amount);
      }
      export function isEpagesProductPage(response: unknown): response is EpagesProductPage {
      return v.safeParse(epagesProductPageSchema, response).success;
      }