pb-sxp-ui 1.0.77 → 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.
package/dist/index.cjs CHANGED
@@ -650,6 +650,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
650
650
  setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
651
651
  })
652
652
  .finally(() => {
653
+ bffEventReport({
654
+ eventInfo: {
655
+ eventSubject: 'apiRequest',
656
+ eventDescription: 'api request succeed'
657
+ }
658
+ });
653
659
  setLoading(false);
654
660
  isInit.current = true;
655
661
  });
@@ -11852,7 +11858,7 @@ var previewData = {
11852
11858
  hashTag: hashTag
11853
11859
  };
11854
11860
 
11855
- const WaterfallFlowItem = (props) => {
11861
+ const WaterfallFlowItem$1 = (props) => {
11856
11862
  const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
11857
11863
  const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
11858
11864
  const [showVideo, setShowVideo] = React.useState(false);
@@ -11916,29 +11922,8 @@ const WaterfallFlowItem = (props) => {
11916
11922
  return null;
11917
11923
  }
11918
11924
  }, [rec]);
11919
- // useEffect(() => {
11920
- // const observer = new IntersectionObserver((entries) => {
11921
- // entries.forEach((entry) => {
11922
- // if (entry.isIntersecting) {
11923
- // if (ref.current === null || src === '') {
11924
- // return;
11925
- // }
11926
- // if (showVideo && firstFrameSrc) {
11927
- // imgDom.current.setSrc(firstFrameSrc);
11928
- // } else {
11929
- // imgDom.current.setSrc(src);
11930
- // }
11931
- // observer.unobserve(ref.current);
11932
- // }
11933
- // });
11934
- // });
11935
- // observer.observe(ref.current);
11936
- // return () => {
11937
- // observer.disconnect();
11938
- // };
11939
- // }, [src, showVideo, firstFrameSrc]);
11940
11925
  React.useEffect(() => {
11941
- if (imgDom.current === null || src === '' || isImgShow === false) {
11926
+ if (imgDom.current === null || src === '') {
11942
11927
  return;
11943
11928
  }
11944
11929
  const img = new Image();
@@ -11955,8 +11940,7 @@ const WaterfallFlowItem = (props) => {
11955
11940
  });
11956
11941
  setIsLoading(true);
11957
11942
  };
11958
- // imgDom.current.setSrc(img.src);
11959
- imgDom.current.src = img.src;
11943
+ imgDom.current.setSrc(img.src);
11960
11944
  }, [src, showVideo, firstFrameSrc, isImgShow]);
