pb-sxp-ui 1.0.91 → 1.0.93

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.
@@ -4,6 +4,7 @@ import { useIconLink } from '../useIconLink';
4
4
  import FormatImage from '../FormatImage';
5
5
  import { useSxpDataSource } from '../../../../core/hooks';
6
6
  import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../../core/utils/event';
7
+ import loading_gif from './loading.gif';
7
8
  const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
8
9
  const [isPauseVideo, setIsPauseVideo] = useState(false);
9
10
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
@@ -13,6 +14,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
13
14
  const { isActive } = useSwiperSlide();
14
15
  const canvasRef = useRef(null);
15
16
  const [firstFrameSrc, setFirstFrameSrc] = useState('');
17
+ const [waiting, setWaiting] = useState(false);
16
18
  const videoId = `pb-cache-video-${index}`;
17
19
  const videoEleRef = useRef(null);
18
20
  const blur = useMemo(() => {
@@ -47,7 +49,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
47
49
  return;
48
50
  videoRef.muted = muted;
49
51
  }, [muted, videoRef]);
50
- const handleEnded = useCallback(() => {
52
+ const handlePlay = useCallback(() => {
51
53
  if (!videoRef)
52
54
  return;
53
55
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
@@ -57,6 +59,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
57
59
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
58
60
  if (!videoRef)
59
61
  return;
62
+ setWaiting(false);
60
63
  setIsLoadFinish(true);
61
64
  setIsPauseVideo(false);
62
65
  const item = data[index];
@@ -168,6 +171,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
168
171
  });
169
172
  }
170
173
  }, [data, index, bffEventReport, videoRef, activeIndex]);
174
+ const handleWaiting = useCallback(() => {
175
+ setWaiting(true);
176
+ }, []);
171
177
  useEffect(() => {
172
178
  if (!isActive || !videoRef)
173
179
  return;
@@ -175,20 +181,17 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
175
181
  if (!videoSrc)
176
182
  return;
177
183
  const Hls = window === null || window === void 0 ? void 0 : window.Hls;
178
- if (videoSrc.includes('.m3u8')) {
179
- if (Hls && Hls.isSupported()) {
180
- const hls = new Hls();
181
- hls.loadSource(videoSrc);
182
- hls.attachMedia(videoRef);
183
- }
184
- else {
185
- videoRef.src = videoSrc;
186
- }
184
+ if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
185
+ const hls = new Hls();
186
+ hls.loadSource(videoSrc);
187
+ hls.attachMedia(videoRef);
188
+ hls.on(Hls.Events.MANIFEST_PARSED, function () {
189
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
190
+ });
187
191
  }
188
192
  else {
189
193
  videoRef.src = videoSrc;
190
194
  }
191
- setIsPauseVideo(false);
192
195
  const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
193
196
  const dom = document.querySelector('#player-container-id');
194
197
  const dom2 = document.querySelector('#player-container-id-copy');
@@ -201,14 +204,18 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
201
204
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
202
205
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
203
206
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
204
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handleEnded);
207
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handlePlay);
208
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('canplay', handlePlay);
209
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('waiting', handleWaiting);
205
210
  return () => {
211
+ setIsLoadFinish(false);
206
212
  dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
207
213
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
208
214
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
209
215
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
210
216
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
211
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handleEnded);
217
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handlePlay);
218
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('waiting', handleWaiting);
212
219
  };
213
220
  }, [isActive, videoId, rec, videoRef]);
214
221
  useEffect(() => {
@@ -258,6 +265,21 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
258
265
  }
259
266
  return (React.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, alt: 'placeholder image' }));
260
267
  }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
