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.cjs CHANGED
@@ -640,6 +640,30 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
640
640
  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 })
641
641
  });
642
642
  }, [bffEventReport, isFromHashtag]);
643
+ React.useEffect(() => {
644
+ var _a, _b;
645
+ const queryString = location.search.slice(1);
646
+ const params = qs.parse(queryString.replace(/\+/g, '%2B'));
647
+ for (const key in params) {
648
+ params[key] = params[key].replace(/%2B/g, '+');
649
+ }
650
+ const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
651
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
652
+ eventInfo: {
653
+ eventSubject: 'h5LinkEnterFeed',
654
+ eventDescription: 'User enter h5 link',
655
+ utmSource: getVal('utm_source'),
656
+ utmMedium: getVal('utm_medium'),
657
+ utmCampaign: getVal('utm_campaign'),
658
+ utmId: getVal('utm_id'),
659
+ utmContent: getVal('utm_content'),
660
+ enterTime: `${Date.now()}`,
661
+ requestId: null,
662
+ 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 : '',
663
+ clSource: getVal('cl_sourc')
664
+ }
665
+ });
666
+ }, []);
643
667
  React.useEffect(() => {
644
668
  setLoading(true);
645
669
  bffGetTagList();
@@ -650,6 +674,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
650
674
  setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
651
675
  })
652
676
  .finally(() => {
677
+ bffEventReport({
678
+ eventInfo: {
679
+ eventSubject: 'apiRequest',
680
+ eventDescription: 'api request succeed'
681
+ }
682
+ });
653
683
  setLoading(false);
654
684
  isInit.current = true;
655
685
  });
@@ -10356,24 +10386,35 @@ var _a, _b;
10356
10386
  * @Author: binruan@chatlabs.com
10357
10387
  * @Date: 2024-04-07 14:07:12
10358
10388
  * @LastEditors: binruan@chatlabs.com
10359
- * @LastEditTime: 2024-05-23 11:03:15
10389
+ * @LastEditTime: 2024-06-07 15:51:49
10360
10390
  * @FilePath: \pb-sxp-ui\src\materials\sxp\HashTag\settingRender.tsx
10361
10391
  *
10362
10392
  */
