@makerinc/react-sdk
    Preparing search index...

    Type Alias Media

    Media: { type: "TypeImage"; value: Image } | { type: "TypeVideo"; value: Video }

    Media type union for product media (images and videos ONLY) Server type: Store.Media.t

    Idiomatic TypeScript discriminated union. Use .type to narrow and .value to access payload. Use variant.mediaIndex to get the primary display media for a variant (defaults to first if not set).

    const media = product.media[variant.mediaIndex ?? 0];
    if (media.type === "TypeImage") {
    return <img src={media.value.url} alt={media.value.altText ?? ''} />;
    } else if (media.type === "TypeVideo") {
    return <video poster={media.value.poster ?? undefined}>...</video>;
    }