268
+ const renderLoading = useMemo(() => {
269
+ if (!waiting || !isLoadFinish)
270
+ return;
271
+ return (React.createElement("img", { style: {
272
+ position: 'absolute',
273
+ top: '50%',
274
+ left: 0,
275
+ right: 0,
276
+ transform: 'translateY(-100%)',
277
+ margin: 'auto',
278
+ width: '50px',
279
+ height: '50px',
280
+ objectFit: 'contain'
281
+ }, src: loading_gif, alt: 'placeholder image' }));
282
+ }, [waiting, isLoadFinish]);
261
283
  useEffect(() => {
262
284
  if (!videoRef)
263
285
  return;
@@ -290,7 +312,8 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
290
312
  React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
291
313
  React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
292
314
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', alt: 'pause', src: PAUSE_ICON }))),
293
- renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, style: {
315
+ renderPoster,
316
+ renderLoading)) : (React.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, style: {
294
317
  position: 'relative',
295
318
  width: '100%',
296
319
  height,
@@ -298,6 +321,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
298
321
  }, onClick: handleClickVideo() },
299
322
  React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
300
323
  renderPoster,
324
+ renderLoading,
301
325
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON, alt: 'pause' })))));
302
326
  };
303
327
  export default memo(VideoWidget);
@@ -366,7 +366,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
366
366
  };
367
367
  const visList = useMemo(() => {
368
368
  var _a;
369
- const list = activeIndex === 0
369
+ const list = activeIndex === 0 && !waterFallData
370
370
  ? [(_a = data === null || data === void 0 ? void 0 : data[0]) !== null && _a !== void 0 ? _a : null]
371
371
  : data === null || data === void 0 ? void 0 : data.map((item, index) => {
372
372
  if (activeIndex === index || index - 1 === activeIndex || index + 1 === activeIndex) {
@@ -6,7 +6,7 @@ import styles from './index.module.less';
6
6
  import { useSxpDataSource } from '../../../../core/hooks';
7
7
  import Img from '../components/Img';
8
8
  const Commodity = (_a) => {
9
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
9
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
10
10
  var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY", "index"]);
11
11
  const { sxpParameter } = useSxpDataSource();
12
12
  const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
@@ -22,6 +22,6 @@ const Commodity = (_a) => {
22
22
  overflow: 'hidden'
23
23
  }) },
24
24
  React.createElement("div", { className: styles['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : 'Product Name'),
25
- React.createElement("div", { className: css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_l = (_k = product === null || product === void 0 ? void 0 : product.bindCta) === null || _k === void 0 ? void 0 : _k.enTitle) !== null && _l !== void 0 ? _l : 'Shop Now'))));
25
+ React.createElement("div", { className: css(Object.assign({ padding: '0 7px', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap', lineHeight: ((_k = ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle) === null || _k === void 0 ? void 0 : _k.height) + 'px' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_m = (_l = product === null || product === void 0 ? void 0 : product.bindCta) === null || _l === void 0 ? void 0 : _l.enTitle) !== null && _m !== void 0 ? _m : 'Shop Now'))));
26
26
  };
27
27
  export default memo(Commodity);
@@ -1,5 +1,5 @@
1
1
  import { css } from '@emotion/css';
2
- import React, { memo, useEffect, useRef } from 'react';
2
+ import React, { memo, useEffect, useMemo, useRef } from 'react';
3
3
  import useOnScreen from '../../../../core/hooks/useOnScreen';
4
4
  import { useSxpDataSource } from '../../../../core/hooks';
5
5
  import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
@@ -15,8 +15,11 @@ const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
15
15
  }, rec, item, index);
16
16
  }
17
17
  }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
18
+ const imgSrc = useMemo(() => {
19
+ return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? src : `${src}?imrquality/rquality/40`;
20
+ }, [src]);
18
21
  return (React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, imgStyle)) },
19
22
  React.createElement("div", { ref: ref, hidden: !src, className: css({ width: '100%', height: '100%' }) },
20
- React.createElement(FormatImage, { className: css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: `${src}?imrquality/rquality/40` }))));
23
+ React.createElement(FormatImage, { className: css(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: imgSrc }))));
21
24
  };
22
25
  export default memo(Img);
@@ -7,6 +7,7 @@ const useIconLink_1 = require("../useIconLink");
7
7
  const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
8
8
  const hooks_1 = require("../../../../core/hooks");
9
9
  const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
10
+ const loading_gif_1 = tslib_1.__importDefault(require("./loading.gif"));
10
11
  const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
11
12
  const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
