Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-13 16:37:00 +03:00
parent bd8dbce39e
commit 72a5a4f0ac
3 changed files with 111 additions and 45 deletions

View File

@@ -526,6 +526,25 @@ function resolveProductImageUrl(item) {
return { contentUrl, publicUrl }
}
async function resolveProductImageUrlForCarousel(item) {
const resolved = resolveProductImageUrl(item)
const contentUrl = String(resolved.contentUrl || '').trim()
if (contentUrl) {
try {
const blobRes = await api.get(contentUrl, { baseURL: '', responseType: 'blob' })
const blob = blobRes?.data
if (blob instanceof Blob) {
const objectUrl = URL.createObjectURL(blob)
productImageBlobUrls.value.push(objectUrl)
return objectUrl
}
} catch {
// fall through to public url
}
}
return String(resolved.publicUrl || contentUrl || '').trim()
}
function getProductImageUrl(code, color, secondColor = '') {
const key = buildImageKey(code, color, secondColor)
const existing = productImageCache.value[key]
@@ -945,12 +964,10 @@ async function openProductCard(grp1, grp2) {
}
}
const images = list
.map((item) => {
const resolved = resolveProductImageUrl(item)
return resolved.publicUrl || resolved.contentUrl || ''
})
.filter((x) => String(x || '').trim() !== '')
const imageCandidates = await Promise.all(
list.map((item) => resolveProductImageUrlForCarousel(item))
)
const images = imageCandidates.filter((x) => String(x || '').trim() !== '')
const uniqueImages = Array.from(new Set(images))
if (!uniqueImages.length) {