ctt-puro 0.45.3 → 0.45.5
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.
package/fesm2022/ctt-puro.mjs
CHANGED
|
@@ -3575,11 +3575,21 @@ class MapperService {
|
|
|
3575
3575
|
get isMaxSmallDesktopInstant() {
|
|
3576
3576
|
return this.screenSizer.maxSmallDesktopInstant();
|
|
3577
3577
|
}
|
|
3578
|
+
thumbnailAvailable(url) {
|
|
3579
|
+
const xhr = new XMLHttpRequest();
|
|
3580
|
+
xhr.open('HEAD', url, false);
|
|
3581
|
+
try {
|
|
3582
|
+
xhr.send();
|
|
3583
|
+
return xhr.status >= 200 && xhr.status < 400;
|
|
3584
|
+
}
|
|
3585
|
+
catch {
|
|
3586
|
+
return false;
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3578
3589
|
getImageResponsive(image) {
|
|
3579
|
-
if (!image)
|
|
3590
|
+
if (!image)
|
|
3580
3591
|
return undefined;
|
|
3581
|
-
|
|
3582
|
-
let selectedImage;
|
|
3592
|
+
let selectedImage = '';
|
|
3583
3593
|
if (this.screenSizer.isMobileInstant()) {
|
|
3584
3594
|
selectedImage = image?.thumbnails?.[375]?.webp;
|
|
3585
3595
|
}
|
|
@@ -3598,8 +3608,14 @@ class MapperService {
|
|
|
3598
3608
|
else {
|
|
3599
3609
|
selectedImage = image?.thumbnails?.[1280]?.webp;
|
|
3600
3610
|
}
|
|
3611
|
+
const cdn = this.siteSvc.cdnImagesInstant;
|
|
3612
|
+
const thumbUrl = cdn + selectedImage;
|
|
3613
|
+
const originalUrl = cdn + image.path.webp;
|
|
3614
|
+
const finalSrc = this.thumbnailAvailable(thumbUrl)
|
|
3615
|
+
? thumbUrl
|
|
3616
|
+
: originalUrl;
|
|
3601
3617
|
return {
|
|
3602
|
-
src:
|
|
3618
|
+
src: finalSrc,
|
|
3603
3619
|
alt: image?.alt,
|
|
3604
3620
|
};
|
|
3605
3621
|
}
|
|
@@ -5274,10 +5290,16 @@ class MapperService {
|
|
|
5274
5290
|
},
|
|
5275
5291
|
center: {
|
|
5276
5292
|
placeholder: props?.texts?.centerPlaceholder,
|
|
5277
|
-
options:
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5293
|
+
options: [
|
|
5294
|
+
{
|
|
5295
|
+
code: 0,
|
|
5296
|
+
name: props?.texts?.allCenters,
|
|
5297
|
+
},
|
|
5298
|
+
...(props?.hotels?.map((center) => ({
|
|
5299
|
+
code: center?.id,
|
|
5300
|
+
name: center?.texts?.name,
|
|
5301
|
+
})) ?? []),
|
|
5302
|
+
],
|
|
5281
5303
|
},
|
|
5282
5304
|
resident: {
|
|
5283
5305
|
placeholder: props?.texts?.residentPlaceholder,
|