12
13
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = (0, hooks_1.useSxpDataSource)();
@@ -16,6 +17,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
16
17
  const { isActive } = (0, react_2.useSwiperSlide)();
17
18
  const canvasRef = (0, react_1.useRef)(null);
18
19
  const [firstFrameSrc, setFirstFrameSrc] = (0, react_1.useState)('');
20
+ const [waiting, setWaiting] = (0, react_1.useState)(false);
19
21
  const videoId = `pb-cache-video-${index}`;
20
22
  const videoEleRef = (0, react_1.useRef)(null);
21
23
  const blur = (0, react_1.useMemo)(() => {
@@ -50,7 +52,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
50
52
  return;
51
53
  videoRef.muted = muted;
52
54
  }, [muted, videoRef]);
53
- const handleEnded = (0, react_1.useCallback)(() => {
55
+ const handlePlay = (0, react_1.useCallback)(() => {
54
56
  if (!videoRef)
55
57
  return;
56
58
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
@@ -60,6 +62,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
60
62
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
61
63
  if (!videoRef)
62
64
  return;
65
+ setWaiting(false);
63
66
  setIsLoadFinish(true);
64
67
  setIsPauseVideo(false);
65
68
  const item = data[index];
@@ -171,6 +174,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
171
174
  });
172
175
  }
173
176
  }, [data, index, bffEventReport, videoRef, activeIndex]);
177
+ const handleWaiting = (0, react_1.useCallback)(() => {
178
+ setWaiting(true);
179
+ }, []);
174
180
  (0, react_1.useEffect)(() => {
175
181
  if (!isActive || !videoRef)
176
182
  return;
@@ -178,20 +184,17 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
178
184
  if (!videoSrc)
179
185
  return;
180
186
  const Hls = window === null || window === void 0 ? void 0 : window.Hls;
181
- if (videoSrc.includes('.m3u8')) {
182
- if (Hls && Hls.isSupported()) {
183
- const hls = new Hls();
184
- hls.loadSource(videoSrc);
185
- hls.attachMedia(videoRef);
186
- }
187
- else {
188
- videoRef.src = videoSrc;
189
- }
187
+ if (videoSrc.includes('.m3u8') && Hls && Hls.isSupported()) {
188
+ const hls = new Hls();
189
+ hls.loadSource(videoSrc);
190
+ hls.attachMedia(videoRef);
191
+ hls.on(Hls.Events.MANIFEST_PARSED, function () {
192
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
193
+ });
190
194
  }
191
195
  else {
192
196
  videoRef.src = videoSrc;
193
197
  }
194
- setIsPauseVideo(false);
195
198
  const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
196
199
  const dom = document.querySelector('#player-container-id');
197
200
  const dom2 = document.querySelector('#player-container-id-copy');
@@ -204,14 +207,18 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
204
207
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
205
208
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
206
209
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
207
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handleEnded);
210
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handlePlay);
211
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('canplay', handlePlay);
212
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('waiting', handleWaiting);
208
213
  return () => {
214
+ setIsLoadFinish(false);
209
215
  dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
210
216
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
211
217
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
212
218
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
213
219
  videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
214
- videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handleEnded);
220
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handlePlay);
221
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('waiting', handleWaiting);
215
222
  };
216
223
  }, [isActive, videoId, rec, videoRef]);
217
224
  (0, react_1.useEffect)(() => {
@@ -261,6 +268,21 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
261
268
  }
262
269
  return (react_1.default.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, alt: 'placeholder image' }));
263
270
  }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
271
+ const renderLoading = (0, react_1.useMemo)(() => {
272
+ if (!waiting || !isLoadFinish)
273
+ return;
274
+ return (react_1.default.createElement("img", { style: {
275
+ position: 'absolute',
276
+ top: '50%',
277
+ left: 0,
278
+ right: 0,
279
+ transform: 'translateY(-100%)',
280
+ margin: 'auto',
281
+ width: '50px',
282
+ height: '50px',
283
+ objectFit: 'contain'
284
+ }, src: loading_gif_1.default, alt: 'placeholder image' }));
285
+ }, [waiting, isLoadFinish]);
264
286
  (0, react_1.useEffect)(() => {
265
287
  if (!videoRef)
266
288
  return;
@@ -293,7 +315,8 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
293
315
  react_1.default.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
294
316
  react_1.default.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
295
317
  react_1.default.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', alt: 'pause', src: PAUSE_ICON }))),
296
- renderPoster)) : (react_1.default.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, style: {
318
+ renderPoster,
319
+ renderLoading)) : (react_1.default.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, style: {
297
320
  position: 'relative',
298
321
  width: '100%',
299
322
  height,
@@ -301,6 +324,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
301
324
  }, onClick: handleClickVideo() },
