42 lines
1.7 KiB
TypeScript
42 lines
1.7 KiB
TypeScript
// Metro module 9757 (f9758).
|
|
import { getAssetURL } from "../../../utils/StoreUtils";
|
|
import { LARGE_ASSET_FORMAT } from "../SlayerStorefrontUtils";
|
|
export const WEB_HERO_WIDTH_PX = 747;
|
|
export const WEB_HERO_HEIGHT_PX = 560;
|
|
export const MOBILE_HERO_WIDTH_PX = 343;
|
|
export const MOBILE_HERO_HEIGHT_PX = 257;
|
|
export const CAROUSEL_THUMBNAIL_SIZE = 112;
|
|
export function getThumbnailSrc(a0) {
|
|
return a0.thumbnailSrc != null ? a0.thumbnailSrc : a0.type === "video" ? a0.videoThumbnailSrc : a0.src;
|
|
}
|
|
export function convertCarouselItemsToMediaItems(a0, a1, a2, { heroWidth }) {
|
|
const r2 = [];
|
|
const r38 = [];
|
|
if (a0 != null && a0.length !== 0) {
|
|
for (const item of a0) {
|
|
const r47 = item.assetId != null ? a2[item.assetId] : null;
|
|
if (r47 != null) {
|
|
r2.push(item);
|
|
if (r47.mime_type.startsWith("video/")) {
|
|
r38.push({
|
|
type: "video",
|
|
src: getAssetURL(a1, r47, heroWidth, "mp4"),
|
|
videoThumbnailSrc: getAssetURL(a1, r47, heroWidth, "webp"),
|
|
thumbnailSrc: item.thumbnailAssetId != null ? getAssetURL(a1, item.thumbnailAssetId, 112, "webp") : void 0,
|
|
backgroundSrc: item.backgroundAssetId != null ? getAssetURL(a1, item.backgroundAssetId, heroWidth, LARGE_ASSET_FORMAT) : void 0
|
|
});
|
|
} else {
|
|
r38.push({
|
|
type: "image",
|
|
src: getAssetURL(a1, r47, heroWidth, "webp"),
|
|
thumbnailSrc: item.thumbnailAssetId != null ? getAssetURL(a1, item.thumbnailAssetId, 112, "webp") : void 0,
|
|
backgroundSrc: item.backgroundAssetId != null ? getAssetURL(a1, item.backgroundAssetId, heroWidth, LARGE_ASSET_FORMAT) : void 0
|
|
});
|
|
}
|
|
}
|
|
}
|
|
return [r2, r38];
|
|
}
|
|
return [r2, r38];
|
|
}
|