pb-sxp-ui 1.0.12 → 1.0.14

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
@@ -392,6 +392,10 @@
392
392
  }
393
393
  return fakeUserId;
394
394
  };
395
+ const getFeUserId = () => {
396
+ const fakeUserId = window.localStorage.getItem(FAKE_USER_KEY);
397
+ return lodash.isEmpty(fakeUserId);
398
+ };
395
399
 
396
400
  /*
397
401
  * @Author: binruan@chatlabs.com
@@ -8232,7 +8236,7 @@
8232
8236
  * @Author: binruan@chatlabs.com
8233
8237
  * @Date: 2023-12-26 16:11:34
8234
8238
  * @LastEditors: binruan@chatlabs.com
8235
- * @LastEditTime: 2024-04-09 11:00:07
8239
+ * @LastEditTime: 2024-04-16 19:27:48
8236
8240
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
8237
8241
  *
8238
8242
  */
@@ -8254,48 +8258,47 @@
8254
8258
  const _words = newWords.length > 1 && newWords.length < words.length ? newWords.slice(0, newWords.length - 1) : newWords;
8255
8259
  return _words.join(' ') + ' ';
8256
8260
  };
8257
- const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost }) => {
8258
- const [isShowMore, setIsShowMore] = React.useState(true);
8259
- const [isShow, setIsShow] = React.useState(false);
8261
+ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost, onChange }) => {
8262
+ const [isShowMore, setIsShowMore] = React.useState(false);
8263
+ React.useState(false);
8260
8264
  const lineClamp = Number((style === null || style === void 0 ? void 0 : style.lineClamp) || 2);
8261
8265
  const multiRow = React.useRef(null);
8262
8266
  const handleClick = React.useCallback(() => {
8263
8267
  setIsShowMore(!isShowMore);
8264
- }, [isShowMore]);
8268
+ onChange === null || onChange === void 0 ? void 0 : onChange(!isShowMore);
8269
+ }, [isShowMore, onChange]);
8265
8270
  React.useMemo(() => {
8266
8271
  return !isShowMore && text.length > maxStr ? limitTextLastWholeWord(text, maxStr) + '...' : text;
8267
8272
  }, [text, maxStr, isShowMore]);
8268
8273
  React.useEffect(() => {
8269
- if (multiRow.current && isPost) {
8270
- setIsShowMore(true);
8271
- setTimeout(() => {
8272
- var _a;
8273
- setIsShow(false);
8274
- try {
8275
- const cs = (_a = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(window, multiRow.current);
8276
- const height = parseFloat(cs === null || cs === void 0 ? void 0 : cs.height);
8277
- const lh = parseFloat(cs === null || cs === void 0 ? void 0 : cs.lineHeight);
8278
- const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) + 6;
8279
- const lineHeight = isNaN(lh) ? fs : lh;
8280
- if (text && height > lineHeight * lineClamp) {
8281
- setIsShowMore(false);
8282
- setIsShow(true);
8283
- }
8284
- }
8285
- catch (_b) { }
8286
- }, 100);
8287
- }
8274
+ // if (multiRow.current && isPost) {
8275
+ // setIsShowMore(true);
8276
+ // setTimeout(() => {
8277
+ // setIsShow(false);
8278
+ // try {
8279
+ // const cs = window?.getComputedStyle?.(multiRow.current);
8280
+ // const height = parseFloat(cs?.height);
8281
+ // const lh = parseFloat(cs?.lineHeight);
8282
+ // const fs = parseFloat(cs?.fontSize) + 6;
8283
+ // const lineHeight = isNaN(lh) ? fs : lh;
8284
+ // if (text && height > lineHeight * lineClamp) {
8285
+ // setIsShowMore(false);
8286
+ // setIsShow(true);
8287
+ // }
8288
+ // } catch {}
8289
+ // }, 100);
8290
+ // }
8288
8291
  }, [multiRow, text, lineClamp, style, isPost]);
