@ikas/bp-storefront 1.4.0-beta.83 → 1.4.0-beta.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -62,19 +62,26 @@ export declare function getThumbnailSrc(image: IkasImage): string;
|
|
|
62
62
|
/**
|
|
63
63
|
* Generates the full CDN source URL for an image or video at the specified size, handling both legacy path-based and merchant-scoped ID formats.
|
|
64
64
|
*
|
|
65
|
+
* NOTE: For videos (`image.isVideo === true`) the `size` argument is IGNORED — the original .mp4 is always returned.
|
|
66
|
+
* So `getSrc(item, 240)` and `getDefaultSrc(item)` produce the identical URL for a video. PREFER `getDefaultSrc(item)`
|
|
67
|
+
* for video `src` (no size param) — do NOT pass an arbitrary size like `getSrc(item, 240)`, it is misleading.
|
|
68
|
+
*
|
|
65
69
|
* @ai-category Image
|
|
66
70
|
* @ai-related getDefaultSrc, getThumbnailSrc, createMediaSrcset
|
|
67
71
|
*
|
|
68
72
|
* @param image - The image object containing the id, fileName, and isVideo flag.
|
|
69
|
-
* @param size - The desired image width in pixels for
|
|
73
|
+
* @param size - The desired image width in pixels. Ignored for videos.
|
|
70
74
|
* @returns The full CDN URL string for the image or video.
|
|
71
75
|
*
|
|
72
76
|
* @example
|
|
73
77
|
* ```typescript
|
|
74
|
-
* import { getSrc } from "@ikas/bp-storefront";
|
|
78
|
+
* import { getSrc, getDefaultSrc } from "@ikas/bp-storefront";
|
|
75
79
|
*
|
|
76
80
|
* const src = getSrc(image, 640);
|
|
77
81
|
* console.log(src); // "https://cdn.example.com/images/.../640/image.webp"
|
|
82
|
+
*
|
|
83
|
+
* // For a video, use getDefaultSrc (size is ignored anyway):
|
|
84
|
+
* <video src={getDefaultSrc(item)} muted playsInline preload="metadata" />
|
|
78
85
|
* ```
|
|
79
86
|
*/
|
|
80
87
|
export declare function getSrc(image: IkasImage, size: number): string;
|