pb-sxp-ui 1.0.41 → 1.0.43

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 (48) hide show
  1. package/dist/index.cjs +218 -497
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +1 -6
  4. package/dist/index.js +218 -496
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +3 -4
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +3 -4
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +222 -500
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +3 -4
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
  15. package/es/core/components/SxpPageRender/VideoWidget/index.js +119 -88
  16. package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
  17. package/es/core/components/SxpPageRender/index.js +58 -11
  18. package/es/core/context/SxpDataSourceProvider.d.ts +2 -0
  19. package/es/core/context/SxpDataSourceProvider.js +5 -2
  20. package/es/core/hooks/useEventReport.js +4 -4
  21. package/es/index.d.ts +0 -1
  22. package/es/index.js +0 -1
  23. package/es/materials/sxp/popup/CommodityDetail/index.js +6 -6
  24. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -9
  25. package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
  26. package/lib/core/components/SxpPageRender/VideoWidget/index.js +119 -88
  27. package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
  28. package/lib/core/components/SxpPageRender/index.js +58 -11
  29. package/lib/core/context/SxpDataSourceProvider.d.ts +2 -0
  30. package/lib/core/context/SxpDataSourceProvider.js +5 -2
  31. package/lib/core/hooks/useEventReport.js +4 -4
  32. package/lib/index.d.ts +0 -1
  33. package/lib/index.js +1 -3
  34. package/lib/materials/sxp/popup/CommodityDetail/index.js +6 -6
  35. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -9
  36. package/package.json +1 -2
  37. package/es/core/components/DiyPortalPreview/PictureGroup.d.ts +0 -13
  38. package/es/core/components/DiyPortalPreview/PictureGroup.js +0 -11
  39. package/es/core/components/DiyPortalPreview/VideoWidget.d.ts +0 -15
  40. package/es/core/components/DiyPortalPreview/VideoWidget.js +0 -236
  41. package/es/core/components/DiyPortalPreview/index.d.ts +0 -6
  42. package/es/core/components/DiyPortalPreview/index.js +0 -112
  43. package/lib/core/components/DiyPortalPreview/PictureGroup.d.ts +0 -13
  44. package/lib/core/components/DiyPortalPreview/PictureGroup.js +0 -14
  45. package/lib/core/components/DiyPortalPreview/VideoWidget.d.ts +0 -15
  46. package/lib/core/components/DiyPortalPreview/VideoWidget.js +0 -239
  47. package/lib/core/components/DiyPortalPreview/index.d.ts +0 -6
  48. package/lib/core/components/DiyPortalPreview/index.js +0 -115
package/dist/index.js CHANGED
@@ -7,7 +7,6 @@ import { css } from '@emotion/css';
7
7
  import { BetaSchemaForm } from '@ant-design/pro-components';
8
8
  import * as ReactDOM from 'react-dom';
9
9
  import EventEmitter from 'eventemitter3';
10
- import Hls from 'hls.js';
11
10
 
12
11
  /******************************************************************************
13
12
  Copyright (c) Microsoft Corporation.
@@ -428,6 +427,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
428
427
  const [cacheRtcList, setCacheRtcList] = useState([]);
429
428
  const [cacheActiveIndex, setCacheActiveIndex] = useState(0);
430
429
  const [isFromHashtag, setIsFromHashtag] = useState(false);
430
+ const [videoRef, setVideoRef] = useState(null);
431
431
  useEffect(() => {
432
432
  setOpenHashtag(isOpenHashTag);
433
433
  }, [isOpenHashTag]);
@@ -555,7 +555,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
555
555
  fromKName = 'imagePage';
556
556
  }
557
557
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
558
- 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 })
558
+ 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 + '', relatedContentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', relatedProductId: 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 })
559
559
  });
560
560
  }, [bffEventReport, isFromHashtag]);
561
561
  useEffect(() => {
@@ -616,7 +616,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
616
616
  appDomain,
617
617
  hashTagSize,
618
618
  loadingImage: loadingImage !== null && loadingImage !== void 0 ? loadingImage : defaultLoadingImage,
619
- isOpenHashTag
619
+ isOpenHashTag,
620
+ videoRef,
621
+ setVideoRef
620
622
  } }, render({ rtcList, mutateLike: bffMutateLike, mutateUnlike: bffMutateUnlike, submitForm: bffSubmitForm })));
621
623
  };
622
624
  var SxpDataSourceProvider$1 = memo(SxpDataSourceProvider);
@@ -842,7 +844,7 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
842
844
  React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
843
845
  });
844
846
 
845
- var index$2 = /*#__PURE__*/Object.freeze({
847
+ var index$1 = /*#__PURE__*/Object.freeze({
846
848
  __proto__: null,
847
849
  EditorCore: EditorCore
848
850
  });
@@ -8128,8 +8130,8 @@ function useEventReport() {
8128
8130
  fromKPage: location === null || location === void 0 ? void 0 : location.href,
8129
8131
  contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
8130
8132
  position: position + '',
8131
- contentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
8132
- ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
8133
+ relatedContentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
8134
+ relatedCtatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
8133
8135
  traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
8134
8136
  }
8135
8137
  });