8289
8292
  return (React.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
8290
8293
  React.createElement("div", { ref: multiRow, style: {
8291
8294
  overflow: 'hidden',
8292
- WebkitLineClamp: !isShowMore ? lineClamp : '',
8295
+ WebkitLineClamp: isShowMore ? '' : lineClamp,
8293
8296
  textOverflow: 'ellipsis',
8294
8297
  display: '-webkit-box',
8295
8298
  WebkitBoxOrient: 'vertical',
8296
8299
  wordBreak: 'break-word'
8297
8300
  }, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
8298
- isShow && text && (React.createElement("span", { style: { textDecoration: 'underline', cursor: 'pointer' }, onClick: onClick !== null && onClick !== void 0 ? onClick : handleClick }, isShowMore ? unfoldText || 'show less' : foldText || 'show more'))));
8301
+ text && isPost && (React.createElement("span", { style: { textDecoration: 'underline', cursor: 'pointer' }, onClick: onClick !== null && onClick !== void 0 ? onClick : handleClick }, isShowMore ? unfoldText || 'show less' : foldText || 'show more'))));
8299
8302
  };
8300
8303
  var ExpandableText$1 = React.memo(ExpandableText);
8301
8304
 
@@ -11584,7 +11587,7 @@ Made in Italy` })));
11584
11587
  };
11585
11588
  }, [src, showVideo]);
11586
11589
  const handleClickToDetail = () => {
11587
- reportTagsView(index);
11590
+ reportTagsView();
11588
11591
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
11589
11592
  setTimeout(() => {
11590
11593
  var _a;
@@ -11692,7 +11695,7 @@ Made in Italy` })));
11692
11695
  * @Author: binruan@chatlabs.com
11693
11696
  * @Date: 2024-01-10 10:58:24
11694
11697
  * @LastEditors: binruan@chatlabs.com
11695
- * @LastEditTime: 2024-04-15 16:48:54
11698
+ * @LastEditTime: 2024-04-15 17:57:59
11696
11699
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
11697
11700
  *
11698
11701
  */
@@ -11719,7 +11722,7 @@ Made in Italy` })));
11719
11722
  if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
11720
11723
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
11721
11724
  }
11722
- reportTagsView(cacheActiveIndex || 0);
11725
+ reportTagsView();
11723
11726
  setWaterFallData === null || setWaterFallData === void 0 ? void 0 : setWaterFallData(undefined);
11724
11727
  setIsFromHashtag === null || setIsFromHashtag === void 0 ? void 0 : setIsFromHashtag(false);
11725
11728
  setTimeout(() => {
@@ -11736,7 +11739,7 @@ Made in Italy` })));
11736
11739
  setRecData(waterFallData);
11737
11740
  }
11738
11741
  }, [waterFallData]);
11739
- const reportTagsView = React.useCallback((index) => {
11742
+ const reportTagsView = React.useCallback(() => {
11740
11743
  var _a, _b, _c, _d, _e, _f;
11741
11744
  const rec = recData === null || recData === void 0 ? void 0 : recData.rec;
11742
11745
  if (!rec)
@@ -11754,7 +11757,7 @@ Made in Italy` })));
11754
11757
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
11755
11758
  eventInfo: {
11756
11759
  relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
11757
- position: index + '',
11760
+ position: cacheActiveIndex + '',
11758
11761
  contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
11759
11762
  traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
11760
11763
  hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
@@ -11765,7 +11768,7 @@ Made in Italy` })));
11765
11768
  eventDescription: 'User click tags view contents'
11766
11769
  }
11767
11770
  });
11768
- }, [recData, bffEventReport, viewTime, isFromHashtag]);
11771
+ }, [recData, bffEventReport, viewTime, isFromHashtag, cacheActiveIndex]);
11769
11772
  React.useEffect(() => {
11770
11773
  if (openHashtag) {
11771
11774
  setViewTime(new Date());
@@ -12229,7 +12232,7 @@ Made in Italy` })));
12229
12232
  * @Author: binruan@chatlabs.com
12230
12233
  * @Date: 2024-03-20 10:27:31
12231
12234
  * @LastEditors: binruan@chatlabs.com
12232
- * @LastEditTime: 2024-04-08 18:44:58
12235
+ * @LastEditTime: 2024-04-15 18:10:26
12233
12236
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12234
12237
  *
12235
12238
  */
@@ -12282,7 +12285,7 @@ Made in Italy` })));
12282
12285
  * @Author: lewinlu@chatlabs.com
12283
12286
  * @Date: 2024-01-03 14:39:09
12284
12287
  * @LastEditors: binruan@chatlabs.com
12285
- * @LastEditTime: 2024-03-25 15:08:11
12288
+ * @LastEditTime: 2024-04-15 18:08:25
12286
12289
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12287
12290
  */
12288
12291
  const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
