pb-sxp-ui 1.0.78 → 1.0.79

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 +407 -38
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +187 -1
  4. package/dist/index.js +407 -38
  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 +407 -38
  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 +4 -1
  20. package/es/core/context/SxpDataSourceProvider.js +6 -0
  21. package/es/materials/sxp/HashTag/index.d.ts +2 -0
  22. package/es/materials/sxp/HashTag/settingRender.d.ts +7 -2
  23. package/es/materials/sxp/HashTag/settingRender.js +15 -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 +4 -1
  30. package/lib/core/context/SxpDataSourceProvider.js +6 -0
  31. package/lib/materials/sxp/HashTag/index.d.ts +2 -0
  32. package/lib/materials/sxp/HashTag/settingRender.d.ts +7 -2
  33. package/lib/materials/sxp/HashTag/settingRender.js +15 -0
  34. package/package.json +1 -1
package/dist/pb-ui.js CHANGED
@@ -642,6 +642,12 @@
642
642
  setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
643
643
  })
644
644
  .finally(() => {
645
+ bffEventReport({
646
+ eventInfo: {
647
+ eventSubject: 'apiRequest',
648
+ eventDescription: 'api request succeed'
649
+ }
650
+ });
645
651
  setLoading(false);
646
652
  isInit.current = true;
647
653
  });
@@ -10353,19 +10359,29 @@ Made in Italy` })));
10353
10359
  *
10354
10360
  */
10355
10361
  var settingRender = [
10362
+ {
10363
+ title: 'Banner',
10364
+ child: [
10365
+ {
10366
+ type: 'Switch',
10367
+ label: 'Banner图开关',
10368
+ name: ['props', 'showBanner']
10369
+ }
10370
+ ]
10371
+ },
10356
10372
  {
10357
10373
  title: '卡片样式',
10358
10374
  child: [
10359
- // {
10360
- // type: 'Number',
10361
- // label: '文本行数',
10362
- // name: ['props', 'lineClamp']
10363
- // },
10364
10375
  {
10365
10376
  type: 'Number',
10366
10377
  label: '上下边距',
10367
10378
  name: ['props', 'space'],
10368
10379
  addonAfter: 'px'
10380
+ },
10381
+ {
10382
+ type: 'Switch',
10383
+ label: '固定宽高',
10384
+ name: ['props', 'isWaterfallFlow']
10369
10385
  }
10370
10386
  ]
10371
10387
  },
@@ -11834,6 +11850,374 @@ Made in Italy` })));
11834
11850
  hashTag: hashTag
11835
11851
  };
11836
11852
 
