@adcp/sdk API Reference - v10.0.1
    Preparing search index...

    Function batchPreviewProducts

    • Extract preview URLs from products' product_card fields.

      AdCP 3.1.0-beta.2 changed product_card from a creative-agent-rendered shape ({ format_id, manifest }) to a self-contained visual card ({ image, title, description, price_label, cta_label }). The card IS the preview — no creative-agent round-trip required. This function now extracts the image URL directly from the inline card.

      Products with no product_card, or with a card that lacks an image.url, return a result with no previewUrl. The function preserves its Promise<PreviewResult[]> return shape so existing adopters' code paths keep compiling and behaving correctly.

      Parameters

      Returns Promise<PreviewResult[]>

      Array of preview results matching input products by index.

      const previews = await batchPreviewProducts(products, creativeAgent);
      previews.forEach(p => {
      if (p.previewUrl) {
      console.log(`${p.item.name}: ${p.previewUrl}`);
      }
      });

      Use product.product_card?.image?.url directly. This wrapper only exists for 8.0-beta migration ergonomics and will be removed.