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/index.js CHANGED
@@ -369,6 +369,7 @@ const getFeSessionId = () => {
369
369
  };
370
370
 
371
371
  const FAKE_USER_KEY = 'SXP_FAKE_USER_ID';
372
+ const FAKE_USER_STATE = 'FAKE_USER_STATE';
372
373
  const storeAndLoadFeUserId = () => {
373
374
  let fakeUserId = window.localStorage.getItem(FAKE_USER_KEY);
374
375
  if (isEmpty(fakeUserId)) {
@@ -378,8 +379,11 @@ const storeAndLoadFeUserId = () => {
378
379
  return fakeUserId;
379
380
  };
380
381
  const getFeUserId = () => {
381
- const fakeUserId = window.localStorage.getItem(FAKE_USER_KEY);
382
- return isEmpty(fakeUserId);
382
+ const fakeUserState = window.localStorage.getItem(FAKE_USER_STATE);
383
+ if (isEmpty(fakeUserState)) {
384
+ window.localStorage.setItem(FAKE_USER_STATE, 'true');
385
+ }
386
+ return isEmpty(fakeUserState);
383
387
  };
384
388
 
385
389
  /*
@@ -12217,7 +12221,7 @@ const FingerSwipeTip = ({ imageUrl }) => {
12217
12221
  * @Author: binruan@chatlabs.com
12218
12222
  * @Date: 2024-03-20 10:27:31
12219
12223
  * @LastEditors: binruan@chatlabs.com
12220
- * @LastEditTime: 2024-04-15 18:10:26
12224
+ * @LastEditTime: 2024-04-16 20:49:51
12221
12225
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12222
12226
  *
12223
12227
  */
@@ -12226,6 +12230,9 @@ const Picture = (props) => {
12226
12230
  const [blur, setBlur] = useState(false);
12227
12231
  const imgDom = useRef(null);
12228
12232
  const { sxpParameter } = useSxpDataSource();
12233
+ const getAvifToPng = useCallback((src) => {
12234
+ return src.indexOf('avif') !== -1 ? `${src}?imageMogr2/format/png` : src;
12235
+ }, []);
12229
12236
  useEffect(() => {
12230
12237
  if (imgDom.current === null || src === '') {
12231
12238
  return;
@@ -12240,22 +12247,22 @@ const Picture = (props) => {
12240
12247
  setBlur(true);
12241
12248
  }
12242
12249
  };
12243
- imgDom.current.src = src;
12244
- }, [src]);
12250
+ imgDom.current.src = getAvifToPng(src);
12251
+ }, [src, getAvifToPng]);
12245
12252
  return (React.createElement("div", { style: {
12246
12253
  overflow: 'hidden',
12247
12254
  height,
12248
12255
  width: '100%',
12249
12256
  position: 'relative'
12250
12257
  } },
12251
- 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: {
12258
+ React.createElement("img", { ref: imgDom, loading: 'lazy', src: src ? getAvifToPng(src) : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: {
12252
12259
  height: '100%',
12253
12260
  width: '100%',
12254
12261
  objectFit: 'cover',
12255
12262
  filter: blur ? 'blur(10px)' : 'none',
12256
12263
  transform: blur ? 'scale(1.2)' : 'none'
12257
12264
  } }),
12258
- blur && (React.createElement("img", { ref: imgDom, src: src, loading: 'lazy', style: {
12265
+ blur && (React.createElement("img", { ref: imgDom, src: getAvifToPng(src), loading: 'lazy', style: {
12259
12266
  width: '100%',
12260
12267
  objectFit: 'contain',
12261
12268
  position: 'absolute',
@@ -12270,7 +12277,7 @@ const Picture = (props) => {
12270
12277
  * @Author: lewinlu@chatlabs.com
12271
12278
  * @Date: 2024-01-03 14:39:09
12272
12279
  * @LastEditors: binruan@chatlabs.com
12273
- * @LastEditTime: 2024-04-15 18:08:25
12280
+ * @LastEditTime: 2024-04-16 22:06:11
12274
12281
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12275
12282
  */
12276
12283
  const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
@@ -12477,7 +12484,7 @@ const Nudge = ({ nudge }) => {
12477
12484
  * @Author: binruan@chatlabs.com
12478
12485
  * @Date: 2024-01-15 19:03:09
12479
12486
  * @LastEditors: binruan@chatlabs.com
12480
- * @LastEditTime: 2024-04-16 18:26:41
12487
+ * @LastEditTime: 2024-04-16 19:50:16
12481
12488
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12482
12489
  *
12483
12490
  */
@@ -12495,7 +12502,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12495
12502
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
12496
12503
  const { productView } = useEventReport();
12497
12504
  const isShowFingerTip = useMemo(() => {
12498
- return data.length > 0 && !loading && !getFeUserId;
12505
+ return data.length > 0 && !loading && getFeUserId();
12499
12506
  }, [data, loading]);
12500
12507
  const handleH5EnterLink = useCallback(() => {
12501
12508
  if (data.length <= 0) {