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/pb-ui.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('uuid'), require('pako'), require('react'), require('qs'), require('@emotion/css'), require('@ant-design/pro-components'), require('react-dom'), require('eventemitter3'), require('hls.js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'uuid', 'pako', 'react', 'qs', '@emotion/css', '@ant-design/pro-components', 'react-dom', 'eventemitter3', 'hls.js'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PUI = {}, global.lodash, global.uuid$1, global.pako, global.React, global.qs, global.css, global.proComponents, global.ReactDOM, global.EventEmitter, global.Hls));
5
- })(this, (function (exports, lodash, uuid$1, pako, React, qs, css, proComponents, ReactDOM, EventEmitter, Hls) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('uuid'), require('pako'), require('react'), require('qs'), require('@emotion/css'), require('@ant-design/pro-components'), require('react-dom'), require('eventemitter3')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'uuid', 'pako', 'react', 'qs', '@emotion/css', '@ant-design/pro-components', 'react-dom', 'eventemitter3'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PUI = {}, global.lodash, global.uuid$1, global.pako, global.React, global.qs, global.css, global.proComponents, global.ReactDOM, global.EventEmitter));
5
+ })(this, (function (exports, lodash, uuid$1, pako, React, qs, css, proComponents, ReactDOM, EventEmitter) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -442,6 +442,7 @@
442
442
  const [cacheRtcList, setCacheRtcList] = React.useState([]);
443
443
  const [cacheActiveIndex, setCacheActiveIndex] = React.useState(0);
444
444
  const [isFromHashtag, setIsFromHashtag] = React.useState(false);
445
+ const [videoRef, setVideoRef] = React.useState(null);
445
446
  React.useEffect(() => {
446
447
  setOpenHashtag(isOpenHashTag);
447
448
  }, [isOpenHashTag]);
@@ -569,7 +570,7 @@
569
570
  fromKName = 'imagePage';
570
571
  }
571
572
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
572
- 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 })
573
+ 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 })
573
574
  });
574
575
  }, [bffEventReport, isFromHashtag]);
575
576
  React.useEffect(() => {
@@ -630,7 +631,9 @@
630
631
  appDomain,
631
632
  hashTagSize,
632
633
  loadingImage: loadingImage !== null && loadingImage !== void 0 ? loadingImage : defaultLoadingImage,
633
- isOpenHashTag
634
+ isOpenHashTag,
635
+ videoRef,
636
+ setVideoRef
634
637
  } }, render({ rtcList, mutateLike: bffMutateLike, mutateUnlike: bffMutateUnlike, submitForm: bffSubmitForm })));
635
638
  };
636
639
  var SxpDataSourceProvider$1 = React.memo(SxpDataSourceProvider);
@@ -856,7 +859,7 @@
856
859
  React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
857
860
  });
858
861
 
859
- var index$2 = /*#__PURE__*/Object.freeze({
862
+ var index$1 = /*#__PURE__*/Object.freeze({
860
863
  __proto__: null,
861
864
  EditorCore: EditorCore
862
865
  });
@@ -8142,8 +8145,8 @@
8142
8145
  fromKPage: location === null || location === void 0 ? void 0 : location.href,
8143
8146
  contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
8144
8147
  position: position + '',
8145
- 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 : '',
8146
- ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
8148
+ 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 : '',
8149
+ relatedCtatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
8147
8150
  traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
8148
8151
  }
8149
8152
  });
@@ -8167,8 +8170,8 @@
8167
8170
  fromKPage: location === null || location === void 0 ? void 0 : location.href,
8168
8171
  contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
8169
8172
  position: position + '',
8170
- contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
8171
- ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
8173
+ relatedContentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
8174
+ relatedCtatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
8172
8175
  traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
8173
8176
  timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
8174
8177
  eventSubject: 'productView',
@@ -8331,7 +8334,7 @@
8331
8334
  var FormatImage$1 = React.memo(FormatImage);
8332
8335
 
8333
8336
  const CommodityDetail$1 = (_a) => {
8334
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
8337
+ var _b, _c, _d, _e, _f, _g, _h, _j;
8335
8338
  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"]);
8336
8339
  const { sxpParameter } = useSxpDataSource();
8337
8340
  const { popupDetailData, bffEventReport, isPreview, waterFallData } = useSxpDataSource();
@@ -8372,7 +8375,7 @@
8372
8375
  return '$7,000';
8373
8376
  }
8374
8377
  }, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