11853
+ const WaterfallFlowItem$1 = (props) => {
11854
+ const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
11855
+ const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
11856
+ const [showVideo, setShowVideo] = React.useState(false);
11857
+ const [isLoading, setIsLoading] = React.useState(false);
11858
+ const [imgInfo, setImgInfo] = React.useState({
11859
+ height: 1,
11860
+ width: 1
11861
+ });
11862
+ const imgDom = React.useRef(null);
11863
+ const ref = React.useRef(null);
11864
+ const videoDom = React.useRef(null);
11865
+ const canvasRef = React.useRef(null);
11866
+ const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
11867
+ const src = React.useMemo(() => {
11868
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11869
+ if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) {
11870
+ return (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
11871
+ }
11872
+ 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) {
11873
+ 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];
11874
+ }
11875
+ 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) {
11876
+ 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];
11877
+ }
11878
+ else {
11879
+ return (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) || '';
11880
+ }
11881
+ }, [rec, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image]);
11882
+ const title = React.useMemo(() => {
11883
+ var _a, _b;
11884
+ 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;
11885
+ }, [rec]);
11886
+ /** 离父亲上边框的距离 */
11887
+ const top = React.useMemo(() => {
11888
+ var _a;
11889
+ const y = style.transform
11890
+ ? Number((_a = style.transform) === null || _a === void 0 ? void 0 : _a.substring(style.transform.indexOf(',', 0) + 1, style.transform.length - 3))
11891
+ : undefined;
11892
+ return y;
11893
+ }, [style]);
11894
+ /** 是否加载图片 */
11895
+ const isImgShow = React.useMemo(() => {
11896
+ if (top === undefined) {
11897
+ return false;
11898
+ }
11899
+ if (top <= showBorder) {
11900
+ return true;
11901
+ }
11902
+ else {
11903
+ return false;
11904
+ }
11905
+ }, [top, showBorder]);
11906
+ const priceText = React.useMemo(() => {
11907
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11908
+ 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)) {
11909
+ 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', {
11910
+ minimumFractionDigits: 0
11911
+ })) !== null && _j !== void 0 ? _j : ''}`;
11912
+ }
11913
+ else {
11914
+ return null;
11915
+ }
11916
+ }, [rec]);
11917
+ React.useEffect(() => {
11918
+ if (imgDom.current === null || src === '') {
11919
+ return;
11920
+ }
11921
+ const img = new Image();
11922
+ if (showVideo && firstFrameSrc) {
11923
+ img.src = firstFrameSrc;
11924
+ }
11925
+ else {
11926
+ img.src = src;
11927
+ }
11928
+ img.onload = () => {
11929
+ setImgInfo({
11930
+ height: img.height,
11931
+ width: img.width
11932
+ });
11933
+ setIsLoading(true);
11934
+ };
11935
+ imgDom.current.setSrc(img.src);
11936
+ }, [src, showVideo, firstFrameSrc, isImgShow]);
11937
+ React.useEffect(() => {
11938
+ // 通过宽度比例获取图片高度
11939
+ const height = imgInfo.height * (unitWidth / imgInfo.width);
11940
+ if (isLoading) {
11941
+ // 加40是因为下方文字部分高度为40,可以自己设置
11942
+ sizeChange(height + 76 + space, index);
11943
+ }
11944
+ }, [imgInfo, index, unitWidth, isLoading, space]); /* 增加sizeChange依赖项会导致在admin预览编辑时无限刷新 */
11945
+ const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
11946
+ const aspectRatio = videoWidth / videoHeight;
11947
+ const targetHeight = targetWidth / aspectRatio;
11948
+ return targetHeight;
11949
+ };
11950
+ React.useEffect(() => {
11951
+ const video = videoDom === null || videoDom === void 0 ? void 0 : videoDom.current;
11952
+ if (video === null || src === '' || !showVideo) {
11953
+ return;
11954
+ }
11955
+ video.src = src;
11956
+ video.currentTime = 1;
11957
+ video.crossOrigin = 'anonymous';
11958
+ video.onloadeddata = () => {
11959
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
11960
+ if (!canvas)
11961
+ return;
11962
+ const ctx = canvas.getContext('2d');
11963
+ const targetWidth = (window === null || window === void 0 ? void 0 : window.innerWidth) / 2;
11964
+ const targetHeight = calculateHeightForWidth(video.videoWidth, video.videoHeight, targetWidth);
11965
+ canvas.height = targetHeight;
11966
+ canvas.width = targetWidth;
11967
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
11968
+ setFirstFrameSrc(canvas.toDataURL());
11969
+ video.remove();
11970
+ canvas.remove();
11971
+ };
11972
+ }, [src, showVideo]);
11973
+ const handleClickToDetail = () => {
11974
+ reportTagsView();
11975
+ setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
11976
+ setTimeout(() => {
11977
+ var _a;
11978
+ (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index, 0, false);
11979
+ setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
11980
+ }, 0);
11981
+ };
11982
+ return (React.createElement("div", { ref: ref, style: Object.assign({}, style), className: 'waterFallList-content-listItem', key: index, onClick: handleClickToDetail },
11983
+ React.createElement("div", { className: 'waterFallList-content-listItem-picture' },
11984
+ showVideo && (React.createElement("div", { style: { display: 'none' } },
11985
+ React.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
11986
+ React.createElement("canvas", { ref: canvasRef }))),
11987
+ React.createElement(FormatImage$1, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
11988
+ React.createElement("div", { className: 'waterFallList-content-listItem-info' },
11989
+ 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),
11990
+ React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
11991
+ };
11992
+ function WaterfallList$1(_a) {
11993
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
11994
+ var { reportTagsView } = _a, props = __rest(_a, ["reportTagsView"]);
11995
+ const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
11996
+ /** 滚动的父元素 */
11997
+ const scrollParent = React.useRef(null);
11998
+ /** 向上滚动的距离 */
11999
+ const [scrollTop, setScrollTop] = React.useState(0);
12000
+ /** 数据列表 */
12001
+ const [data, setData] = React.useState();
12002
+ const waterfallFlowDom = React.useRef(null);
12003
+ /** 样式列表 */
12004
+ const [styleList, setStyleList] = React.useState([]);
12005
+ const styleListRef = React.useRef();
12006
+ /** 自定义骨架屏高度 */
12007
+ const heightList = [170, 230, 300];
12008
+ /** 到达底部 */
12009
+ const [isLoadingData, setIsLoadingData] = React.useState(false);
12010
+ const [list, setList] = React.useState([]);
12011
+ const buttonRef = React.useRef();
12012
+ /** 生成随机数 */
12013
+ const createRandomNum = React.useCallback((min, max) => {
12014
+ return Math.floor(Math.random() * (max - min + 1)) + min;
12015
+ }, []);
12016
+ const waterfallFlowListInfo = React.useRef([]);
12017
+ /** 当前容器信息 */
12018
+ const [frameInfo, setFrameInfoInfo] = React.useState({ width: 0 });
12019
+ /** 每行个数 */
12020
+ const rowsNum = React.useMemo(() => {
12021
+ const width = frameInfo.width || 0;
12022
+ if (width >= 1200) {
12023
+ return 6;
12024
+ }
12025
+ else if (width >= 768 && width <= 1199) {
12026
+ return 4;
12027
+ }
12028
+ else {
12029
+ return 2;
12030
+ }
12031
+ }, [frameInfo]);
12032
+ /** 每一个的宽度 */
12033
+ const unitWidth = React.useMemo(() => {
12034
+ return frameInfo.width / rowsNum - 2;
12035
+ }, [rowsNum, frameInfo]);
12036
+ /** 获取位置 */
12037
+ const getStyleList = React.useCallback(() => {
12038
+ var _a;
12039
+ const temporaryStyleList = (_a = styleListRef.current) !== null && _a !== void 0 ? _a : [];
12040
+ /** 目前最下一行的index */
12041
+ const bottomItemIndex = [];
12042
+ for (let i = 0; i < (list === null || list === void 0 ? void 0 : list.length); i++) {
12043
+ // 原本应对应的行数
12044
+ const currentRow = Math.floor(i / rowsNum);
12045
+ //
12046
+ const remainder = (i % rowsNum) + 1;
12047
+ // 最低item下标
12048
+ let minHeightInd = 0;
12049
+ // 最低高度
12050
+ let minHeight = 9999999999;
12051
+ // 寻找最低高度的下标
12052
+ if (currentRow === 0) {
12053
+ bottomItemIndex[i] = i;
12054
+ }
12055
+ else {
12056
+ for (let j = 0; j < bottomItemIndex.length; j++) {
12057
+ if (waterfallFlowListInfo.current[bottomItemIndex[j]].top +
12058
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height <
12059
+ minHeight) {
12060
+ minHeightInd = j;
12061
+ minHeight =
12062
+ waterfallFlowListInfo.current[bottomItemIndex[j]].top +
12063
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height;
12064
+ }
12065
+ }
12066
+ bottomItemIndex[minHeightInd] = i;
12067
+ }
12068
+ if (waterfallFlowListInfo.current[i] === undefined) {
12069
+ waterfallFlowListInfo.current[i] = {};
12070
+ }
12071
+ // 第一行特殊处理,一定是从左到右铺的
12072
+ if (currentRow === 0) {
12073
+ if (remainder === 1) {
12074
+ waterfallFlowListInfo.current[i].left = 0;
12075
+ }
12076
+ else {
12077
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[i - 1].left + unitWidth + 4;
12078
+ }
12079
+ waterfallFlowListInfo.current[i].top = 0;
12080
+ }
12081
+ // 剩下的行数,铺在当前最低高度下面
12082
+ else {
12083
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[minHeightInd].left;
12084
+ waterfallFlowListInfo.current[i].top = minHeight;
12085
+ }
12086
+ // 是否已经有高度,有高度使用已有高度,否则随机生成
12087
+ waterfallFlowListInfo.current[i].height =
12088
+ waterfallFlowListInfo.current[i].height || heightList[createRandomNum(0, 2)];
12089
+ temporaryStyleList[i] = {
12090
+ transform: `translate(${waterfallFlowListInfo.current[i].left}px,${waterfallFlowListInfo.current[i].top}px)`,
12091
+ width: `${unitWidth}px`,
12092
+ height: waterfallFlowListInfo.current[i].height
12093
+ };
12094
+ }
12095
+ setStyleList([...temporaryStyleList]);
12096
+ return [...temporaryStyleList];
12097
+ }, [unitWidth, rowsNum, heightList, createRandomNum, list]);
12098
+ /** 图片加载完更新高度 */
12099
+ const onSizeChange = React.useCallback((height, index) => {
12100
+ if (waterfallFlowListInfo.current[index] === undefined) {
12101
+ waterfallFlowListInfo.current[index] = {};
12102
+ }
12103
+ waterfallFlowListInfo.current[index].height = height;
12104
+ styleListRef.current = getStyleList();
12105
+ }, [getStyleList]);
12106
+ /** 大小、数量发生变化时触发 */
12107
+ React.useEffect(() => {
12108
+ styleListRef.current = getStyleList();
12109
+ }, [unitWidth, rowsNum, list]); /* 增加getStyleList依赖项会导致在admin预览编辑时无限刷新 */
12110
+ /** 初始化请求数据 */
12111
+ React.useEffect(() => {
12112
+ var _a, _b;
12113
+ setIsLoadingData(true);
12114
+ waterFallData &&
12115
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12116
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12117
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12118
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
12119
+ defaultSize: hashTagSize,
12120
+ maxSize: hashTagSize
12121
+ }).then((res) => {
12122
+ var _a, _b;
12123
+ setData(res);
12124
+ 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 : []);
12125
+ setIsLoadingData(false);
12126
+ }));
12127
+ if (isOpenHashTag) {
12128
+ const res = previewData;
12129
+ setData(res);
12130
+ 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 : []);
12131
+ setIsLoadingData(false);
12132
+ }
12133
+ }, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
12134
+ const onResize = React.useCallback(() => {
12135
+ if (waterfallFlowDom.current === null) {
12136
+ return;
12137
+ }
12138
+ setFrameInfoInfo({
12139
+ width: waterfallFlowDom.current.getBoundingClientRect().width
12140
+ });
12141
+ }, []);
12142
+ /** 监听列表容器大小变化 */
12143
+ React.useEffect(() => {
12144
+ if (waterfallFlowDom.current === null) {
12145
+ return;
12146
+ }
12147
+ const resizeObserver = new ResizeObserver((entries) => {
12148
+ onResize();
12149
+ });
12150
+ resizeObserver.observe(waterfallFlowDom.current);
12151
+ return () => {
12152
+ resizeObserver.disconnect();
12153
+ };
12154
+ }, [onResize]);
12155
+ React.useCallback(() => {
12156
+ setIsLoadingData(true);
12157
+ waterFallData &&
12158
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12159
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12160
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12161
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
12162
+ }).then((res) => {
12163
+ var _a, _b;
12164
+ 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 : []));
12165
+ setIsLoadingData(false);
12166
+ }));
12167
+ }, [waterFallData, getRecommendVideos, list]);
12168
+ const onScroll = React.useCallback(() => {
12169
+ // 记录滚动值
12170
+ setScrollTop(scrollParent.current.scrollTop);
12171
+ // const top = (scrollParent.current as any).scrollTop;
12172
+ // const clientHeight = (scrollParent.current as any).clientHeight;
12173
+ // const scrollHeight = (scrollParent.current as any).scrollHeight;
12174
+ // // 做底部加载
12175
+ // if (scrollHeight <= top + clientHeight && !isLoadingData) {
12176
+ // loadMoreData();
12177
+ // }
12178
+ }, []);
12179
+ /** 监听滚动 */
12180
+ React.useEffect(() => {
12181
+ var _a;
12182
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', onScroll);
12183
+ return () => {
12184
+ var _a;
12185
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', onScroll);
12186
+ };
12187
+ }, [onScroll, scrollParent]);
12188
+ const handleClickLink = () => {
12189
+ var _a, _b;
12190
+ if ((_a = data === null || data === void 0 ? void 0 : data.tag) === null || _a === void 0 ? void 0 : _a.link) {
12191
+ reportTagsView();
12192
+ window.location.href = (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.link;
12193
+ }
12194
+ };
12195
+ return (React.createElement(React.Fragment, null, isLoadingData ? (React.createElement("div", { style: { height: '100%', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' } },
12196
+ React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { className: 'waterFallList', ref: waterfallFlowDom },
12197
+ React.createElement("div", { className: 'waterFallList-scroll', ref: scrollParent },
12198
+ 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),
12199
+ 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'),
12200
+ React.createElement("div", { className: 'waterFallList-content' }, list === null || list === void 0 ? void 0 :
12201
+ list.map((item, ind) => {
12202
+ var _a;
12203
+ 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)));
12204
+ }),
12205
+ React.createElement("div", { hidden: !((_g = data === null || data === void 0 ? void 0 : data.tag) === null || _g === void 0 ? void 0 : _g.link), style: {
12206
+ position: 'absolute',
12207
+ width: '100%',
12208
+ 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) +
12209
+ ((_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)`,
12210
+ height: ((_o = data === null || data === void 0 ? void 0 : data.tag) === null || _o === void 0 ? void 0 : _o.link)
12211
+ ? ((_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'
12212
+ : 0
12213
+ } }))),
12214
+ 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 }),
12215
+ 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' }) },
12216
+ 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'))))));
12217
+ }
12218
+
12219
+ var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12220
+
11837
12221
  const WaterfallFlowItem = (props) => {
11838
12222
  const { rec, index, list, reportTagsView, textStyles, space } = props;
11839
12223
  const { swiperRef, setRtcList, setOpenHashtag, bffEventReport, sxpParameter } = useSxpDataSource();
@@ -12044,13 +12428,11 @@ Made in Italy` })));
12044
12428
  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
12429
  }
12046
12430
 
12047
- var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12048
-
12049
12431
  /*
12050
12432
  * @Author: binruan@chatlabs.com
12051
12433
  * @Date: 2024-01-10 10:58:24
12052
12434
  * @LastEditors: binruan@chatlabs.com
12053
- * @LastEditTime: 2024-04-15 17:57:59
12435
+ * @LastEditTime: 2024-06-07 10:35:35
12054
12436
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
12055
12437
  *
12056
12438
  */
@@ -12144,7 +12526,7 @@ Made in Italy` })));
12144
12526
  display: openHashtag ? 'block' : 'none'