@@ -8153,8 +8155,8 @@ function useEventReport() {
8153
8155
  fromKPage: location === null || location === void 0 ? void 0 : location.href,
8154
8156
  contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
8155
8157
  position: position + '',
8156
- contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
8157
- ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
8158
+ relatedContentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
8159
+ relatedCtatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
8158
8160
  traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
8159
8161
  timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
8160
8162
  eventSubject: 'productView',
@@ -8317,7 +8319,7 @@ const FormatImage = forwardRef((props, ref) => {
8317
8319
  var FormatImage$1 = memo(FormatImage);
8318
8320
 
8319
8321
  const CommodityDetail$1 = (_a) => {
8320
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
8322
+ var _b, _c, _d, _e, _f, _g, _h, _j;
8321
8323
  var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index"]);
8322
8324
  const { sxpParameter } = useSxpDataSource();
8323
8325
  const { popupDetailData, bffEventReport, isPreview, waterFallData } = useSxpDataSource();
@@ -8358,7 +8360,7 @@ const CommodityDetail$1 = (_a) => {
8358
8360
  return '$7,000';
8359
8361
  }
8360
8362
  }, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
8361
- const width = isPreview ? 375 : (_f = style === null || style === void 0 ? void 0 : style.width) !== null && _f !== void 0 ? _f : window.innerWidth;
8363
+ const width = isPreview ? 375 : window.innerWidth;
8362
8364
  const renderContent = ({ isPost }) => {
8363
8365
  var _a, _b, _c;
8364
8366
  return (React.createElement("div", null,
@@ -8378,7 +8380,7 @@ const CommodityDetail$1 = (_a) => {
8378
8380
  };
8379
8381
  return (React.createElement("div", { className: 'pb-commondity' },
8380
8382
  React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
8381
- product && ((_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.length) > 0 && (React.createElement(Swiper, { height: width, modules: [Pagination, Autoplay], pagination: {
8383
+ product && ((_f = product === null || product === void 0 ? void 0 : product.homePage) === null || _f === void 0 ? void 0 : _f.length) > 0 && (React.createElement(Swiper, { height: width, modules: [Pagination, Autoplay], pagination: {
8382
8384
  clickable: true,
8383
8385
  bulletActiveClass: 'swipe-item-active-bullet',
8384
8386
  clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
@@ -8386,7 +8388,7 @@ const CommodityDetail$1 = (_a) => {
8386
8388
  : 'commondityDetail-swiper-clickable-center'
8387
8389
  }, loop: true, autoplay: {
8388
8390
  delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
8389
- } }, (_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.map((src) => {
8391
+ } }, (_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.map((src) => {
8390
8392
  return (React.createElement(SwiperSlide, { key: src },
8391
8393
  React.createElement("div", { style: {
8392
8394
  overflow: 'hidden',
@@ -8395,7 +8397,7 @@ const CommodityDetail$1 = (_a) => {
8395
8397
  } },
8396
8398
  React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
8397
8399
  }))),
8398
- !((_j = product === null || product === void 0 ? void 0 : product.homePage) === null || _j === void 0 ? void 0 : _j.length) && (React.createElement("div", { className: css({
8400
+ !((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (React.createElement("div", { className: css({
8399
8401
  position: 'relative',
8400
8402
  height: 0,
8401
8403
  width: '100%',
@@ -8408,7 +8410,7 @@ const CommodityDetail$1 = (_a) => {
8408
8410
  top: 0,
8409
8411
  objectFit: 'cover',
8410
8412
  width: '100%'
8411
- }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: '' }))),
8413
+ }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
8412
8414
  React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
8413
8415
  renderBtn(),
8414
8416
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) },
@@ -8768,7 +8770,7 @@ var settingRender$2 = [
8768
8770
  ];
8769
8771
 
8770
8772
  const CommodityDetailDiroNew$1 = (_a) => {
8771
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
8773
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
8772
8774
  var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index"]);
8773
8775
  useState(true);
8774
8776
  const { sxpParameter } = useSxpDataSource();
@@ -8816,7 +8818,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
8816
8818
  return '£102,300.00';
8817
8819
  }
8818
8820
  }, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
8819
- const width = isPreview ? 375 : (_f = style === null || style === void 0 ? void 0 : style.width) !== null && _f !== void 0 ? _f : window.innerWidth;
8821
+ const width = isPreview ? 375 : window.innerWidth;
8820
8822
  const productInfoText = ({ isPost }) => {
8821
8823
  return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8822
8824
  React.createElement(ExpandableText$1, { isPost: isPost, onClick: () => setShowModal(true), className: 'pb-commondityDiroNew-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (product === null || product === void 0 ? void 0 : product.info) ||
@@ -8825,7 +8827,7 @@ Made in Italy` })));
8825
8827
  };
8826
8828
  return (React.createElement("div", { className: 'pb-commondityDiroNew' },
8827
8829
  React.createElement("div", Object.assign({ ref: scrollRef, className: css(Object.assign({}, style)) }, props),
8828
- product && ((_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.length) > 0 && (React.createElement(Swiper, { height: width, modules: [Pagination, Autoplay], pagination: {
8830
+ product && ((_f = product === null || product === void 0 ? void 0 : product.homePage) === null || _f === void 0 ? void 0 : _f.length) > 0 && (React.createElement(Swiper, { height: width, modules: [Pagination, Autoplay], pagination: {
8829
8831
  clickable: true,
8830
8832
  bulletActiveClass: 'commondityDiroNew-swipe-item-active-bullet',
8831
8833
  clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
@@ -8833,7 +8835,7 @@ Made in Italy` })));
8833
8835
  : 'commondityDiroNew-swiper-clickable-center'
8834
8836
  }, loop: true, autoplay: {
8835
8837
  delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
8836
- } }, (_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.map((src) => {
8838
+ } }, (_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.map((src) => {
8837
8839
  return (React.createElement(SwiperSlide, { key: src },
8838
8840
  React.createElement("div", { style: {
8839
8841
  overflow: 'hidden',
@@ -8842,7 +8844,7 @@ Made in Italy` })));
8842
8844
  } },
8843
8845
  React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
8844
8846
  }))),
8845
- !((_j = product === null || product === void 0 ? void 0 : product.homePage) === null || _j === void 0 ? void 0 : _j.length) && (React.createElement("div", { className: css({
8847
+ !((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (React.createElement("div", { className: css({
8846
8848
  position: 'relative',
8847
8849
  height: 0,
8848
8850
  width: '100%',
@@ -8855,16 +8857,16 @@ Made in Italy` })));
8855
8857
  top: 0,
8856
8858
  objectFit: 'cover',
8857
8859
  width: '100%'
8858
- }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: '' }))),
8860
+ }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
8859
8861
  React.createElement("div", { className: 'pb-commondityDiroNew-content' },
8860
8862
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
8861
8863
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
8862
- React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_l = product === null || product === void 0 ? void 0 : product.title) !== null && _l !== void 0 ? _l : 'Large Dior Toujours Bag'),
8864
+ React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_k = product === null || product === void 0 ? void 0 : product.title) !== null && _k !== void 0 ? _k : 'Large Dior Toujours Bag'),
8863
8865
  React.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage Calfskin')),
8864
8866
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
8865
8867
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
8866
- React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo }, (_m = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _m !== void 0 ? _m : '税费'))),
8867
- (!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (_o = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _o !== void 0 ? _o : 'Shop now')),
8868
+ React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo }, (_l = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _l !== void 0 ? _l : '税费'))),
8869
+ (!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (_m = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _m !== void 0 ? _m : 'Shop now')),
8868
8870
  productInfoText({ isPost }))),
8869
8871
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
8870
8872
  };
@@ -11772,7 +11774,7 @@ const WaterFall = (props) => {
11772
11774
  }
11773
11775
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
11774
11776
  eventInfo: {
11775
- contentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
11777
+ relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
11776
11778
  position: cacheActiveIndex + '',
11777
11779
  contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
11778
11780
  traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
@@ -11905,14 +11907,14 @@ var _materials_ = /*#__PURE__*/Object.freeze({
11905
11907
  Prompt: Prompt
11906
11908
  });
11907
11909
 
11908
- const defaultUnLikeIconPath$1 = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
11909
- const defaultLikeIconPath$1 = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
11910
+ const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
11911
+ const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
11910
11912
  const LikeButton = (_a) => {
11911
11913
  var { active, activeIcon, unActicveIcon, recData, position } = _a, props = __rest(_a, ["active", "activeIcon", "unActicveIcon", "recData", "position"]);
11912
11914
  const { mutateLike, mutateUnlike, bffEventReport } = useSxpDataSource();
11913
11915
  const [state, setState] = useState(active);
11914
- const likeIcon = useIconLink(defaultLikeIconPath$1);
11915
- const unlikeIcon = useIconLink(defaultUnLikeIconPath$1);
11916
+ const likeIcon = useIconLink(defaultLikeIconPath);
11917
+ const unlikeIcon = useIconLink(defaultUnLikeIconPath);
11916
11918
  const handleClick = debounce(() => __awaiter(void 0, void 0, void 0, function* () {
11917
11919
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
11918
11920
  if (state) {
@@ -11968,9 +11970,8 @@ var SXP_EVENT_TYPE;
11968
11970
  SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
11969
11971
  })(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
11970
11972
 
11971
- const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig }) => {
11973
+ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
11972
11974
  const [isPauseVideo, setIsPauseVideo] = useState(false);
11973
- const videoRef = useRef(null);
11974
11975
  const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
11975
11976
  const videoStartTime = useRef(0);
11976
11977
  const [isLoadFinish, setIsLoadFinish] = useState(false);
@@ -11978,99 +11979,118 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
11978
11979
  const { isActive } = useSwiperSlide();
11979
11980
  const canvasRef = useRef(null);
11980
11981
  const [firstFrameSrc, setFirstFrameSrc] = useState('');
11982
+ const videoId = `pb-cache-video-${index}`;
11983
+ const videoEleRef = useRef(null);
11981
11984
  useEffect(() => {
11982
- if (!videoRef.current)
11985
+ if (!videoRef)
11983
11986
  return;
11984
- videoRef.current.muted = muted;
11985
- }, [muted]);
11986
- const handleVideoStart = useCallback(() => {
11987
- var _a;
11988
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
11989
- }, []);
11987
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.muted(muted);
11988
+ }, [muted, videoRef]);
11989
+ const handleEnded = useCallback(() => {
11990
+ if (!videoRef)
11991
+ return;
11992
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
11993
+ }, [videoRef]);
11990
11994
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
11991
11995
  const handlePlaying = useCallback(() => {
11992
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
11996
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11997
+ if (!videoRef)
11998
+ return;
11993
11999
  setIsPauseVideo(false);
11994
12000
  const item = data[index];
11995
- if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
11996
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
11997
- const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
11998
- const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
12001
+ if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration())) {
12002
+ videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) || 0;
12003
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12004
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
11999
12005
  const playType = isFirstPlay ? '0' : '1';
12000
12006
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12001
12007
  eventInfo: {
12002
12008
  eventSubject: 'playVideo',
12003
12009
  eventDescription: 'User played the video',
12004
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12005
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
12010
+ contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
12011
+ contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
12006
12012
  playType,
12007
12013
  startTime: videoCurrentTime,
12008
12014
  videoDuration,
12009
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
12015
+ contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
12010
12016
  position: index + '',
12011
12017
  contentFormat: 'video',
12012
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
12018
+ traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
12013
12019
  }
12014
12020
  });
12015
12021
  setIsFirstPlay(false);
12016
12022
  }
12017
- }, [bffEventReport, data, index, isFirstPlay]);
12018
- const handleLoadedMetadata = useCallback(() => {
12023
+ }, [bffEventReport, data, index, isFirstPlay, videoRef]);
12024
+ const handleLoadedmetadata = useCallback(() => {
12025
+ if (!videoRef)
12026
+ return;
12027
+ if (activeIndex !== index) {
12028
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12029
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12030
+ }
12031
+ setIsLoadFinish(true);
12032
+ }, [activeIndex, index, videoRef]);
12033
+ const handleCanplay = useCallback(() => {
12019
12034
  setIsLoadFinish(true);
12020
12035
  }, []);
12021
12036
  const handleClickVideo = useCallback((type) => () => {
12022
- var _a, _b, _c, _d, _e;
12037
+ if (!videoRef)
12038
+ return;
12023
12039
  if (!isLoadFinish)
12024
12040
  return;
12025
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12041
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
12026
12042
  switch (type) {
12027
12043
  case 'start':
12028
12044
  if (!isPause)
12029
12045
  return;
12030
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
12046
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12031
12047
  setIsPauseVideo(false);
12032
12048
  break;
12033
12049
  case 'pause':
12034
12050
  if (isPause)
12035
12051
  return;
12036
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12052
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12037
12053
  setIsPauseVideo(true);
12038
12054
  break;
12039
12055
  default:
12040
12056
  if (isPause) {
12041
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
12057
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12042
12058
  }
12043
12059
  else {
12044
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
12060
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12045
12061
  }
12046
12062
  setIsPauseVideo(!isPause);
12047
12063
  break;
12048
12064
  }
12049
- }, [isLoadFinish]);
12050
- const onPause = useCallback(() => {
12051
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12065
+ }, [isLoadFinish, videoRef]);
12066
+ const handlePause = useCallback(() => {
12067
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
12068
+ if (!videoRef)
12069
+ return;
12070
+ if (activeIndex !== index)
12071
+ return;
12052
12072
  const item = data[index];
12053
- const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12054
- const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
12055
- if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
12056
- const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
12073
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12074
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12075
+ if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) {
12076
+ const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) - videoStartTime.current).toFixed(2);
12057
12077
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12058
12078
  eventInfo: {
12059
12079
  eventSubject: 'playOverVideo',
12060
12080
  eventDescription: 'User finished playing the video',
12061
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12062
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
12081
+ contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
12082
+ contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
12063
12083
  endTime: videoCurrentTime,
12064
12084
  videoDuration,
12065
12085
  playDuration,
12066
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
12086
+ contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
12067
12087
  position: index + '',
12068
12088
  contentFormat: 'video',
12069
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
12089
+ traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
12070
12090
  }
12071
12091
  });
12072
12092
  }
12073
- }, [data, index, bffEventReport]);
12093
+ }, [data, index, bffEventReport, videoRef]);
12074
12094
  const blur = useMemo(() => {
12075
12095
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12076
12096
  }, [videoPostConfig]);