10363
10393
  var settingRender = [
10394
+ {
10395
+ title: 'Banner',
10396
+ child: [
10397
+ {
10398
+ type: 'Switch',
10399
+ label: 'Banner图开关',
10400
+ name: ['props', 'showBanner']
10401
+ }
10402
+ ]
10403
+ },
10364
10404
  {
10365
10405
  title: '卡片样式',
10366
10406
  child: [
10367
- // {
10368
- // type: 'Number',
10369
- // label: '文本行数',
10370
- // name: ['props', 'lineClamp']
10371
- // },
10372
10407
  {
10373
10408
  type: 'Number',
10374
10409
  label: '上下边距',
10375
10410
  name: ['props', 'space'],
10376
10411
  addonAfter: 'px'
10412
+ },
10413
+ {
10414
+ type: 'Switch',
10415
+ label: '固定宽高',
10416
+ name: ['props', 'isWaterfallFlow'],
10417
+ initialValue: true
10377
10418
  }
10378
10419
  ]
10379
10420
  },
@@ -11842,6 +11883,374 @@ var previewData = {
11842
11883
  hashTag: hashTag
11843
11884
  };
11844
11885
 
11886
+ const WaterfallFlowItem$1 = (props) => {
11887
+ const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
11888
+ const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
11889
+ const [showVideo, setShowVideo] = React.useState(false);
11890
+ const [isLoading, setIsLoading] = React.useState(false);
11891
+ const [imgInfo, setImgInfo] = React.useState({
11892
+ height: 1,
11893
+ width: 1
11894
+ });
11895
+ const imgDom = React.useRef(null);
11896
+ const ref = React.useRef(null);
11897
+ const videoDom = React.useRef(null);
11898
+ const canvasRef = React.useRef(null);
11899
+ const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
11900
+ const src = React.useMemo(() => {
11901
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11902
+ if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) {
11903
+ return (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
11904
+ }
11905
+ 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) {
11906
+ 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];
11907
+ }
11908
+ 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) {
11909
+ 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];
11910
+ }
11911
+ else {
11912
+ return (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) || '';
11913
+ }
11914
+ }, [rec, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image]);
11915
+ const title = React.useMemo(() => {
11916
+ var _a, _b;
11917
+ 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;
11918
+ }, [rec]);
11919
+ /** 离父亲上边框的距离 */
11920
+ const top = React.useMemo(() => {
11921
+ var _a;
11922
+ const y = style.transform
11923
+ ? Number((_a = style.transform) === null || _a === void 0 ? void 0 : _a.substring(style.transform.indexOf(',', 0) + 1, style.transform.length - 3))
11924
+ : undefined;
11925
+ return y;
11926
+ }, [style]);
11927
+ /** 是否加载图片 */
11928
+ const isImgShow = React.useMemo(() => {
11929
+ if (top === undefined) {
11930
+ return false;
11931
+ }
11932
+ if (top <= showBorder) {
11933
+ return true;
11934
+ }
11935
+ else {
11936
+ return false;
11937
+ }
11938
+ }, [top, showBorder]);
11939
+ const priceText = React.useMemo(() => {
11940
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11941
+ 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)) {
11942
+ 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', {
11943
+ minimumFractionDigits: 0
11944
+ })) !== null && _j !== void 0 ? _j : ''}`;
11945
+ }
11946
+ else {
11947
+ return null;
11948
+ }
11949
+ }, [rec]);
11950
+ React.useEffect(() => {
11951
+ if (imgDom.current === null || src === '') {
11952
+ return;
11953
+ }
11954
+ const img = new Image();
11955
+ if (showVideo && firstFrameSrc) {
11956
+ img.src = firstFrameSrc;
11957
+ }
11958
+ else {
11959
+ img.src = src;
11960
+ }
11961
+ img.onload = () => {
11962
+ setImgInfo({
11963
+ height: img.height,
11964
+ width: img.width
11965
+ });
11966
+ setIsLoading(true);
11967
+ };
11968
+ imgDom.current.setSrc(img.src);
11969
+ }, [src, showVideo, firstFrameSrc, isImgShow]);
11970
+ React.useEffect(() => {
11971
+ // 通过宽度比例获取图片高度
11972
+ const height = imgInfo.height * (unitWidth / imgInfo.width);
11973
+ if (isLoading) {
11974
+ // 加40是因为下方文字部分高度为40,可以自己设置
11975
+ sizeChange(height + 76 + space, index);
11976
+ }
11977
+ }, [imgInfo, index, unitWidth, isLoading, space]); /* 增加sizeChange依赖项会导致在admin预览编辑时无限刷新 */
11978
+ const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
11979
+ const aspectRatio = videoWidth / videoHeight;
11980
+ const targetHeight = targetWidth / aspectRatio;
11981
+ return targetHeight;
11982
+ };
11983
+ React.useEffect(() => {
11984
+ const video = videoDom === null || videoDom === void 0 ? void 0 : videoDom.current;
11985
+ if (video === null || src === '' || !showVideo) {
11986
+ return;
11987
+ }
11988
+ video.src = src;
11989
+ video.currentTime = 1;
11990
+ video.crossOrigin = 'anonymous';
11991
+ video.onloadeddata = () => {
11992
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
11993
+ if (!canvas)
11994
+ return;
11995
+ const ctx = canvas.getContext('2d');
11996
+ const targetWidth = (window === null || window === void 0 ? void 0 : window.innerWidth) / 2;
11997
+ const targetHeight = calculateHeightForWidth(video.videoWidth, video.videoHeight, targetWidth);
11998
+ canvas.height = targetHeight;
11999
+ canvas.width = targetWidth;
12000
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12001
+ setFirstFrameSrc(canvas.toDataURL());
12002
+ video.remove();
12003
+ canvas.remove();
12004
+ };
12005
+ }, [src, showVideo]);
12006
+ const handleClickToDetail = () => {
12007
+ reportTagsView();
12008
+ setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
12009
+ setTimeout(() => {
12010
+ var _a;
12011
+ (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index, 0, false);
12012
+ setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
12013
+ }, 0);
12014
+ };
12015
+ return (React.createElement("div", { ref: ref, style: Object.assign({}, style), className: 'waterFallList-content-listItem', key: index, onClick: handleClickToDetail },
12016
+ React.createElement("div", { className: 'waterFallList-content-listItem-picture' },
12017
+ showVideo && (React.createElement("div", { style: { display: 'none' } },
12018
+ React.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
12019
+ React.createElement("canvas", { ref: canvasRef }))),
12020
+ React.createElement(FormatImage$1, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
12021
+ React.createElement("div", { className: 'waterFallList-content-listItem-info' },
12022
+ 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),
12023
+ React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
12024
+ };
12025
+ function WaterfallList$1(_a) {
12026
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
12027
+ var { reportTagsView } = _a, props = __rest(_a, ["reportTagsView"]);
12028
+ const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
12029
+ /** 滚动的父元素 */
12030
+ const scrollParent = React.useRef(null);
12031
+ /** 向上滚动的距离 */
12032
+ const [scrollTop, setScrollTop] = React.useState(0);
12033
+ /** 数据列表 */
12034
+ const [data, setData] = React.useState();
12035
+ const waterfallFlowDom = React.useRef(null);
12036
+ /** 样式列表 */
12037
+ const [styleList, setStyleList] = React.useState([]);
12038
+ const styleListRef = React.useRef();
12039
+ /** 自定义骨架屏高度 */
12040
+ const heightList = [170, 230, 300];
12041
+ /** 到达底部 */
12042
+ const [isLoadingData, setIsLoadingData] = React.useState(false);
12043
+ const [list, setList] = React.useState([]);
12044
+ const buttonRef = React.useRef();
12045
+ /** 生成随机数 */
12046
+ const createRandomNum = React.useCallback((min, max) => {
12047
+ return Math.floor(Math.random() * (max - min + 1)) + min;
12048
+ }, []);
12049
+ const waterfallFlowListInfo = React.useRef([]);
12050
+ /** 当前容器信息 */
12051
+ const [frameInfo, setFrameInfoInfo] = React.useState({ width: 0 });
12052
+ /** 每行个数 */
12053
+ const rowsNum = React.useMemo(() => {
12054
+ const width = frameInfo.width || 0;
12055
+ if (width >= 1200) {
12056
+ return 6;
12057
+ }
12058
+ else if (width >= 768 && width <= 1199) {
12059
+ return 4;
12060
+ }
12061
+ else {
12062
+ return 2;
12063
+ }
12064
+ }, [frameInfo]);
12065
+ /** 每一个的宽度 */
12066
+ const unitWidth = React.useMemo(() => {
12067
+ return frameInfo.width / rowsNum - 2;
12068
+ }, [rowsNum, frameInfo]);
12069
+ /** 获取位置 */
12070
+ const getStyleList = React.useCallback(() => {
12071
+ var _a;
12072
+ const temporaryStyleList = (_a = styleListRef.current) !== null && _a !== void 0 ? _a : [];
12073
+ /** 目前最下一行的index */
12074
+ const bottomItemIndex = [];
12075
+ for (let i = 0; i < (list === null || list === void 0 ? void 0 : list.length); i++) {
12076
+ // 原本应对应的行数
12077
+ const currentRow = Math.floor(i / rowsNum);
12078
+ //
12079
+ const remainder = (i % rowsNum) + 1;
12080
+ // 最低item下标
12081
+ let minHeightInd = 0;
12082
+ // 最低高度
12083
+ let minHeight = 9999999999;
12084
+ // 寻找最低高度的下标
12085
+ if (currentRow === 0) {
12086
+ bottomItemIndex[i] = i;
12087
+ }
12088
+ else {
12089
+ for (let j = 0; j < bottomItemIndex.length; j++) {
12090
+ if (waterfallFlowListInfo.current[bottomItemIndex[j]].top +
12091
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height <
12092
+ minHeight) {
12093
+ minHeightInd = j;
12094
+ minHeight =
12095
+ waterfallFlowListInfo.current[bottomItemIndex[j]].top +
12096
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height;
12097
+ }
12098
+ }
12099
+ bottomItemIndex[minHeightInd] = i;
12100
+ }
12101
+ if (waterfallFlowListInfo.current[i] === undefined) {
12102
+ waterfallFlowListInfo.current[i] = {};
12103
+ }
12104
+ // 第一行特殊处理,一定是从左到右铺的
12105
+ if (currentRow === 0) {
12106
+ if (remainder === 1) {
12107
+ waterfallFlowListInfo.current[i].left = 0;
12108
+ }
12109
+ else {
12110
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[i - 1].left + unitWidth + 4;
12111
+ }
12112
+ waterfallFlowListInfo.current[i].top = 0;
12113
+ }
12114
+ // 剩下的行数,铺在当前最低高度下面
12115
+ else {
12116
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[minHeightInd].left;
12117
+ waterfallFlowListInfo.current[i].top = minHeight;
12118
+ }
12119
+ // 是否已经有高度,有高度使用已有高度,否则随机生成
12120
+ waterfallFlowListInfo.current[i].height =
12121
+ waterfallFlowListInfo.current[i].height || heightList[createRandomNum(0, 2)];
12122
+ temporaryStyleList[i] = {
12123
+ transform: `translate(${waterfallFlowListInfo.current[i].left}px,${waterfallFlowListInfo.current[i].top}px)`,
12124
+ width: `${unitWidth}px`,
12125
+ height: waterfallFlowListInfo.current[i].height
12126
+ };
12127
+ }
12128
+ setStyleList([...temporaryStyleList]);
12129
+ return [...temporaryStyleList];
12130
+ }, [unitWidth, rowsNum, heightList, createRandomNum, list]);
12131
+ /** 图片加载完更新高度 */
12132
+ const onSizeChange = React.useCallback((height, index) => {
12133
+ if (waterfallFlowListInfo.current[index] === undefined) {
12134
+ waterfallFlowListInfo.current[index] = {};
12135
+ }
12136
+ waterfallFlowListInfo.current[index].height = height;
12137
+ styleListRef.current = getStyleList();
12138
+ }, [getStyleList]);
12139
+ /** 大小、数量发生变化时触发 */
12140
+ React.useEffect(() => {
12141
+ styleListRef.current = getStyleList();
12142
+ }, [unitWidth, rowsNum, list]); /* 增加getStyleList依赖项会导致在admin预览编辑时无限刷新 */
12143
+ /** 初始化请求数据 */
12144
+ React.useEffect(() => {
12145
+ var _a, _b;
12146
+ setIsLoadingData(true);
12147
+ waterFallData &&
12148
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12149
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12150
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12151
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
12152
+ defaultSize: hashTagSize,
12153
+ maxSize: hashTagSize
12154
+ }).then((res) => {
12155
+ var _a, _b;
12156
+ setData(res);
12157
+ 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 : []);
12158
+ setIsLoadingData(false);
12159
+ }));
12160
+ if (isOpenHashTag) {
12161
+ const res = previewData;
12162
+ setData(res);
12163
+ 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 : []);
12164
+ setIsLoadingData(false);
12165
+ }
12166
+ }, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
12167
+ const onResize = React.useCallback(() => {
12168
+ if (waterfallFlowDom.current === null) {
12169
+ return;
12170
+ }
12171
+ setFrameInfoInfo({
12172
+ width: waterfallFlowDom.current.getBoundingClientRect().width
12173
+ });
12174
+ }, []);
12175
+ /** 监听列表容器大小变化 */
12176
+ React.useEffect(() => {
12177
+ if (waterfallFlowDom.current === null) {
12178
+ return;
12179
+ }
12180
+ const resizeObserver = new ResizeObserver((entries) => {
12181
+ onResize();
12182
+ });
12183
+ resizeObserver.observe(waterfallFlowDom.current);
12184
+ return () => {
12185
+ resizeObserver.disconnect();
12186
+ };
12187
+ }, [onResize]);
12188
+ React.useCallback(() => {
12189
+ setIsLoadingData(true);
12190
+ waterFallData &&
12191
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12192
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12193
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12194
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
12195
+ }).then((res) => {
12196
+ var _a, _b;
12197
+ 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 : []));
12198
+ setIsLoadingData(false);
12199
+ }));
12200
+ }, [waterFallData, getRecommendVideos, list]);
12201
+ const onScroll = React.useCallback(() => {
12202
+ // 记录滚动值
12203
+ setScrollTop(scrollParent.current.scrollTop);
12204
+ // const top = (scrollParent.current as any).scrollTop;
12205
+ // const clientHeight = (scrollParent.current as any).clientHeight;
12206
+ // const scrollHeight = (scrollParent.current as any).scrollHeight;
12207
+ // // 做底部加载
12208
+ // if (scrollHeight <= top + clientHeight && !isLoadingData) {
12209
+ // loadMoreData();
12210
+ // }
12211
+ }, []);
12212
+ /** 监听滚动 */
12213
+ React.useEffect(() => {
12214
+ var _a;
12215
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', onScroll);
12216
+ return () => {
12217
+ var _a;
12218
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', onScroll);
12219
+ };
12220
+ }, [onScroll, scrollParent]);
12221
+ const handleClickLink = () => {
12222
+ var _a, _b;
12223
+ if ((_a = data === null || data === void 0 ? void 0 : data.tag) === null || _a === void 0 ? void 0 : _a.link) {
12224
+ reportTagsView();
12225
+ window.location.href = (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.link;
12226
+ }
12227
+ };
12228
+ return (React.createElement(React.Fragment, null, isLoadingData ? (React.createElement("div", { style: { height: '100%', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' } },
12229
+ React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { className: 'waterFallList', ref: waterfallFlowDom },
12230
+ React.createElement("div", { className: 'waterFallList-scroll', ref: scrollParent },
12231
+ 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),
12232
+ 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'),
12233
+ React.createElement("div", { className: 'waterFallList-content' }, list === null || list === void 0 ? void 0 :
12234
+ list.map((item, ind) => {
12235
+ var _a;
12236
+ 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)));
12237
+ }),
12238
+ React.createElement("div", { hidden: !((_g = data === null || data === void 0 ? void 0 : data.tag) === null || _g === void 0 ? void 0 : _g.link), style: {
12239
+ position: 'absolute',
12240
+ width: '100%',
12241
+ 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) +
12242
+ ((_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)`,
12243
+ height: ((_o = data === null || data === void 0 ? void 0 : data.tag) === null || _o === void 0 ? void 0 : _o.link)
12244
+ ? ((_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'
12245
+ : 0
12246
+ } }))),
12247
+ 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 }),
12248
+ 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' }) },
12249
+ 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'))))));
12250
+ }
12251
+
12252
+ var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12253
+
11845
12254
  const WaterfallFlowItem = (props) => {
11846
12255
  const { rec, index, list, reportTagsView, textStyles, space } = props;
11847
12256
  const { swiperRef, setRtcList, setOpenHashtag, bffEventReport, sxpParameter } = useSxpDataSource();
@@ -12052,13 +12461,11 @@ function WaterfallList(_a) {
12052
12461
  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'))))));
12053
12462
  }
12054
12463
 
12055
- var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12056
-
12057
12464
  /*
12058
12465
  * @Author: binruan@chatlabs.com
12059
12466
  * @Date: 2024-01-10 10:58:24
12060
12467
  * @LastEditors: binruan@chatlabs.com
12061
- * @LastEditTime: 2024-04-15 17:57:59
12468
+ * @LastEditTime: 2024-06-07 15:57:29
12062
12469
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
12063
12470
  *
12064
12471
  */
@@ -12152,7 +12559,7 @@ const WaterFall = (props) => {
12152
12559
  display: openHashtag ? 'block' : 'none'
12153
12560
  } },
