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/index.cjs CHANGED
@@ -400,6 +400,10 @@ const storeAndLoadFeUserId = () => {
400
400
  }
401
401
  return fakeUserId;
402
402
  };
403
+ const getFeUserId = () => {
404
+ const fakeUserId = window.localStorage.getItem(FAKE_USER_KEY);
405
+ return lodash.isEmpty(fakeUserId);
406
+ };
403
407
 
404
408
  /*
405
409
  * @Author: binruan@chatlabs.com
@@ -8240,7 +8244,7 @@ var Modal$1 = React.memo(Modal);
8240
8244
  * @Author: binruan@chatlabs.com
8241
8245
  * @Date: 2023-12-26 16:11:34
8242
8246
  * @LastEditors: binruan@chatlabs.com
8243
- * @LastEditTime: 2024-04-09 11:00:07
8247
+ * @LastEditTime: 2024-04-16 19:27:48
8244
8248
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
8245
8249
  *
8246
8250
  */
@@ -8262,48 +8266,47 @@ const limitTextLastWholeWord = (originalText = '', limit) => {
8262
8266
  const _words = newWords.length > 1 && newWords.length < words.length ? newWords.slice(0, newWords.length - 1) : newWords;
8263
8267
  return _words.join(' ') + ' ';
8264
8268
  };
8265
- const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost }) => {
8266
- const [isShowMore, setIsShowMore] = React.useState(true);
8267
- const [isShow, setIsShow] = React.useState(false);
8269
+ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost, onChange }) => {
8270
+ const [isShowMore, setIsShowMore] = React.useState(false);
8271
+ React.useState(false);
8268
8272
  const lineClamp = Number((style === null || style === void 0 ? void 0 : style.lineClamp) || 2);
8269
8273
  const multiRow = React.useRef(null);
8270
8274
  const handleClick = React.useCallback(() => {
8271
8275
  setIsShowMore(!isShowMore);
8272
- }, [isShowMore]);
8276
+ onChange === null || onChange === void 0 ? void 0 : onChange(!isShowMore);
8277
+ }, [isShowMore, onChange]);
8273
8278
  React.useMemo(() => {
8274
8279
  return !isShowMore && text.length > maxStr ? limitTextLastWholeWord(text, maxStr) + '...' : text;
8275
8280
  }, [text, maxStr, isShowMore]);
8276
8281
  React.useEffect(() => {
8277
- if (multiRow.current && isPost) {
8278
- setIsShowMore(true);
8279
- setTimeout(() => {
8280
- var _a;
8281
- setIsShow(false);
8282
- try {
8283
- const cs = (_a = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(window, multiRow.current);
8284
- const height = parseFloat(cs === null || cs === void 0 ? void 0 : cs.height);
8285
- const lh = parseFloat(cs === null || cs === void 0 ? void 0 : cs.lineHeight);
8286
- const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) + 6;
8287
- const lineHeight = isNaN(lh) ? fs : lh;
8288
- if (text && height > lineHeight * lineClamp) {
8289
- setIsShowMore(false);
8290
- setIsShow(true);
8291
- }
8292
- }
8293
- catch (_b) { }
8294
- }, 100);
8295
- }
8282
+ // if (multiRow.current && isPost) {
8283
+ // setIsShowMore(true);
8284
+ // setTimeout(() => {
8285
+ // setIsShow(false);
8286
+ // try {
8287
+ // const cs = window?.getComputedStyle?.(multiRow.current);
8288
+ // const height = parseFloat(cs?.height);
8289
+ // const lh = parseFloat(cs?.lineHeight);
8290
+ // const fs = parseFloat(cs?.fontSize) + 6;
8291
+ // const lineHeight = isNaN(lh) ? fs : lh;
8292
+ // if (text && height > lineHeight * lineClamp) {
8293
+ // setIsShowMore(false);
8294
+ // setIsShow(true);
8295
+ // }
8296
+ // } catch {}
8297
+ // }, 100);
8298
+ // }
8296
8299
  }, [multiRow, text, lineClamp, style, isPost]);
