pb-sxp-ui 1.0.14 → 1.0.15

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/dist/pb-ui.js CHANGED
@@ -384,6 +384,7 @@
384
384
  };
385
385
 
386
386
  const FAKE_USER_KEY = 'SXP_FAKE_USER_ID';
387
+ const FAKE_USER_STATE = 'FAKE_USER_STATE';
387
388
  const storeAndLoadFeUserId = () => {
388
389
  let fakeUserId = window.localStorage.getItem(FAKE_USER_KEY);
389
390
  if (lodash.isEmpty(fakeUserId)) {
@@ -393,8 +394,11 @@
393
394
  return fakeUserId;
394
395
  };
395
396
  const getFeUserId = () => {
396
- const fakeUserId = window.localStorage.getItem(FAKE_USER_KEY);
397
- return lodash.isEmpty(fakeUserId);
397
+ const fakeUserState = window.localStorage.getItem(FAKE_USER_STATE);
398
+ if (lodash.isEmpty(fakeUserState)) {
399
+ window.localStorage.setItem(FAKE_USER_STATE, 'true');
400
+ }
401
+ return lodash.isEmpty(fakeUserState);
398
402
  };
399
403
 
400
404
  /*
@@ -12232,7 +12236,7 @@ Made in Italy` })));
12232
12236
  * @Author: binruan@chatlabs.com
12233
12237
  * @Date: 2024-03-20 10:27:31
12234
12238
  * @LastEditors: binruan@chatlabs.com
12235
- * @LastEditTime: 2024-04-15 18:10:26
12239
+ * @LastEditTime: 2024-04-16 20:49:51
12236
12240
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12237
12241
  *
12238
12242
  */
@@ -12241,6 +12245,9 @@ Made in Italy` })));
12241
12245
  const [blur, setBlur] = React.useState(false);
12242
12246
  const imgDom = React.useRef(null);
12243
12247
  const { sxpParameter } = useSxpDataSource();
12248
+ const getAvifToPng = React.useCallback((src) => {
12249
+ return src.indexOf('avif') !== -1 ? `${src}?imageMogr2/format/png` : src;
12250
+ }, []);
12244
12251
  React.useEffect(() => {
12245
12252
  if (imgDom.current === null || src === '') {
12246
12253
  return;
@@ -12255,22 +12262,22 @@ Made in Italy` })));
12255
12262
  setBlur(true);
12256
12263
  }
12257
12264
  };
12258
- imgDom.current.src = src;
12259
- }, [src]);
12265
+ imgDom.current.src = getAvifToPng(src);
12266
+ }, [src, getAvifToPng]);
12260
12267
  return (React.createElement("div", { style: {
12261
12268
  overflow: 'hidden',
12262
12269
  height,
12263
12270
  width: '100%',
12264
12271
  position: 'relative'
12265
12272
  } },
12266
- React.createElement("img", { ref: imgDom, loading: 'lazy', src: src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: {
12273
+ React.createElement("img", { ref: imgDom, loading: 'lazy', src: src ? getAvifToPng(src) : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: {
12267
12274
  height: '100%',
12268
12275
  width: '100%',
12269
12276
  objectFit: 'cover',
12270
12277
  filter: blur ? 'blur(10px)' : 'none',
12271
12278
  transform: blur ? 'scale(1.2)' : 'none'
12272
12279
  } }),
12273
- blur && (React.createElement("img", { ref: imgDom, src: src, loading: 'lazy', style: {
12280
+ blur && (React.createElement("img", { ref: imgDom, src: getAvifToPng(src), loading: 'lazy', style: {
12274
12281
  width: '100%',
12275
12282
  objectFit: 'contain',
12276
12283
  position: 'absolute',
@@ -12285,7 +12292,7 @@ Made in Italy` })));
12285
12292
  * @Author: lewinlu@chatlabs.com
12286
12293
  * @Date: 2024-01-03 14:39:09
12287
12294
  * @LastEditors: binruan@chatlabs.com
12288
- * @LastEditTime: 2024-04-15 18:08:25
12295
+ * @LastEditTime: 2024-04-16 22:06:11
12289
12296
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12290
12297
  */
12291
12298
  const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
@@ -12492,7 +12499,7 @@ Made in Italy` })));
12492
12499
  * @Author: binruan@chatlabs.com
12493
12500
  * @Date: 2024-01-15 19:03:09
12494
12501
  * @LastEditors: binruan@chatlabs.com
12495
- * @LastEditTime: 2024-04-16 18:26:41
12502
+ * @LastEditTime: 2024-04-16 19:50:16
12496
12503
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12497
12504
  *
12498
12505
  */
@@ -12510,7 +12517,7 @@ Made in Italy` })));
12510
12517
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
12511
12518
  const { productView } = useEventReport();
12512
12519
  const isShowFingerTip = React.useMemo(() => {
12513
- return data.length > 0 && !loading && !getFeUserId;
12520
+ return data.length > 0 && !loading && getFeUserId();
12514
12521
  }, [data, loading]);
12515
12522
  const handleH5EnterLink = React.useCallback(() => {
12516
12523
  if (data.length <= 0) {