8375
- const width = isPreview ? 375 : (_f = style === null || style === void 0 ? void 0 : style.width) !== null && _f !== void 0 ? _f : window.innerWidth;
8378
+ const width = isPreview ? 375 : window.innerWidth;
8376
8379
  const renderContent = ({ isPost }) => {
8377
8380
  var _a, _b, _c;
8378
8381
  return (React.createElement("div", null,
@@ -8392,7 +8395,7 @@
8392
8395
  };
8393
8396
  return (React.createElement("div", { className: 'pb-commondity' },
8394
8397
  React.createElement("div", Object.assign({ className: css.css(Object.assign({}, style)) }, props),
8395
- 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: {
8398
+ 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: {
8396
8399
  clickable: true,
8397
8400
  bulletActiveClass: 'swipe-item-active-bullet',
8398
8401
  clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
@@ -8400,7 +8403,7 @@
8400
8403
  : 'commondityDetail-swiper-clickable-center'
8401
8404
  }, loop: true, autoplay: {
8402
8405
  delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
8403
- } }, (_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.map((src) => {
8406
+ } }, (_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.map((src) => {
8404
8407
  return (React.createElement(SwiperSlide, { key: src },
8405
8408
  React.createElement("div", { style: {
8406
8409
  overflow: 'hidden',
@@ -8409,7 +8412,7 @@
8409
8412
  } },
8410
8413
  React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
8411
8414
  }))),
8412
- !((_j = product === null || product === void 0 ? void 0 : product.homePage) === null || _j === void 0 ? void 0 : _j.length) && (React.createElement("div", { className: css.css({
8415
+ !((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (React.createElement("div", { className: css.css({
8413
8416
  position: 'relative',
8414
8417
  height: 0,
8415
8418
  width: '100%',
@@ -8422,7 +8425,7 @@
8422
8425
  top: 0,
8423
8426
  objectFit: 'cover',
8424
8427
  width: '100%'
8425
- }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: '' }))),
8428
+ }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
8426
8429
  React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
8427
8430
  renderBtn(),
8428
8431
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) },
@@ -8782,7 +8785,7 @@
8782
8785
  ];
8783
8786
 
8784
8787
  const CommodityDetailDiroNew$1 = (_a) => {
8785
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
8788
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
8786
8789
  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"]);
8787
8790
  React.useState(true);
8788
8791
  const { sxpParameter } = useSxpDataSource();
@@ -8830,7 +8833,7 @@
8830
8833
  return '£102,300.00';
8831
8834
  }
8832
8835
  }, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
8833
- const width = isPreview ? 375 : (_f = style === null || style === void 0 ? void 0 : style.width) !== null && _f !== void 0 ? _f : window.innerWidth;
8836
+ const width = isPreview ? 375 : window.innerWidth;
8834
8837
  const productInfoText = ({ isPost }) => {
8835
8838
  return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8836
8839
  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) ||
@@ -8839,7 +8842,7 @@ Made in Italy` })));
8839
8842
  };
8840
8843
  return (React.createElement("div", { className: 'pb-commondityDiroNew' },
8841
8844
  React.createElement("div", Object.assign({ ref: scrollRef, className: css.css(Object.assign({}, style)) }, props),
8842
- 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: {
8845
+ 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: {
8843
8846
  clickable: true,
8844
8847
  bulletActiveClass: 'commondityDiroNew-swipe-item-active-bullet',
8845
8848
  clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
@@ -8847,7 +8850,7 @@ Made in Italy` })));
8847
8850
  : 'commondityDiroNew-swiper-clickable-center'
8848
8851
  }, loop: true, autoplay: {
8849
8852
  delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
8850
- } }, (_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.map((src) => {
8853
+ } }, (_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.map((src) => {
8851
8854
  return (React.createElement(SwiperSlide, { key: src },
8852
8855
  React.createElement("div", { style: {
8853
8856
  overflow: 'hidden',
@@ -8856,7 +8859,7 @@ Made in Italy` })));
8856
8859
  } },
8857
8860
  React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
8858
8861
  }))),
8859
- !((_j = product === null || product === void 0 ? void 0 : product.homePage) === null || _j === void 0 ? void 0 : _j.length) && (React.createElement("div", { className: css.css({
8862
+ !((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (React.createElement("div", { className: css.css({
8860
8863
  position: 'relative',
8861
8864
  height: 0,
8862
8865
  width: '100%',
@@ -8869,16 +8872,16 @@ Made in Italy` })));
8869
8872
  top: 0,
8870
8873
  objectFit: 'cover',
8871
8874
  width: '100%'
8872
- }), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: '' }))),
8875
+ }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
8873
8876
  React.createElement("div", { className: 'pb-commondityDiroNew-content' },
8874
8877
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
8875
8878
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
8876
- 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'),
8879
+ 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'),
8877
8880
  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')),
8878
8881
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
8879
8882
  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),
8880
- 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 : '税费'))),
8881
- (!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')),
8883
+ 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 : '税费'))),
8884
+ (!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')),
8882
8885
  productInfoText({ isPost }))),
8883
8886
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
8884
8887
  };
@@ -11786,7 +11789,7 @@ Made in Italy` })));
11786
11789
  }
11787
11790
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
11788
11791
  eventInfo: {
11789
- contentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
11792
+ relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
11790
11793
  position: cacheActiveIndex + '',
11791
11794
  contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
11792
11795
  traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
@@ -11919,14 +11922,14 @@ Made in Italy` })));
11919
11922
  Prompt: Prompt
11920
11923
  });
11921
11924
 
