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/pb-ui.js CHANGED
@@ -632,6 +632,30 @@
632
632
  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 })
633
633
  });
634
634
  }, [bffEventReport, isFromHashtag]);
635
+ React.useEffect(() => {
636
+ var _a, _b;
637
+ const queryString = location.search.slice(1);
638
+ const params = qs.parse(queryString.replace(/\+/g, '%2B'));
639
+ for (const key in params) {
640
+ params[key] = params[key].replace(/%2B/g, '+');
641
+ }
642
+ const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
643
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
644
+ eventInfo: {
645
+ eventSubject: 'h5LinkEnterFeed',
646
+ eventDescription: 'User enter h5 link',
647
+ utmSource: getVal('utm_source'),
648
+ utmMedium: getVal('utm_medium'),
649
+ utmCampaign: getVal('utm_campaign'),
650
+ utmId: getVal('utm_id'),
651
+ utmContent: getVal('utm_content'),
652
+ enterTime: `${Date.now()}`,
653
+ requestId: null,
654
+ 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 : '',
655
+ clSource: getVal('cl_sourc')
656
+ }
657
+ });
658
+ }, []);
635
659
  React.useEffect(() => {
636
660
  setLoading(true);
637
661
  bffGetTagList();
@@ -642,6 +666,12 @@
642
666
  setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
643
667
  })
644
668
  .finally(() => {
669
+ bffEventReport({
670
+ eventInfo: {
671
+ eventSubject: 'apiRequest',
672
+ eventDescription: 'api request succeed'
673
+ }
674
+ });
645
675
  setLoading(false);
646
676
  isInit.current = true;
647
677
  });
@@ -10348,24 +10378,35 @@ Made in Italy` })));
10348
10378
  * @Author: binruan@chatlabs.com
10349
10379
  * @Date: 2024-04-07 14:07:12
10350
10380
  * @LastEditors: binruan@chatlabs.com
10351
- * @LastEditTime: 2024-05-23 11:03:15
10381
+ * @LastEditTime: 2024-06-07 15:51:49
10352
10382
  * @FilePath: \pb-sxp-ui\src\materials\sxp\HashTag\settingRender.tsx
10353
10383
  *
10354
10384
  */
10355
10385
  var settingRender = [
10386
+ {
10387
+ title: 'Banner',
10388
+ child: [
10389
+ {
10390
+ type: 'Switch',
10391
+ label: 'Banner图开关',
10392
+ name: ['props', 'showBanner']
10393
+ }
10394
+ ]
10395
+ },
10356
10396
  {
10357
10397
  title: '卡片样式',
10358
10398
  child: [
10359
- // {
10360
- // type: 'Number',
10361
- // label: '文本行数',
10362
- // name: ['props', 'lineClamp']
10363
- // },
10364
10399
  {
10365
10400
  type: 'Number',
10366
10401
  label: '上下边距',
10367
10402
  name: ['props', 'space'],
10368
10403
  addonAfter: 'px'
10404
+ },
10405
+ {
10406
+ type: 'Switch',
10407
+ label: '固定宽高',
10408
+ name: ['props', 'isWaterfallFlow'],
10409
+ initialValue: true
10369
10410
  }
10370
10411
  ]
10371
10412
  },
@@ -11834,6 +11875,374 @@ Made in Italy` })));
11834
11875
  hashTag: hashTag
11835
11876
  };
11836
11877
 