302
325
  react_1.default.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
303
326
  renderPoster,
327
+ renderLoading,
304
328
  react_1.default.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON, alt: 'pause' })))));
305
329
  };
306
330
  exports.default = (0, react_1.memo)(VideoWidget);
@@ -369,7 +369,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
369
369
  };
370
370
  const visList = (0, react_1.useMemo)(() => {
371
371
  var _a;
372
- const list = activeIndex === 0
372
+ const list = activeIndex === 0 && !waterFallData
373
373
  ? [(_a = data === null || data === void 0 ? void 0 : data[0]) !== null && _a !== void 0 ? _a : null]
374
374
  : data === null || data === void 0 ? void 0 : data.map((item, index) => {
375
375
  if (activeIndex === index || index - 1 === activeIndex || index + 1 === activeIndex) {
@@ -8,7 +8,7 @@ const index_module_less_1 = tslib_1.__importDefault(require("./index.module.less
8
8
  const hooks_1 = require("../../../../core/hooks");
9
9
  const Img_1 = tslib_1.__importDefault(require("../components/Img"));
10
10
  const Commodity = (_a) => {
11
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
11
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
12
12
  var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0, index } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY", "index"]);
13
13
  const { sxpParameter } = (0, hooks_1.useSxpDataSource)();
14
14
  const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
@@ -24,6 +24,6 @@ const Commodity = (_a) => {
24
24
  overflow: 'hidden'
25
25
  }) },
26
26
  react_1.default.createElement("div", { className: index_module_less_1.default['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : 'Product Name'),
27
- react_1.default.createElement("div", { className: (0, css_1.css)(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_l = (_k = product === null || product === void 0 ? void 0 : product.bindCta) === null || _k === void 0 ? void 0 : _k.enTitle) !== null && _l !== void 0 ? _l : 'Shop Now'))));
27
+ react_1.default.createElement("div", { className: (0, css_1.css)(Object.assign({ padding: '0 7px', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap', lineHeight: ((_k = ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle) === null || _k === void 0 ? void 0 : _k.height) + 'px' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_m = (_l = product === null || product === void 0 ? void 0 : product.bindCta) === null || _l === void 0 ? void 0 : _l.enTitle) !== null && _m !== void 0 ? _m : 'Shop Now'))));
28
28
  };
29
29
  exports.default = (0, react_1.memo)(Commodity);
@@ -18,8 +18,11 @@ const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
18
18
  }, rec, item, index);
19
19
  }
20
20
  }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
21
+ const imgSrc = (0, react_1.useMemo)(() => {
22
+ return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? src : `${src}?imrquality/rquality/40`;
23
+ }, [src]);
21
24
  return (react_1.default.createElement("div", { className: (0, css_1.css)(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, imgStyle)) },
22
25
  react_1.default.createElement("div", { ref: ref, hidden: !src, className: (0, css_1.css)({ width: '100%', height: '100%' }) },
23
- react_1.default.createElement(FormatImage_1.default, { className: (0, css_1.css)(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: `${src}?imrquality/rquality/40` }))));
26
+ react_1.default.createElement(FormatImage_1.default, { className: (0, css_1.css)(Object.assign({ width: '100%', objectFit: 'cover', height: '100%', display: 'block', objectPosition: `50% ${translateY ? -translateY + 50 : 50}%` }, style)), src: imgSrc }))));
24
27
  };
25
28
  exports.default = (0, react_1.memo)(Img);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.0.91",
3
+ "version": "1.0.93",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",