pb-sxp-ui 1.0.13 → 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
 
@@ -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))