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.css CHANGED
@@ -1319,7 +1319,6 @@ button.swiper-pagination-bullet {
1319
1319
  bottom: 0;
1320
1320
  left: 0;
1321
1321
  right: 0;
1322
- padding: 20px 0 20px 0;
1323
1322
  }
1324
1323
  .clc-sxp-bottom-nudge {
1325
1324
  display: -webkit-box;
package/dist/index.js CHANGED
@@ -377,6 +377,10 @@ const storeAndLoadFeUserId = () => {
377
377
  }
378
378
  return fakeUserId;
379
379
  };
380
+ const getFeUserId = () => {
381
+ const fakeUserId = window.localStorage.getItem(FAKE_USER_KEY);
382
+ return isEmpty(fakeUserId);
383
+ };
380
384
 
381
385
  /*
382
386
  * @Author: binruan@chatlabs.com
@@ -8217,7 +8221,7 @@ var Modal$1 = memo(Modal);
8217
8221
  * @Author: binruan@chatlabs.com
8218
8222
  * @Date: 2023-12-26 16:11:34
8219
8223
  * @LastEditors: binruan@chatlabs.com
8220
- * @LastEditTime: 2024-04-09 11:00:07
8224
+ * @LastEditTime: 2024-04-16 19:27:48
8221
8225
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
8222
8226
  *
8223
8227
  */
@@ -8239,48 +8243,47 @@ const limitTextLastWholeWord = (originalText = '', limit) => {
8239
8243
  const _words = newWords.length > 1 && newWords.length < words.length ? newWords.slice(0, newWords.length - 1) : newWords;
8240
8244
  return _words.join(' ') + ' ';
8241
8245
  };
8242
- const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost }) => {
8243
- const [isShowMore, setIsShowMore] = useState(true);
8244
- const [isShow, setIsShow] = useState(false);
8246
+ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost, onChange }) => {
8247
+ const [isShowMore, setIsShowMore] = useState(false);
8248
+ useState(false);
8245
8249
  const lineClamp = Number((style === null || style === void 0 ? void 0 : style.lineClamp) || 2);
8246
8250
  const multiRow = useRef(null);
8247
8251
  const handleClick = useCallback(() => {
8248
8252
  setIsShowMore(!isShowMore);
8249
- }, [isShowMore]);
8253
+ onChange === null || onChange === void 0 ? void 0 : onChange(!isShowMore);
8254
+ }, [isShowMore, onChange]);
8250
8255
  useMemo(() => {
8251
8256
  return !isShowMore && text.length > maxStr ? limitTextLastWholeWord(text, maxStr) + '...' : text;
8252
8257
  }, [text, maxStr, isShowMore]);
8253
8258
  useEffect(() => {
8254
- if (multiRow.current && isPost) {
8255
- setIsShowMore(true);
8256
- setTimeout(() => {
8257
- var _a;
8258
- setIsShow(false);
8259
- try {
8260
- const cs = (_a = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(window, multiRow.current);
8261
- const height = parseFloat(cs === null || cs === void 0 ? void 0 : cs.height);
8262
- const lh = parseFloat(cs === null || cs === void 0 ? void 0 : cs.lineHeight);
8263
- const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) + 6;
8264
- const lineHeight = isNaN(lh) ? fs : lh;
8265
- if (text && height > lineHeight * lineClamp) {
8266
- setIsShowMore(false);
8267
- setIsShow(true);
8268
- }
8269
- }
8270
- catch (_b) { }
8271
- }, 100);
8272
- }
8259
+ // if (multiRow.current && isPost) {
8260
+ // setIsShowMore(true);
8261
+ // setTimeout(() => {
8262
+ // setIsShow(false);
8263
+ // try {
8264
+ // const cs = window?.getComputedStyle?.(multiRow.current);
8265
+ // const height = parseFloat(cs?.height);
8266
+ // const lh = parseFloat(cs?.lineHeight);
8267
+ // const fs = parseFloat(cs?.fontSize) + 6;
8268
+ // const lineHeight = isNaN(lh) ? fs : lh;
8269
+ // if (text && height > lineHeight * lineClamp) {
8270
+ // setIsShowMore(false);
8271
+ // setIsShow(true);
8272
+ // }
8273
+ // } catch {}
8274
+ // }, 100);
8275
+ // }
8273
8276
  }, [multiRow, text, lineClamp, style, isPost]);