@@ -12085,82 +12105,82 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12085
12105
  return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12086
12106
  }, [firstFrameSrc, rec]);
12087
12107
  const handLoadeddata = useCallback(() => {
12088
- if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
12108
+ var _a;
12109
+ if (!videoRef)
12089
12110
  return;
12090
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12091
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12092
- const ctx = canvas.getContext('2d');
12093
- const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12094
- const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
12095
- canvas.height = targetHeight;
12096
- canvas.width = targetWidth;
12097
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12098
- setFirstFrameSrc(canvas.toDataURL());
12099
- }, []);
12111
+ const videoDomRef = document.getElementById(`${videoId}_html5_api`);
12112
+ if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !videoDomRef || !canvasRef.current)
12113
+ return;
12114
+ const setFrameImg = () => {
12115
+ const video = videoDomRef;
12116
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12117
+ const ctx = canvas.getContext('2d');
12118
+ const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12119
+ const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
12120
+ canvas.height = targetHeight;
12121
+ canvas.width = targetWidth;
12122
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12123
+ setFirstFrameSrc(canvas.toDataURL());
12124
+ };
12125
+ setFrameImg();
12126
+ setTimeout(() => {
12127
+ setFrameImg();
12128
+ }, 500);
12129
+ }, [videoRef]);
12100
12130
  useEffect(() => {
12101
- var _a, _b, _c, _d;
12102
- if (!videoRef.current)
12131
+ if (!isActive || !videoRef)
12132
+ return;
12133
+ const videoSrc = rec.video.url;
12134
+ if (!videoSrc)
12103
12135
  return;
12104
12136
  setIsPauseVideo(false);
12105
- if (!videoRef.current.src) {
12106
- const videoSrc = rec.video.url;
12107
- // if (videoSrc.includes('.m3u8')) {
12108
- // if (Hls.isSupported()) {
12109
- // const hls = new Hls();
12110
- // hls.loadSource(videoSrc);
12111
- // hls.attachMedia(videoRef.current);
12112
- // hls.on(Hls.Events.MANIFEST_PARSED, function () {
12113
- // videoRef?.current?.play();
12114
- // });
12115
- // } else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
12116
- // videoRef.current.src = videoSrc;
12117
- // } else {
12118
- // videoRef.current.src = videoSrc;
12119
- // }
12120
- // } else {
12121
- videoRef.current.src = videoSrc;
12122
- // }
12123
- videoRef.current.setAttribute('x5-playsinline', 'true');
12124
- videoRef.current.setAttribute('webkit-playsinline', 'true');
12125
- }
12126
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
12127
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12128
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12129
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
12137
+ const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
12138
+ const dom = document.querySelector('#player-container-id');
12139
+ const dom2 = document.querySelector('#player-container-id-copy');
12140
+ if (!dom && !dom2)
12141
+ return;
12142
+ videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
12143
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
12144
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
12145
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
12146
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('canplay', handleCanplay);
12147
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('playing', handlePlaying);
12148
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('pause', handlePause);
12149
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('ended', handleEnded);
12130
12150
  return () => {
12131
- var _a, _b, _c, _d;
12132
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
12133
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
12134
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
12135
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
12151
+ dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
12152
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadedmetadata', handleLoadedmetadata);
12153
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadeddata', handLoadeddata);
12154
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('canplay', handleCanplay);
12155
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('playing', handlePlaying);
12156
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('pause', handlePause);
12157
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('ended', handleEnded);
12136
12158
  };
12137
- }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
12159
+ }, [isActive, videoId, rec, videoRef]);
12138
12160
  useEffect(() => {
12139
- var _a;
12140
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
12161
+ if (!videoRef || !isLoadFinish)
12141
12162
  return;
12142
12163
  if (isActive) {
12143
- videoRef.current.play();
12164
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12144
12165
  }
12145
12166
  else {
12146
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
12167
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12147
12168
  }
12148
- }, [isActive, isLoadFinish]);
12169
+ }, [isActive, isLoadFinish, videoRef]);
12149
12170
  /*
12150
12171
  打开/关闭hashtag暂停/播放视频
12151
12172
  */
