pb-sxp-ui 1.7.3 → 1.7.4

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/pb-ui.js CHANGED
@@ -823,17 +823,20 @@
823
823
  });
824
824
  }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview]);
825
825
  const bffFbReport = React.useCallback(({ eventName, product }) => {
826
- var _a, _b, _c, _d;
827
- if (!enableReportEvent || !enabledMetaConversionApi || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
826
+ var _a, _b, _c, _d, _e;
827
+ if (!enableReportEvent ||
828
+ !enabledMetaConversionApi ||
829
+ (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
830
+ !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
828
831
  return;
829
832
  }
830
- let jsonParams = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName];
833
+ let jsonParams = JSON.parse(JSON.stringify((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]));
831
834
  const urlParams = new URLSearchParams(window.location.search);
832
835
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
833
836
  const fix_par = {
834
- event_source_url: (_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href,
837
+ event_source_url: (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href,
835
838
  external_id: storeAndLoadFeUserId(),
836
- client_user_agent: (_d = (_c = window === null || window === void 0 ? void 0 : window.navigator) === null || _c === void 0 ? void 0 : _c.userAgent) !== null && _d !== void 0 ? _d : '',
839
+ client_user_agent: (_e = (_d = window === null || window === void 0 ? void 0 : window.navigator) === null || _d === void 0 ? void 0 : _d.userAgent) !== null && _e !== void 0 ? _e : '',
837
840
  fbc: fbclid ? `fb.2.${new Date().getTime()}.${fbclid}` : '',
838
841
  fbp: getCookie('_fbp') ? `fb.2.${new Date().getTime()}.${getCookie('_fbp')}` : '',
839
842
  time: new Date().getTime()
@@ -858,7 +861,7 @@
858
861
  matches.forEach((match) => {
859
862
  const prop = match.substring(2, match.length - 2);
860
863
  try {
861
- const replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
864
+ let replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
862
865
  if (replaceValue) {
863
866
  obj[key] = replaceValue;
864
867
  }
@@ -15900,7 +15903,7 @@ Made in Italy` })));
15900
15903
  };
15901
15904
  }, [isActive]);
15902
15905
  React.useEffect(() => {
15903
- var _a, _b, _c, _d;
15906
+ var _a, _b, _c, _d, _e, _f;
15904
15907
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
15905
15908
  return;
15906
15909
  if (isActive) {
@@ -15908,10 +15911,14 @@ Made in Italy` })));
15908
15911
  eventName: 'ViewContent',
15909
15912
  product: (_b = (_a = data === null || data === void 0 ? void 0 : data[index]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.bindProduct
15910
15913
  });
15911
- (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
15914
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
15915
+ eventName: 'PageView',
15916
+ product: (_d = (_c = data === null || data === void 0 ? void 0 : data[index]) === null || _c === void 0 ? void 0 : _c.video) === null || _d === void 0 ? void 0 : _d.bindProduct
15917
+ });
15918
+ (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
15912
15919
  }
15913
15920
  else {
15914
- (_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.pause();
15921
+ (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
15915
15922
  }
15916
15923
  }, [isActive, isLoadFinish, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
15917
15924
  /*
@@ -15933,12 +15940,7 @@ Made in Italy` })));
15933
15940
  if (!isActive)
15934
15941
  return;
15935
15942
  const onShow = () => {
15936
- var _a, _b;
15937
15943
  handleClickVideo('start')();
15938
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
15939
- eventName: 'ViewContent',
15940
- product: (_b = (_a = data === null || data === void 0 ? void 0 : data[index]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.bindProduct
15941
- });
15942
15944
  };
15943
15945
  const onHide = handleClickVideo('pause');
15944
15946
  SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
@@ -16109,7 +16111,7 @@ Made in Italy` })));
16109
16111
  }, onLoad: onShowFirstImage }))));
16110
16112
  };
16111
16113
 
16112
- const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
16114
+ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
16113
16115
  var _a, _b;
16114
16116
  const ref = React.useRef();
16115
16117
  const { isActive } = useSwiperSlide();
@@ -16121,16 +16123,16 @@ Made in Italy` })));
16121
16123
  if (isLoad && isActive) {
16122
16124
  (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.start();
16123
16125
  if (openHashtag) {
16124
- onReportViewImageEnd(rec);
16126
+ onViewImageEndEvent(rec);
16125
16127
  }
16126
16128
  else {
16127
- onViewImageStartEvent(index, imgInfo);
16129
+ onViewImageStartEvent(index, imgInfo, true);
16128
16130
  }
16129
16131
  }
16130
16132
  else {
16131
16133
  (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
16132
16134
  }
16133
- }, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
16135
+ }, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
16134
16136
  const showFirstImageFn = React.useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
16135
16137
  if (!isLoad) {
16136
16138
  const contentSize = yield getResFileSizeFromSrc(e.src);
@@ -16146,7 +16148,7 @@ Made in Italy` })));
16146
16148
  // }
16147
16149
  React.useEffect(() => {
16148
16150
  const onShow = () => onViewImageStartEvent(index, imgInfo);
16149
- const onHide = () => onReportViewImageEnd(rec);
16151
+ const onHide = () => onViewImageEndEvent(rec);
16150
16152
  SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
16151
16153
  SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_HIDE, onHide);
16152
16154
  return () => {
@@ -16292,7 +16294,7 @@ Made in Italy` })));
16292
16294
  * @Author: binruan@chatlabs.com
16293
16295
  * @Date: 2023-12-26 16:11:34
16294
16296
  * @LastEditors: binruan@chatlabs.com
16295
- * @LastEditTime: 2024-10-25 10:36:59
16297
+ * @LastEditTime: 2024-10-29 14:07:29
16296
16298
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\RenderCard.tsx
16297
16299
  *
16298
16300
  */
@@ -16439,7 +16441,7 @@ Made in Italy` })));
16439
16441
  * @Author: binruan@chatlabs.com
16440
16442
  * @Date: 2024-01-15 19:03:09
16441
16443
  * @LastEditors: binruan@chatlabs.com
16442
- * @LastEditTime: 2024-10-25 15:41:58
16444
+ * @LastEditTime: 2024-10-28 16:36:22
16443
16445
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
16444
16446
  *
16445
16447
  */
@@ -16509,7 +16511,6 @@ Made in Italy` })));
16509
16511
  // 移动端h5直接杀掉浏览器或宿主app时不会触发,pc端直接杀掉标签页时能触发
16510
16512
  if (repCond) {
16511
16513
  SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
16512
- // handleReportViewImageEnd(item);
16513
16514
  handleReportProductView(item);
16514
16515
  }
16515
16516
  let fromKName = '';
@@ -16554,7 +16555,6 @@ Made in Italy` })));
16554
16555
  // 页面可见时触发,注意页面初始化时不会触发
16555
16556
  handleH5EnterLink();
16556
16557
  if (repCond) {
16557
- // handleViewImageStartEvent(activeIndex);
16558
16558
  SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
16559
16559
  backMainFeed('external', selectTag);
16560
16560
  }
@@ -16639,7 +16639,7 @@ Made in Italy` })));
16639
16639
  return (React.createElement(VideoWidget$3, { key: isReload, rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon }));