11878
+ const WaterfallFlowItem$1 = (props) => {
11879
+ const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
11880
+ const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
11881
+ const [showVideo, setShowVideo] = React.useState(false);
11882
+ const [isLoading, setIsLoading] = React.useState(false);
11883
+ const [imgInfo, setImgInfo] = React.useState({
11884
+ height: 1,
11885
+ width: 1
11886
+ });
11887
+ const imgDom = React.useRef(null);
11888
+ const ref = React.useRef(null);
11889
+ const videoDom = React.useRef(null);
11890
+ const canvasRef = React.useRef(null);
11891
+ const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
11892
+ const src = React.useMemo(() => {
11893
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11894
+ if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) {
11895
+ return (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
11896
+ }
11897
+ 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) {
11898
+ 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];
11899
+ }
11900
+ 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) {
11901
+ 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];
11902
+ }
11903
+ else {
11904
+ return (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) || '';
11905
+ }
11906
+ }, [rec, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image]);
11907
+ const title = React.useMemo(() => {
11908
+ var _a, _b;
11909
+ 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;
11910
+ }, [rec]);
11911
+ /** 离父亲上边框的距离 */
11912
+ const top = React.useMemo(() => {
11913
+ var _a;
11914
+ const y = style.transform
11915
+ ? Number((_a = style.transform) === null || _a === void 0 ? void 0 : _a.substring(style.transform.indexOf(',', 0) + 1, style.transform.length - 3))
11916
+ : undefined;
11917
+ return y;
11918
+ }, [style]);
11919
+ /** 是否加载图片 */
11920
+ const isImgShow = React.useMemo(() => {
11921
+ if (top === undefined) {
11922
+ return false;
11923
+ }
11924
+ if (top <= showBorder) {
11925
+ return true;
11926
+ }
11927
+ else {
11928
+ return false;
11929
+ }
11930
+ }, [top, showBorder]);
11931
+ const priceText = React.useMemo(() => {
11932
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11933
+ 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)) {
11934
+ 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', {
11935
+ minimumFractionDigits: 0
11936
+ })) !== null && _j !== void 0 ? _j : ''}`;
11937
+ }
11938
+ else {
11939
+ return null;
11940
+ }
11941
+ }, [rec]);
11942
+ React.useEffect(() => {
11943
+ if (imgDom.current === null || src === '') {
11944
+ return;
11945
+ }
11946
+ const img = new Image();
11947
+ if (showVideo && firstFrameSrc) {
11948
+ img.src = firstFrameSrc;
11949
+ }
11950
+ else {
11951
+ img.src = src;
11952
+ }
11953
+ img.onload = () => {
11954
+ setImgInfo({
11955
+ height: img.height,
11956
+ width: img.width
11957
+ });
11958
+ setIsLoading(true);
11959
+ };
11960
+ imgDom.current.setSrc(img.src);
11961
+ }, [src, showVideo, firstFrameSrc, isImgShow]);
11962
+ React.useEffect(() => {
11963
+ // 通过宽度比例获取图片高度
11964
+ const height = imgInfo.height * (unitWidth / imgInfo.width);
11965
+ if (isLoading) {
11966
+ // 加40是因为下方文字部分高度为40,可以自己设置
11967
+ sizeChange(height + 76 + space, index);
11968
+ }
11969
+ }, [imgInfo, index, unitWidth, isLoading, space]); /* 增加sizeChange依赖项会导致在admin预览编辑时无限刷新 */
11970
+ const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
11971
+ const aspectRatio = videoWidth / videoHeight;
11972
+ const targetHeight = targetWidth / aspectRatio;
11973
+ return targetHeight;
11974
+ };
11975
+ React.useEffect(() => {
11976
+ const video = videoDom === null || videoDom === void 0 ? void 0 : videoDom.current;
11977
+ if (video === null || src === '' || !showVideo) {
11978
+ return;
11979
+ }
11980
+ video.src = src;
11981
+ video.currentTime = 1;
11982
+ video.crossOrigin = 'anonymous';
11983
+ video.onloadeddata = () => {
11984
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
11985
+ if (!canvas)
11986
+ return;
11987
+ const ctx = canvas.getContext('2d');
11988
+ const targetWidth = (window === null || window === void 0 ? void 0 : window.innerWidth) / 2;
11989
+ const targetHeight = calculateHeightForWidth(video.videoWidth, video.videoHeight, targetWidth);
11990
+ canvas.height = targetHeight;
11991
+ canvas.width = targetWidth;
11992
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
11993
+ setFirstFrameSrc(canvas.toDataURL());
11994
+ video.remove();
11995
+ canvas.remove();
11996
+ };
11997
+ }, [src, showVideo]);
11998
+ const handleClickToDetail = () => {
11999
+ reportTagsView();
12000
+ setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
12001
+ setTimeout(() => {
12002
+ var _a;
12003
+ (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index, 0, false);
12004
+ setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
12005
+ }, 0);
12006
+ };
12007
+ return (React.createElement("div", { ref: ref, style: Object.assign({}, style), className: 'waterFallList-content-listItem', key: index, onClick: handleClickToDetail },
12008
+ React.createElement("div", { className: 'waterFallList-content-listItem-picture' },
12009
+ showVideo && (React.createElement("div", { style: { display: 'none' } },
12010
+ React.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
12011
+ React.createElement("canvas", { ref: canvasRef }))),
12012
+ React.createElement(FormatImage$1, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
12013
+ React.createElement("div", { className: 'waterFallList-content-listItem-info' },
12014
+ 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),
12015
+ React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
12016
+ };
12017
+ function WaterfallList$1(_a) {
12018
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
12019
+ var { reportTagsView } = _a, props = __rest(_a, ["reportTagsView"]);
12020
+ const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
12021
+ /** 滚动的父元素 */
12022
+ const scrollParent = React.useRef(null);
12023
+ /** 向上滚动的距离 */
12024
+ const [scrollTop, setScrollTop] = React.useState(0);
12025
+ /** 数据列表 */
12026
+ const [data, setData] = React.useState();
12027
+ const waterfallFlowDom = React.useRef(null);
12028
+ /** 样式列表 */
12029
+ const [styleList, setStyleList] = React.useState([]);
12030
+ const styleListRef = React.useRef();
12031
+ /** 自定义骨架屏高度 */
12032
+ const heightList = [170, 230, 300];
12033
+ /** 到达底部 */
12034
+ const [isLoadingData, setIsLoadingData] = React.useState(false);
12035
+ const [list, setList] = React.useState([]);
12036
+ const buttonRef = React.useRef();
12037
+ /** 生成随机数 */
12038
+ const createRandomNum = React.useCallback((min, max) => {
12039
+ return Math.floor(Math.random() * (max - min + 1)) + min;
12040
+ }, []);
12041
+ const waterfallFlowListInfo = React.useRef([]);
12042
+ /** 当前容器信息 */
12043
+ const [frameInfo, setFrameInfoInfo] = React.useState({ width: 0 });
12044
+ /** 每行个数 */
12045
+ const rowsNum = React.useMemo(() => {
12046
+ const width = frameInfo.width || 0;
12047
+ if (width >= 1200) {
12048
+ return 6;
12049
+ }
12050
+ else if (width >= 768 && width <= 1199) {
12051
+ return 4;
12052
+ }
12053
+ else {
12054
+ return 2;
12055
+ }
12056
+ }, [frameInfo]);
12057
+ /** 每一个的宽度 */
12058
+ const unitWidth = React.useMemo(() => {
12059
+ return frameInfo.width / rowsNum - 2;
12060
+ }, [rowsNum, frameInfo]);
12061
+ /** 获取位置 */
12062
+ const getStyleList = React.useCallback(() => {
12063
+ var _a;
12064
+ const temporaryStyleList = (_a = styleListRef.current) !== null && _a !== void 0 ? _a : [];
12065
+ /** 目前最下一行的index */
12066
+ const bottomItemIndex = [];
12067
+ for (let i = 0; i < (list === null || list === void 0 ? void 0 : list.length); i++) {
12068
+ // 原本应对应的行数
12069
+ const currentRow = Math.floor(i / rowsNum);
12070
+ //
12071
+ const remainder = (i % rowsNum) + 1;
12072
+ // 最低item下标
12073
+ let minHeightInd = 0;
12074
+ // 最低高度
12075
+ let minHeight = 9999999999;
12076
+ // 寻找最低高度的下标
12077
+ if (currentRow === 0) {
12078
+ bottomItemIndex[i] = i;
12079
+ }
12080
+ else {
12081
+ for (let j = 0; j < bottomItemIndex.length; j++) {
12082
+ if (waterfallFlowListInfo.current[bottomItemIndex[j]].top +
12083
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height <
12084
+ minHeight) {
12085
+ minHeightInd = j;
12086
+ minHeight =
12087
+ waterfallFlowListInfo.current[bottomItemIndex[j]].top +
12088
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height;
12089
+ }
12090
+ }
12091
+ bottomItemIndex[minHeightInd] = i;
12092
+ }
12093
+ if (waterfallFlowListInfo.current[i] === undefined) {
12094
+ waterfallFlowListInfo.current[i] = {};
12095
+ }
12096
+ // 第一行特殊处理,一定是从左到右铺的
12097
+ if (currentRow === 0) {
12098
+ if (remainder === 1) {
12099
+ waterfallFlowListInfo.current[i].left = 0;
12100
+ }
12101
+ else {
12102
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[i - 1].left + unitWidth + 4;
12103
+ }
12104
+ waterfallFlowListInfo.current[i].top = 0;
12105
+ }
12106
+ // 剩下的行数,铺在当前最低高度下面
12107
+ else {
12108
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[minHeightInd].left;
12109
+ waterfallFlowListInfo.current[i].top = minHeight;
12110
+ }
12111
+ // 是否已经有高度,有高度使用已有高度,否则随机生成
12112
+ waterfallFlowListInfo.current[i].height =
12113
+ waterfallFlowListInfo.current[i].height || heightList[createRandomNum(0, 2)];
12114
+ temporaryStyleList[i] = {
12115
+ transform: `translate(${waterfallFlowListInfo.current[i].left}px,${waterfallFlowListInfo.current[i].top}px)`,
12116
+ width: `${unitWidth}px`,
12117
+ height: waterfallFlowListInfo.current[i].height
12118
+ };
12119
+ }
12120
+ setStyleList([...temporaryStyleList]);
12121
+ return [...temporaryStyleList];
12122
+ }, [unitWidth, rowsNum, heightList, createRandomNum, list]);
12123
+ /** 图片加载完更新高度 */
12124
+ const onSizeChange = React.useCallback((height, index) => {
12125
+ if (waterfallFlowListInfo.current[index] === undefined) {
12126
+ waterfallFlowListInfo.current[index] = {};
12127
+ }
12128
+ waterfallFlowListInfo.current[index].height = height;
12129
+ styleListRef.current = getStyleList();
12130
+ }, [getStyleList]);
12131
+ /** 大小、数量发生变化时触发 */
12132
+ React.useEffect(() => {
12133
+ styleListRef.current = getStyleList();
12134
+ }, [unitWidth, rowsNum, list]); /* 增加getStyleList依赖项会导致在admin预览编辑时无限刷新 */
12135
+ /** 初始化请求数据 */
12136
+ React.useEffect(() => {
12137
+ var _a, _b;
12138
+ setIsLoadingData(true);
12139
+ waterFallData &&
12140
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12141
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12142
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12143
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
12144
+ defaultSize: hashTagSize,
12145
+ maxSize: hashTagSize
12146
+ }).then((res) => {
12147
+ var _a, _b;
12148
+ setData(res);
12149
+ 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 : []);
12150
+ setIsLoadingData(false);
12151
+ }));
12152
+ if (isOpenHashTag) {
12153
+ const res = previewData;
12154
+ setData(res);
12155
+ 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 : []);
12156
+ setIsLoadingData(false);
12157
+ }
12158
+ }, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
12159
+ const onResize = React.useCallback(() => {
12160
+ if (waterfallFlowDom.current === null) {
12161
+ return;
12162
+ }
12163
+ setFrameInfoInfo({
12164
+ width: waterfallFlowDom.current.getBoundingClientRect().width
12165
+ });
12166
+ }, []);
12167
+ /** 监听列表容器大小变化 */
12168
+ React.useEffect(() => {
12169
+ if (waterfallFlowDom.current === null) {
12170
+ return;
12171
+ }
12172
+ const resizeObserver = new ResizeObserver((entries) => {
12173
+ onResize();
12174
+ });
12175
+ resizeObserver.observe(waterfallFlowDom.current);
12176
+ return () => {
12177
+ resizeObserver.disconnect();
12178
+ };
12179
+ }, [onResize]);
12180
+ React.useCallback(() => {
12181
+ setIsLoadingData(true);
12182
+ waterFallData &&
12183
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12184
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12185
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12186
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
12187
+ }).then((res) => {
12188
+ var _a, _b;
12189
+ 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 : []));
12190
+ setIsLoadingData(false);
12191
+ }));
12192
+ }, [waterFallData, getRecommendVideos, list]);
12193
+ const onScroll = React.useCallback(() => {
12194
+ // 记录滚动值
12195
+ setScrollTop(scrollParent.current.scrollTop);
12196
+ // const top = (scrollParent.current as any).scrollTop;
12197
+ // const clientHeight = (scrollParent.current as any).clientHeight;
12198
+ // const scrollHeight = (scrollParent.current as any).scrollHeight;
12199
+ // // 做底部加载
12200
+ // if (scrollHeight <= top + clientHeight && !isLoadingData) {
12201
+ // loadMoreData();
12202
+ // }
12203
+ }, []);
12204
+ /** 监听滚动 */
12205
+ React.useEffect(() => {
12206
+ var _a;
12207
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', onScroll);
12208
+ return () => {
12209
+ var _a;
12210
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', onScroll);
12211
+ };
12212
+ }, [onScroll, scrollParent]);
12213
+ const handleClickLink = () => {
12214
+ var _a, _b;
12215
+ if ((_a = data === null || data === void 0 ? void 0 : data.tag) === null || _a === void 0 ? void 0 : _a.link) {
12216
+ reportTagsView();
12217
+ window.location.href = (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.link;
12218
+ }
12219
+ };
12220
+ return (React.createElement(React.Fragment, null, isLoadingData ? (React.createElement("div", { style: { height: '100%', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' } },
12221
+ React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { className: 'waterFallList', ref: waterfallFlowDom },
12222
+ React.createElement("div", { className: 'waterFallList-scroll', ref: scrollParent },
12223
+ 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),
12224
+ 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'),
12225
+ React.createElement("div", { className: 'waterFallList-content' }, list === null || list === void 0 ? void 0 :
12226
+ list.map((item, ind) => {
12227
+ var _a;
12228
+ 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)));
12229
+ }),
12230
+ React.createElement("div", { hidden: !((_g = data === null || data === void 0 ? void 0 : data.tag) === null || _g === void 0 ? void 0 : _g.link), style: {
12231
+ position: 'absolute',
12232
+ width: '100%',
12233
+ 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) +
12234
+ ((_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)`,
12235
+ height: ((_o = data === null || data === void 0 ? void 0 : data.tag) === null || _o === void 0 ? void 0 : _o.link)
12236
+ ? ((_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'
12237
+ : 0
12238
+ } }))),
12239
+ 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 }),
12240
+ 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' }) },
12241
+ 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'))))));
12242
+ }
12243
+
12244
+ var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12245
+
11837
12246
  const WaterfallFlowItem = (props) => {
11838
12247
  const { rec, index, list, reportTagsView, textStyles, space } = props;
11839
12248
  const { swiperRef, setRtcList, setOpenHashtag, bffEventReport, sxpParameter } = useSxpDataSource();
@@ -12044,13 +12453,11 @@ Made in Italy` })));
12044
12453
  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'))))));
12045
12454
  }
12046
12455
 
12047
- var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12048
-
12049
12456
  /*
12050
12457
  * @Author: binruan@chatlabs.com
12051
12458
  * @Date: 2024-01-10 10:58:24
12052
12459
  * @LastEditors: binruan@chatlabs.com
12053
- * @LastEditTime: 2024-04-15 17:57:59
12460
+ * @LastEditTime: 2024-06-07 15:57:29
12054
12461
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
12055
12462
  *
12056
12463
  */
@@ -12144,7 +12551,7 @@ Made in Italy` })));
12144
12551
  display: openHashtag ? 'block' : 'none'