12152
12173
  useEffect(() => {
12153
- var _a, _b, _c;
12154
- if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
12174
+ if (!isActive || !videoRef)
12155
12175
  return;
12156
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12176
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
12157
12177
  if (!isPause && openHashtag) {
12158
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
12178
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12159
12179
  }
12160
12180
  else if (!openHashtag) {
12161
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
12181
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12162
12182
  }
12163
- }, [openHashtag, isActive]);
12183
+ }, [openHashtag, isActive, videoRef]);
12164
12184
  useEffect(() => {
12165
12185
  if (!isActive)
12166
12186
  return;
@@ -12180,9 +12200,11 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12180
12200
  return (React.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image }));
12181
12201
  }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
12182
12202
  useEffect(() => {
12203
+ if (!videoRef)
12204
+ return;
12183
12205
  const handleBeforeUnload = () => {
12184
- var _a, _b;
12185
- if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.src) && !isPauseVideo) {
12206
+ var _a;
12207
+ if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && videoRef && !isPauseVideo) {
12186
12208
  handleClickVideo('pause')();
12187
12209
  }
12188
12210
  };
@@ -12220,23 +12242,19 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12220
12242
  right: 0
12221
12243
  } },
12222
12244
  React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
12223
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
12224
- width: '100%',
12225
- height: '100%',
12226
- objectFit: 'contain'
12227
- } }),
12245
+ React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
12228
12246
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
12229
- renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
12247
+ renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
12230
12248
  position: 'relative',