12154
12561
  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 }),
12155
- React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props))), modalEleRef.current);
12562
+ (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);
12156
12563
  };
12157
12564
  var WaterFall$1 = React.memo(WaterFall);
12158
12565
 
@@ -12676,7 +13083,7 @@ const FingerSwipeTip = ({ imageUrl, style }) => {
12676
13083
  *
12677
13084
  */
12678
13085
  const Picture = (props) => {
12679
- const { src, height, imgUrlsPostConfig } = props;
13086
+ const { src, height, imgUrlsPostConfig, onShowFirstImage } = props;
12680
13087
  const blur = React.useMemo(() => {
12681
13088
  return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2';
12682
13089
  }, [imgUrlsPostConfig]);
@@ -12701,7 +13108,7 @@ const Picture = (props) => {
12701
13108
  return isBgColor && (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor) ? { backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor } : {};
12702
13109
  }, [imgUrlsPostConfig, isBgColor]);
12703
13110
  return (React.createElement("div", { style: Object.assign({ overflow: 'hidden', height, width: '100%', position: 'relative' }, bgStyle) },
12704
- (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
13111
+ (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle), onLoad: onShowFirstImage })),
12705
13112
  blur && (React.createElement(FormatImage$1, { src: src, style: {
12706
13113
  width: '100%',
12707
13114
  height: '100%',
@@ -12718,7 +13125,7 @@ const Picture = (props) => {
12718
13125
  * @Author: lewinlu@chatlabs.com
12719
13126
  * @Date: 2024-01-03 14:39:09
12720
13127
  * @LastEditors: binruan@chatlabs.com
12721
- * @LastEditTime: 2024-04-18 19:56:22
13128
+ * @LastEditTime: 2024-06-07 14:05:08
12722
13129
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12723
13130
  */
12724
13131
  const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
@@ -12738,16 +13145,20 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageE
12738
13145
  }
12739
13146
  }
12740
13147
  else {
12741
- setIsLoad(true);
12742
13148
  (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
12743
13149
  }
12744
13150
  }, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
13151
+ const showFirstImageFn = React.useCallback(() => {
13152
+ if (!isLoad) {
13153
+ setIsLoad(true);
13154
+ }
13155
+ }, [isLoad]);
12745
13156
  // if (!isActive) {
12746
13157
  // return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
12747
13158
  // }
12748
- 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) => {
12749
- return (React.createElement(SwiperSlide, { key: url },
12750
- React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
13159
+ 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) => {
13160
+ return (React.createElement(SwiperSlide, { key: index },
13161
+ React.createElement(Picture, { src: !isLoad && index > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
12751
13162
  })));
12752
13163
  };
12753
13164
  var PictureGroup$3 = React.memo(PictureGroup$2);
@@ -12967,7 +13378,7 @@ var Tagbar$1 = React.memo(Tagbar);
12967
13378
  * @Author: binruan@chatlabs.com
12968
13379
  * @Date: 2024-01-15 19:03:09
12969
13380
  * @LastEditors: binruan@chatlabs.com
12970
- * @LastEditTime: 2024-06-06 18:42:24
13381
+ * @LastEditTime: 2024-06-07 11:10:42
12971
13382
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12972
13383
  *
12973
13384
  */
@@ -12994,32 +13405,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12994
13405
  return;
12995
13406
  }
12996
13407
  initTime();
12997
- // 刷新 sessionId
12998
- // refreshFeSessionId();
12999
- const queryString = location.search.slice(1);
13000
- const params = qs.parse(queryString.replace(/\+/g, '%2B'));
13001
- for (const key in params) {
13002
- params[key] = params[key].replace(/%2B/g, '+');
13003
- }
13004
- const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
13005
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
13006
- eventInfo: {
13007
- eventSubject: 'h5LinkEnterFeed',
13008
- eventDescription: 'User enter h5 link',
13009
- utmSource: getVal('utm_source'),
13010
- utmMedium: getVal('utm_medium'),
13011
- utmCampaign: getVal('utm_campaign'),
13012
- utmId: getVal('utm_id'),
13013
- utmContent: getVal('utm_content'),
13014
- enterTime: `${Date.now()}`,
13015
- requestId: null
13016
- }
13017
- });
13018
13408
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
13019
13409
  eventName: 'PageView'
13020
13410
  });