12145
12552
  } },
12146
12553
  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 }),
12147
- React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props))), modalEleRef.current);
12554
+ (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);
12148
12555
  };
12149
12556
  var WaterFall$1 = React.memo(WaterFall);
12150
12557
 
@@ -12668,7 +13075,7 @@ Made in Italy` })));
12668
13075
  *
12669
13076
  */
12670
13077
  const Picture = (props) => {
12671
- const { src, height, imgUrlsPostConfig } = props;
13078
+ const { src, height, imgUrlsPostConfig, onShowFirstImage } = props;
12672
13079
  const blur = React.useMemo(() => {
12673
13080
  return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2';
12674
13081
  }, [imgUrlsPostConfig]);
@@ -12693,7 +13100,7 @@ Made in Italy` })));
12693
13100
  return isBgColor && (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor) ? { backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor } : {};
12694
13101
  }, [imgUrlsPostConfig, isBgColor]);
12695
13102
  return (React.createElement("div", { style: Object.assign({ overflow: 'hidden', height, width: '100%', position: 'relative' }, bgStyle) },
12696
- (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
13103
+ (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle), onLoad: onShowFirstImage })),
12697
13104
  blur && (React.createElement(FormatImage$1, { src: src, style: {
12698
13105
  width: '100%',
12699
13106
  height: '100%',
@@ -12710,7 +13117,7 @@ Made in Italy` })));
12710
13117
  * @Author: lewinlu@chatlabs.com
12711
13118
  * @Date: 2024-01-03 14:39:09
12712
13119
  * @LastEditors: binruan@chatlabs.com
12713
- * @LastEditTime: 2024-04-18 19:56:22
13120
+ * @LastEditTime: 2024-06-07 14:05:08
12714
13121
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12715
13122
  */
12716
13123
  const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
@@ -12730,16 +13137,20 @@ Made in Italy` })));
12730
13137
  }