12231
12249
  width: '100%',
12232
12250
  height,
12233
12251
  overflow: 'hidden'
12234
- } },
12235
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
12252
+ }, onClick: handleClickVideo() },
12253
+ React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
12236
12254
  renderPoster,
12237
12255
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
12238
12256
  };
12239
- var VideoWidget$3 = memo(VideoWidget$2);
12257
+ var VideoWidget$1 = memo(VideoWidget);
12240
12258
 
12241
12259
  /*
12242
12260
  * @Author: binruan@chatlabs.com
@@ -12336,7 +12354,7 @@ const Picture = (props) => {
12336
12354
  * @LastEditTime: 2024-04-18 19:56:22
12337
12355
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12338
12356
  */
12339
- const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
12357
+ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
12340
12358
  var _a;
12341
12359
  const ref = useRef();
12342
12360
  const { isActive } = useSwiperSlide();
@@ -12365,7 +12383,7 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageE
12365
12383
  React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
12366
12384
  })));
12367
12385
  };
12368
- var PictureGroup$3 = memo(PictureGroup$2);
12386
+ var PictureGroup$1 = memo(PictureGroup);
12369
12387
 
12370
12388
  /*
12371
12389
  * @Author: binruan@chatlabs.com
@@ -12544,7 +12562,7 @@ const Nudge = ({ nudge }) => {
12544
12562
  * @Author: binruan@chatlabs.com
12545
12563
  * @Date: 2024-01-15 19:03:09
12546
12564
  * @LastEditors: binruan@chatlabs.com
12547
- * @LastEditTime: 2024-04-23 15:48:32
12565
+ * @LastEditTime: 2024-04-29 15:48:42
12548
12566
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12549
12567
  *
12550
12568
  */
@@ -12560,6 +12578,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12560
12578
  const [isLoadMore, setIsLoadMore] = useState(false);
12561
12579
  const [isShowMore, setIsShowMore] = useState(false);
12562
12580
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
12581
+ const [videoRef, setVideoRef] = useState(null);
12582
+ const playerRef = useRef();
12563
12583
  const { productView } = useEventReport();
12564
12584
  const isShowFingerTip = useMemo(() => {
12565
12585
  return data.length > 0 && !loading && getFeUserId();
@@ -12597,6 +12617,25 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12597
12617
  viewTime.current = new Date();
12598
12618
  refreshFeSessionId();
12599
12619
  };
12620
+ const firstRef = useRef();
12621
+ useEffect(() => {
12622
+ if (!firstRef.current && !videoRef) {
12623
+ firstRef.current = true;
12624
+ const player = TCPlayer('player-container-id', {
12625
+ licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
12626
+ controls: false,
12627
+ autoplay: false,
12628
+ loop: false,
12629
+ muted: true,
12630
+ preload: 'auto',
12631
+ posterImage: false,
12632
+ bigPlayButton: true
12633
+ });
12634
+ player === null || player === void 0 ? void 0 : player.ready(() => {
12635
+ setVideoRef(player);
12636
+ });
12637
+ }
12638
+ }, [videoRef]);
12600
12639
  useEffect(() => {
12601
12640
  if (!isInit)
12602
12641
  handleH5EnterLink();
@@ -12626,8 +12665,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12626
12665
  // sessionDuration: Math.floor(((new Date() as any) - curTime) / 1000) + '',
12627
12666
  // eventSubject: 'sessionCompleted',
12628
12667
  // eventDescription: 'Session completed',
12629
- // contentId: item?.video?.itemId,
12630
- // productId: item?.product?.itemId,
12668
+ // relatedContentId: item?.video?.itemId,
12669
+ // relatedProductId: item?.product?.itemId,
12631
12670
  // position: item?.position
12632
12671
  // }
12633
12672
  // });
@@ -12671,12 +12710,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12671
12710
  sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
12672
12711
  eventSubject: 'sessionCompleted',
12673
12712
  eventDescription: 'Session completed',
12674
- contentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
12675
- productId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
12713
+ relatedContentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
12714
+ relatedProductId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
12676
12715
  position: activeIndex + '',
12677
12716
  fromKName,
12678
12717
  fromKPage: location === null || location === void 0 ? void 0 : location.href,
12679
- ctatId: (_q = (_p = (_o = item.video) === null || _o === void 0 ? void 0 : _o.bindCta) === null || _p === void 0 ? void 0 : _p.itemId) !== null && _q !== void 0 ? _q : ''
12718
+ relatedCtatId: (_q = (_p = (_o = item.video) === null || _o === void 0 ? void 0 : _o.bindCta) === null || _p === void 0 ? void 0 : _p.itemId) !== null && _q !== void 0 ? _q : ''
12680
12719
  }
12681
12720
  });