11922
- const defaultUnLikeIconPath$1 = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
11923
- const defaultLikeIconPath$1 = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
11925
+ const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
11926
+ const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
11924
11927
  const LikeButton = (_a) => {
11925
11928
  var { active, activeIcon, unActicveIcon, recData, position } = _a, props = __rest(_a, ["active", "activeIcon", "unActicveIcon", "recData", "position"]);
11926
11929
  const { mutateLike, mutateUnlike, bffEventReport } = useSxpDataSource();
11927
11930
  const [state, setState] = React.useState(active);
11928
- const likeIcon = useIconLink(defaultLikeIconPath$1);
11929
- const unlikeIcon = useIconLink(defaultUnLikeIconPath$1);
11931
+ const likeIcon = useIconLink(defaultLikeIconPath);
11932
+ const unlikeIcon = useIconLink(defaultUnLikeIconPath);
11930
11933
  const handleClick = lodash.debounce(() => __awaiter(void 0, void 0, void 0, function* () {
11931
11934
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
11932
11935
  if (state) {
@@ -11982,9 +11985,8 @@ Made in Italy` })));
11982
11985
  SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
11983
11986
  })(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
11984
11987
 
11985
- const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig }) => {
11988
+ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
11986
11989
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
11987
- const videoRef = React.useRef(null);
11988
11990
  const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
11989
11991
  const videoStartTime = React.useRef(0);
11990
11992
  const [isLoadFinish, setIsLoadFinish] = React.useState(false);
@@ -11992,99 +11994,118 @@ Made in Italy` })));
11992
11994
  const { isActive } = useSwiperSlide();
11993
11995
  const canvasRef = React.useRef(null);
11994
11996
  const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
11997
+ const videoId = `pb-cache-video-${index}`;
11998
+ const videoEleRef = React.useRef(null);
11995
11999
  React.useEffect(() => {
11996
- if (!videoRef.current)
12000
+ if (!videoRef)
11997
12001
  return;
11998
- videoRef.current.muted = muted;
11999
- }, [muted]);
12000
- const handleVideoStart = React.useCallback(() => {
12001
- var _a;
12002
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
12003
- }, []);
12002
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.muted(muted);
12003
+ }, [muted, videoRef]);
12004
+ const handleEnded = React.useCallback(() => {
12005
+ if (!videoRef)
12006
+ return;
12007
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12008
+ }, [videoRef]);
12004
12009
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
12005
12010
  const handlePlaying = React.useCallback(() => {
12006
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12011
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
12012
+ if (!videoRef)
12013
+ return;
12007
12014
  setIsPauseVideo(false);
12008
12015
  const item = data[index];
12009
- if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
12010
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
12011
- const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
12012
- const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
12016
+ if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration())) {
12017
+ videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) || 0;
12018
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12019
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12013
12020
  const playType = isFirstPlay ? '0' : '1';
12014
12021
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12015
12022
  eventInfo: {
12016
12023
  eventSubject: 'playVideo',
12017
12024
  eventDescription: 'User played the video',
12018
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12019
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
12025
+ contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
12026
+ contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
12020
12027
  playType,
12021
12028
  startTime: videoCurrentTime,
12022
12029
  videoDuration,
12023
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
12030
+ contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
12024
12031
  position: index + '',
12025
12032
  contentFormat: 'video',
12026
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
12033
+ traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
12027
12034
  }
12028
12035
  });
12029
12036
  setIsFirstPlay(false);
12030
12037
  }
12031
- }, [bffEventReport, data, index, isFirstPlay]);
12032
- const handleLoadedMetadata = React.useCallback(() => {
12038
+ }, [bffEventReport, data, index, isFirstPlay, videoRef]);
12039
+ const handleLoadedmetadata = React.useCallback(() => {
12040
+ if (!videoRef)
12041
+ return;
12042
+ if (activeIndex !== index) {
12043
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12044
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12045
+ }
12046
+ setIsLoadFinish(true);
12047
+ }, [activeIndex, index, videoRef]);
12048
+ const handleCanplay = React.useCallback(() => {
12033
12049
  setIsLoadFinish(true);
12034
12050
  }, []);
12035
12051
  const handleClickVideo = React.useCallback((type) => () => {
12036
- var _a, _b, _c, _d, _e;
12052
+ if (!videoRef)
12053
+ return;
12037
12054
  if (!isLoadFinish)
12038
12055
  return;
12039
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12056
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
12040
12057
  switch (type) {
12041
12058
  case 'start':
12042
12059
  if (!isPause)
12043
12060
  return;
12044
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
12061
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12045
12062
  setIsPauseVideo(false);
12046
12063
  break;
12047
12064
  case 'pause':
12048
12065
  if (isPause)
12049
12066
  return;
12050
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12067
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12051
12068
  setIsPauseVideo(true);
12052
12069
  break;
12053
12070
  default:
12054
12071
  if (isPause) {
12055
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
12072
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12056
12073
  }
12057
12074
  else {
12058
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
12075
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12059
12076
  }
12060
12077
  setIsPauseVideo(!isPause);
12061
12078
  break;
12062
12079
  }
12063
- }, [isLoadFinish]);
12064
- const onPause = React.useCallback(() => {
12065
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12080
+ }, [isLoadFinish, videoRef]);
12081
+ const handlePause = React.useCallback(() => {
12082
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
12083
+ if (!videoRef)
12084
+ return;
12085
+ if (activeIndex !== index)
12086
+ return;
12066
12087
  const item = data[index];
12067
- const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12068
- const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
12069
- if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
12070
- const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
12088
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
12089
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12090
+ if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) {
12091
+ const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) - videoStartTime.current).toFixed(2);
12071
12092
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12072
12093
  eventInfo: {
12073
12094
  eventSubject: 'playOverVideo',
12074
12095
  eventDescription: 'User finished playing the video',
12075
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12076
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
12096
+ contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
12097
+ contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
12077
12098
  endTime: videoCurrentTime,
12078
12099
  videoDuration,
12079
12100
  playDuration,
12080
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
12101
+ contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
12081
12102
  position: index + '',
12082
12103
  contentFormat: 'video',
12083
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
12104
+ traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
12084
12105
  }