16640
16640
  }
16641
16641
  if ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
16642
- return (React.createElement(PictureGroup$3, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onReportViewImageEnd: handleReportViewImageEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
16642
+ return (React.createElement(PictureGroup$3, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
16643
16643
  }
16644
16644
  if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _c === void 0 ? void 0 : _c.length) > 0) {
16645
16645
  return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
@@ -16713,7 +16713,7 @@ Made in Italy` })));
16713
16713
  if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike) || !visible)
16714
16714
  return;
16715
16715
  let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
16716
- if (waterFallData && top < 40) {
16716
+ if (waterFallData && top < 40 && globalConfig.likeIconYPosit === 'top') {
16717
16717
  top += 40;
16718
16718
  }
16719
16719
  if (rec === null || rec === void 0 ? void 0 : rec.video) {
@@ -16725,7 +16725,7 @@ Made in Italy` })));
16725
16725
  }
16726
16726
  return null;
16727
16727
  }, [globalConfig, waterFallData]);
16728
- const handleReportViewImageEnd = (item) => {
16728
+ const handleViewImageStartEnd = (item) => {
16729
16729
  var _a, _b, _c, _d, _e, _f;
16730
16730
  if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
16731
16731
  const endTime = Date.now();
@@ -16808,7 +16808,7 @@ Made in Italy` })));
16808
16808
  }
16809
16809
  });
16810
16810
  // 如果上一个商品是图片集,需上报 浏览图片集结结束 事件
16811
- handleReportViewImageEnd(item);
16811
+ handleViewImageStartEnd(item);
16812
16812
  handleSlideSkip(item, swiper.previousIndex);
16813
16813
  }
16814
16814
  else {
@@ -16825,7 +16825,7 @@ Made in Italy` })));
16825
16825
  }