@@ -12302,9 +12305,9 @@ Made in Italy` })));
12302
12305
  setIsLoad(true);
12303
12306
  }
12304
12307
  }, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
12305
- if (!isActive) {
12306
- return React.createElement("img", { src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: { width, height, objectFit: 'cover' } });
12307
- }
12308
+ // if (!isActive) {
12309
+ // return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
12310
+ // }
12308
12311
  return (React.createElement(Swiper, { defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: 3000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
12309
12312
  return (React.createElement(SwiperSlide, { key: url },
12310
12313
  React.createElement(Picture, { src: url, width: width, height: height })));
@@ -12489,7 +12492,7 @@ Made in Italy` })));
12489
12492
  * @Author: binruan@chatlabs.com
12490
12493
  * @Date: 2024-01-15 19:03:09
12491
12494
  * @LastEditors: binruan@chatlabs.com
12492
- * @LastEditTime: 2024-04-15 17:07:42
12495
+ * @LastEditTime: 2024-04-16 18:26:41
12493
12496
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12494
12497
  *
12495
12498
  */
@@ -12503,10 +12506,11 @@ Made in Italy` })));
12503
12506
  const curTime = React.useRef();
12504
12507
  const viewTime = React.useRef();
12505
12508
  const [isLoadMore, setIsLoadMore] = React.useState(false);
12509
+ const [isShowMore, setIsShowMore] = React.useState(false);
12506
12510
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
12507
12511
  const { productView } = useEventReport();
12508
12512
  const isShowFingerTip = React.useMemo(() => {
12509
- return data.length > 0 && !loading;
12513
+ return data.length > 0 && !loading && !getFeUserId;
12510
12514
  }, [data, loading]);
12511
12515
  const handleH5EnterLink = React.useCallback(() => {
12512
12516
  if (data.length <= 0) {
@@ -12665,20 +12669,47 @@ Made in Italy` })));
12665
12669
  }
12666
12670
  return null;
12667
12671
  }, [containerWidth, data, height, isMuted, activeIndex, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost, viewTime, tipText, resolver, schema]);
12672
+ const onExpandableChange = React.useCallback((v) => {
12673
+ setIsShowMore(v);
12674
+ }, []);
12675
+ const lineGradStyle = React.useMemo(() => {
12676
+ return !isShowMore
12677
+ ? {
12678
+ padding: '20px 0'
12679
+ }
12680
+ : {
12681
+ background: 'linear-gradient( 180deg, rgba(129,129,129,0) 0%, rgba(121,121,121,0.5) 5%, #616161 100%)',
12682
+ paddingTop: 20,
12683
+ paddingBottom: 20
12684
+ };
12685
+ }, [isShowMore]);
12668
12686
  const renderBottom = React.useCallback((rec, index) => {
12669
12687
  var _a, _b, _c, _d, _e, _f, _g;
12670
12688
  if (rec.video) {
12671
12689
  return (React.createElement(React.Fragment, null,
12672
- ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
12690
+ ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && !isShowMore && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
12673
12691
  React.createElement("div", { className: 'clc-sxp-bottom' },
12674
12692
  React.createElement(Nudge, { nudge: nudge }),
12675
12693
  React.createElement("div", { className: 'clc-sxp-bottom-card' },
12676
12694
  React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
12677
- React.createElement(ExpandableText$1, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }) }),
12678
- React.createElement(Hashtag$1, { index: activeIndex, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.url) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle }))));
12695
+ React.createElement("div", { style: lineGradStyle },
12696
+ React.createElement(ExpandableText$1, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }), onChange: onExpandableChange }),
12697
+ React.createElement(Hashtag$1, { index: activeIndex, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.url) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle })))));
12679
12698
  }
12680
12699
  return null;
12681
- }, [descStyle, activeIndex, tempMap, resolver, tipText, nudge, hashTagStyle, globalConfig]);
12700
+ }, [
12701
+ descStyle,
12702
+ activeIndex,
12703
+ tempMap,
12704
+ resolver,
12705
+ tipText,
12706
+ nudge,
12707
+ hashTagStyle,
12708
+ globalConfig,
12709
+ onExpandableChange,
12710
+ isShowMore,
12711
+ lineGradStyle
12712
+ ]);
12682
12713
  const renderLikeButton = React.useCallback((rec, index) => {
12683
12714
  var _a, _b;
12684
12715
  if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))