8297
8300
  return (React.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
8298
8301
  React.createElement("div", { ref: multiRow, style: {
8299
8302
  overflow: 'hidden',
8300
- WebkitLineClamp: !isShowMore ? lineClamp : '',
8303
+ WebkitLineClamp: isShowMore ? '' : lineClamp,
8301
8304
  textOverflow: 'ellipsis',
8302
8305
  display: '-webkit-box',
8303
8306
  WebkitBoxOrient: 'vertical',
8304
8307
  wordBreak: 'break-word'
8305
8308
  }, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
8306
- 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'))));
8309
+ 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'))));
8307
8310
  };
8308
8311
  var ExpandableText$1 = React.memo(ExpandableText);
8309
8312
 
@@ -11592,7 +11595,7 @@ const WaterfallFlowItem = (props) => {
11592
11595
  };
11593
11596
  }, [src, showVideo]);
11594
11597
  const handleClickToDetail = () => {
11595
- reportTagsView(index);
11598
+ reportTagsView();
11596
11599
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
11597
11600
  setTimeout(() => {
11598
11601
  var _a;
@@ -11700,7 +11703,7 @@ var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeA
11700
11703
  * @Author: binruan@chatlabs.com
11701
11704
  * @Date: 2024-01-10 10:58:24
11702
11705
  * @LastEditors: binruan@chatlabs.com
11703
- * @LastEditTime: 2024-04-15 16:48:54
11706
+ * @LastEditTime: 2024-04-15 17:57:59
11704
11707
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
11705
11708
  *
11706
11709
  */
@@ -11727,7 +11730,7 @@ const WaterFall = (props) => {
11727
11730
  if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
11728
11731
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
11729
11732
  }
11730
- reportTagsView(cacheActiveIndex || 0);
11733
+ reportTagsView();
11731
11734
  setWaterFallData === null || setWaterFallData === void 0 ? void 0 : setWaterFallData(undefined);
11732
11735
  setIsFromHashtag === null || setIsFromHashtag === void 0 ? void 0 : setIsFromHashtag(false);
11733
11736
  setTimeout(() => {
@@ -11744,7 +11747,7 @@ const WaterFall = (props) => {
11744
11747
  setRecData(waterFallData);
11745
11748
  }
11746
11749
  }, [waterFallData]);
11747
- const reportTagsView = React.useCallback((index) => {
11750
+ const reportTagsView = React.useCallback(() => {
11748
11751
  var _a, _b, _c, _d, _e, _f;
11749
11752
  const rec = recData === null || recData === void 0 ? void 0 : recData.rec;
11750
11753
  if (!rec)
@@ -11762,7 +11765,7 @@ const WaterFall = (props) => {
11762
11765
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
11763
11766
  eventInfo: {
11764
11767
  relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
11765
- position: index + '',
11768
+ position: cacheActiveIndex + '',
11766
11769
  contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
11767
11770
  traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
11768
11771
  hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
@@ -11773,7 +11776,7 @@ const WaterFall = (props) => {
11773
11776
  eventDescription: 'User click tags view contents'
11774
11777
  }
11775
11778
  });
11776
- }, [recData, bffEventReport, viewTime, isFromHashtag]);
11779
+ }, [recData, bffEventReport, viewTime, isFromHashtag, cacheActiveIndex]);
11777
11780
  React.useEffect(() => {
11778
11781
  if (openHashtag) {
11779
11782
  setViewTime(new Date());
@@ -12237,7 +12240,7 @@ const FingerSwipeTip = ({ imageUrl }) => {
12237
12240
  * @Author: binruan@chatlabs.com
12238
12241
  * @Date: 2024-03-20 10:27:31
12239
12242
  * @LastEditors: binruan@chatlabs.com
12240
- * @LastEditTime: 2024-04-08 18:44:58
12243
+ * @LastEditTime: 2024-04-15 18:10:26
12241
12244
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12242
12245
  *
12243
12246
  */
@@ -12290,7 +12293,7 @@ const Picture = (props) => {
12290
12293
  * @Author: lewinlu@chatlabs.com
12291
12294
  * @Date: 2024-01-03 14:39:09
12292
12295
  * @LastEditors: binruan@chatlabs.com
12293
- * @LastEditTime: 2024-03-25 15:08:11
12296
+ * @LastEditTime: 2024-04-15 18:08:25
12294
12297
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12295
12298
  */
12296
12299
  const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
@@ -12310,9 +12313,9 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
12310
12313
  setIsLoad(true);
12311
12314
  }
12312
12315
  }, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
12313
- if (!isActive) {
12314
- return React.createElement("img", { src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: { width, height, objectFit: 'cover' } });
12315
- }
12316
+ // if (!isActive) {
12317
+ // return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
12318
+ // }
12316
12319
  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) => {
12317
12320
  return (React.createElement(SwiperSlide, { key: url },
12318
12321
  React.createElement(Picture, { src: url, width: width, height: height })));
@@ -12497,7 +12500,7 @@ const Nudge = ({ nudge }) => {
12497
12500
  * @Author: binruan@chatlabs.com
12498
12501
  * @Date: 2024-01-15 19:03:09
12499
12502
  * @LastEditors: binruan@chatlabs.com
12500
- * @LastEditTime: 2024-04-15 17:07:42
12503
+ * @LastEditTime: 2024-04-16 18:26:41
12501
12504
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12502
12505
  *
12503
12506
  */
@@ -12511,10 +12514,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12511
12514
  const curTime = React.useRef();
12512
12515
  const viewTime = React.useRef();
12513
12516
  const [isLoadMore, setIsLoadMore] = React.useState(false);
12517
+ const [isShowMore, setIsShowMore] = React.useState(false);
12514
12518
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
12515
12519
  const { productView } = useEventReport();
12516
12520
  const isShowFingerTip = React.useMemo(() => {
12517
- return data.length > 0 && !loading;
12521
+ return data.length > 0 && !loading && !getFeUserId;
12518
12522
  }, [data, loading]);
12519
12523
  const handleH5EnterLink = React.useCallback(() => {
12520
12524
  if (data.length <= 0) {
@@ -12673,20 +12677,47 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12673
12677
  }
12674
12678
  return null;
12675
12679
  }, [containerWidth, data, height, isMuted, activeIndex, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost, viewTime, tipText, resolver, schema]);
12680
+ const onExpandableChange = React.useCallback((v) => {
12681
+ setIsShowMore(v);
12682
+ }, []);
12683
+ const lineGradStyle = React.useMemo(() => {
12684
+ return !isShowMore
12685
+ ? {
12686
+ padding: '20px 0'
12687
+ }
12688
+ : {
12689
+ background: 'linear-gradient( 180deg, rgba(129,129,129,0) 0%, rgba(121,121,121,0.5) 5%, #616161 100%)',
12690
+ paddingTop: 20,
12691
+ paddingBottom: 20
12692
+ };
12693
+ }, [isShowMore]);
12676
12694
  const renderBottom = React.useCallback((rec, index) => {
12677
12695
  var _a, _b, _c, _d, _e, _f, _g;
12678
12696
  if (rec.video) {
12679
12697
  return (React.createElement(React.Fragment, null,
12680
- ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
12698
+ ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && !isShowMore && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
12681
12699
  React.createElement("div", { className: 'clc-sxp-bottom' },
12682
12700
  React.createElement(Nudge, { nudge: nudge }),
12683
12701
  React.createElement("div", { className: 'clc-sxp-bottom-card' },
12684
12702
  React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
12685
- 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' }) }),
12686
- 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 }))));
12703
+ React.createElement("div", { style: lineGradStyle },
12704
+ 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 }),
12705
+ 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 })))));
12687
12706
  }
12688
12707
  return null;
12689
- }, [descStyle, activeIndex, tempMap, resolver, tipText, nudge, hashTagStyle, globalConfig]);
12708
+ }, [
12709
+ descStyle,
12710
+ activeIndex,
12711
+ tempMap,
12712
+ resolver,
12713
+ tipText,
12714
+ nudge,
12715
+ hashTagStyle,
12716
+ globalConfig,
12717
+ onExpandableChange,
12718
+ isShowMore,
12719
+ lineGradStyle
12720
+ ]);
12690
12721
  const renderLikeButton = React.useCallback((rec, index) => {
12691
12722
  var _a, _b;
12692
12723
  if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))