12085
12106
  });
12086
12107
  }
12087
- }, [data, index, bffEventReport]);
12108
+ }, [data, index, bffEventReport, videoRef]);
12088
12109
  const blur = React.useMemo(() => {
12089
12110
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12090
12111
  }, [videoPostConfig]);
@@ -12099,82 +12120,82 @@ Made in Italy` })));
12099
12120
  return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12100
12121
  }, [firstFrameSrc, rec]);
12101
12122
  const handLoadeddata = React.useCallback(() => {
12102
- if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
12123
+ var _a;
12124
+ if (!videoRef)
12103
12125
  return;
12104
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12105
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12106
- const ctx = canvas.getContext('2d');
12107
- const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12108
- const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
12109
- canvas.height = targetHeight;
12110
- canvas.width = targetWidth;
12111
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12112
- setFirstFrameSrc(canvas.toDataURL());
12113
- }, []);
12126
+ const videoDomRef = document.getElementById(`${videoId}_html5_api`);
12127
+ if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !videoDomRef || !canvasRef.current)
12128
+ return;
12129
+ const setFrameImg = () => {
12130
+ const video = videoDomRef;
12131
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12132
+ const ctx = canvas.getContext('2d');
12133
+ const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12134
+ const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
12135
+ canvas.height = targetHeight;
12136
+ canvas.width = targetWidth;
12137
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12138
+ setFirstFrameSrc(canvas.toDataURL());
12139
+ };
12140
+ setFrameImg();
12141
+ setTimeout(() => {
12142
+ setFrameImg();
12143
+ }, 500);
12144
+ }, [videoRef]);
12114
12145
  React.useEffect(() => {
12115
- var _a, _b, _c, _d;
12116
- if (!videoRef.current)
12146
+ if (!isActive || !videoRef)
12147
+ return;
12148
+ const videoSrc = rec.video.url;
12149
+ if (!videoSrc)
12117
12150
  return;
12118
12151
  setIsPauseVideo(false);
12119
- if (!videoRef.current.src) {
12120
- const videoSrc = rec.video.url;
12121
- // if (videoSrc.includes('.m3u8')) {
12122
- // if (Hls.isSupported()) {
12123
- // const hls = new Hls();
12124
- // hls.loadSource(videoSrc);
12125
- // hls.attachMedia(videoRef.current);
12126
- // hls.on(Hls.Events.MANIFEST_PARSED, function () {
12127
- // videoRef?.current?.play();
12128
- // });
12129
- // } else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
12130
- // videoRef.current.src = videoSrc;
12131
- // } else {
12132
- // videoRef.current.src = videoSrc;
12133
- // }
12134
- // } else {
12135
- videoRef.current.src = videoSrc;
12136
- // }
12137
- videoRef.current.setAttribute('x5-playsinline', 'true');
12138
- videoRef.current.setAttribute('webkit-playsinline', 'true');
12139
- }
12140
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
12141
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12142
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12143
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
12152
+ const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
12153
+ const dom = document.querySelector('#player-container-id');
12154
+ const dom2 = document.querySelector('#player-container-id-copy');
12155
+ if (!dom && !dom2)
12156
+ return;
12157
+ videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
12158
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
12159
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
12160
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
12161
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('canplay', handleCanplay);
12162
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('playing', handlePlaying);
12163
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('pause', handlePause);
12164
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('ended', handleEnded);
12144
12165
  return () => {
12145
- var _a, _b, _c, _d;
12146
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
12147
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
12148
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
12149
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
12166
+ dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
12167
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadedmetadata', handleLoadedmetadata);
12168
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadeddata', handLoadeddata);
12169
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('canplay', handleCanplay);
12170
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('playing', handlePlaying);
12171
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('pause', handlePause);
12172
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('ended', handleEnded);
12150
12173
  };
12151
- }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
12174
+ }, [isActive, videoId, rec, videoRef]);
12152
12175
  React.useEffect(() => {
12153
- var _a;
12154
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
12176
+ if (!videoRef || !isLoadFinish)
12155
12177
  return;
12156
12178
  if (isActive) {
12157
- videoRef.current.play();
12179
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12158
12180
  }
12159
12181
  else {
12160
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
12182
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12161
12183
  }
12162
- }, [isActive, isLoadFinish]);
12184
+ }, [isActive, isLoadFinish, videoRef]);
12163
12185
  /*
12164
12186
  打开/关闭hashtag暂停/播放视频
12165
12187
  */
12166
12188
  React.useEffect(() => {
12167
- var _a, _b, _c;
12168
- if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
12189
+ if (!isActive || !videoRef)
12169
12190
  return;
12170
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12191
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
12171
12192
  if (!isPause && openHashtag) {
12172
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
12193
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
12173
12194
  }
12174
12195
  else if (!openHashtag) {
12175
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
12196
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
12176
12197
  }
12177
- }, [openHashtag, isActive]);
12198
+ }, [openHashtag, isActive, videoRef]);
12178
12199
  React.useEffect(() => {
12179
12200
  if (!isActive)
12180
12201
  return;
@@ -12194,9 +12215,11 @@ Made in Italy` })));
12194
12215
  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 }));
12195
12216
  }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