13021
13411
  setIsInit(true);
13022
- }, [bffEventReport, data.length, bffFbReport]);
13412
+ }, [data.length, bffFbReport]);
13023
13413
  const initTime = () => {
13024
13414
  curTime.current = new Date();
13025
13415
  viewTime.current = new Date();
@@ -13072,26 +13462,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13072
13462
  })) || 0;
13073
13463
  (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
13074
13464
  }, [ctaType, swiperRef]);
13075
- // useEffect(() => {
13076
- // const handleBeforeUnload = (event: any) => {
13077
- // event.preventDefault();
13078
- // const item = data?.[activeIndex];
13079
- // bffEventReport?.({
13080
- // eventInfo: {
13081
- // sessionDuration: Math.floor(((new Date() as any) - curTime) / 1000) + '',
13082
- // eventSubject: 'sessionCompleted',
13083
- // eventDescription: 'Session completed',
13084
- // contentId: item?.video?.itemId,
13085
- // productId: item?.product?.itemId,
13086
- // position: item?.position
13087
- // }
13088
- // });
13089
- // };
13090
- // window.addEventListener('beforeunload', handleBeforeUnload);
13091
- // return () => {
13092
- // window.removeEventListener('beforeunload', handleBeforeUnload);
13093
- // };
13094
- // }, [activeIndex, data, bffEventReport, curTime]);
13095
13465
  React.useEffect(() => {
13096
13466
  const item = data === null || data === void 0 ? void 0 : data[activeIndex];
13097
13467
  const visibleChange = () => {