8274
8277
  return (React.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
8275
8278
  React.createElement("div", { ref: multiRow, style: {
8276
8279
  overflow: 'hidden',
8277
- WebkitLineClamp: !isShowMore ? lineClamp : '',
8280
+ WebkitLineClamp: isShowMore ? '' : lineClamp,
8278
8281
  textOverflow: 'ellipsis',
8279
8282
  display: '-webkit-box',
8280
8283
  WebkitBoxOrient: 'vertical',
8281
8284
  wordBreak: 'break-word'
8282
8285
  }, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
8283
- 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'))));
8286
+ 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'))));
8284
8287
  };
8285
8288
  var ExpandableText$1 = memo(ExpandableText);
8286
8289
 
@@ -11569,7 +11572,7 @@ const WaterfallFlowItem = (props) => {
11569
11572
  };
11570
11573
  }, [src, showVideo]);
11571
11574
  const handleClickToDetail = () => {
11572
- reportTagsView(index);
11575
+ reportTagsView();
11573
11576
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
11574
11577
  setTimeout(() => {
11575
11578
  var _a;
@@ -11677,7 +11680,7 @@ var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeA
11677
11680
  * @Author: binruan@chatlabs.com
11678
11681
  * @Date: 2024-01-10 10:58:24
11679
11682
  * @LastEditors: binruan@chatlabs.com
11680
- * @LastEditTime: 2024-04-15 16:48:54
11683
+ * @LastEditTime: 2024-04-15 17:57:59
11681
11684
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
11682
11685
  *
11683
11686
  */
@@ -11704,7 +11707,7 @@ const WaterFall = (props) => {
11704
11707
  if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
11705
11708
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);
11706
11709
  }
11707
- reportTagsView(cacheActiveIndex || 0);
11710
+ reportTagsView();
11708
11711
  setWaterFallData === null || setWaterFallData === void 0 ? void 0 : setWaterFallData(undefined);
11709
11712
  setIsFromHashtag === null || setIsFromHashtag === void 0 ? void 0 : setIsFromHashtag(false);
11710
11713
  setTimeout(() => {
@@ -11721,7 +11724,7 @@ const WaterFall = (props) => {
11721
11724
  setRecData(waterFallData);
11722
11725
  }
11723
11726
  }, [waterFallData]);
11724
- const reportTagsView = useCallback((index) => {
11727
+ const reportTagsView = useCallback(() => {
11725
11728
  var _a, _b, _c, _d, _e, _f;
11726
11729
  const rec = recData === null || recData === void 0 ? void 0 : recData.rec;
11727
11730
  if (!rec)
@@ -11739,7 +11742,7 @@ const WaterFall = (props) => {
11739
11742
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
11740
11743
  eventInfo: {
11741
11744
  relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
11742
- position: index + '',
11745
+ position: cacheActiveIndex + '',
11743
11746
  contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
11744
11747
  traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
11745
11748
  hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
@@ -11750,7 +11753,7 @@ const WaterFall = (props) => {
11750
11753
  eventDescription: 'User click tags view contents'
11751
11754
  }
11752
11755
  });
11753
- }, [recData, bffEventReport, viewTime, isFromHashtag]);
11756
+ }, [recData, bffEventReport, viewTime, isFromHashtag, cacheActiveIndex]);
11754
11757
  useEffect(() => {
11755
11758
  if (openHashtag) {
11756
11759
  setViewTime(new Date());
@@ -12214,7 +12217,7 @@ const FingerSwipeTip = ({ imageUrl }) => {
12214
12217
  * @Author: binruan@chatlabs.com
12215
12218
  * @Date: 2024-03-20 10:27:31
12216
12219
  * @LastEditors: binruan@chatlabs.com
12217
- * @LastEditTime: 2024-04-08 18:44:58
12220
+ * @LastEditTime: 2024-04-15 18:10:26
12218
12221
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12219
12222
  *
12220
12223
  */
@@ -12267,7 +12270,7 @@ const Picture = (props) => {
12267
12270
  * @Author: lewinlu@chatlabs.com
12268
12271
  * @Date: 2024-01-03 14:39:09
12269
12272
  * @LastEditors: binruan@chatlabs.com
12270
- * @LastEditTime: 2024-03-25 15:08:11
12273
+ * @LastEditTime: 2024-04-15 18:08:25
12271
12274
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12272
12275
  */
12273
12276
  const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
@@ -12287,9 +12290,9 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
12287
12290
  setIsLoad(true);
12288
12291
  }
12289
12292
  }, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
12290
- if (!isActive) {
12291
- return React.createElement("img", { src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: { width, height, objectFit: 'cover' } });
12292
- }
12293
+ // if (!isActive) {
12294
+ // return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
12295
+ // }
12293
12296
  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) => {
12294
12297
  return (React.createElement(SwiperSlide, { key: url },
12295
12298
  React.createElement(Picture, { src: url, width: width, height: height })));
@@ -12474,7 +12477,7 @@ const Nudge = ({ nudge }) => {
12474
12477
  * @Author: binruan@chatlabs.com
12475
12478
  * @Date: 2024-01-15 19:03:09
12476
12479
  * @LastEditors: binruan@chatlabs.com
12477
- * @LastEditTime: 2024-04-15 17:07:42
12480
+ * @LastEditTime: 2024-04-16 18:26:41
12478
12481
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12479
12482
  *
12480
12483
  */
@@ -12488,10 +12491,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12488
12491
  const curTime = useRef();
12489
12492
  const viewTime = useRef();
12490
12493
  const [isLoadMore, setIsLoadMore] = useState(false);
12494
+ const [isShowMore, setIsShowMore] = useState(false);
12491
12495
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
12492
12496
  const { productView } = useEventReport();
12493
12497
  const isShowFingerTip = useMemo(() => {
12494
- return data.length > 0 && !loading;
12498
+ return data.length > 0 && !loading && !getFeUserId;
12495
12499
  }, [data, loading]);
12496
12500
  const handleH5EnterLink = useCallback(() => {
12497
12501
  if (data.length <= 0) {
@@ -12650,20 +12654,47 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12650
12654
  }
12651
12655
  return null;
12652
12656
  }, [containerWidth, data, height, isMuted, activeIndex, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost, viewTime, tipText, resolver, schema]);
12657
+ const onExpandableChange = useCallback((v) => {
12658
+ setIsShowMore(v);
12659
+ }, []);
12660
+ const lineGradStyle = useMemo(() => {
12661
+ return !isShowMore
12662
+ ? {
12663
+ padding: '20px 0'
12664
+ }
12665
+ : {
12666
+ background: 'linear-gradient( 180deg, rgba(129,129,129,0) 0%, rgba(121,121,121,0.5) 5%, #616161 100%)',
12667
+ paddingTop: 20,
12668
+ paddingBottom: 20
12669
+ };
12670
+ }, [isShowMore]);
12653
12671
  const renderBottom = useCallback((rec, index) => {
12654
12672
  var _a, _b, _c, _d, _e, _f, _g;
12655
12673
  if (rec.video) {
12656
12674
  return (React.createElement(React.Fragment, null,
12657
- ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
12675
+ ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && !isShowMore && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
12658
12676
  React.createElement("div", { className: 'clc-sxp-bottom' },
12659
12677
  React.createElement(Nudge, { nudge: nudge }),
12660
12678
  React.createElement("div", { className: 'clc-sxp-bottom-card' },
12661
12679
  React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
12662
- 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' }) }),
12663
- 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 }))));
12680
+ React.createElement("div", { style: lineGradStyle },
12681
+ 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 }),
12682
+ 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 })))));
12664
12683
  }
12665
12684
  return null;
12666
- }, [descStyle, activeIndex, tempMap, resolver, tipText, nudge, hashTagStyle, globalConfig]);
12685
+ }, [
12686
+ descStyle,
12687
+ activeIndex,
12688
+ tempMap,
12689
+ resolver,
12690
+ tipText,
12691
+ nudge,
12692
+ hashTagStyle,
12693
+ globalConfig,
12694
+ onExpandableChange,
12695
+ isShowMore,
12696
+ lineGradStyle
12697
+ ]);
12667
12698
  const renderLikeButton = useCallback((rec, index) => {
12668
12699
  var _a, _b;
12669
12700
  if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))