12731
13138
  }
12732
13139
  else {
12733
- setIsLoad(true);
12734
13140
  (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
12735
13141
  }
12736
13142
  }, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
13143
+ const showFirstImageFn = React.useCallback(() => {
13144
+ if (!isLoad) {
13145
+ setIsLoad(true);
13146
+ }
13147
+ }, [isLoad]);
12737
13148
  // if (!isActive) {
12738
13149
  // return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
12739
13150
  // }
12740
- 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) => {
12741
- return (React.createElement(SwiperSlide, { key: url },
12742
- React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
13151
+ 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) => {
13152
+ return (React.createElement(SwiperSlide, { key: index },
13153
+ React.createElement(Picture, { src: !isLoad && index > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
12743
13154
  })));
12744
13155
  };
12745
13156
  var PictureGroup$3 = React.memo(PictureGroup$2);
@@ -12959,7 +13370,7 @@ Made in Italy` })));
12959
13370
  * @Author: binruan@chatlabs.com
12960
13371
  * @Date: 2024-01-15 19:03:09
12961
13372
  * @LastEditors: binruan@chatlabs.com
12962
- * @LastEditTime: 2024-06-06 18:42:24
13373
+ * @LastEditTime: 2024-06-07 11:10:42
12963
13374
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12964
13375
  *
12965
13376
  */
@@ -12986,32 +13397,11 @@ Made in Italy` })));
12986
13397
  return;
