pb-sxp-ui 1.0.78 → 1.0.80

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.
Files changed (34) hide show
  1. package/dist/index.cjs +430 -60
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +187 -1
  4. package/dist/index.js +430 -60
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +3 -3
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +3 -3
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +430 -60
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +3 -3
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/SxpPageRender/PictureGroup/Picture.d.ts +1 -0
  15. package/es/core/components/SxpPageRender/PictureGroup/Picture.js +2 -2
  16. package/es/core/components/SxpPageRender/PictureGroup/index.js +9 -5
  17. package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +52 -37
  18. package/es/core/components/SxpPageRender/WaterFall/index.js +3 -2
  19. package/es/core/components/SxpPageRender/index.js +1 -21
  20. package/es/core/context/SxpDataSourceProvider.js +30 -0
  21. package/es/materials/sxp/HashTag/index.d.ts +2 -0
  22. package/es/materials/sxp/HashTag/settingRender.d.ts +15 -1
  23. package/es/materials/sxp/HashTag/settingRender.js +16 -0
  24. package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +1 -0
  25. package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +2 -2
  26. package/lib/core/components/SxpPageRender/PictureGroup/index.js +8 -4
  27. package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +52 -37
  28. package/lib/core/components/SxpPageRender/WaterFall/index.js +3 -2
  29. package/lib/core/components/SxpPageRender/index.js +1 -21
  30. package/lib/core/context/SxpDataSourceProvider.js +30 -0
  31. package/lib/materials/sxp/HashTag/index.d.ts +2 -0
  32. package/lib/materials/sxp/HashTag/settingRender.d.ts +15 -1
  33. package/lib/materials/sxp/HashTag/settingRender.js +16 -0
  34. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -617,6 +617,30 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
617
617
  eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '', contentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : '', fromKName })
618
618
  });
619
619
  }, [bffEventReport, isFromHashtag]);
620
+ useEffect(() => {
621
+ var _a, _b;
622
+ const queryString = location.search.slice(1);
623
+ const params = qs.parse(queryString.replace(/\+/g, '%2B'));
624
+ for (const key in params) {
625
+ params[key] = params[key].replace(/%2B/g, '+');
626
+ }
627
+ const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
628
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
629
+ eventInfo: {
630
+ eventSubject: 'h5LinkEnterFeed',
631
+ eventDescription: 'User enter h5 link',
632
+ utmSource: getVal('utm_source'),
633
+ utmMedium: getVal('utm_medium'),
634
+ utmCampaign: getVal('utm_campaign'),
635
+ utmId: getVal('utm_id'),
636
+ utmContent: getVal('utm_content'),
637
+ enterTime: `${Date.now()}`,
638
+ requestId: null,
639
+ enterUrl: (_b = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : '',
640
+ clSource: getVal('cl_sourc')
641
+ }
642
+ });
643
+ }, []);
620
644
  useEffect(() => {
621
645
  setLoading(true);
622
646
  bffGetTagList();
@@ -627,6 +651,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
627
651
  setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
628
652
  })
629
653
  .finally(() => {
654
+ bffEventReport({
655
+ eventInfo: {
656
+ eventSubject: 'apiRequest',
657
+ eventDescription: 'api request succeed'
658
+ }
659
+ });
630
660
  setLoading(false);
631
661
  isInit.current = true;
632
662
  });
@@ -10333,24 +10363,35 @@ var _a, _b;
10333
10363
  * @Author: binruan@chatlabs.com
10334
10364
  * @Date: 2024-04-07 14:07:12
10335
10365
  * @LastEditors: binruan@chatlabs.com
10336
- * @LastEditTime: 2024-05-23 11:03:15
10366
+ * @LastEditTime: 2024-06-07 15:51:49
10337
10367
  * @FilePath: \pb-sxp-ui\src\materials\sxp\HashTag\settingRender.tsx
10338
10368
  *
10339
10369
  */