12682
12721
  }
@@ -12705,10 +12744,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12705
12744
  const renderContent = useCallback((rec, index) => {
12706
12745
  var _a, _b, _c, _d;
12707
12746
  if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
12708
- return (React.createElement(VideoWidget$3, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost }));
12747
+ return (React.createElement(VideoWidget$1, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoRef: videoRef }));
12709
12748
  }
12710
12749
  if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
12711
- return (React.createElement(PictureGroup$3, { key: rec.video.itemId, imgUrls: 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 }));
12750
+ return (React.createElement(PictureGroup$1, { key: rec.video.itemId, imgUrls: 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 }));
12712
12751
  }
12713
12752
  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) {
12714
12753
  return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
@@ -12720,7 +12759,19 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12720
12759
  });
12721
12760
  }
12722
12761
  return null;
12723
- }, [containerWidth, data, height, isMuted, activeIndex, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost, viewTime, tipText, resolver, schema]);
12762
+ }, [
12763
+ containerWidth,
12764
+ data,
12765
+ height,
12766
+ isMuted,
12767
+ activeIndex,
12768
+ globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost,
12769
+ viewTime,
12770
+ tipText,
12771
+ resolver,
12772
+ schema,
12773
+ videoRef
12774
+ ]);
12724
12775
  const onExpandableChange = useCallback((v) => {
12725
12776
  setIsShowMore(v);
12726
12777
  }, []);
@@ -12810,8 +12861,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12810
12861
  eventInfo: {
12811
12862
  eventSubject: 'scrollDown',
12812
12863
  eventDescription: 'User scroll down',
12813
- contentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
12814
- productId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
12864
+ relatedContentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
12865
+ relatedProductId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
12815
12866
  requestId: null
12816
12867
  }
12817
12868
  });
@@ -12823,8 +12874,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12823
12874
  eventInfo: {
12824
12875
  eventSubject: 'scrollUp',
12825
12876
  eventDescription: 'User scroll up',
12826
- contentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
12827
- productId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12877
+ relatedContentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
12878
+ relatedProductId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12828
12879
  requestId: null
12829
12880
  }
12830
12881
  });
@@ -12905,7 +12956,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12905
12956
  } })),
12906
12957
  renderLogo,
12907
12958
  isShowFingerTip ? React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
12908
- React.createElement(Swiper, { ref: swiperRef, onActiveIndexChange: (swiper) => {
12959
+ React.createElement(Swiper, { ref: swiperRef, onSlideChange: () => {
12960
+ swiperRef.current.swiper.allowTouchMove = false;
12961
+ setTimeout(() => {
12962
+ swiperRef.current.swiper.allowTouchMove = true;
12963
+ }, 500);
12964
+ }, onActiveIndexChange: (swiper) => {
12909
12965
  setActiveIndex(swiper.activeIndex);
12910
12966
  if (openHashtag)
12911
12967
  return;
@@ -12922,6 +12978,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12922
12978
  }
12923
12979
  }
12924
12980
  },
12981
+ // style={{
12982
+ // pointerEvents: canSwiper ? 'auto' : 'none'
12983
+ // }}
12925
12984
  // onReachEnd={() => {
12926
12985
  // // 由hashtaglist跳转过来时不执行下面的方法
12927
12986
  // if (waterFallData) return;
@@ -12944,353 +13003,17 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12944
13003
  zIndex: 999
12945
13004
  }, 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 }),
12946
13005
  renderView),