12987
13398
  }
12988
13399
  initTime();
12989
- // 刷新 sessionId
12990
- // refreshFeSessionId();
12991
- const queryString = location.search.slice(1);
12992
- const params = qs.parse(queryString.replace(/\+/g, '%2B'));
12993
- for (const key in params) {
12994
- params[key] = params[key].replace(/%2B/g, '+');
12995
- }
12996
- const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
12997
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12998
- eventInfo: {
12999
- eventSubject: 'h5LinkEnterFeed',
13000
- eventDescription: 'User enter h5 link',
13001
- utmSource: getVal('utm_source'),
13002
- utmMedium: getVal('utm_medium'),
13003
- utmCampaign: getVal('utm_campaign'),
13004
- utmId: getVal('utm_id'),
13005
- utmContent: getVal('utm_content'),
13006
- enterTime: `${Date.now()}`,
13007
- requestId: null
13008
- }
13009
- });
13010
13400
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
13011
13401
  eventName: 'PageView'
13012
13402
  });
13013
13403
  setIsInit(true);
13014
- }, [bffEventReport, data.length, bffFbReport]);
13404
+ }, [data.length, bffFbReport]);
13015
13405
  const initTime = () => {
13016
13406
  curTime.current = new Date();
13017
13407
  viewTime.current = new Date();
@@ -13064,26 +13454,6 @@ Made in Italy` })));
13064
13454
  })) || 0;
13065
13455
  (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
13066
13456
  }, [ctaType, swiperRef]);
13067
- // useEffect(() => {
13068
- // const handleBeforeUnload = (event: any) => {
13069
- // event.preventDefault();
13070
- // const item = data?.[activeIndex];
13071
- // bffEventReport?.({
13072
- // eventInfo: {
13073
- // sessionDuration: Math.floor(((new Date() as any) - curTime) / 1000) + '',
13074
- // eventSubject: 'sessionCompleted',
13075
- // eventDescription: 'Session completed',
13076
- // contentId: item?.video?.itemId,
13077
- // productId: item?.product?.itemId,
13078
- // position: item?.position
13079
- // }
13080
- // });
13081
- // };
13082
- // window.addEventListener('beforeunload', handleBeforeUnload);
13083
- // return () => {
13084
- // window.removeEventListener('beforeunload', handleBeforeUnload);
13085
- // };
13086
- // }, [activeIndex, data, bffEventReport, curTime]);
13087
13457
  React.useEffect(() => {
13088
13458
  const item = data === null || data === void 0 ? void 0 : data[activeIndex];
13089
13459
  const visibleChange = () => {