@avvyr/storefront-sdk - v0.19.0
    Preparing search index...

    Class AssetsResource

    Index
    • Images with the products shown in them (hotspots).

      Pass productIds for every image tagged with any of those products, and/or ids for specific images such as the product's own gallery. Hotspots carry the product's id and SKU only: fetch name, price and stock with products.getBatchByIds (or getBatch by SKU), and drop hotspots whose product does not come back (not sold in this market or not in the customer's catalog).

      Parameters

      Returns Promise<AssetListResponse>

      const { data } = await client.assets.list({ productIds: variantIds, limit: 12 })
      const ids = [...new Set(data.flatMap((img) => img.hotspots.map((h) => h.productId)))]
      const products = await client.products.getBatchByIds(ids)