12947
- React.createElement(WaterFall$1, Object.assign({}, (_g = (_f = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.item) === null || _g === void 0 ? void 0 : _g.props))));
12948
- };
12949
-
12950
- const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index }) => {
12951
- return (React.createElement(Swiper, { defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, style: { width }, loop: true, autoplay: false }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
12952
- return (React.createElement(SwiperSlide, { key: url },
12953
- React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
12954
- })));
12955
- };
12956
- var PictureGroup$1 = memo(PictureGroup);
12957
-
12958
- const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, width }) => {
12959
- const [isPauseVideo, setIsPauseVideo] = useState(false);
12960
- const videoRef = useRef(null);
12961
- const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
12962
- const videoStartTime = useRef(0);
12963
- const [isLoadFinish, setIsLoadFinish] = useState(false);
12964
- const [isFirstPlay, setIsFirstPlay] = useState(true);
12965
- const canvasRef = useRef(null);
12966
- const [firstFrameSrc, setFirstFrameSrc] = useState('');
12967
- useEffect(() => {
12968
- if (!videoRef.current)
12969
- return;
12970
- videoRef.current.muted = muted;
12971
- }, [muted]);
12972
- const handleVideoStart = useCallback(() => {
12973
- var _a;
12974
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
12975
- }, []);
12976
- const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
12977
- const handlePlaying = useCallback(() => {
12978
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12979
- setIsPauseVideo(false);
12980
- const item = data[index];
12981
- if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
12982
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
12983
- const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
12984
- const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
12985
- const playType = isFirstPlay ? '0' : '1';
12986
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12987
- eventInfo: {
12988
- eventSubject: 'playVideo',
12989
- eventDescription: 'User played the video',
12990
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12991
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
12992
- playType,
12993
- startTime: videoCurrentTime,
12994
- videoDuration,
12995
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
12996
- position: index + '',
12997
- contentFormat: 'video',
12998
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
12999
- }
13000
- });
13001
- setIsFirstPlay(false);
13002
- }
13003
- }, [bffEventReport, data, index, isFirstPlay]);
13004
- const handleLoadedMetadata = useCallback(() => {
13005
- setIsLoadFinish(true);
13006
- }, []);
13007
- const handleClickVideo = useCallback((type) => () => {
13008
- var _a, _b, _c, _d, _e;
13009
- if (!isLoadFinish)
13010
- return;
13011
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
13012
- switch (type) {
13013
- case 'start':
13014
- if (!isPause)
13015
- return;
13016
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
13017
- setIsPauseVideo(false);
13018
- break;
13019
- case 'pause':
13020
- if (isPause)
13021
- return;
13022
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
13023
- setIsPauseVideo(true);
13024
- break;
13025
- default:
13026
- if (isPause) {
13027
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
13028
- }
13029
- else {
13030
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
13031
- }
13032
- setIsPauseVideo(!isPause);
13033
- break;
13034
- }
13035
- }, [isLoadFinish]);
13036
- const onPause = useCallback(() => {
13037
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
13038
- const item = data[index];
13039
- const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
13040
- const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
13041
- if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
13042
- const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
13043
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
13044
- eventInfo: {
13045
- eventSubject: 'playOverVideo',
13046
- eventDescription: 'User finished playing the video',
13047
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
13048
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
13049
- endTime: videoCurrentTime,
13050
- videoDuration,
13051
- playDuration,
13052
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
13053
- position: index + '',
13054
- contentFormat: 'video',
13055
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
13056
- }
13057
- });
13058
- }
13059
- }, [data, index, bffEventReport]);
13060
- const blur = useMemo(() => {
13061
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
13062
- }, [videoPostConfig]);
13063
- const translateY = useMemo(() => {
13064
- var _a;
13065
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
13066
- ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
13067
- : 'translateY(-50%)';
13068
- }, [videoPostConfig]);
13069
- const blurBgSrc = useMemo(() => {
13070
- var _a;
13071
- return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
13072
- }, [firstFrameSrc, rec]);
13073
- const handLoadeddata = useCallback(() => {
13074
- if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
13075
- return;
13076
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
13077
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
13078
- const ctx = canvas.getContext('2d');
13079
- const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
13080
- const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
13081
- canvas.height = targetHeight;
13082
- canvas.width = targetWidth;
13083
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
13084
- setFirstFrameSrc(canvas.toDataURL());
13085
- }, []);
13086
- useEffect(() => {
13087
- var _a, _b, _c, _d;
13088
- if (!videoRef.current)
13089
- return;
13090
- setIsPauseVideo(false);
13091
- if (!videoRef.current.src) {
13092
- const videoSrc = rec.video.url;
13093
- if (videoSrc.includes('.m3u8')) {
13094
- if (Hls.isSupported()) {
13095
- const hls = new Hls();
13096
- hls.loadSource(videoSrc);
13097
- hls.attachMedia(videoRef.current);
13098
- }
13099
- else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
13100
- videoRef.current.src = videoSrc;
13101
- }
13102
- else {
13103
- videoRef.current.src = videoSrc;
13104
- }
13105
- }
13106
- else {
13107
- videoRef.current.src = videoSrc;
13108
- }
13109
- videoRef.current.setAttribute('x5-playsinline', 'true');
13110
- videoRef.current.setAttribute('webkit-playsinline', 'true');
13111
- }
13112
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
13113
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
13114
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
13115
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
13116
- return () => {
13117
- var _a, _b, _c, _d;
13118
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
13119
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
13120
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
13121
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
13122
- };
13123
- }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
13124
- const renderPoster = useMemo(() => {
13125
- if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
13126
- return null;
13127
- }
13128
- return (React.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image }));
13129
- }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
13130
- useEffect(() => {
13131
- const handleBeforeUnload = () => {
13132
- var _a, _b;
13133
- if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.src) && !isPauseVideo) {
13134
- handleClickVideo('pause')();
13135
- }
13136
- };
13137
- window.addEventListener('beforeunload', handleBeforeUnload);
13138
- return () => {
13139
- window.removeEventListener('beforeunload', handleBeforeUnload);
13140
- };
13141
- }, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
13142
- const blurStyle = useMemo(() => {
13143
- return blur
13144
- ? {
13145
- filter: 'blur(10px)',
13146
- transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
13147
- }
13148
- : {};
13149
- }, [blur]);
13150
- if (!rec.video) {
13151
- return null;
13152
- }
13153
- return (React.createElement(React.Fragment, null, blur ? (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
13154
- position: 'relative',
13155
- width,
13156
- height,
13157
- overflow: 'hidden'
13158
- } },
13159
- React.createElement(FormatImage$1, { src: blurBgSrc, style: Object.assign({ height,
13160
- width, objectFit: 'cover' }, blurStyle) }),
13161
- React.createElement("canvas", { ref: canvasRef, style: { display: 'none' } }),
13162
- React.createElement("div", { style: {
13163
- position: 'absolute',
13164
- width,
13165
- height,
13166
- top: '50%',
13167
- transform: translateY,
13168
- left: 0,
13169
- right: 0
13170
- } },
13171
- React.createElement("div", { style: { position: 'relative', width, height: '100%' } },
13172
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
13173
- width: '100%',
13174
- height,
13175
- objectFit: 'contain'
13176
- } }),
13177
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
13178
- renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
13179
- position: 'relative',
13180
- width,
13181
- height,
13182
- overflow: 'hidden'
13183
- } },
13184
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
13185
- renderPoster,
13186
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
13187
- };
13188
- var VideoWidget$1 = memo(VideoWidget);
13189
-
13190
- const RESOLVER$1 = {};
13191
- Object.values(_materials_).forEach((v) => {
13192
- RESOLVER$1[v.extend.type] = v;
13193
- });
13194
- const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
13195
- const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
13196
- const DiyPortalPreview = ({ data, globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain }) => {
13197
- const height = useMemo(() => {
13198
- return (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo) ? containerHeight - 45 : containerHeight;
13199
- }, [globalConfig, containerHeight]);
13200
- const renderContent = (rec, index) => {
13201
- var _a, _b, _c, _d;
13202
- if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
13203
- return (React.createElement(VideoWidget$1, { rec: rec, index: index, muted: true, width: containerWidth, data: data !== null && data !== void 0 ? data : [], height: height, activeIndex: index, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost }));
13204
- }
13205
- if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
13206
- return (React.createElement(PictureGroup$1, { key: rec.video.itemId, imgUrls: rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
13207
- }
13208
- if (rec.product) {
13209
- 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) {
13210
- return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
13211
- var _a, _b, _c, _d, _e, _f, _g, _h;
13212
- const t = RESOLVER$1[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
13213
- const Component = withBindDataSource(t);
13214
- const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
13215
- return (React.createElement(Component, Object.assign({ key: `${index}${idx}`, textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.textStyle), bindDatas: (_e = (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.bindDatas) !== null && _e !== void 0 ? _e : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.props, { event: ((_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.event) || {},
13216
- // schema={schema}
13217
- id: value === null || value === void 0 ? void 0 : value.id,
13218
- // viewTime={viewTime.current}
13219
- rec: rec, isPost: true, tipText: tipText, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.style), { width: containerWidth, height, overflow: 'auto' }), index: index })));
13220
- });
13221
- }
13222
- }
13223
- };
13224
- const renderLogo = useMemo(() => {
13225
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
13226
- return (React.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
13227
- React.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
13228
- }
13229
- return null;
13230
- }, [globalConfig]);
13231
- const renderBottom = (rec, index) => {
13232
- var _a, _b, _c, _d, _e, _f, _g;
13233
- if (rec.video) {
13234
- return (React.createElement(React.Fragment, null,
13235
- ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
13236
- React.createElement("div", { className: 'clc-sxp-bottom' },
13237
- React.createElement(Nudge, { nudge: nudge }),
13238
- React.createElement("div", { className: 'clc-sxp-bottom-card' },
13239
- React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER$1 })),
13240
- React.createElement("div", null,
13241
- React.createElement(ExpandableText$1, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }) })),
13242
- React.createElement(Hashtag$1, { index: index, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle }))));
13243
- }
13244
- return null;
13245
- };
13246
- const likeIcon = useIconLink(defaultLikeIconPath, appDomain);
13247
- const unlikeIcon = useIconLink(defaultUnLikeIconPath, appDomain);
13248
- const renderLikeButton = (rec, index) => {
13249
- var _a, _b, _c, _d;
13250
- if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
13251
- return;
13252
- let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
13253
- if (top < 40) {
13254
- top += 40;
13255
- }
13256
- if (rec.video) {
13257
- return (React.createElement(LikeButton$1, { key: rec.position, activeIcon: (_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIcon) !== null && _b !== void 0 ? _b : likeIcon, unActicveIcon: (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unlikeIcon) !== null && _c !== void 0 ? _c : unlikeIcon, position: index, active: rec.isCollected, recData: rec, className: 'clc-sxp-like-button', style: {
13258
- top,
13259
- right: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconX) !== null && _d !== void 0 ? _d : 0
13260
- } }));
13261
- }
13262
- return null;
13263
- };
13264
- const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png', appDomain);
13265
- const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png', appDomain);
13266
- const renderView = (rec, index) => {
13267
- var _a, _b, _c, _d;
13268
- return (React.createElement("div", { style: { position: 'relative' } },
13269
- renderLogo,
13270
- React.createElement(ToggleButton$1, { style: {
13271
- position: 'absolute',
13272
- right: (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _a !== void 0 ? _a : 0,
13273
- visibility: ((_c = (_b = data === null || data === void 0 ? void 0 : data[index]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
13274
- bottom: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _d !== void 0 ? _d : 23,
13275
- zIndex: 999
13276
- }, defaultValue: true, 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 }),
13277
- renderContent(rec, index),
13278
- renderBottom(rec, index),
13279
- renderLikeButton(rec, index)));
13280
- };
13281
- return (React.createElement("div", { style: {
13282
- width: '100%',
13283
- height: containerHeight,
13284
- display: 'flex',
13285
- boxSizing: 'border-box',
13286
- gap: 16,
13287
- pointerEvents: 'none',
13288
- userSelect: 'none'
13289
- } }, data === null || data === void 0 ? void 0 : data.map((rec, index) => {
13290
- return renderView(rec, index);
13291
- })));
13006
+ React.createElement(WaterFall$1, Object.assign({}, (_g = (_f = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.item) === null || _g === void 0 ? void 0 : _g.props)),
13007
+ React.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
13008
+ React.createElement("video", { ref: playerRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', style: {
13009
+ backgroundColor: 'transparent',
13010
+ width: '100%',
13011
+ height: '100%',
13012
+ objectFit: 'cover',
13013
+ pointerEvents: 'none'
13014
+ } }),
13015
+ React.createElement("div", { id: 'player-container-id-copy' }))));
13292
13016
  };
13293
- var index$1 = memo(DiyPortalPreview);
13294
13017
 
13295
13018
  /*
13296
13019
  * @Author: binruan@chatlabs.com
@@ -13432,5 +13155,4 @@ function useEditorDataProvider() {
13432
13155
  * @FilePath: \pb-sxp-ui\src\index.ts
13433
13156
  */
13434
13157
 
13435
- export { index$1 as DiyPortalPreview, EditorDataProvider, Modal$1 as Modal, SxpDataSourceProvider$1 as SxpDataSourceProvider, index as SxpPageCore, SxpPageRender, index$2 as core, Pagebuilder as default, defaultSetting, _materials_ as materials, useEditorDataProvider };
13436
- //# sourceMappingURL=index.js.map
13158
+ export { EditorDataProvider, Modal$1 as Modal, SxpDataSourceProvider$1 as SxpDataSourceProvider, index as SxpPageCore, SxpPageRender, index$1 as core, Pagebuilder as default, defaultSetting, _materials_ as materials, useEditorDataProvider };