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.
- package/dist/index.cjs +218 -497
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -6
- package/dist/index.js +218 -496
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +222 -500
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/VideoWidget/index.js +119 -88
- package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/es/core/components/SxpPageRender/index.js +58 -11
- package/es/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/es/core/context/SxpDataSourceProvider.js +5 -2
- package/es/core/hooks/useEventReport.js +4 -4
- package/es/index.d.ts +0 -1
- package/es/index.js +0 -1
- package/es/materials/sxp/popup/CommodityDetail/index.js +6 -6
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -9
- package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +119 -88
- package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/lib/core/components/SxpPageRender/index.js +58 -11
- package/lib/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/lib/core/context/SxpDataSourceProvider.js +5 -2
- package/lib/core/hooks/useEventReport.js +4 -4
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/materials/sxp/popup/CommodityDetail/index.js +6 -6
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -9
- package/package.json +1 -2
- package/es/core/components/DiyPortalPreview/PictureGroup.d.ts +0 -13
- package/es/core/components/DiyPortalPreview/PictureGroup.js +0 -11
- package/es/core/components/DiyPortalPreview/VideoWidget.d.ts +0 -15
- package/es/core/components/DiyPortalPreview/VideoWidget.js +0 -236
- package/es/core/components/DiyPortalPreview/index.d.ts +0 -6
- package/es/core/components/DiyPortalPreview/index.js +0 -112
- package/lib/core/components/DiyPortalPreview/PictureGroup.d.ts +0 -13
- package/lib/core/components/DiyPortalPreview/PictureGroup.js +0 -14
- package/lib/core/components/DiyPortalPreview/VideoWidget.d.ts +0 -15
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +0 -239
- package/lib/core/components/DiyPortalPreview/index.d.ts +0 -6
- package/lib/core/components/DiyPortalPreview/index.js +0 -115
package/dist/index.cjs
CHANGED
@@ -11,7 +11,6 @@ var css = require('@emotion/css');
|
|
11
11
|
var proComponents = require('@ant-design/pro-components');
|
12
12
|
var ReactDOM = require('react-dom');
|
13
13
|
var EventEmitter = require('eventemitter3');
|
14
|
-
var Hls = require('hls.js');
|
15
14
|
|
16
15
|
function _interopNamespaceDefault(e) {
|
17
16
|
var n = Object.create(null);
|
@@ -451,6 +450,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
451
450
|
const [cacheRtcList, setCacheRtcList] = React.useState([]);
|
452
451
|
const [cacheActiveIndex, setCacheActiveIndex] = React.useState(0);
|
453
452
|
const [isFromHashtag, setIsFromHashtag] = React.useState(false);
|
453
|
+
const [videoRef, setVideoRef] = React.useState(null);
|
454
454
|
React.useEffect(() => {
|
455
455
|
setOpenHashtag(isOpenHashTag);
|
456
456
|
}, [isOpenHashTag]);
|
@@ -578,7 +578,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
578
578
|
fromKName = 'imagePage';
|
579
579
|
}
|
580
580
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
581
|
-
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 + '',
|
581
|
+
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 })
|
582
582
|
});
|
583
583
|
}, [bffEventReport, isFromHashtag]);
|
584
584
|
React.useEffect(() => {
|
@@ -639,7 +639,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
639
639
|
appDomain,
|
640
640
|
hashTagSize,
|
641
641
|
loadingImage: loadingImage !== null && loadingImage !== void 0 ? loadingImage : defaultLoadingImage,
|
642
|
-
isOpenHashTag
|
642
|
+
isOpenHashTag,
|
643
|
+
videoRef,
|
644
|
+
setVideoRef
|
643
645
|
} }, render({ rtcList, mutateLike: bffMutateLike, mutateUnlike: bffMutateUnlike, submitForm: bffSubmitForm })));
|
644
646
|
};
|
645
647
|
var SxpDataSourceProvider$1 = React.memo(SxpDataSourceProvider);
|
@@ -865,7 +867,7 @@ const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enable
|
|
865
867
|
React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
|
866
868
|
});
|
867
869
|
|
868
|
-
var index$
|
870
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
869
871
|
__proto__: null,
|
870
872
|
EditorCore: EditorCore
|
871
873
|
});
|
@@ -8151,8 +8153,8 @@ function useEventReport() {
|
|
8151
8153
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
8152
8154
|
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
8153
8155
|
position: position + '',
|
8154
|
-
|
8155
|
-
|
8156
|
+
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 : '',
|
8157
|
+
relatedCtatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
|
8156
8158
|
traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
|
8157
8159
|
}
|
8158
8160
|
});
|
@@ -8176,8 +8178,8 @@ function useEventReport() {
|
|
8176
8178
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
8177
8179
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
8178
8180
|
position: position + '',
|
8179
|
-
|
8180
|
-
|
8181
|
+
relatedContentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
8182
|
+
relatedCtatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
8181
8183
|
traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
|
8182
8184
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
8183
8185
|
eventSubject: 'productView',
|
@@ -8340,7 +8342,7 @@ const FormatImage = React.forwardRef((props, ref) => {
|
|
8340
8342
|
var FormatImage$1 = React.memo(FormatImage);
|
8341
8343
|
|
8342
8344
|
const CommodityDetail$1 = (_a) => {
|
8343
|
-
var _b, _c, _d, _e, _f, _g, _h, _j
|
8345
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
8344
8346
|
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"]);
|
8345
8347
|
const { sxpParameter } = useSxpDataSource();
|
8346
8348
|
const { popupDetailData, bffEventReport, isPreview, waterFallData } = useSxpDataSource();
|
@@ -8381,7 +8383,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8381
8383
|
return '$7,000';
|
8382
8384
|
}
|
8383
8385
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
8384
|
-
const width = isPreview ? 375 :
|
8386
|
+
const width = isPreview ? 375 : window.innerWidth;
|
8385
8387
|
const renderContent = ({ isPost }) => {
|
8386
8388
|
var _a, _b, _c;
|
8387
8389
|
return (React.createElement("div", null,
|
@@ -8401,7 +8403,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8401
8403
|
};
|
8402
8404
|
return (React.createElement("div", { className: 'pb-commondity' },
|
8403
8405
|
React.createElement("div", Object.assign({ className: css.css(Object.assign({}, style)) }, props),
|
8404
|
-
product && ((
|
8406
|
+
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: {
|
8405
8407
|
clickable: true,
|
8406
8408
|
bulletActiveClass: 'swipe-item-active-bullet',
|
8407
8409
|
clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
|
@@ -8409,7 +8411,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8409
8411
|
: 'commondityDetail-swiper-clickable-center'
|
8410
8412
|
}, loop: true, autoplay: {
|
8411
8413
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
8412
|
-
} }, (
|
8414
|
+
} }, (_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.map((src) => {
|
8413
8415
|
return (React.createElement(SwiperSlide, { key: src },
|
8414
8416
|
React.createElement("div", { style: {
|
8415
8417
|
overflow: 'hidden',
|
@@ -8418,7 +8420,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8418
8420
|
} },
|
8419
8421
|
React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
8420
8422
|
}))),
|
8421
|
-
!((
|
8423
|
+
!((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (React.createElement("div", { className: css.css({
|
8422
8424
|
position: 'relative',
|
8423
8425
|
height: 0,
|
8424
8426
|
width: '100%',
|
@@ -8431,7 +8433,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8431
8433
|
top: 0,
|
8432
8434
|
objectFit: 'cover',
|
8433
8435
|
width: '100%'
|
8434
|
-
}), src: (
|
8436
|
+
}), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
|
8435
8437
|
React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
|
8436
8438
|
renderBtn(),
|
8437
8439
|
React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) },
|
@@ -8791,7 +8793,7 @@ var settingRender$2 = [
|
|
8791
8793
|
];
|
8792
8794
|
|
8793
8795
|
const CommodityDetailDiroNew$1 = (_a) => {
|
8794
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
8796
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
8795
8797
|
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"]);
|
8796
8798
|
React.useState(true);
|
8797
8799
|
const { sxpParameter } = useSxpDataSource();
|
@@ -8839,7 +8841,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
|
|
8839
8841
|
return '£102,300.00';
|
8840
8842
|
}
|
8841
8843
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
8842
|
-
const width = isPreview ? 375 :
|
8844
|
+
const width = isPreview ? 375 : window.innerWidth;
|
8843
8845
|
const productInfoText = ({ isPost }) => {
|
8844
8846
|
return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
8845
8847
|
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) ||
|
@@ -8848,7 +8850,7 @@ Made in Italy` })));
|
|
8848
8850
|
};
|
8849
8851
|
return (React.createElement("div", { className: 'pb-commondityDiroNew' },
|
8850
8852
|
React.createElement("div", Object.assign({ ref: scrollRef, className: css.css(Object.assign({}, style)) }, props),
|
8851
|
-
product && ((
|
8853
|
+
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: {
|
8852
8854
|
clickable: true,
|
8853
8855
|
bulletActiveClass: 'commondityDiroNew-swipe-item-active-bullet',
|
8854
8856
|
clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
|
@@ -8856,7 +8858,7 @@ Made in Italy` })));
|
|
8856
8858
|
: 'commondityDiroNew-swiper-clickable-center'
|
8857
8859
|
}, loop: true, autoplay: {
|
8858
8860
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
8859
|
-
} }, (
|
8861
|
+
} }, (_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.map((src) => {
|
8860
8862
|
return (React.createElement(SwiperSlide, { key: src },
|
8861
8863
|
React.createElement("div", { style: {
|
8862
8864
|
overflow: 'hidden',
|
@@ -8865,7 +8867,7 @@ Made in Italy` })));
|
|
8865
8867
|
} },
|
8866
8868
|
React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
8867
8869
|
}))),
|
8868
|
-
!((
|
8870
|
+
!((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (React.createElement("div", { className: css.css({
|
8869
8871
|
position: 'relative',
|
8870
8872
|
height: 0,
|
8871
8873
|
width: '100%',
|
@@ -8878,16 +8880,16 @@ Made in Italy` })));
|
|
8878
8880
|
top: 0,
|
8879
8881
|
objectFit: 'cover',
|
8880
8882
|
width: '100%'
|
8881
|
-
}), src: (
|
8883
|
+
}), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
|
8882
8884
|
React.createElement("div", { className: 'pb-commondityDiroNew-content' },
|
8883
8885
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
|
8884
8886
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
|
8885
|
-
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (
|
8887
|
+
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'),
|
8886
8888
|
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')),
|
8887
8889
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
|
8888
8890
|
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),
|
8889
|
-
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 }, (
|
8890
|
-
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (
|
8891
|
+
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 : '税费'))),
|
8892
|
+
(!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')),
|
8891
8893
|
productInfoText({ isPost }))),
|
8892
8894
|
React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
|
8893
8895
|
};
|
@@ -11795,7 +11797,7 @@ const WaterFall = (props) => {
|
|
11795
11797
|
}
|
11796
11798
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
11797
11799
|
eventInfo: {
|
11798
|
-
|
11800
|
+
relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
11799
11801
|
position: cacheActiveIndex + '',
|
11800
11802
|
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
11801
11803
|
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
@@ -11928,14 +11930,14 @@ var _materials_ = /*#__PURE__*/Object.freeze({
|
|
11928
11930
|
Prompt: Prompt
|
11929
11931
|
});
|
11930
11932
|
|
11931
|
-
const defaultUnLikeIconPath
|
11932
|
-
const defaultLikeIconPath
|
11933
|
+
const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
11934
|
+
const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
11933
11935
|
const LikeButton = (_a) => {
|
11934
11936
|
var { active, activeIcon, unActicveIcon, recData, position } = _a, props = __rest(_a, ["active", "activeIcon", "unActicveIcon", "recData", "position"]);
|
11935
11937
|
const { mutateLike, mutateUnlike, bffEventReport } = useSxpDataSource();
|
11936
11938
|
const [state, setState] = React.useState(active);
|
11937
|
-
const likeIcon = useIconLink(defaultLikeIconPath
|
11938
|
-
const unlikeIcon = useIconLink(defaultUnLikeIconPath
|
11939
|
+
const likeIcon = useIconLink(defaultLikeIconPath);
|
11940
|
+
const unlikeIcon = useIconLink(defaultUnLikeIconPath);
|
11939
11941
|
const handleClick = lodash.debounce(() => __awaiter(void 0, void 0, void 0, function* () {
|
11940
11942
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
11941
11943
|
if (state) {
|
@@ -11991,9 +11993,8 @@ var SXP_EVENT_TYPE;
|
|
11991
11993
|
SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
|
11992
11994
|
})(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
|
11993
11995
|
|
11994
|
-
const VideoWidget
|
11996
|
+
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
|
11995
11997
|
const [isPauseVideo, setIsPauseVideo] = React.useState(false);
|
11996
|
-
const videoRef = React.useRef(null);
|
11997
11998
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
|
11998
11999
|
const videoStartTime = React.useRef(0);
|
11999
12000
|
const [isLoadFinish, setIsLoadFinish] = React.useState(false);
|
@@ -12001,99 +12002,118 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12001
12002
|
const { isActive } = useSwiperSlide();
|
12002
12003
|
const canvasRef = React.useRef(null);
|
12003
12004
|
const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
|
12005
|
+
const videoId = `pb-cache-video-${index}`;
|
12006
|
+
const videoEleRef = React.useRef(null);
|
12004
12007
|
React.useEffect(() => {
|
12005
|
-
if (!videoRef
|
12008
|
+
if (!videoRef)
|
12006
12009
|
return;
|
12007
|
-
videoRef
|
12008
|
-
}, [muted]);
|
12009
|
-
const
|
12010
|
-
|
12011
|
-
|
12012
|
-
|
12010
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.muted(muted);
|
12011
|
+
}, [muted, videoRef]);
|
12012
|
+
const handleEnded = React.useCallback(() => {
|
12013
|
+
if (!videoRef)
|
12014
|
+
return;
|
12015
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12016
|
+
}, [videoRef]);
|
12013
12017
|
const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
12014
12018
|
const handlePlaying = React.useCallback(() => {
|
12015
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
12019
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
12020
|
+
if (!videoRef)
|
12021
|
+
return;
|
12016
12022
|
setIsPauseVideo(false);
|
12017
12023
|
const item = data[index];
|
12018
|
-
if (item && (
|
12019
|
-
videoStartTime.current = (
|
12020
|
-
const videoDuration = ((
|
12021
|
-
const videoCurrentTime = ((
|
12024
|
+
if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration())) {
|
12025
|
+
videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) || 0;
|
12026
|
+
const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
|
12027
|
+
const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
12022
12028
|
const playType = isFirstPlay ? '0' : '1';
|
12023
12029
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12024
12030
|
eventInfo: {
|
12025
12031
|
eventSubject: 'playVideo',
|
12026
12032
|
eventDescription: 'User played the video',
|
12027
|
-
contentId: (
|
12028
|
-
contentName: (
|
12033
|
+
contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
12034
|
+
contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
|
12029
12035
|
playType,
|
12030
12036
|
startTime: videoCurrentTime,
|
12031
12037
|
videoDuration,
|
12032
|
-
contentTags: JSON.stringify((
|
12038
|
+
contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
|
12033
12039
|
position: index + '',
|
12034
12040
|
contentFormat: 'video',
|
12035
|
-
traceInfo: (
|
12041
|
+
traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
|
12036
12042
|
}
|
12037
12043
|
});
|
12038
12044
|
setIsFirstPlay(false);
|
12039
12045
|
}
|
12040
|
-
}, [bffEventReport, data, index, isFirstPlay]);
|
12041
|
-
const
|
12046
|
+
}, [bffEventReport, data, index, isFirstPlay, videoRef]);
|
12047
|
+
const handleLoadedmetadata = React.useCallback(() => {
|
12048
|
+
if (!videoRef)
|
12049
|
+
return;
|
12050
|
+
if (activeIndex !== index) {
|
12051
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12052
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12053
|
+
}
|
12054
|
+
setIsLoadFinish(true);
|
12055
|
+
}, [activeIndex, index, videoRef]);
|
12056
|
+
const handleCanplay = React.useCallback(() => {
|
12042
12057
|
setIsLoadFinish(true);
|
12043
12058
|
}, []);
|
12044
12059
|
const handleClickVideo = React.useCallback((type) => () => {
|
12045
|
-
|
12060
|
+
if (!videoRef)
|
12061
|
+
return;
|
12046
12062
|
if (!isLoadFinish)
|
12047
12063
|
return;
|
12048
|
-
const isPause =
|
12064
|
+
const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
|
12049
12065
|
switch (type) {
|
12050
12066
|
case 'start':
|
12051
12067
|
if (!isPause)
|
12052
12068
|
return;
|
12053
|
-
|
12069
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12054
12070
|
setIsPauseVideo(false);
|
12055
12071
|
break;
|
12056
12072
|
case 'pause':
|
12057
12073
|
if (isPause)
|
12058
12074
|
return;
|
12059
|
-
|
12075
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12060
12076
|
setIsPauseVideo(true);
|
12061
12077
|
break;
|
12062
12078
|
default:
|
12063
12079
|
if (isPause) {
|
12064
|
-
|
12080
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12065
12081
|
}
|
12066
12082
|
else {
|
12067
|
-
|
12083
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12068
12084
|
}
|
12069
12085
|
setIsPauseVideo(!isPause);
|
12070
12086
|
break;
|
12071
12087
|
}
|
12072
|
-
}, [isLoadFinish]);
|
12073
|
-
const
|
12074
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
12088
|
+
}, [isLoadFinish, videoRef]);
|
12089
|
+
const handlePause = React.useCallback(() => {
|
12090
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
12091
|
+
if (!videoRef)
|
12092
|
+
return;
|
12093
|
+
if (activeIndex !== index)
|
12094
|
+
return;
|
12075
12095
|
const item = data[index];
|
12076
|
-
const videoDuration = ((
|
12077
|
-
const videoCurrentTime = ((
|
12078
|
-
if (
|
12079
|
-
const playDuration = ((
|
12096
|
+
const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
|
12097
|
+
const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
12098
|
+
if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) {
|
12099
|
+
const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) - videoStartTime.current).toFixed(2);
|
12080
12100
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12081
12101
|
eventInfo: {
|
12082
12102
|
eventSubject: 'playOverVideo',
|
12083
12103
|
eventDescription: 'User finished playing the video',
|
12084
|
-
contentId: (
|
12085
|
-
contentName: (
|
12104
|
+
contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
12105
|
+
contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
|
12086
12106
|
endTime: videoCurrentTime,
|
12087
12107
|
videoDuration,
|
12088
12108
|
playDuration,
|
12089
|
-
contentTags: JSON.stringify((
|
12109
|
+
contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
|
12090
12110
|
position: index + '',
|
12091
12111
|
contentFormat: 'video',
|
12092
|
-
traceInfo: (
|
12112
|
+
traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
|
12093
12113
|
}
|
12094
12114
|
});
|
12095
12115
|
}
|
12096
|
-
}, [data, index, bffEventReport]);
|
12116
|
+
}, [data, index, bffEventReport, videoRef]);
|
12097
12117
|
const blur = React.useMemo(() => {
|
12098
12118
|
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
12099
12119
|
}, [videoPostConfig]);
|
@@ -12108,82 +12128,82 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12108
12128
|
return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
|
12109
12129
|
}, [firstFrameSrc, rec]);
|
12110
12130
|
const handLoadeddata = React.useCallback(() => {
|
12111
|
-
|
12131
|
+
var _a;
|
12132
|
+
if (!videoRef)
|
12112
12133
|
return;
|
12113
|
-
const
|
12114
|
-
|
12115
|
-
|
12116
|
-
const
|
12117
|
-
|
12118
|
-
|
12119
|
-
|
12120
|
-
|
12121
|
-
|
12122
|
-
|
12134
|
+
const videoDomRef = document.getElementById(`${videoId}_html5_api`);
|
12135
|
+
if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !videoDomRef || !canvasRef.current)
|
12136
|
+
return;
|
12137
|
+
const setFrameImg = () => {
|
12138
|
+
const video = videoDomRef;
|
12139
|
+
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
12140
|
+
const ctx = canvas.getContext('2d');
|
12141
|
+
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
12142
|
+
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
12143
|
+
canvas.height = targetHeight;
|
12144
|
+
canvas.width = targetWidth;
|
12145
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
12146
|
+
setFirstFrameSrc(canvas.toDataURL());
|
12147
|
+
};
|
12148
|
+
setFrameImg();
|
12149
|
+
setTimeout(() => {
|
12150
|
+
setFrameImg();
|
12151
|
+
}, 500);
|
12152
|
+
}, [videoRef]);
|
12123
12153
|
React.useEffect(() => {
|
12124
|
-
|
12125
|
-
|
12154
|
+
if (!isActive || !videoRef)
|
12155
|
+
return;
|
12156
|
+
const videoSrc = rec.video.url;
|
12157
|
+
if (!videoSrc)
|
12126
12158
|
return;
|
12127
12159
|
setIsPauseVideo(false);
|
12128
|
-
|
12129
|
-
|
12130
|
-
|
12131
|
-
|
12132
|
-
|
12133
|
-
|
12134
|
-
|
12135
|
-
|
12136
|
-
|
12137
|
-
|
12138
|
-
|
12139
|
-
|
12140
|
-
|
12141
|
-
// videoRef.current.src = videoSrc;
|
12142
|
-
// }
|
12143
|
-
// } else {
|
12144
|
-
videoRef.current.src = videoSrc;
|
12145
|
-
// }
|
12146
|
-
videoRef.current.setAttribute('x5-playsinline', 'true');
|
12147
|
-
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
12148
|
-
}
|
12149
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
|
12150
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
|
12151
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
|
12152
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
|
12160
|
+
const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
|
12161
|
+
const dom = document.querySelector('#player-container-id');
|
12162
|
+
const dom2 = document.querySelector('#player-container-id-copy');
|
12163
|
+
if (!dom && !dom2)
|
12164
|
+
return;
|
12165
|
+
videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
|
12166
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
|
12167
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
|
12168
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
|
12169
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('canplay', handleCanplay);
|
12170
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('playing', handlePlaying);
|
12171
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('pause', handlePause);
|
12172
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('ended', handleEnded);
|
12153
12173
|
return () => {
|
12154
|
-
|
12155
|
-
|
12156
|
-
|
12157
|
-
|
12158
|
-
|
12174
|
+
dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
|
12175
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadedmetadata', handleLoadedmetadata);
|
12176
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadeddata', handLoadeddata);
|
12177
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('canplay', handleCanplay);
|
12178
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('playing', handlePlaying);
|
12179
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('pause', handlePause);
|
12180
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('ended', handleEnded);
|
12159
12181
|
};
|
12160
|
-
}, [
|
12182
|
+
}, [isActive, videoId, rec, videoRef]);
|
12161
12183
|
React.useEffect(() => {
|
12162
|
-
|
12163
|
-
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
12184
|
+
if (!videoRef || !isLoadFinish)
|
12164
12185
|
return;
|
12165
12186
|
if (isActive) {
|
12166
|
-
videoRef.
|
12187
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12167
12188
|
}
|
12168
12189
|
else {
|
12169
|
-
|
12190
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12170
12191
|
}
|
12171
|
-
}, [isActive, isLoadFinish]);
|
12192
|
+
}, [isActive, isLoadFinish, videoRef]);
|
12172
12193
|
/*
|
12173
12194
|
打开/关闭hashtag暂停/播放视频
|
12174
12195
|
*/
|
12175
12196
|
React.useEffect(() => {
|
12176
|
-
|
12177
|
-
if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
12197
|
+
if (!isActive || !videoRef)
|
12178
12198
|
return;
|
12179
|
-
const isPause =
|
12199
|
+
const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
|
12180
12200
|
if (!isPause && openHashtag) {
|
12181
|
-
|
12201
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
12182
12202
|
}
|
12183
12203
|
else if (!openHashtag) {
|
12184
|
-
|
12204
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
|
12185
12205
|
}
|
12186
|
-
}, [openHashtag, isActive]);
|
12206
|
+
}, [openHashtag, isActive, videoRef]);
|
12187
12207
|
React.useEffect(() => {
|
12188
12208
|
if (!isActive)
|
12189
12209
|
return;
|
@@ -12203,9 +12223,11 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12203
12223
|
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 }));
|
12204
12224
|
}, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
|
12205
12225
|
React.useEffect(() => {
|
12226
|
+
if (!videoRef)
|
12227
|
+
return;
|
12206
12228
|
const handleBeforeUnload = () => {
|
12207
|
-
var _a
|
12208
|
-
if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) &&
|
12229
|
+
var _a;
|
12230
|
+
if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && videoRef && !isPauseVideo) {
|
12209
12231
|
handleClickVideo('pause')();
|
12210
12232
|
}
|
12211
12233
|
};
|
@@ -12243,23 +12265,19 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
12243
12265
|
right: 0
|
12244
12266
|
} },
|
12245
12267
|
React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
12246
|
-
React.createElement("
|
12247
|
-
width: '100%',
|
12248
|
-
height: '100%',
|
12249
|
-
objectFit: 'contain'
|
12250
|
-
} }),
|
12268
|
+
React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
|
12251
12269
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
|
12252
|
-
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId,
|
12270
|
+
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
|
12253
12271
|
position: 'relative',
|
12254
12272
|
width: '100%',
|
12255
12273
|
height,
|
12256
12274
|
overflow: 'hidden'
|
12257
|
-
} },
|
12258
|
-
React.createElement("
|
12275
|
+
}, onClick: handleClickVideo() },
|
12276
|
+
React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
|
12259
12277
|
renderPoster,
|
12260
12278
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
|
12261
12279
|
};
|
12262
|
-
var VideoWidget$
|
12280
|
+
var VideoWidget$1 = React.memo(VideoWidget);
|
12263
12281
|
|
12264
12282
|
/*
|
12265
12283
|
* @Author: binruan@chatlabs.com
|
@@ -12359,7 +12377,7 @@ const Picture = (props) => {
|
|
12359
12377
|
* @LastEditTime: 2024-04-18 19:56:22
|
12360
12378
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
|
12361
12379
|
*/
|
12362
|
-
const PictureGroup
|
12380
|
+
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
|
12363
12381
|
var _a;
|
12364
12382
|
const ref = React.useRef();
|
12365
12383
|
const { isActive } = useSwiperSlide();
|
@@ -12388,7 +12406,7 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageE
|
|
12388
12406
|
React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
|
12389
12407
|
})));
|
12390
12408
|
};
|
12391
|
-
var PictureGroup$
|
12409
|
+
var PictureGroup$1 = React.memo(PictureGroup);
|
12392
12410
|
|
12393
12411
|
/*
|
12394
12412
|
* @Author: binruan@chatlabs.com
|
@@ -12567,7 +12585,7 @@ const Nudge = ({ nudge }) => {
|
|
12567
12585
|
* @Author: binruan@chatlabs.com
|
12568
12586
|
* @Date: 2024-01-15 19:03:09
|
12569
12587
|
* @LastEditors: binruan@chatlabs.com
|
12570
|
-
* @LastEditTime: 2024-04-
|
12588
|
+
* @LastEditTime: 2024-04-29 15:48:42
|
12571
12589
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12572
12590
|
*
|
12573
12591
|
*/
|
@@ -12583,6 +12601,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12583
12601
|
const [isLoadMore, setIsLoadMore] = React.useState(false);
|
12584
12602
|
const [isShowMore, setIsShowMore] = React.useState(false);
|
12585
12603
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
|
12604
|
+
const [videoRef, setVideoRef] = React.useState(null);
|
12605
|
+
const playerRef = React.useRef();
|
12586
12606
|
const { productView } = useEventReport();
|
12587
12607
|
const isShowFingerTip = React.useMemo(() => {
|
12588
12608
|
return data.length > 0 && !loading && getFeUserId();
|
@@ -12620,6 +12640,25 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12620
12640
|
viewTime.current = new Date();
|
12621
12641
|
refreshFeSessionId();
|
12622
12642
|
};
|
12643
|
+
const firstRef = React.useRef();
|
12644
|
+
React.useEffect(() => {
|
12645
|
+
if (!firstRef.current && !videoRef) {
|
12646
|
+
firstRef.current = true;
|
12647
|
+
const player = TCPlayer('player-container-id', {
|
12648
|
+
licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl
|
12649
|
+
controls: false,
|
12650
|
+
autoplay: false,
|
12651
|
+
loop: false,
|
12652
|
+
muted: true,
|
12653
|
+
preload: 'auto',
|
12654
|
+
posterImage: false,
|
12655
|
+
bigPlayButton: true
|
12656
|
+
});
|
12657
|
+
player === null || player === void 0 ? void 0 : player.ready(() => {
|
12658
|
+
setVideoRef(player);
|
12659
|
+
});
|
12660
|
+
}
|
12661
|
+
}, [videoRef]);
|
12623
12662
|
React.useEffect(() => {
|
12624
12663
|
if (!isInit)
|
12625
12664
|
handleH5EnterLink();
|
@@ -12649,8 +12688,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12649
12688
|
// sessionDuration: Math.floor(((new Date() as any) - curTime) / 1000) + '',
|
12650
12689
|
// eventSubject: 'sessionCompleted',
|
12651
12690
|
// eventDescription: 'Session completed',
|
12652
|
-
//
|
12653
|
-
//
|
12691
|
+
// relatedContentId: item?.video?.itemId,
|
12692
|
+
// relatedProductId: item?.product?.itemId,
|
12654
12693
|
// position: item?.position
|
12655
12694
|
// }
|
12656
12695
|
// });
|
@@ -12694,12 +12733,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12694
12733
|
sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
|
12695
12734
|
eventSubject: 'sessionCompleted',
|
12696
12735
|
eventDescription: 'Session completed',
|
12697
|
-
|
12698
|
-
|
12736
|
+
relatedContentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
|
12737
|
+
relatedProductId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
|
12699
12738
|
position: activeIndex + '',
|
12700
12739
|
fromKName,
|
12701
12740
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
12702
|
-
|
12741
|
+
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 : ''
|
12703
12742
|
}
|
12704
12743
|
});
|
12705
12744
|
}
|
@@ -12728,10 +12767,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12728
12767
|
const renderContent = React.useCallback((rec, index) => {
|
12729
12768
|
var _a, _b, _c, _d;
|
12730
12769
|
if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
12731
|
-
return (React.createElement(VideoWidget$
|
12770
|
+
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 }));
|
12732
12771
|
}
|
12733
12772
|
if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
|
12734
|
-
return (React.createElement(PictureGroup$
|
12773
|
+
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 }));
|
12735
12774
|
}
|
12736
12775
|
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) {
|
12737
12776
|
return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
|
@@ -12743,7 +12782,19 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12743
12782
|
});
|
12744
12783
|
}
|
12745
12784
|
return null;
|
12746
|
-
}, [
|
12785
|
+
}, [
|
12786
|
+
containerWidth,
|
12787
|
+
data,
|
12788
|
+
height,
|
12789
|
+
isMuted,
|
12790
|
+
activeIndex,
|
12791
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost,
|
12792
|
+
viewTime,
|
12793
|
+
tipText,
|
12794
|
+
resolver,
|
12795
|
+
schema,
|
12796
|
+
videoRef
|
12797
|
+
]);
|
12747
12798
|
const onExpandableChange = React.useCallback((v) => {
|
12748
12799
|
setIsShowMore(v);
|
12749
12800
|
}, []);
|
@@ -12833,8 +12884,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12833
12884
|
eventInfo: {
|
12834
12885
|
eventSubject: 'scrollDown',
|
12835
12886
|
eventDescription: 'User scroll down',
|
12836
|
-
|
12837
|
-
|
12887
|
+
relatedContentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
|
12888
|
+
relatedProductId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
12838
12889
|
requestId: null
|
12839
12890
|
}
|
12840
12891
|
});
|
@@ -12846,8 +12897,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12846
12897
|
eventInfo: {
|
12847
12898
|
eventSubject: 'scrollUp',
|
12848
12899
|
eventDescription: 'User scroll up',
|
12849
|
-
|
12850
|
-
|
12900
|
+
relatedContentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
|
12901
|
+
relatedProductId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
12851
12902
|
requestId: null
|
12852
12903
|
}
|
12853
12904
|
});
|
@@ -12928,7 +12979,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12928
12979
|
} })),
|
12929
12980
|
renderLogo,
|
12930
12981
|
isShowFingerTip ? React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
|
12931
|
-
React.createElement(Swiper, { ref: swiperRef,
|
12982
|
+
React.createElement(Swiper, { ref: swiperRef, onSlideChange: () => {
|
12983
|
+
swiperRef.current.swiper.allowTouchMove = false;
|
12984
|
+
setTimeout(() => {
|
12985
|
+
swiperRef.current.swiper.allowTouchMove = true;
|
12986
|
+
}, 500);
|
12987
|
+
}, onActiveIndexChange: (swiper) => {
|
12932
12988
|
setActiveIndex(swiper.activeIndex);
|
12933
12989
|
if (openHashtag)
|
12934
12990
|
return;
|
@@ -12945,6 +13001,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12945
13001
|
}
|
12946
13002
|
}
|
12947
13003
|
},
|
13004
|
+
// style={{
|
13005
|
+
// pointerEvents: canSwiper ? 'auto' : 'none'
|
13006
|
+
// }}
|
12948
13007
|
// onReachEnd={() => {
|
12949
13008
|
// // 由hashtaglist跳转过来时不执行下面的方法
|
12950
13009
|
// if (waterFallData) return;
|
@@ -12967,353 +13026,17 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12967
13026
|
zIndex: 999
|
12968
13027
|
}, 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 }),
|
12969
13028
|
renderView),
|
12970
|
-
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))
|
12971
|
-
}
|
12972
|
-
|
12973
|
-
|
12974
|
-
|
12975
|
-
|
12976
|
-
|
12977
|
-
|
12978
|
-
}
|
12979
|
-
|
12980
|
-
|
12981
|
-
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, width }) => {
|
12982
|
-
const [isPauseVideo, setIsPauseVideo] = React.useState(false);
|
12983
|
-
const videoRef = React.useRef(null);
|
12984
|
-
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
|
12985
|
-
const videoStartTime = React.useRef(0);
|
12986
|
-
const [isLoadFinish, setIsLoadFinish] = React.useState(false);
|
12987
|
-
const [isFirstPlay, setIsFirstPlay] = React.useState(true);
|
12988
|
-
const canvasRef = React.useRef(null);
|
12989
|
-
const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
|
12990
|
-
React.useEffect(() => {
|
12991
|
-
if (!videoRef.current)
|
12992
|
-
return;
|
12993
|
-
videoRef.current.muted = muted;
|
12994
|
-
}, [muted]);
|
12995
|
-
const handleVideoStart = React.useCallback(() => {
|
12996
|
-
var _a;
|
12997
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
12998
|
-
}, []);
|
12999
|
-
const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
13000
|
-
const handlePlaying = React.useCallback(() => {
|
13001
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
13002
|
-
setIsPauseVideo(false);
|
13003
|
-
const item = data[index];
|
13004
|
-
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
13005
|
-
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
13006
|
-
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
13007
|
-
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
13008
|
-
const playType = isFirstPlay ? '0' : '1';
|
13009
|
-
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
13010
|
-
eventInfo: {
|
13011
|
-
eventSubject: 'playVideo',
|
13012
|
-
eventDescription: 'User played the video',
|
13013
|
-
contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
13014
|
-
contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
|
13015
|
-
playType,
|
13016
|
-
startTime: videoCurrentTime,
|
13017
|
-
videoDuration,
|
13018
|
-
contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
|
13019
|
-
position: index + '',
|
13020
|
-
contentFormat: 'video',
|
13021
|
-
traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
13022
|
-
}
|
13023
|
-
});
|
13024
|
-
setIsFirstPlay(false);
|
13025
|
-
}
|
13026
|
-
}, [bffEventReport, data, index, isFirstPlay]);
|
13027
|
-
const handleLoadedMetadata = React.useCallback(() => {
|
13028
|
-
setIsLoadFinish(true);
|
13029
|
-
}, []);
|
13030
|
-
const handleClickVideo = React.useCallback((type) => () => {
|
13031
|
-
var _a, _b, _c, _d, _e;
|
13032
|
-
if (!isLoadFinish)
|
13033
|
-
return;
|
13034
|
-
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
13035
|
-
switch (type) {
|
13036
|
-
case 'start':
|
13037
|
-
if (!isPause)
|
13038
|
-
return;
|
13039
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
|
13040
|
-
setIsPauseVideo(false);
|
13041
|
-
break;
|
13042
|
-
case 'pause':
|
13043
|
-
if (isPause)
|
13044
|
-
return;
|
13045
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
13046
|
-
setIsPauseVideo(true);
|
13047
|
-
break;
|
13048
|
-
default:
|
13049
|
-
if (isPause) {
|
13050
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
|
13051
|
-
}
|
13052
|
-
else {
|
13053
|
-
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
|
13054
|
-
}
|
13055
|
-
setIsPauseVideo(!isPause);
|
13056
|
-
break;
|
13057
|
-
}
|
13058
|
-
}, [isLoadFinish]);
|
13059
|
-
const onPause = React.useCallback(() => {
|
13060
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
13061
|
-
const item = data[index];
|
13062
|
-
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
13063
|
-
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
13064
|
-
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
|
13065
|
-
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
|
13066
|
-
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
13067
|
-
eventInfo: {
|
13068
|
-
eventSubject: 'playOverVideo',
|
13069
|
-
eventDescription: 'User finished playing the video',
|
13070
|
-
contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
13071
|
-
contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
|
13072
|
-
endTime: videoCurrentTime,
|
13073
|
-
videoDuration,
|
13074
|
-
playDuration,
|
13075
|
-
contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
|
13076
|
-
position: index + '',
|
13077
|
-
contentFormat: 'video',
|
13078
|
-
traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
13079
|
-
}
|
13080
|
-
});
|
13081
|
-
}
|
13082
|
-
}, [data, index, bffEventReport]);
|
13083
|
-
const blur = React.useMemo(() => {
|
13084
|
-
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
13085
|
-
}, [videoPostConfig]);
|
13086
|
-
const translateY = React.useMemo(() => {
|
13087
|
-
var _a;
|
13088
|
-
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
|
13089
|
-
? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
|
13090
|
-
: 'translateY(-50%)';
|
13091
|
-
}, [videoPostConfig]);
|
13092
|
-
const blurBgSrc = React.useMemo(() => {
|
13093
|
-
var _a;
|
13094
|
-
return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
|
13095
|
-
}, [firstFrameSrc, rec]);
|
13096
|
-
const handLoadeddata = React.useCallback(() => {
|
13097
|
-
if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
|
13098
|
-
return;
|
13099
|
-
const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
|
13100
|
-
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
13101
|
-
const ctx = canvas.getContext('2d');
|
13102
|
-
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
13103
|
-
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
13104
|
-
canvas.height = targetHeight;
|
13105
|
-
canvas.width = targetWidth;
|
13106
|
-
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
13107
|
-
setFirstFrameSrc(canvas.toDataURL());
|
13108
|
-
}, []);
|
13109
|
-
React.useEffect(() => {
|
13110
|
-
var _a, _b, _c, _d;
|
13111
|
-
if (!videoRef.current)
|
13112
|
-
return;
|
13113
|
-
setIsPauseVideo(false);
|
13114
|
-
if (!videoRef.current.src) {
|
13115
|
-
const videoSrc = rec.video.url;
|
13116
|
-
if (videoSrc.includes('.m3u8')) {
|
13117
|
-
if (Hls.isSupported()) {
|
13118
|
-
const hls = new Hls();
|
13119
|
-
hls.loadSource(videoSrc);
|
13120
|
-
hls.attachMedia(videoRef.current);
|
13121
|
-
}
|
13122
|
-
else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
|
13123
|
-
videoRef.current.src = videoSrc;
|
13124
|
-
}
|
13125
|
-
else {
|
13126
|
-
videoRef.current.src = videoSrc;
|
13127
|
-
}
|
13128
|
-
}
|
13129
|
-
else {
|
13130
|
-
videoRef.current.src = videoSrc;
|
13131
|
-
}
|
13132
|
-
videoRef.current.setAttribute('x5-playsinline', 'true');
|
13133
|
-
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
13134
|
-
}
|
13135
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
|
13136
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
|
13137
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
|
13138
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
|
13139
|
-
return () => {
|
13140
|
-
var _a, _b, _c, _d;
|
13141
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
|
13142
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
|
13143
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
|
13144
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
|
13145
|
-
};
|
13146
|
-
}, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
|
13147
|
-
const renderPoster = React.useMemo(() => {
|
13148
|
-
if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
|
13149
|
-
return null;
|
13150
|
-
}
|
13151
|
-
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 }));
|
13152
|
-
}, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
|
13153
|
-
React.useEffect(() => {
|
13154
|
-
const handleBeforeUnload = () => {
|
13155
|
-
var _a, _b;
|
13156
|
-
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) {
|
13157
|
-
handleClickVideo('pause')();
|
13158
|
-
}
|
13159
|
-
};
|
13160
|
-
window.addEventListener('beforeunload', handleBeforeUnload);
|
13161
|
-
return () => {
|
13162
|
-
window.removeEventListener('beforeunload', handleBeforeUnload);
|
13163
|
-
};
|
13164
|
-
}, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
|
13165
|
-
const blurStyle = React.useMemo(() => {
|
13166
|
-
return blur
|
13167
|
-
? {
|
13168
|
-
filter: 'blur(10px)',
|
13169
|
-
transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
|
13170
|
-
}
|
13171
|
-
: {};
|
13172
|
-
}, [blur]);
|
13173
|
-
if (!rec.video) {
|
13174
|
-
return null;
|
13175
|
-
}
|
13176
|
-
return (React.createElement(React.Fragment, null, blur ? (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
|
13177
|
-
position: 'relative',
|
13178
|
-
width,
|
13179
|
-
height,
|
13180
|
-
overflow: 'hidden'
|
13181
|
-
} },
|
13182
|
-
React.createElement(FormatImage$1, { src: blurBgSrc, style: Object.assign({ height,
|
13183
|
-
width, objectFit: 'cover' }, blurStyle) }),
|
13184
|
-
React.createElement("canvas", { ref: canvasRef, style: { display: 'none' } }),
|
13185
|
-
React.createElement("div", { style: {
|
13186
|
-
position: 'absolute',
|
13187
|
-
width,
|
13188
|
-
height,
|
13189
|
-
top: '50%',
|
13190
|
-
transform: translateY,
|
13191
|
-
left: 0,
|
13192
|
-
right: 0
|
13193
|
-
} },
|
13194
|
-
React.createElement("div", { style: { position: 'relative', width, height: '100%' } },
|
13195
|
-
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: {
|
13196
|
-
width: '100%',
|
13197
|
-
height,
|
13198
|
-
objectFit: 'contain'
|
13199
|
-
} }),
|
13200
|
-
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
|
13201
|
-
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
|
13202
|
-
position: 'relative',
|
13203
|
-
width,
|
13204
|
-
height,
|
13205
|
-
overflow: 'hidden'
|
13206
|
-
} },
|
13207
|
-
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 }),
|
13208
|
-
renderPoster,
|
13209
|
-
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
|
13210
|
-
};
|
13211
|
-
var VideoWidget$1 = React.memo(VideoWidget);
|
13212
|
-
|
13213
|
-
const RESOLVER$1 = {};
|
13214
|
-
Object.values(_materials_).forEach((v) => {
|
13215
|
-
RESOLVER$1[v.extend.type] = v;
|
13216
|
-
});
|
13217
|
-
const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
13218
|
-
const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
13219
|
-
const DiyPortalPreview = ({ data, globalConfig, tipText, nudge, tempMap, descStyle, hashTagStyle, containerHeight = 664, containerWidth = 375, appDomain }) => {
|
13220
|
-
const height = React.useMemo(() => {
|
13221
|
-
return (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo) ? containerHeight - 45 : containerHeight;
|
13222
|
-
}, [globalConfig, containerHeight]);
|
13223
|
-
const renderContent = (rec, index) => {
|
13224
|
-
var _a, _b, _c, _d;
|
13225
|
-
if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
13226
|
-
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 }));
|
13227
|
-
}
|
13228
|
-
if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
|
13229
|
-
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 }));
|
13230
|
-
}
|
13231
|
-
if (rec.product) {
|
13232
|
-
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) {
|
13233
|
-
return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
|
13234
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
13235
|
-
const t = RESOLVER$1[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
13236
|
-
const Component = withBindDataSource(t);
|
13237
|
-
const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
|
13238
|
-
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) || {},
|
13239
|
-
// schema={schema}
|
13240
|
-
id: value === null || value === void 0 ? void 0 : value.id,
|
13241
|
-
// viewTime={viewTime.current}
|
13242
|
-
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 })));
|
13243
|
-
});
|
13244
|
-
}
|
13245
|
-
}
|
13246
|
-
};
|
13247
|
-
const renderLogo = React.useMemo(() => {
|
13248
|
-
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
13249
|
-
return (React.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
|
13250
|
-
React.createElement("img", { src: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl, alt: 'logo' })));
|
13251
|
-
}
|
13252
|
-
return null;
|
13253
|
-
}, [globalConfig]);
|
13254
|
-
const renderBottom = (rec, index) => {
|
13255
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
13256
|
-
if (rec.video) {
|
13257
|
-
return (React.createElement(React.Fragment, null,
|
13258
|
-
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
13259
|
-
React.createElement("div", { className: 'clc-sxp-bottom' },
|
13260
|
-
React.createElement(Nudge, { nudge: nudge }),
|
13261
|
-
React.createElement("div", { className: 'clc-sxp-bottom-card' },
|
13262
|
-
React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: RESOLVER$1 })),
|
13263
|
-
React.createElement("div", null,
|
13264
|
-
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' }) })),
|
13265
|
-
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 }))));
|
13266
|
-
}
|
13267
|
-
return null;
|
13268
|
-
};
|
13269
|
-
const likeIcon = useIconLink(defaultLikeIconPath, appDomain);
|
13270
|
-
const unlikeIcon = useIconLink(defaultUnLikeIconPath, appDomain);
|
13271
|
-
const renderLikeButton = (rec, index) => {
|
13272
|
-
var _a, _b, _c, _d;
|
13273
|
-
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
|
13274
|
-
return;
|
13275
|
-
let top = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconY) !== null && _a !== void 0 ? _a : 400;
|
13276
|
-
if (top < 40) {
|
13277
|
-
top += 40;
|
13278
|
-
}
|
13279
|
-
if (rec.video) {
|
13280
|
-
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: {
|
13281
|
-
top,
|
13282
|
-
right: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconX) !== null && _d !== void 0 ? _d : 0
|
13283
|
-
} }));
|
13284
|
-
}
|
13285
|
-
return null;
|
13286
|
-
};
|
13287
|
-
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png', appDomain);
|
13288
|
-
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png', appDomain);
|
13289
|
-
const renderView = (rec, index) => {
|
13290
|
-
var _a, _b, _c, _d;
|
13291
|
-
return (React.createElement("div", { style: { position: 'relative' } },
|
13292
|
-
renderLogo,
|
13293
|
-
React.createElement(ToggleButton$1, { style: {
|
13294
|
-
position: 'absolute',
|
13295
|
-
right: (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _a !== void 0 ? _a : 0,
|
13296
|
-
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',
|
13297
|
-
bottom: (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _d !== void 0 ? _d : 23,
|
13298
|
-
zIndex: 999
|
13299
|
-
}, 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 }),
|
13300
|
-
renderContent(rec, index),
|
13301
|
-
renderBottom(rec, index),
|
13302
|
-
renderLikeButton(rec, index)));
|
13303
|
-
};
|
13304
|
-
return (React.createElement("div", { style: {
|
13305
|
-
width: '100%',
|
13306
|
-
height: containerHeight,
|
13307
|
-
display: 'flex',
|
13308
|
-
boxSizing: 'border-box',
|
13309
|
-
gap: 16,
|
13310
|
-
pointerEvents: 'none',
|
13311
|
-
userSelect: 'none'
|
13312
|
-
} }, data === null || data === void 0 ? void 0 : data.map((rec, index) => {
|
13313
|
-
return renderView(rec, index);
|
13314
|
-
})));
|
13029
|
+
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)),
|
13030
|
+
React.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
|
13031
|
+
React.createElement("video", { ref: playerRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', style: {
|
13032
|
+
backgroundColor: 'transparent',
|
13033
|
+
width: '100%',
|
13034
|
+
height: '100%',
|
13035
|
+
objectFit: 'cover',
|
13036
|
+
pointerEvents: 'none'
|
13037
|
+
} }),
|
13038
|
+
React.createElement("div", { id: 'player-container-id-copy' }))));
|
13315
13039
|
};
|
13316
|
-
var index$1 = React.memo(DiyPortalPreview);
|
13317
13040
|
|
13318
13041
|
/*
|
13319
13042
|
* @Author: binruan@chatlabs.com
|
@@ -13455,15 +13178,13 @@ function useEditorDataProvider() {
|
|
13455
13178
|
* @FilePath: \pb-sxp-ui\src\index.ts
|
13456
13179
|
*/
|
13457
13180
|
|
13458
|
-
exports.DiyPortalPreview = index$1;
|
13459
13181
|
exports.EditorDataProvider = EditorDataProvider;
|
13460
13182
|
exports.Modal = Modal$1;
|
13461
13183
|
exports.SxpDataSourceProvider = SxpDataSourceProvider$1;
|
13462
13184
|
exports.SxpPageCore = index;
|
13463
13185
|
exports.SxpPageRender = SxpPageRender;
|
13464
|
-
exports.core = index$
|
13186
|
+
exports.core = index$1;
|
13465
13187
|
exports.default = Pagebuilder;
|
13466
13188
|
exports.defaultSetting = defaultSetting;
|
13467
13189
|
exports.materials = _materials_;
|
13468
13190
|
exports.useEditorDataProvider = useEditorDataProvider;
|
13469
|
-
//# sourceMappingURL=index.cjs.map
|