12196
12217
  React.useEffect(() => {
12218
+ if (!videoRef)
12219
+ return;
12197
12220
  const handleBeforeUnload = () => {
12198
- var _a, _b;
12199
- 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) {
12221
+ var _a;
12222
+ if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && videoRef && !isPauseVideo) {
12200
12223
  handleClickVideo('pause')();
12201
12224
  }
12202
12225
  };
@@ -12234,23 +12257,19 @@ Made in Italy` })));
12234
12257
  right: 0
12235
12258
  } },
12236
12259
  React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
12237
- 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: {
12238
- width: '100%',
12239
- height: '100%',
12240
- objectFit: 'contain'
12241
- } }),
12260
+ React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
12242
12261
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
12243
- renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
12262
+ renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
12244
12263
  position: 'relative',
12245
12264
  width: '100%',
12246
12265
  height,
12247
12266
  overflow: 'hidden'
12248
- } },
12249
- 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 }),
12267
+ }, onClick: handleClickVideo() },
12268
+ React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
12250
12269
  renderPoster,
12251
12270
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
12252
12271
  };
12253
- var VideoWidget$3 = React.memo(VideoWidget$2);
12272
+ var VideoWidget$1 = React.memo(VideoWidget);
12254
12273
 
12255
12274
  /*
12256
12275
  * @Author: binruan@chatlabs.com
@@ -12350,7 +12369,7 @@ Made in Italy` })));
12350
12369
  * @LastEditTime: 2024-04-18 19:56:22
12351
12370
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12352
12371
  */
12353
- const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
12372
+ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
12354
12373
  var _a;
12355
12374
  const ref = React.useRef();
12356
12375
  const { isActive } = useSwiperSlide();
@@ -12379,7 +12398,7 @@ Made in Italy` })));
12379
12398
  React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
12380
12399
  })));
12381
12400
  };
12382
- var PictureGroup$3 = React.memo(PictureGroup$2);
12401
+ var PictureGroup$1 = React.memo(PictureGroup);
12383
12402
 
12384
12403
  /*
12385
12404
  * @Author: binruan@chatlabs.com
@@ -12558,7 +12577,7 @@ Made in Italy` })));
12558
12577
  * @Author: binruan@chatlabs.com
12559
12578
  * @Date: 2024-01-15 19:03:09
12560
12579
  * @LastEditors: binruan@chatlabs.com
12561
- * @LastEditTime: 2024-04-23 15:48:32
12580
+ * @LastEditTime: 2024-04-29 15:48:42
12562
12581
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12563
12582
  *
12564
12583
  */
@@ -12574,6 +12593,8 @@ Made in Italy` })));
12574
12593
  const [isLoadMore, setIsLoadMore] = React.useState(false);
12575
12594
  const [isShowMore, setIsShowMore] = React.useState(false);
12576
12595
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
12596
+ const [videoRef, setVideoRef] = React.useState(null);
12597
+ const playerRef = React.useRef();
12577
12598
  const { productView } = useEventReport();
12578
12599
  const isShowFingerTip = React.useMemo(() => {
12579
12600
  return data.length > 0 && !loading && getFeUserId();
@@ -12611,6 +12632,25 @@ Made in Italy` })));
12611
12632
  viewTime.current = new Date();
12612
12633
  refreshFeSessionId();
12613
12634
  };
12635
+ const firstRef = React.useRef();
12636
+ React.useEffect(() => {
12637
+ if (!firstRef.current && !videoRef) {
12638
+ firstRef.current = true;
12639
+ const player = TCPlayer('player-container-id', {
12640
+ licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
12641
+ controls: false,
12642
+ autoplay: false,
12643
+ loop: false,
12644
+ muted: true,
12645
+ preload: 'auto',
12646
+ posterImage: false,
12647
+ bigPlayButton: true
12648
+ });
12649
+ player === null || player === void 0 ? void 0 : player.ready(() => {
12650
+ setVideoRef(player);
12651
+ });
12652
+ }
12653
+ }, [videoRef]);
12614
12654
  React.useEffect(() => {
12615
12655
  if (!isInit)
12616
12656
  handleH5EnterLink();
@@ -12640,8 +12680,8 @@ Made in Italy` })));
12640
12680
  // sessionDuration: Math.floor(((new Date() as any) - curTime) / 1000) + '',
12641
12681
  // eventSubject: 'sessionCompleted',
12642
12682
  // eventDescription: 'Session completed',
12643
- // contentId: item?.video?.itemId,
12644
- // productId: item?.product?.itemId,
12683
+ // relatedContentId: item?.video?.itemId,
12684
+ // relatedProductId: item?.product?.itemId,
12645
12685
  // position: item?.position
12646
12686
  // }
12647
12687
  // });
@@ -12685,12 +12725,12 @@ Made in Italy` })));
12685
12725
  sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
12686
12726
  eventSubject: 'sessionCompleted',
12687
12727
  eventDescription: 'Session completed',
12688
- contentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
12689
- productId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
12728
+ relatedContentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
12729
+ relatedProductId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
12690
12730
  position: activeIndex + '',
12691
12731
  fromKName,
12692
12732
  fromKPage: location === null || location === void 0 ? void 0 : location.href,
12693
- 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 : ''
12733
+ 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 : ''
12694
12734
  }
12695
12735
  });
12696
12736
  }