10340
10370
  var settingRender = [
10371
+ {
10372
+ title: 'Banner',
10373
+ child: [
10374
+ {
10375
+ type: 'Switch',
10376
+ label: 'Banner图开关',
10377
+ name: ['props', 'showBanner']
10378
+ }
10379
+ ]
10380
+ },
10341
10381
  {
10342
10382
  title: '卡片样式',
10343
10383
  child: [
10344
- // {
10345
- // type: 'Number',
10346
- // label: '文本行数',
10347
- // name: ['props', 'lineClamp']
10348
- // },
10349
10384
  {
10350
10385
  type: 'Number',
10351
10386
  label: '上下边距',
10352
10387
  name: ['props', 'space'],
10353
10388
  addonAfter: 'px'
10389
+ },
10390
+ {
10391
+ type: 'Switch',
10392
+ label: '固定宽高',
10393
+ name: ['props', 'isWaterfallFlow'],
10394
+ initialValue: true
10354
10395
  }
10355
10396
  ]
10356
10397
  },
@@ -11819,6 +11860,374 @@ var previewData = {
11819
11860
  hashTag: hashTag
11820
11861
  };
11821
11862
 
11863
+ const WaterfallFlowItem$1 = (props) => {
11864
+ const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
11865
+ const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
11866
+ const [showVideo, setShowVideo] = useState(false);
11867
+ const [isLoading, setIsLoading] = useState(false);
11868
+ const [imgInfo, setImgInfo] = useState({
11869
+ height: 1,
11870
+ width: 1
11871
+ });
11872
+ const imgDom = useRef(null);
11873
+ const ref = useRef(null);
11874
+ const videoDom = useRef(null);
11875
+ const canvasRef = useRef(null);
11876
+ const [firstFrameSrc, setFirstFrameSrc] = useState('');
11877
+ const src = useMemo(() => {
11878
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11879
+ if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) {
11880
+ return (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
11881
+ }
11882
+ else if ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.imgUrls) === null || _d === void 0 ? void 0 : _d.length) {
11883
+ return (_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.imgUrls) === null || _f === void 0 ? void 0 : _f[0];
11884
+ }
11885
+ else if ((_h = (_g = rec === null || rec === void 0 ? void 0 : rec.product) === null || _g === void 0 ? void 0 : _g.homePage) === null || _h === void 0 ? void 0 : _h.length) {
11886
+ return (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.homePage) === null || _k === void 0 ? void 0 : _k[0];
11887
+ }
11888
+ else {
11889
+ return (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) || '';
11890
+ }
11891
+ }, [rec, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image]);
11892
+ const title = useMemo(() => {
11893
+ var _a, _b;
11894
+ return ((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.title) || ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.title) || null;
11895
+ }, [rec]);
11896
+ /** 离父亲上边框的距离 */
11897
+ const top = useMemo(() => {
11898
+ var _a;
11899
+ const y = style.transform
11900
+ ? Number((_a = style.transform) === null || _a === void 0 ? void 0 : _a.substring(style.transform.indexOf(',', 0) + 1, style.transform.length - 3))
11901
+ : undefined;
11902
+ return y;
11903
+ }, [style]);
11904
+ /** 是否加载图片 */
11905
+ const isImgShow = useMemo(() => {
11906
+ if (top === undefined) {
11907
+ return false;
11908
+ }
11909
+ if (top <= showBorder) {
11910
+ return true;
11911
+ }
11912
+ else {
11913
+ return false;
11914
+ }
11915
+ }, [top, showBorder]);
11916
+ const priceText = useMemo(() => {
11917
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11918
+ if (((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.currency) && ((_b = rec === null || rec === void 0 ? void 0 : rec.product) === null || _b === void 0 ? void 0 : _b.price)) {
11919
+ return `${(_f = (_e = (_d = (_c = rec === null || rec === void 0 ? void 0 : rec.product) === null || _c === void 0 ? void 0 : _c.currency) === null || _d === void 0 ? void 0 : _d.split('-')[1]) === null || _e === void 0 ? void 0 : _e.toUpperCase()) !== null && _f !== void 0 ? _f : ''}${(_j = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.product) === null || _g === void 0 ? void 0 : _g.price) === null || _h === void 0 ? void 0 : _h.toLocaleString('zh', {
11920
+ minimumFractionDigits: 0
11921
+ })) !== null && _j !== void 0 ? _j : ''}`;
11922
+ }
11923
+ else {
11924
+ return null;
11925
+ }
11926
+ }, [rec]);
11927
+ useEffect(() => {
11928
+ if (imgDom.current === null || src === '') {
11929
+ return;
11930
+ }
11931
+ const img = new Image();
11932
+ if (showVideo && firstFrameSrc) {
11933
+ img.src = firstFrameSrc;
11934
+ }
11935
+ else {
11936
+ img.src = src;
11937
+ }
11938
+ img.onload = () => {
11939
+ setImgInfo({
11940
+ height: img.height,
11941
+ width: img.width
11942
+ });
11943
+ setIsLoading(true);
11944
+ };
11945
+ imgDom.current.setSrc(img.src);
11946
+ }, [src, showVideo, firstFrameSrc, isImgShow]);
11947
+ useEffect(() => {
11948
+ // 通过宽度比例获取图片高度
11949
+ const height = imgInfo.height * (unitWidth / imgInfo.width);
11950
+ if (isLoading) {
11951
+ // 加40是因为下方文字部分高度为40,可以自己设置
11952
+ sizeChange(height + 76 + space, index);
11953
+ }
11954
+ }, [imgInfo, index, unitWidth, isLoading, space]); /* 增加sizeChange依赖项会导致在admin预览编辑时无限刷新 */
11955
+ const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
11956
+ const aspectRatio = videoWidth / videoHeight;
11957
+ const targetHeight = targetWidth / aspectRatio;
11958
+ return targetHeight;
11959
+ };
11960
+ useEffect(() => {
11961
+ const video = videoDom === null || videoDom === void 0 ? void 0 : videoDom.current;
11962
+ if (video === null || src === '' || !showVideo) {
11963
+ return;
11964
+ }
11965
+ video.src = src;
11966
+ video.currentTime = 1;
11967
+ video.crossOrigin = 'anonymous';
11968
+ video.onloadeddata = () => {
11969
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
11970
+ if (!canvas)
11971
+ return;
11972
+ const ctx = canvas.getContext('2d');
11973
+ const targetWidth = (window === null || window === void 0 ? void 0 : window.innerWidth) / 2;
11974
+ const targetHeight = calculateHeightForWidth(video.videoWidth, video.videoHeight, targetWidth);
11975
+ canvas.height = targetHeight;
11976
+ canvas.width = targetWidth;
11977
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
11978
+ setFirstFrameSrc(canvas.toDataURL());
11979
+ video.remove();
11980
+ canvas.remove();
11981
+ };
11982
+ }, [src, showVideo]);
11983
+ const handleClickToDetail = () => {
11984
+ reportTagsView();
11985
+ setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
11986
+ setTimeout(() => {
11987
+ var _a;
11988
+ (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index, 0, false);
11989
+ setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
11990
+ }, 0);
11991
+ };
11992
+ return (React.createElement("div", { ref: ref, style: Object.assign({}, style), className: 'waterFallList-content-listItem', key: index, onClick: handleClickToDetail },
11993
+ React.createElement("div", { className: 'waterFallList-content-listItem-picture' },
11994
+ showVideo && (React.createElement("div", { style: { display: 'none' } },
11995
+ React.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
11996
+ React.createElement("canvas", { ref: canvasRef }))),
11997
+ React.createElement(FormatImage$1, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
11998
+ React.createElement("div", { className: 'waterFallList-content-listItem-info' },
11999
+ React.createElement("div", { className: `${'waterFallList-content-listItem-info-title'} ${priceText ? 'waterFallList-content-listItem-info-nowrap' : ''}`, style: Object.assign({}, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title) }, title && title),
12000
+ React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
12001
+ };
12002
+ function WaterfallList$1(_a) {
12003
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
12004
+ var { reportTagsView } = _a, props = __rest(_a, ["reportTagsView"]);
12005
+ const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
12006
+ /** 滚动的父元素 */
12007
+ const scrollParent = useRef(null);
12008
+ /** 向上滚动的距离 */
12009
+ const [scrollTop, setScrollTop] = useState(0);
12010
+ /** 数据列表 */
12011
+ const [data, setData] = useState();
12012
+ const waterfallFlowDom = useRef(null);
12013
+ /** 样式列表 */
12014
+ const [styleList, setStyleList] = useState([]);
12015
+ const styleListRef = useRef();
12016
+ /** 自定义骨架屏高度 */
12017
+ const heightList = [170, 230, 300];
12018
+ /** 到达底部 */
12019
+ const [isLoadingData, setIsLoadingData] = useState(false);
12020
+ const [list, setList] = useState([]);
12021
+ const buttonRef = useRef();
12022
+ /** 生成随机数 */
12023
+ const createRandomNum = useCallback((min, max) => {
12024
+ return Math.floor(Math.random() * (max - min + 1)) + min;
12025
+ }, []);
12026
+ const waterfallFlowListInfo = useRef([]);
12027
+ /** 当前容器信息 */
12028
+ const [frameInfo, setFrameInfoInfo] = useState({ width: 0 });
12029
+ /** 每行个数 */
12030
+ const rowsNum = useMemo(() => {
12031
+ const width = frameInfo.width || 0;
12032
+ if (width >= 1200) {
12033
+ return 6;
12034
+ }
12035
+ else if (width >= 768 && width <= 1199) {
12036
+ return 4;
12037
+ }
12038
+ else {
12039
+ return 2;
12040
+ }
12041
+ }, [frameInfo]);
12042
+ /** 每一个的宽度 */
12043
+ const unitWidth = useMemo(() => {
12044
+ return frameInfo.width / rowsNum - 2;
12045
+ }, [rowsNum, frameInfo]);
12046
+ /** 获取位置 */
12047
+ const getStyleList = useCallback(() => {
12048
+ var _a;
12049
+ const temporaryStyleList = (_a = styleListRef.current) !== null && _a !== void 0 ? _a : [];
12050
+ /** 目前最下一行的index */
12051
+ const bottomItemIndex = [];
12052
+ for (let i = 0; i < (list === null || list === void 0 ? void 0 : list.length); i++) {
12053
+ // 原本应对应的行数
12054
+ const currentRow = Math.floor(i / rowsNum);
12055
+ //
12056
+ const remainder = (i % rowsNum) + 1;
12057
+ // 最低item下标
12058
+ let minHeightInd = 0;
12059
+ // 最低高度
12060
+ let minHeight = 9999999999;
12061
+ // 寻找最低高度的下标
12062
+ if (currentRow === 0) {
12063
+ bottomItemIndex[i] = i;
12064
+ }
12065
+ else {
12066
+ for (let j = 0; j < bottomItemIndex.length; j++) {
12067
+ if (waterfallFlowListInfo.current[bottomItemIndex[j]].top +
12068
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height <
12069
+ minHeight) {
12070
+ minHeightInd = j;
12071
+ minHeight =
12072
+ waterfallFlowListInfo.current[bottomItemIndex[j]].top +
12073
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height;
12074
+ }
12075
+ }
12076
+ bottomItemIndex[minHeightInd] = i;
12077
+ }
12078
+ if (waterfallFlowListInfo.current[i] === undefined) {
12079
+ waterfallFlowListInfo.current[i] = {};
12080
+ }
12081
+ // 第一行特殊处理,一定是从左到右铺的
12082
+ if (currentRow === 0) {
12083
+ if (remainder === 1) {
12084
+ waterfallFlowListInfo.current[i].left = 0;
12085
+ }
12086
+ else {
12087
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[i - 1].left + unitWidth + 4;
12088
+ }
12089
+ waterfallFlowListInfo.current[i].top = 0;
12090
+ }
12091
+ // 剩下的行数,铺在当前最低高度下面
12092
+ else {
12093
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[minHeightInd].left;
12094
+ waterfallFlowListInfo.current[i].top = minHeight;
12095
+ }
12096
+ // 是否已经有高度,有高度使用已有高度,否则随机生成
12097
+ waterfallFlowListInfo.current[i].height =
12098
+ waterfallFlowListInfo.current[i].height || heightList[createRandomNum(0, 2)];
12099
+ temporaryStyleList[i] = {
12100
+ transform: `translate(${waterfallFlowListInfo.current[i].left}px,${waterfallFlowListInfo.current[i].top}px)`,
12101
+ width: `${unitWidth}px`,
12102
+ height: waterfallFlowListInfo.current[i].height
12103
+ };
12104
+ }
12105
+ setStyleList([...temporaryStyleList]);
12106
+ return [...temporaryStyleList];
12107
+ }, [unitWidth, rowsNum, heightList, createRandomNum, list]);
12108
+ /** 图片加载完更新高度 */
12109
+ const onSizeChange = useCallback((height, index) => {
12110
+ if (waterfallFlowListInfo.current[index] === undefined) {
12111
+ waterfallFlowListInfo.current[index] = {};
12112
+ }
12113
+ waterfallFlowListInfo.current[index].height = height;
12114
+ styleListRef.current = getStyleList();
12115
+ }, [getStyleList]);
12116
+ /** 大小、数量发生变化时触发 */
12117
+ useEffect(() => {
12118
+ styleListRef.current = getStyleList();
12119
+ }, [unitWidth, rowsNum, list]); /* 增加getStyleList依赖项会导致在admin预览编辑时无限刷新 */
12120
+ /** 初始化请求数据 */
12121
+ useEffect(() => {
12122
+ var _a, _b;
12123
+ setIsLoadingData(true);
12124
+ waterFallData &&
12125
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12126
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12127
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12128
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
12129
+ defaultSize: hashTagSize,
12130
+ maxSize: hashTagSize
12131
+ }).then((res) => {
12132
+ var _a, _b;
12133
+ setData(res);
12134
+ setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
12135
+ setIsLoadingData(false);
12136
+ }));
12137
+ if (isOpenHashTag) {
12138
+ const res = previewData;
12139
+ setData(res);
12140
+ setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
12141
+ setIsLoadingData(false);
12142
+ }
12143
+ }, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
12144
+ const onResize = useCallback(() => {
12145
+ if (waterfallFlowDom.current === null) {
12146
+ return;
12147
+ }
12148
+ setFrameInfoInfo({
12149
+ width: waterfallFlowDom.current.getBoundingClientRect().width
12150
+ });
12151
+ }, []);
12152
+ /** 监听列表容器大小变化 */
12153
+ useEffect(() => {
12154
+ if (waterfallFlowDom.current === null) {
12155
+ return;
12156
+ }
12157
+ const resizeObserver = new ResizeObserver((entries) => {
12158
+ onResize();
12159
+ });
12160
+ resizeObserver.observe(waterfallFlowDom.current);
12161
+ return () => {
12162
+ resizeObserver.disconnect();
12163
+ };
12164
+ }, [onResize]);
12165
+ useCallback(() => {
12166
+ setIsLoadingData(true);
12167
+ waterFallData &&
12168
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12169
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12170
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12171
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
12172
+ }).then((res) => {
12173
+ var _a, _b;
12174
+ setList(list === null || list === void 0 ? void 0 : list.concat((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => !(item === null || item === void 0 ? void 0 : item.video))) !== null && _b !== void 0 ? _b : []));
12175
+ setIsLoadingData(false);
12176
+ }));
12177
+ }, [waterFallData, getRecommendVideos, list]);
12178
+ const onScroll = useCallback(() => {
12179
+ // 记录滚动值
12180
+ setScrollTop(scrollParent.current.scrollTop);
12181
+ // const top = (scrollParent.current as any).scrollTop;
12182
+ // const clientHeight = (scrollParent.current as any).clientHeight;
12183
+ // const scrollHeight = (scrollParent.current as any).scrollHeight;
12184
+ // // 做底部加载
12185
+ // if (scrollHeight <= top + clientHeight && !isLoadingData) {
12186
+ // loadMoreData();
12187
+ // }
12188
+ }, []);
12189
+ /** 监听滚动 */
12190
+ useEffect(() => {
12191
+ var _a;
12192
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', onScroll);
12193
+ return () => {
12194
+ var _a;
12195
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', onScroll);
12196
+ };
12197
+ }, [onScroll, scrollParent]);
12198
+ const handleClickLink = () => {
12199
+ var _a, _b;
12200
+ if ((_a = data === null || data === void 0 ? void 0 : data.tag) === null || _a === void 0 ? void 0 : _a.link) {
12201
+ reportTagsView();
12202
+ window.location.href = (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.link;
12203
+ }
12204
+ };
12205
+ return (React.createElement(React.Fragment, null, isLoadingData ? (React.createElement("div", { style: { height: '100%', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' } },
12206
+ React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { className: 'waterFallList', ref: waterfallFlowDom },
12207
+ React.createElement("div", { className: 'waterFallList-scroll', ref: scrollParent },
12208
+ React.createElement("div", { className: 'waterFallList-info', style: (_b = props === null || props === void 0 ? void 0 : props.textStyles) === null || _b === void 0 ? void 0 : _b.hashTagDesc }, (_c = data === null || data === void 0 ? void 0 : data.tag) === null || _c === void 0 ? void 0 : _c.info),
12209
+ React.createElement("div", { hidden: !((_d = data === null || data === void 0 ? void 0 : data.tag) === null || _d === void 0 ? void 0 : _d.link), className: 'waterFallList-collection', style: Object.assign({}, (_e = props === null || props === void 0 ? void 0 : props.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagLink), onClick: handleClickLink }, ((_f = data === null || data === void 0 ? void 0 : data.tag) === null || _f === void 0 ? void 0 : _f.linkTitle) || 'Shop the collection'),
12210
+ React.createElement("div", { className: 'waterFallList-content' }, list === null || list === void 0 ? void 0 :
12211
+ list.map((item, ind) => {
12212
+ var _a;
12213
+ return (React.createElement(WaterfallFlowItem$1, Object.assign({ key: ind, index: ind, rec: item, list: list, showBorder: scrollTop + ((_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.clientHeight), style: styleList[ind], sizeChange: onSizeChange, unitWidth: unitWidth, reportTagsView: reportTagsView }, props)));
12214
+ }),
12215
+ React.createElement("div", { hidden: !((_g = data === null || data === void 0 ? void 0 : data.tag) === null || _g === void 0 ? void 0 : _g.link), style: {
12216
+ position: 'absolute',
12217
+ width: '100%',
12218
+ transform: `translate(0px,${(_m = ((_j = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current[((_h = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current) === null || _h === void 0 ? void 0 : _h.length) - 1]) === null || _j === void 0 ? void 0 : _j.top) +
12219
+ ((_l = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current[((_k = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current) === null || _k === void 0 ? void 0 : _k.length) - 1]) === null || _l === void 0 ? void 0 : _l.height)) !== null && _m !== void 0 ? _m : 0}px)`,
12220
+ height: ((_o = data === null || data === void 0 ? void 0 : data.tag) === null || _o === void 0 ? void 0 : _o.link)
12221
+ ? ((_p = buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) === null || _p === void 0 ? void 0 : _p.offsetHeight) || ((_q = props === null || props === void 0 ? void 0 : props.buttonBgStyle) === null || _q === void 0 ? void 0 : _q.height) || '100px'
12222
+ : 0
12223
+ } }))),
12224
+ React.createElement("div", { className: 'waterFallList-bottom', hidden: !((_r = data === null || data === void 0 ? void 0 : data.tag) === null || _r === void 0 ? void 0 : _r.link), style: props === null || props === void 0 ? void 0 : props.buttonBgStyle }),
12225
+ React.createElement("div", { ref: buttonRef, hidden: !((_s = data === null || data === void 0 ? void 0 : data.tag) === null || _s === void 0 ? void 0 : _s.link), className: 'waterFallList-btn-wrap', style: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.buttonBgStyle), { height: 'auto', backgroundColor: 'transparent' }) },
12226
+ React.createElement("button", { className: 'waterFallList-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink }, ((_t = data === null || data === void 0 ? void 0 : data.tag) === null || _t === void 0 ? void 0 : _t.linkTitle) || 'Shop the collection'))))));
12227
+ }
12228
+
12229
+ var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12230
+
11822
12231
  const WaterfallFlowItem = (props) => {
11823
12232
  const { rec, index, list, reportTagsView, textStyles, space } = props;
11824
12233
  const { swiperRef, setRtcList, setOpenHashtag, bffEventReport, sxpParameter } = useSxpDataSource();
@@ -12029,13 +12438,11 @@ function WaterfallList(_a) {
12029
12438
  React.createElement("button", { className: 'list-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink }, ((_o = data === null || data === void 0 ? void 0 : data.tag) === null || _o === void 0 ? void 0 : _o.linkTitle) || 'Shop the collection'))))));
12030
12439
  }
12031
12440
 
12032
- var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12033
-
12034
12441
  /*
12035
12442
  * @Author: binruan@chatlabs.com
12036
12443
  * @Date: 2024-01-10 10:58:24
12037
12444
  * @LastEditors: binruan@chatlabs.com
12038
- * @LastEditTime: 2024-04-15 17:57:59
12445
+ * @LastEditTime: 2024-06-07 15:57:29
12039
12446
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
12040
12447
  *
12041
12448
  */
@@ -12129,7 +12536,7 @@ const WaterFall = (props) => {
12129
12536
  display: openHashtag ? 'block' : 'none'
12130
12537
  } },
12131
12538
  React.createElement(Navbar$1, { icon: img$1, styles: { top: '32px' }, textStyle: (_a = props === null || props === void 0 ? void 0 : props.textStyles) === null || _a === void 0 ? void 0 : _a.hashTagTitle, onClose: handleClose }),
12132
- React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props))), modalEleRef.current);
12539
+ (props === null || props === void 0 ? void 0 : props.isWaterfallFlow) === true || (props === null || props === void 0 ? void 0 : props.isWaterfallFlow) === undefined ? (React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props))) : (React.createElement(WaterfallList$1, Object.assign({ reportTagsView: reportTagsView }, props)))), modalEleRef.current);
12133
12540
  };
12134
12541
  var WaterFall$1 = memo(WaterFall);
12135
12542
 
@@ -12653,7 +13060,7 @@ const FingerSwipeTip = ({ imageUrl, style }) => {
12653
13060
  *
12654
13061
  */
12655
13062
  const Picture = (props) => {
12656
- const { src, height, imgUrlsPostConfig } = props;
13063
+ const { src, height, imgUrlsPostConfig, onShowFirstImage } = props;
12657
13064
  const blur = useMemo(() => {
12658
13065
  return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2';
12659
13066
  }, [imgUrlsPostConfig]);
@@ -12678,7 +13085,7 @@ const Picture = (props) => {
12678
13085
  return isBgColor && (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor) ? { backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor } : {};
12679
13086
  }, [imgUrlsPostConfig, isBgColor]);
12680
13087
  return (React.createElement("div", { style: Object.assign({ overflow: 'hidden', height, width: '100%', position: 'relative' }, bgStyle) },
12681
- (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
13088
+ (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle), onLoad: onShowFirstImage })),
12682
13089
  blur && (React.createElement(FormatImage$1, { src: src, style: {
12683
13090
  width: '100%',
12684
13091
  height: '100%',
@@ -12695,7 +13102,7 @@ const Picture = (props) => {
12695
13102
  * @Author: lewinlu@chatlabs.com
12696
13103
  * @Date: 2024-01-03 14:39:09
12697
13104
  * @LastEditors: binruan@chatlabs.com
12698
- * @LastEditTime: 2024-04-18 19:56:22
13105
+ * @LastEditTime: 2024-06-07 14:05:08
12699
13106
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12700
13107
  */
12701
13108
  const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
@@ -12715,16 +13122,20 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageE
12715
13122
  }
12716
13123
  }
12717
13124
  else {
12718
- setIsLoad(true);
12719
13125
  (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
12720
13126
  }
12721
13127
  }, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
13128
+ const showFirstImageFn = useCallback(() => {
13129
+ if (!isLoad) {
13130
+ setIsLoad(true);
13131
+ }
13132
+ }, [isLoad]);
12722
13133
  // if (!isActive) {
12723
13134
  // return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
12724
13135
  // }
12725
- return (React.createElement(Swiper, { ref: ref, defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.delay) !== null && _a !== void 0 ? _a : 3) * 1000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
12726
- return (React.createElement(SwiperSlide, { key: url },
12727
- React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
13136
+ return (React.createElement(Swiper, { ref: ref, defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.delay) !== null && _a !== void 0 ? _a : 3) * 1000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url, index) => {
13137
+ return (React.createElement(SwiperSlide, { key: index },
13138
+ React.createElement(Picture, { src: !isLoad && index > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
12728
13139
  })));
12729
13140
  };
12730
13141
  var PictureGroup$3 = memo(PictureGroup$2);
@@ -12944,7 +13355,7 @@ var Tagbar$1 = memo(Tagbar);
12944
13355
  * @Author: binruan@chatlabs.com
12945
13356
  * @Date: 2024-01-15 19:03:09
12946
13357
  * @LastEditors: binruan@chatlabs.com
12947
- * @LastEditTime: 2024-06-06 18:42:24
13358
+ * @LastEditTime: 2024-06-07 11:10:42
12948
13359
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12949
13360
  *
12950
13361
  */
@@ -12971,32 +13382,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12971
13382
  return;
12972
13383
  }
12973
13384
  initTime();
12974
- // 刷新 sessionId
12975
- // refreshFeSessionId();
12976
- const queryString = location.search.slice(1);
12977
- const params = qs.parse(queryString.replace(/\+/g, '%2B'));
12978
- for (const key in params) {
12979
- params[key] = params[key].replace(/%2B/g, '+');
12980
- }
12981
- const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
12982
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12983
- eventInfo: {
12984
- eventSubject: 'h5LinkEnterFeed',
12985
- eventDescription: 'User enter h5 link',
12986
- utmSource: getVal('utm_source'),
12987
- utmMedium: getVal('utm_medium'),
12988
- utmCampaign: getVal('utm_campaign'),
12989
- utmId: getVal('utm_id'),
12990
- utmContent: getVal('utm_content'),
12991
- enterTime: `${Date.now()}`,
12992
- requestId: null
12993
- }
12994
- });
12995
13385
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
12996
13386
  eventName: 'PageView'
12997
13387
  });
12998
13388
  setIsInit(true);
12999
- }, [bffEventReport, data.length, bffFbReport]);
13389
+ }, [data.length, bffFbReport]);
13000
13390
  const initTime = () => {
13001
13391
  curTime.current = new Date();
13002
13392
  viewTime.current = new Date();
@@ -13049,26 +13439,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13049
13439
  })) || 0;
13050
13440
  (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
13051
13441
  }, [ctaType, swiperRef]);
13052
- // useEffect(() => {
13053
- // const handleBeforeUnload = (event: any) => {
13054
- // event.preventDefault();
13055
- // const item = data?.[activeIndex];
13056
- // bffEventReport?.({
13057
- // eventInfo: {
13058
- // sessionDuration: Math.floor(((new Date() as any) - curTime) / 1000) + '',
13059
- // eventSubject: 'sessionCompleted',
13060
- // eventDescription: 'Session completed',
13061
- // contentId: item?.video?.itemId,
13062
- // productId: item?.product?.itemId,
13063
- // position: item?.position
13064
- // }
13065
- // });
13066
- // };
13067
- // window.addEventListener('beforeunload', handleBeforeUnload);
13068
- // return () => {
13069
- // window.removeEventListener('beforeunload', handleBeforeUnload);
13070
- // };
13071
- // }, [activeIndex, data, bffEventReport, curTime]);
13072
13442
  useEffect(() => {
13073
13443
  const item = data === null || data === void 0 ? void 0 : data[activeIndex];
13074
13444
  const visibleChange = () => {