12145
12527
  } },
12146
12528
  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);
12529
+ (props === null || props === void 0 ? void 0 : props.isWaterfallFlow) ? (React.createElement(WaterfallList$1, Object.assign({ reportTagsView: reportTagsView }, props))) : (React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props)))), modalEleRef.current);
12148
12530
  };
12149
12531
  var WaterFall$1 = React.memo(WaterFall);
12150
12532
 
@@ -12668,7 +13050,7 @@ Made in Italy` })));
12668
13050
  *
12669
13051
  */
12670
13052
  const Picture = (props) => {
12671
- const { src, height, imgUrlsPostConfig } = props;
13053
+ const { src, height, imgUrlsPostConfig, onShowFirstImage } = props;
12672
13054
  const blur = React.useMemo(() => {
12673
13055
  return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2';
12674
13056
  }, [imgUrlsPostConfig]);
@@ -12693,7 +13075,7 @@ Made in Italy` })));
12693
13075
  return isBgColor && (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor) ? { backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor } : {};
12694
13076
  }, [imgUrlsPostConfig, isBgColor]);
12695
13077
  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) })),
13078
+ (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle), onLoad: onShowFirstImage })),
12697
13079
  blur && (React.createElement(FormatImage$1, { src: src, style: {
12698
13080
  width: '100%',
12699
13081
  height: '100%',
@@ -12710,7 +13092,7 @@ Made in Italy` })));
12710
13092
  * @Author: lewinlu@chatlabs.com
12711
13093
  * @Date: 2024-01-03 14:39:09
12712
13094
  * @LastEditors: binruan@chatlabs.com
12713
- * @LastEditTime: 2024-04-18 19:56:22
13095
+ * @LastEditTime: 2024-06-07 14:05:08
12714
13096
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12715
13097
  */
12716
13098
  const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
@@ -12730,16 +13112,20 @@ Made in Italy` })));
12730
13112
  }