@@ -12719,10 +12759,10 @@ Made in Italy` })));
12719
12759
  const renderContent = React.useCallback((rec, index) => {
12720
12760
  var _a, _b, _c, _d;
12721
12761
  if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
12722
- 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 }));
12762
+ 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 }));
12723
12763
  }
12724
12764
  if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
12725
- 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 }));
12765
+ 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 }));
12726
12766
  }
12727
12767
  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) {
12728
12768
  return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
@@ -12734,7 +12774,19 @@ Made in Italy` })));
12734
12774
  });
12735
12775
  }
12736
12776
  return null;
12737
- }, [containerWidth, data, height, isMuted, activeIndex, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost, viewTime, tipText, resolver, schema]);
12777
+ }, [
12778
+ containerWidth,
12779
+ data,
12780
+ height,
12781
+ isMuted,
12782
+ activeIndex,
12783
+ globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost,
12784
+ viewTime,
12785
+ tipText,
12786
+ resolver,
12787
+ schema,
12788
+ videoRef
12789
+ ]);
12738
12790
  const onExpandableChange = React.useCallback((v) => {
12739
12791
  setIsShowMore(v);
12740
12792
  }, []);
@@ -12824,8 +12876,8 @@ Made in Italy` })));
12824
12876
  eventInfo: {
12825
12877
  eventSubject: 'scrollDown',
12826
12878
  eventDescription: 'User scroll down',
12827
- contentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
12828
- productId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
12879
+ relatedContentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
12880
+ relatedProductId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
12829
12881
  requestId: null
12830
12882
  }
12831
12883
  });
@@ -12837,8 +12889,8 @@ Made in Italy` })));
12837
12889
  eventInfo: {
12838
12890
  eventSubject: 'scrollUp',
12839
12891
  eventDescription: 'User scroll up',
12840
- contentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
12841
- productId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12892
+ relatedContentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
12893
+ relatedProductId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12842
12894
  requestId: null
12843
12895
  }
12844
12896
  });
@@ -12919,7 +12971,12 @@ Made in Italy` })));
12919
12971
  } })),
12920
12972
  renderLogo,
12921
12973
  isShowFingerTip ? React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
12922
- React.createElement(Swiper, { ref: swiperRef, onActiveIndexChange: (swiper) => {
12974
+ React.createElement(Swiper, { ref: swiperRef, onSlideChange: () => {
12975
+ swiperRef.current.swiper.allowTouchMove = false;
12976
+ setTimeout(() => {
12977
+ swiperRef.current.swiper.allowTouchMove = true;
12978
+ }, 500);
12979
+ }, onActiveIndexChange: (swiper) => {
12923
12980
  setActiveIndex(swiper.activeIndex);
12924
12981
  if (openHashtag)
12925
12982
  return;
@@ -12936,6 +12993,9 @@ Made in Italy` })));
12936
12993
  }
12937
12994
  }
12938
12995
  },
12996
+ // style={{
12997
+ // pointerEvents: canSwiper ? 'auto' : 'none'
12998
+ // }}
12939
12999
  // onReachEnd={() => {
12940
13000
  // // 由hashtaglist跳转过来时不执行下面的方法
12941
13001
  // if (waterFallData) return;