11961
11945
  React.useEffect(() => {
11962
11946
  // 通过宽度比例获取图片高度
@@ -12008,12 +11992,12 @@ const WaterfallFlowItem = (props) => {
12008
11992
  showVideo && (React.createElement("div", { style: { display: 'none' } },
12009
11993
  React.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
12010
11994
  React.createElement("canvas", { ref: canvasRef }))),
12011
- React.createElement("img", { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
11995
+ React.createElement(FormatImage$1, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
12012
11996
  React.createElement("div", { className: 'waterFallList-content-listItem-info' },
12013
11997
  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),
12014
11998
  React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
12015
11999
  };
12016
- function WaterfallList(_a) {
12000
+ function WaterfallList$1(_a) {
12017
12001
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
12018
12002
  var { reportTagsView } = _a, props = __rest(_a, ["reportTagsView"]);
12019
12003
  const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
@@ -12224,7 +12208,7 @@ function WaterfallList(_a) {
12224
12208
  React.createElement("div", { className: 'waterFallList-content' }, list === null || list === void 0 ? void 0 :
12225
12209
  list.map((item, ind) => {
12226
12210
  var _a;
12227
- return (React.createElement(WaterfallFlowItem, 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)));
12211
+ 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)));
12228
12212
  }),
12229
12213
  React.createElement("div", { hidden: !((_g = data === null || data === void 0 ? void 0 : data.tag) === null || _g === void 0 ? void 0 : _g.link), style: {
12230
12214
  position: 'absolute',
@@ -12242,11 +12226,221 @@ function WaterfallList(_a) {
12242
12226
 
12243
12227
  var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12244
12228
 
12229
+ const WaterfallFlowItem = (props) => {
12230
+ const { rec, index, list, reportTagsView, textStyles, space } = props;
12231
+ const { swiperRef, setRtcList, setOpenHashtag, bffEventReport, sxpParameter } = useSxpDataSource();
12232
+ const [showVideo, setShowVideo] = React.useState(false);
12233
+ const imgDom = React.useRef(null);
12234
+ const ref = React.useRef(null);
12235
+ const videoDom = React.useRef(null);
12236
+ const canvasRef = React.useRef(null);
12237
+ const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
12238
+ const src = React.useMemo(() => {
12239
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
12240
+ if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) {
12241
+ return (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
12242
+ }
12243
+ 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) {
12244
+ 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];
12245
+ }
12246
+ 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) {
12247
+ 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];
12248
+ }
12249
+ else {
12250
+ return (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) || '';
12251
+ }
12252
+ }, [rec, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image]);
12253
+ const title = React.useMemo(() => {
12254
+ var _a, _b;
12255
+ 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;
12256
+ }, [rec]);
12257
+ const priceText = React.useMemo(() => {
12258
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
12259
+ 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)) {
12260
+ 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', {
12261
+ minimumFractionDigits: 0
12262
+ })) !== null && _j !== void 0 ? _j : ''}`;
12263
+ }
12264
+ else {
12265
+ return null;
12266
+ }
12267
+ }, [rec]);
12268
+ // useEffect(() => {
12269
+ // if (imgDom.current === null || src === '') {
12270
+ // return;
12271
+ // }
12272
+ // const img = new Image();
12273
+ // if (showVideo && firstFrameSrc) {
12274
+ // img.src = firstFrameSrc;
12275
+ // } else {
12276
+ // img.src = src;
12277
+ // }
12278
+ // // img.onload = () => {
12279
+ // // setIsLoading(true);
12280
+ // // };
12281
+ // imgDom.current.src = img.src;
12282
+ // }, [src, showVideo, firstFrameSrc]);
12283
+ React.useEffect(() => {
12284
+ const observer = new IntersectionObserver((entries) => {
12285
+ entries.forEach((entry) => {
12286
+ if (entry.isIntersecting) {
12287
+ if (ref.current === null || src === '') {
12288
+ return;
12289
+ }
12290
+ if (showVideo && firstFrameSrc) {
12291
+ imgDom.current.setSrc(firstFrameSrc);
12292
+ }
12293
+ else {
12294
+ imgDom.current.setSrc(src);
12295
+ }
12296
+ observer.unobserve(ref.current);
12297
+ }
12298
+ });
12299
+ });
12300
+ observer.observe(ref.current);
12301
+ return () => {
12302
+ observer.disconnect();
12303
+ };
12304
+ }, [src, showVideo, firstFrameSrc]);
12305
+ const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
12306
+ const aspectRatio = videoWidth / videoHeight;
12307
+ const targetHeight = targetWidth / aspectRatio;
12308
+ return targetHeight;
12309
+ };
12310
+ React.useEffect(() => {
12311
+ const video = videoDom === null || videoDom === void 0 ? void 0 : videoDom.current;
12312
+ if (video === null || src === '' || !showVideo) {
12313
+ return;
12314
+ }
12315
+ video.src = src;
12316
+ video.currentTime = 1;
12317
+ video.crossOrigin = 'anonymous';
12318
+ video.onloadeddata = () => {
12319
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12320
+ if (!canvas)
12321
+ return;
12322
+ const ctx = canvas.getContext('2d');
12323
+ const targetWidth = (window === null || window === void 0 ? void 0 : window.innerWidth) / 2;
12324
+ const targetHeight = calculateHeightForWidth(video.videoWidth, video.videoHeight, targetWidth);
12325
+ canvas.height = targetHeight;
12326
+ canvas.width = targetWidth;
12327
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12328
+ setFirstFrameSrc(canvas.toDataURL());
12329
+ video.remove();
12330
+ canvas.remove();
12331
+ };
12332
+ }, [src, showVideo]);
12333
+ const handleClickToDetail = () => {
12334
+ reportTagsView();
12335
+ setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
12336
+ setTimeout(() => {
12337
+ var _a;
12338
+ (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index, 0, false);
12339
+ setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
12340
+ }, 0);
12341
+ };
12342
+ return (React.createElement("div", { ref: ref, className: 'list-content-listItem', key: index, onClick: handleClickToDetail, style: { marginBottom: space } },
12343
+ React.createElement("div", { className: 'list-content-listItem-picture' },
12344
+ showVideo && (React.createElement("div", { style: { display: 'none' } },
12345
+ React.createElement("video", { ref: videoDom, crossOrigin: 'anonymous', className: 'list-content-listItem-picture-img' }),
12346
+ React.createElement("canvas", { ref: canvasRef }))),
12347
+ React.createElement(FormatImage$1, { loading: 'lazy', className: 'list-content-listItem-picture-img', ref: imgDom })),
12348
+ React.createElement("div", { className: 'list-content-listItem-info' },
12349
+ React.createElement("div", { className: `${'list-content-listItem-info-title'} ${priceText ? 'list-content-listItem-info-nowrap' : ''}`, style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.title }, title && title),
12350
+ React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
12351
+ };
12352
+ function WaterfallList(_a) {
12353
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12354
+ var { reportTagsView } = _a, props = __rest(_a, ["reportTagsView"]);
12355
+ const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
12356
+ const [list, setList] = React.useState();
12357
+ const [data, setData] = React.useState();
12358
+ const [isLoadingData, setIsLoadingData] = React.useState(false);
12359
+ const containerRef = React.useRef(null);
12360
+ const [isLoadMore, setIsLoadMore] = React.useState(false);
12361
+ React.useCallback(() => {
12362
+ if (isLoadMore)
12363
+ return;
12364
+ setIsLoadMore(true);
12365
+ waterFallData &&
12366
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12367
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12368
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12369
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
12370
+ }).then((res) => {
12371
+ var _a;
12372
+ setList(list === null || list === void 0 ? void 0 : list.concat((_a = res === null || res === void 0 ? void 0 : res.recList) !== null && _a !== void 0 ? _a : []));
12373
+ setIsLoadMore(false);
12374
+ }));
12375
+ }, [waterFallData, getRecommendVideos, list, isLoadMore]);
12376
+ React.useEffect(() => {
12377
+ var _a, _b;
12378
+ setIsLoadingData(true);
12379
+ waterFallData &&
12380
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12381
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12382
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12383
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
12384
+ defaultSize: hashTagSize,
12385
+ maxSize: hashTagSize
12386
+ }).then((res) => {
12387
+ var _a, _b;
12388
+ setData(res);
12389
+ 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 : []);
12390
+ setIsLoadingData(false);
12391
+ }));
12392
+ if (isOpenHashTag) {
12393
+ const res = previewData;
12394
+ setData(res);
12395
+ 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 : []);
12396
+ setIsLoadingData(false);
12397
+ }
12398
+ }, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
12399
+ // useEffect(() => {
12400
+ // const container = containerRef?.current;
12401
+ // if (!container) return;
12402
+ // const handleScroll = () => {
12403
+ // const top = (container as any)?.scrollTop;
12404
+ // const clientHeight = (container as any)?.clientHeight;
12405
+ // const scrollHeight = (container as any)?.scrollHeight;
12406
+ // if (scrollHeight <= top + clientHeight && !isLoadingData) {
12407
+ // loadMoreData();
12408
+ // }
12409
+ // };
12410
+ // container?.addEventListener('scroll', handleScroll);
12411
+ // return () => {
12412
+ // container?.removeEventListener('scroll', handleScroll); // 在组件卸载时移除事件监听器
12413
+ // };
12414
+ // }, [isLoadingData, containerRef, loadMoreData]);
12415
+ const handleClickLink = () => {
12416
+ var _a, _b;
12417
+ if ((_a = data === null || data === void 0 ? void 0 : data.tag) === null || _a === void 0 ? void 0 : _a.link) {
12418
+ reportTagsView();
12419
+ window.location.href = (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.link;
12420
+ }
12421
+ };
12422
+ return (React.createElement(React.Fragment, null, isLoadingData ? (React.createElement("div", { style: { height: '100%', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' } },
12423
+ React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { className: 'list' },
12424
+ React.createElement("div", { className: 'list-scroll', ref: containerRef },
12425
+ React.createElement("div", { className: 'list-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),
12426
+ React.createElement("div", { hidden: !((_d = data === null || data === void 0 ? void 0 : data.tag) === null || _d === void 0 ? void 0 : _d.link), className: 'list-collection', onClick: handleClickLink, style: Object.assign(Object.assign({}, (_e = props === null || props === void 0 ? void 0 : props.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagLink), { marginBottom: props === null || props === void 0 ? void 0 : props.space }) }, ((_f = data === null || data === void 0 ? void 0 : data.tag) === null || _f === void 0 ? void 0 : _f.linkTitle) || 'Shop the collection'),
12427
+ React.createElement("div", { className: 'list-content' }, list === null || list === void 0 ? void 0 : list.map((item, ind) => {
12428
+ return (React.createElement(WaterfallFlowItem, Object.assign({ key: ind, index: ind, rec: item, list: list, reportTagsView: reportTagsView }, props)));
12429
+ })),
12430
+ React.createElement("div", { hidden: !isLoadMore, style: { textAlign: 'center' } }, "loading..."),
12431
+ React.createElement("div", { hidden: !((_g = data === null || data === void 0 ? void 0 : data.tag) === null || _g === void 0 ? void 0 : _g.link), style: {
12432
+ height: ((_h = data === null || data === void 0 ? void 0 : data.tag) === null || _h === void 0 ? void 0 : _h.link) ? ((_j = props === null || props === void 0 ? void 0 : props.buttonBgStyle) === null || _j === void 0 ? void 0 : _j.height) || ((_k = props === null || props === void 0 ? void 0 : props.buttonStyle) === null || _k === void 0 ? void 0 : _k.height) || '100px' : 0
12433
+ } })),
12434
+ React.createElement("div", { className: 'list-bottom', hidden: !((_l = data === null || data === void 0 ? void 0 : data.tag) === null || _l === void 0 ? void 0 : _l.link), style: props === null || props === void 0 ? void 0 : props.buttonBgStyle }),
12435
+ React.createElement("div", { hidden: !((_m = data === null || data === void 0 ? void 0 : data.tag) === null || _m === void 0 ? void 0 : _m.link), className: 'list-btn-wrap', style: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.buttonBgStyle), { height: 'auto', backgroundColor: 'transparent' }) },
12436
+ 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'))))));
12437
+ }
12438
+
12245
12439
  /*
12246
12440
  * @Author: binruan@chatlabs.com
12247
12441
  * @Date: 2024-01-10 10:58:24
12248
12442
  * @LastEditors: binruan@chatlabs.com
12249
- * @LastEditTime: 2024-06-06 17:19:25
12443
+ * @LastEditTime: 2024-06-07 10:35:35
12250
12444
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
12251
12445
  *
12252
12446
  */
@@ -12340,7 +12534,7 @@ const WaterFall = (props) => {
12340
12534
  display: openHashtag ? 'block' : 'none'
12341
12535
  } },
12342
12536
  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 }),
12343
- React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props))), modalEleRef.current);
12537
+ (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);
12344
12538
  };
12345
12539
  var WaterFall$1 = React.memo(WaterFall);
12346
12540
 
@@ -12864,7 +13058,7 @@ const FingerSwipeTip = ({ imageUrl, style }) => {
12864
13058
  *
12865
13059
  */
12866
13060
  const Picture = (props) => {
12867
- const { src, height, imgUrlsPostConfig } = props;
13061
+ const { src, height, imgUrlsPostConfig, onShowFirstImage } = props;
12868
13062
  const blur = React.useMemo(() => {
12869
13063
  return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2';
12870
13064
  }, [imgUrlsPostConfig]);
@@ -12889,7 +13083,7 @@ const Picture = (props) => {
12889
13083
  return isBgColor && (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor) ? { backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor } : {};
12890
13084
  }, [imgUrlsPostConfig, isBgColor]);
12891
13085
  return (React.createElement("div", { style: Object.assign({ overflow: 'hidden', height, width: '100%', position: 'relative' }, bgStyle) },
12892
- (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
13086
+ (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle), onLoad: onShowFirstImage })),
12893
13087
  blur && (React.createElement(FormatImage$1, { src: src, style: {
12894
13088
  width: '100%',
12895
13089
  height: '100%',
@@ -12906,7 +13100,7 @@ const Picture = (props) => {
12906
13100
  * @Author: lewinlu@chatlabs.com
12907
13101
  * @Date: 2024-01-03 14:39:09
12908
13102
  * @LastEditors: binruan@chatlabs.com
12909
- * @LastEditTime: 2024-04-18 19:56:22
13103
+ * @LastEditTime: 2024-06-07 14:05:08
12910
13104
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12911
13105
  */
12912
13106
  const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
@@ -12926,16 +13120,20 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageE
12926
13120
  }
12927
13121
  }
12928
13122
  else {
12929
- setIsLoad(true);
12930
13123
  (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
12931
13124
  }
12932
13125
  }, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
13126
+ const showFirstImageFn = React.useCallback(() => {
13127
+ if (!isLoad) {
13128
+ setIsLoad(true);
13129
+ }
13130
+ }, [isLoad]);
12933
13131
  // if (!isActive) {
12934
13132
  // return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
12935
13133
  // }
12936
- 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) => {
12937
- return (React.createElement(SwiperSlide, { key: url },
12938
- React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
13134
+ 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) => {
13135
+ return (React.createElement(SwiperSlide, { key: index },
13136
+ React.createElement(Picture, { src: !isLoad && index > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
12939
13137
  })));
12940
13138
  };
12941
13139
  var PictureGroup$3 = React.memo(PictureGroup$2);
@@ -13155,7 +13353,7 @@ var Tagbar$1 = React.memo(Tagbar);
13155
13353
  * @Author: binruan@chatlabs.com
13156
13354
  * @Date: 2024-01-15 19:03:09
13157
13355
  * @LastEditors: binruan@chatlabs.com
13158
- * @LastEditTime: 2024-06-06 18:42:24
13356
+ * @LastEditTime: 2024-06-07 11:10:42
13159
13357
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
13160
13358
  *
13161
13359
  */
@@ -13178,6 +13376,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13178
13376
  return data.length > 0 && !loading && getFeUserId();
13179
13377
  }, [data, loading]);
13180
13378
  const handleH5EnterLink = React.useCallback(() => {
13379
+ var _a, _b;
13181
13380
  if (data.length <= 0) {
13182
13381
  return;
13183
13382
  }
@@ -13200,7 +13399,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13200
13399
  utmId: getVal('utm_id'),
13201
13400
  utmContent: getVal('utm_content'),
13202
13401
  enterTime: `${Date.now()}`,
13203
- requestId: null
13402
+ requestId: null,
13403
+ 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 : '',
13404
+ clSource: getVal('cl_sourc')
13204
13405
  }
13205
13406
  });
13206
13407
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
@@ -13260,26 +13461,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13260
13461
  })) || 0;
13261
13462
  (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
13262
13463
  }, [ctaType, swiperRef]);
13263
- // useEffect(() => {
13264
- // const handleBeforeUnload = (event: any) => {
13265
- // event.preventDefault();
13266
- // const item = data?.[activeIndex];
13267
- // bffEventReport?.({
13268
- // eventInfo: {
13269
- // sessionDuration: Math.floor(((new Date() as any) - curTime) / 1000) + '',
13270
- // eventSubject: 'sessionCompleted',
13271
- // eventDescription: 'Session completed',
13272
- // contentId: item?.video?.itemId,
13273
- // productId: item?.product?.itemId,
13274
- // position: item?.position
13275
- // }
13276
- // });
13277
- // };
13278
- // window.addEventListener('beforeunload', handleBeforeUnload);
13279
- // return () => {
13280
- // window.removeEventListener('beforeunload', handleBeforeUnload);
13281
- // };
13282
- // }, [activeIndex, data, bffEventReport, curTime]);
13283
13464
  React.useEffect(() => {
13284
13465
  const item = data === null || data === void 0 ? void 0 : data[activeIndex];
13285
13466
  const visibleChange = () => {