12731
13113
  }
12732
13114
  else {
12733
- setIsLoad(true);
12734
13115
  (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
12735
13116
  }
12736
13117
  }, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
13118
+ const showFirstImageFn = React.useCallback(() => {
13119
+ if (!isLoad) {
13120
+ setIsLoad(true);
13121
+ }
13122
+ }, [isLoad]);
12737
13123
  // if (!isActive) {
12738
13124
  // return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
12739
13125
  // }
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 })));
13126
+ 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) => {
13127
+ return (React.createElement(SwiperSlide, { key: index },
13128
+ React.createElement(Picture, { src: !isLoad && index > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
12743
13129
  })));
12744
13130
  };
12745
13131
  var PictureGroup$3 = React.memo(PictureGroup$2);
@@ -12959,7 +13345,7 @@ Made in Italy` })));
12959
13345
  * @Author: binruan@chatlabs.com
12960
13346
  * @Date: 2024-01-15 19:03:09
12961
13347
  * @LastEditors: binruan@chatlabs.com
12962
- * @LastEditTime: 2024-06-06 18:42:24
13348
+ * @LastEditTime: 2024-06-07 11:10:42
12963
13349
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12964
13350
  *
12965
13351
  */
@@ -12982,6 +13368,7 @@ Made in Italy` })));
12982
13368
  return data.length > 0 && !loading && getFeUserId();
12983
13369
  }, [data, loading]);
12984
13370
  const handleH5EnterLink = React.useCallback(() => {
13371
+ var _a, _b;
12985
13372
  if (data.length <= 0) {
12986
13373
  return;
12987
13374
  }
@@ -13004,7 +13391,9 @@ Made in Italy` })));
13004
13391
  utmId: getVal('utm_id'),
13005
13392
  utmContent: getVal('utm_content'),
13006
13393
  enterTime: `${Date.now()}`,
13007
- requestId: null
13394
+ requestId: null,
13395
+ 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 : '',
13396
+ clSource: getVal('cl_sourc')
13008
13397
  }
13009
13398
  });
13010
13399
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
@@ -13064,26 +13453,6 @@ Made in Italy` })));
13064
13453
  })) || 0;
13065
13454
  (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
13066
13455
  }, [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
13456
  React.useEffect(() => {
13088
13457
  const item = data === null || data === void 0 ? void 0 : data[activeIndex];
13089
13458
  const visibleChange = () => {