@@ -12958,353 +13018,17 @@ Made in Italy` })));
12958
13018
  zIndex: 999
12959
13019
  }, 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 }),
12960
13020
  renderView),
12961
- 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))));
12962
- };
12963
-
12964
- const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index }) => {
12965
- 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) => {
12966
- return (React.createElement(SwiperSlide, { key: url },
12967
- React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
12968
- })));
12969
- };
12970
- var PictureGroup$1 = React.memo(PictureGroup);
12971
-
12972
- const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, width }) => {
12973
- const [isPauseVideo, setIsPauseVideo] = React.useState(false);
12974
- const videoRef = React.useRef(null);
12975
- const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
12976
- const videoStartTime = React.useRef(0);
12977
- const [isLoadFinish, setIsLoadFinish] = React.useState(false);
12978
- const [isFirstPlay, setIsFirstPlay] = React.useState(true);
12979
- const canvasRef = React.useRef(null);
12980
- const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
12981
- React.useEffect(() => {
12982
- if (!videoRef.current)
12983
- return;
12984
- videoRef.current.muted = muted;
12985
- }, [muted]);
12986
- const handleVideoStart = React.useCallback(() => {
12987
- var _a;
12988
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
12989
- }, []);
12990
- const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
12991
- const handlePlaying = React.useCallback(() => {
12992
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12993
- setIsPauseVideo(false);
12994
- const item = data[index];
12995
- if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
12996
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
12997
- const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
12998
- const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
12999
- const playType = isFirstPlay ? '0' : '1';
13000
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
13001
- eventInfo: {
13002
- eventSubject: 'playVideo',
13003
- eventDescription: 'User played the video',
13004
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
13005
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
13006
- playType,
13007
- startTime: videoCurrentTime,
13008
- videoDuration,
13009
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
13010
- position: index + '',
13011
- contentFormat: 'video',
13012
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
13013
- }
13014
- });
13015
- setIsFirstPlay(false);
13016
- }
13017
- }, [bffEventReport, data, index, isFirstPlay]);
13018
- const handleLoadedMetadata = React.useCallback(() => {
13019
- setIsLoadFinish(true);
13020
- }, []);
13021
- const handleClickVideo = React.useCallback((type) => () => {
13022
- var _a, _b, _c, _d, _e;
13023
- if (!isLoadFinish)
13024
- return;
13025
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
13026
- switch (type) {
13027
- case 'start':
13028
- if (!isPause)
13029
- return;
13030
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
13031
- setIsPauseVideo(false);
13032
- break;
13033
- case 'pause':
13034
- if (isPause)
13035
- return;
13036
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
13037
- setIsPauseVideo(true);
13038
- break;
13039
- default:
13040
- if (isPause) {
13041
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
13042
- }
13043
- else {
13044
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
13045
- }
13046
- setIsPauseVideo(!isPause);
13047
- break;
13048
- }
13049
- }, [isLoadFinish]);
13050
- const onPause = React.useCallback(() => {
13051
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
13052
- const item = data[index];
13053
- const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
13054
- const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
13055
- if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
13056
- const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
13057
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
13058
- eventInfo: {
13059
- eventSubject: 'playOverVideo',
13060
- eventDescription: 'User finished playing the video',
13061
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
13062
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
13063
- endTime: videoCurrentTime,
13064
- videoDuration,
13065
- playDuration,
13066
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
13067
- position: index + '',
13068
- contentFormat: 'video',
13069
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
13070
- }
13071
- });
13072
- }
13073
- }, [data, index, bffEventReport]);
13074
- const blur = React.useMemo(() => {
13075
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
13076
- }, [videoPostConfig]);
13077
- const translateY = React.useMemo(() => {
13078
- var _a;
13079
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
13080
- ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
13081
- : 'translateY(-50%)';
13082
- }, [videoPostConfig]);
13083
- const blurBgSrc = React.useMemo(() => {
13084
- var _a;
13085
- return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
13086
- }, [firstFrameSrc, rec]);
13087
- const handLoadeddata = React.useCallback(() => {
13088
- if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
13089
- return;
13090
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
13091
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
13092
- const ctx = canvas.getContext('2d');
13093
- const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
13094
- const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
13095
- canvas.height = targetHeight;
13096
- canvas.width = targetWidth;
13097
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
13098
- setFirstFrameSrc(canvas.toDataURL());
13099
- }, []);
13100
- React.useEffect(() => {
13101
- var _a, _b, _c, _d;
13102
- if (!videoRef.current)
13103
- return;
13104
- setIsPauseVideo(false);
13105
- if (!videoRef.current.src) {
13106
- const videoSrc = rec.video.url;
13107
- if (videoSrc.includes('.m3u8')) {
13108
- if (Hls.isSupported()) {
13109
- const hls = new Hls();
13110
- hls.loadSource(videoSrc);
13111
- hls.attachMedia(videoRef.current);
13112
- }
13113
- else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
13114
- videoRef.current.src = videoSrc;
13115
- }
13116
- else {
13117
- videoRef.current.src = videoSrc;
13118
- }
13119
- }
13120
- else {
13121
- videoRef.current.src = videoSrc;
13122
- }
13123
- videoRef.current.setAttribute('x5-playsinline', 'true');
13124
- videoRef.current.setAttribute('webkit-playsinline', 'true');
13125
- }
13126
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
13127
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
13128
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
13129
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
13130
- return () => {
13131
- var _a, _b, _c, _d;
13132
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
13133
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
13134
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
13135
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
13136
- };
13137
- }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
13138
- const renderPoster = React.useMemo(() => {
13139
- if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
13140
- return null;
13141
- }
13142
- 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 }));
13143
- }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
13144
- React.useEffect(() => {
13145
- const handleBeforeUnload = () => {
13146
- var _a, _b;
13147
- 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) {
13148
- handleClickVideo('pause')();
13149
- }
13150
- };
13151
- window.addEventListener('beforeunload', handleBeforeUnload);
13152
- return () => {
13153
- window.removeEventListener('beforeunload', handleBeforeUnload);
13154
- };
13155
- }, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
13156
- const blurStyle = React.useMemo(() => {
13157
- return blur
13158
- ? {
13159
- filter: 'blur(10px)',
13160
- transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
13161
- }
13162
- : {};
13163
- }, [blur]);
13164
- if (!rec.video) {
13165
- return null;
13166
- }
13167
- return (React.createElement(React.Fragment, null, blur ? (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
13168
- position: 'relative',
13169
- width,
13170
- height,
13171
- overflow: 'hidden'
13172
- } },
13173
- React.createElement(FormatImage$1, { src: blurBgSrc, style: Object.assign({ height,
13174
- width, objectFit: 'cover' }, blurStyle) }),
13175
- React.createElement("canvas", { ref: canvasRef, style: { display: 'none' } }),
13176
- React.createElement("div", { style: {
13177
- position: 'absolute',
13178
- width,
13179
- height,
13180
- top: '50%',
13181
- transform: translateY,
13182
- left: 0,
13183
- right: 0
13184
- } },
13185
- React.createElement("div", { style: { position: 'relative', width, height: '100%' } },
13186
- 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: {
13187
- width: '100%',
13188
- height,
13189
- objectFit: 'contain'
13190
- } }),
13191
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
13192
- renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
13193
- position: 'relative',
13194
- width,
13195
- height,
13196
- overflow: 'hidden'
13197
- } },
13198
- 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 }),
13199
- renderPoster,
13200
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
13201
- };
13202
- var VideoWidget$1 = React.memo(VideoWidget);
13203
-
13204
- const RESOLVER$1 = {};
13205
- Object.values(_materials_).forEach((v) => {
13206
- RESOLVER$1[v.extend.type] = v;
13207
- });
13208
- const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
13209
- const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
13210
- const DiyPortalPreview = ({ data, globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain }) => {
13211
- const height = React.useMemo(() => {
13212
- return (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo) ? containerHeight - 45 : containerHeight;
13213
- }, [globalConfig, containerHeight]);
13214
- const renderContent = (rec, index) => {
13215
- var _a, _b, _c, _d;
13216
- if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
13217
- 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 }));
13218
- }
13219
- if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
13220
- 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 }));
13221
- }
13222
- if (rec.product) {
13223
- 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) {
13224
- return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
13225
- var _a, _b, _c, _d, _e, _f, _g, _h;
13226
- const t = RESOLVER$1[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
13227
- const Component = withBindDataSource(t);
13228
- const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
13229
- 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) || {},
13230
- // schema={schema}
13231
- id: value === null || value === void 0 ? void 0 : value.id,
13232
- // viewTime={viewTime.current}
13233
- 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 })));
13234
- });
13235
- }
13236
- }
13237
- };
13238
- const renderLogo = React.useMemo(() => {
13239
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
13240
- return (React.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
13241
- React.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
13242
- }
13243
- return null;
13244
- }, [globalConfig]);
13245
- const renderBottom = (rec, index) => {
13246
- var _a, _b, _c, _d, _e, _f, _g;
13247
- if (rec.video) {
13248
- return (React.createElement(React.Fragment, null,
13249
- ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
13250
- React.createElement("div", { className: 'clc-sxp-bottom' },
13251
- React.createElement(Nudge, { nudge: nudge }),
13252
- React.createElement("div", { className: 'clc-sxp-bottom-card' },
13253
- React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER$1 })),
13254
- React.createElement("div", null,
13255
- 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' }) })),
13256
- 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 }))));
13257
- }
13258
- return null;
13259
- };
13260
- const likeIcon = useIconLink(defaultLikeIconPath, appDomain);
13261
- const unlikeIcon = useIconLink(defaultUnLikeIconPath, appDomain);
13262
- const renderLikeButton = (rec, index) => {
13263
- var _a, _b, _c, _d;
13264
- if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
13265
- return;
13266
- let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
13267
- if (top < 40) {
13268
- top += 40;
13269
- }
13270
- if (rec.video) {
13271
- 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: {
13272
- top,
13273
- right: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconX) !== null && _d !== void 0 ? _d : 0
13274
- } }));
13275
- }
13276
- return null;
13277
- };
13278
- const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png', appDomain);
13279
- const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png', appDomain);
13280
- const renderView = (rec, index) => {
13281
- var _a, _b, _c, _d;
13282
- return (React.createElement("div", { style: { position: 'relative' } },
13283
- renderLogo,
13284
- React.createElement(ToggleButton$1, { style: {
13285
- position: 'absolute',
13286
- right: (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _a !== void 0 ? _a : 0,
13287
- 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',
13288
- bottom: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _d !== void 0 ? _d : 23,
13289
- zIndex: 999
13290
- }, 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 }),
13291
- renderContent(rec, index),
13292
- renderBottom(rec, index),
13293
- renderLikeButton(rec, index)));
13294
- };
13295
- return (React.createElement("div", { style: {
13296
- width: '100%',
13297
- height: containerHeight,
13298
- display: 'flex',
13299
- boxSizing: 'border-box',
13300
- gap: 16,
13301
- pointerEvents: 'none',
13302
- userSelect: 'none'
13303
- } }, data === null || data === void 0 ? void 0 : data.map((rec, index) => {
13304
- return renderView(rec, index);
13305
- })));
13021
+ 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)),
13022
+ React.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
13023
+ React.createElement("video", { ref: playerRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', style: {
13024
+ backgroundColor: 'transparent',
13025
+ width: '100%',
13026
+ height: '100%',
13027
+ objectFit: 'cover',
13028
+ pointerEvents: 'none'
13029
+ } }),
13030
+ React.createElement("div", { id: 'player-container-id-copy' }))));
13306
13031
  };
13307
- var index$1 = React.memo(DiyPortalPreview);
13308
13032
 
13309
13033
  /*
13310
13034
  * @Author: binruan@chatlabs.com
@@ -13446,13 +13170,12 @@ Made in Italy` })));
13446
13170
  * @FilePath: \pb-sxp-ui\src\index.ts
13447
13171
  */
13448
13172
 
13449
- exports.DiyPortalPreview = index$1;
13450
13173
  exports.EditorDataProvider = EditorDataProvider;
13451
13174
  exports.Modal = Modal$1;
13452
13175
  exports.SxpDataSourceProvider = SxpDataSourceProvider$1;
13453
13176
  exports.SxpPageCore = index;
13454
13177
  exports.SxpPageRender = SxpPageRender;
13455
- exports.core = index$2;
13178
+ exports.core = index$1;
13456
13179
  exports.default = Pagebuilder;
13457
13180
  exports.defaultSetting = defaultSetting;
13458
13181
  exports.materials = _materials_;
@@ -13461,4 +13184,3 @@ Made in Italy` })));
13461
13184
  Object.defineProperty(exports, '__esModule', { value: true });
13462
13185
 
13463
13186
  }));
13464
- //# sourceMappingURL=pb-ui.js.map