16826
16826
  });
16827
16827
  // 如果上一个商品是图片集,需上报 浏览图片集结结束 事件
16828
- handleReportViewImageEnd(item);
16828
+ handleViewImageStartEnd(item);
16829
16829
  }
16830
16830
  // 商品浏览事件
16831
16831
  handleReportProductView(item);
@@ -16846,7 +16846,7 @@ Made in Italy` })));
16846
16846
  viewTime.current = new Date();
16847
16847
  }
16848
16848
  }, [openHashtag, data, activeIndex]);
16849
- const handleViewImageStartEvent = (activeIndex, imgInfo) => {
16849
+ const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
16850
16850
  var _a, _b, _c, _d, _e, _f, _g, _h;
16851
16851
  const item = data[activeIndex];
16852
16852
  // 如果是图片集则上报事件
@@ -16868,29 +16868,35 @@ Made in Italy` })));
16868
16868
  loadTime: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.loadTime
16869
16869
  }
16870
16870
  });
16871
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
16872
- eventName: 'ViewContent',
16873
- product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
16874
- });
16875
- bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
16876
- eventName: 'PageView',
16877
- product: (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.bindProduct
16878
- });
16871
+ if (enableCapi) {
16872
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
16873
+ eventName: 'ViewContent',
16874
+ product: (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.bindProduct
16875
+ });
16876
+ bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
16877
+ eventName: 'PageView',
16878
+ product: (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.bindProduct
16879
+ });
16880
+ }
16879
16881
  }
16880
16882
  };
16881
16883
  const renderToggleButton = React.useCallback((visible) => {
16882
16884
  var _a, _b, _c, _d, _e, _f;
16883
16885
  if (!visible)
16884
16886
  return;
16887
+ let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _a !== void 0 ? _a : 23;
16888
+ if (waterFallData && top < 40 && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
16889
+ top += 40;
16890
+ }
16885
16891
  return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (React.createElement(ToggleButton$1, { style: {
16886
16892
  position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
16887
- visibility: ((_b = (_a = visList === null || visList === void 0 ? void 0 : visList[activeIndex]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.url) ? 'visible' : 'hidden',
16893
+ visibility: ((_c = (_b = visList === null || visList === void 0 ? void 0 : visList[activeIndex]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
16888
16894
  zIndex: 999,
16889
16895
  transform: 'translate3d(0px,0px,0px)',
16890
- [(_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _c !== void 0 ? _c : 'right']: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _d !== void 0 ? _d : 0,
16891
- [(_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _e !== void 0 ? _e : 'bottom']: (_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _f !== void 0 ? _f : 23
16896
+ [(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _d !== void 0 ? _d : 'right']: (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _e !== void 0 ? _e : 0,
16897
+ [(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: top
16892
16898
  }, defaultValue: isMuted, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon, onChange: setIsMuted })));
16893
- }, [globalConfig, visList, activeIndex, isMuted]);
16899
+ }, [globalConfig, visList, activeIndex, isMuted, waterFallData]);
16894
16900
  const renderView = React.useMemo(() => {
16895
16901
  if (loading) {
16896
16902
  return (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
@@ -16923,7 +16929,7 @@ Made in Italy` })));
16923
16929
  renderToggleButton
16924
16930
  ]);
16925
16931
  return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: Object.assign({}, ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset) && { textUnderlineOffset: `${globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset}px` })) },
16926
- waterFallData && (React.createElement(Navbar$1, { icon: img, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
16932
+ waterFallData && (React.createElement(Navbar$1, { icon: img, styles: { background: 'rgba(0,0,0,.3)', color: '#fff', top: `${minusHeight}px` }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
16927
16933
  const isEq = lodash.isEqual(rtcList, cacheRtcList);
16928
16934
  if (!isEq && cacheRtcList && (cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.length)) {
16929
16935
  setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(cacheRtcList);