pb-sxp-ui 1.0.40 → 1.0.41
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 +455 -135
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +8 -1
- package/dist/index.js +454 -135
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +458 -139
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/PictureGroup.d.ts +13 -0
- package/es/core/components/DiyPortalPreview/PictureGroup.js +11 -0
- package/es/core/components/DiyPortalPreview/VideoWidget.d.ts +15 -0
- package/es/core/components/DiyPortalPreview/VideoWidget.js +236 -0
- package/es/core/components/DiyPortalPreview/index.d.ts +6 -0
- package/es/core/components/DiyPortalPreview/index.js +112 -0
- package/es/core/components/SxpPageRender/PictureGroup/Picture.js +1 -0
- package/es/core/components/SxpPageRender/VideoWidget/index.js +46 -79
- package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/es/core/components/SxpPageRender/index.js +8 -13
- package/es/core/context/SxpDataSourceProvider.js +1 -1
- package/es/core/hooks/useEventReport.js +4 -4
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +6 -6
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -9
- package/lib/core/components/DiyPortalPreview/PictureGroup.d.ts +13 -0
- package/lib/core/components/DiyPortalPreview/PictureGroup.js +14 -0
- package/lib/core/components/DiyPortalPreview/VideoWidget.d.ts +15 -0
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +239 -0
- package/lib/core/components/DiyPortalPreview/index.d.ts +6 -0
- package/lib/core/components/DiyPortalPreview/index.js +115 -0
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +1 -0
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +46 -79
- package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/lib/core/components/SxpPageRender/index.js +8 -13
- package/lib/core/context/SxpDataSourceProvider.js +1 -1
- package/lib/core/hooks/useEventReport.js +4 -4
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.js +6 -6
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -9
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
@@ -11,6 +11,7 @@ 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');
|
14
15
|
|
15
16
|
function _interopNamespaceDefault(e) {
|
16
17
|
var n = Object.create(null);
|
@@ -577,7 +578,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
577
578
|
fromKName = 'imagePage';
|
578
579
|
}
|
579
580
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
580
|
-
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 + '', 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 })
|
581
582
|
});
|
582
583
|
}, [bffEventReport, isFromHashtag]);
|
583
584
|
React.useEffect(() => {
|
@@ -864,7 +865,7 @@ const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enable
|
|
864
865
|
React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
|
865
866
|
});
|
866
867
|
|
867
|
-
var index$
|
868
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
868
869
|
__proto__: null,
|
869
870
|
EditorCore: EditorCore
|
870
871
|
});
|
@@ -8150,8 +8151,8 @@ function useEventReport() {
|
|
8150
8151
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
8151
8152
|
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
8152
8153
|
position: position + '',
|
8153
|
-
|
8154
|
-
|
8154
|
+
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 : '',
|
8155
|
+
ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
|
8155
8156
|
traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
|
8156
8157
|
}
|
8157
8158
|
});
|
@@ -8175,8 +8176,8 @@ function useEventReport() {
|
|
8175
8176
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
8176
8177
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
8177
8178
|
position: position + '',
|
8178
|
-
|
8179
|
-
|
8179
|
+
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
8180
|
+
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
8180
8181
|
traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
|
8181
8182
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
8182
8183
|
eventSubject: 'productView',
|
@@ -8339,7 +8340,7 @@ const FormatImage = React.forwardRef((props, ref) => {
|
|
8339
8340
|
var FormatImage$1 = React.memo(FormatImage);
|
8340
8341
|
|
8341
8342
|
const CommodityDetail$1 = (_a) => {
|
8342
|
-
var _b, _c, _d, _e, _f, _g, _h, _j;
|
8343
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
8343
8344
|
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"]);
|
8344
8345
|
const { sxpParameter } = useSxpDataSource();
|
8345
8346
|
const { popupDetailData, bffEventReport, isPreview, waterFallData } = useSxpDataSource();
|
@@ -8380,7 +8381,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8380
8381
|
return '$7,000';
|
8381
8382
|
}
|
8382
8383
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
8383
|
-
const width = isPreview ? 375 : window.innerWidth;
|
8384
|
+
const width = isPreview ? 375 : (_f = style === null || style === void 0 ? void 0 : style.width) !== null && _f !== void 0 ? _f : window.innerWidth;
|
8384
8385
|
const renderContent = ({ isPost }) => {
|
8385
8386
|
var _a, _b, _c;
|
8386
8387
|
return (React.createElement("div", null,
|
@@ -8400,7 +8401,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8400
8401
|
};
|
8401
8402
|
return (React.createElement("div", { className: 'pb-commondity' },
|
8402
8403
|
React.createElement("div", Object.assign({ className: css.css(Object.assign({}, style)) }, props),
|
8403
|
-
product && ((
|
8404
|
+
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: {
|
8404
8405
|
clickable: true,
|
8405
8406
|
bulletActiveClass: 'swipe-item-active-bullet',
|
8406
8407
|
clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
|
@@ -8408,7 +8409,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8408
8409
|
: 'commondityDetail-swiper-clickable-center'
|
8409
8410
|
}, loop: true, autoplay: {
|
8410
8411
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
8411
|
-
} }, (
|
8412
|
+
} }, (_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.map((src) => {
|
8412
8413
|
return (React.createElement(SwiperSlide, { key: src },
|
8413
8414
|
React.createElement("div", { style: {
|
8414
8415
|
overflow: 'hidden',
|
@@ -8417,7 +8418,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8417
8418
|
} },
|
8418
8419
|
React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
8419
8420
|
}))),
|
8420
|
-
!((
|
8421
|
+
!((_j = product === null || product === void 0 ? void 0 : product.homePage) === null || _j === void 0 ? void 0 : _j.length) && (React.createElement("div", { className: css.css({
|
8421
8422
|
position: 'relative',
|
8422
8423
|
height: 0,
|
8423
8424
|
width: '100%',
|
@@ -8430,7 +8431,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8430
8431
|
top: 0,
|
8431
8432
|
objectFit: 'cover',
|
8432
8433
|
width: '100%'
|
8433
|
-
}), src: (
|
8434
|
+
}), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: '' }))),
|
8434
8435
|
React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
|
8435
8436
|
renderBtn(),
|
8436
8437
|
React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) },
|
@@ -8790,7 +8791,7 @@ var settingRender$2 = [
|
|
8790
8791
|
];
|
8791
8792
|
|
8792
8793
|
const CommodityDetailDiroNew$1 = (_a) => {
|
8793
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
8794
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
8794
8795
|
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"]);
|
8795
8796
|
React.useState(true);
|
8796
8797
|
const { sxpParameter } = useSxpDataSource();
|
@@ -8838,7 +8839,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
|
|
8838
8839
|
return '£102,300.00';
|
8839
8840
|
}
|
8840
8841
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
8841
|
-
const width = isPreview ? 375 : window.innerWidth;
|
8842
|
+
const width = isPreview ? 375 : (_f = style === null || style === void 0 ? void 0 : style.width) !== null && _f !== void 0 ? _f : window.innerWidth;
|
8842
8843
|
const productInfoText = ({ isPost }) => {
|
8843
8844
|
return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
8844
8845
|
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) ||
|
@@ -8847,7 +8848,7 @@ Made in Italy` })));
|
|
8847
8848
|
};
|
8848
8849
|
return (React.createElement("div", { className: 'pb-commondityDiroNew' },
|
8849
8850
|
React.createElement("div", Object.assign({ ref: scrollRef, className: css.css(Object.assign({}, style)) }, props),
|
8850
|
-
product && ((
|
8851
|
+
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: {
|
8851
8852
|
clickable: true,
|
8852
8853
|
bulletActiveClass: 'commondityDiroNew-swipe-item-active-bullet',
|
8853
8854
|
clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
|
@@ -8855,7 +8856,7 @@ Made in Italy` })));
|
|
8855
8856
|
: 'commondityDiroNew-swiper-clickable-center'
|
8856
8857
|
}, loop: true, autoplay: {
|
8857
8858
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
8858
|
-
} }, (
|
8859
|
+
} }, (_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.map((src) => {
|
8859
8860
|
return (React.createElement(SwiperSlide, { key: src },
|
8860
8861
|
React.createElement("div", { style: {
|
8861
8862
|
overflow: 'hidden',
|
@@ -8864,7 +8865,7 @@ Made in Italy` })));
|
|
8864
8865
|
} },
|
8865
8866
|
React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
8866
8867
|
}))),
|
8867
|
-
!((
|
8868
|
+
!((_j = product === null || product === void 0 ? void 0 : product.homePage) === null || _j === void 0 ? void 0 : _j.length) && (React.createElement("div", { className: css.css({
|
8868
8869
|
position: 'relative',
|
8869
8870
|
height: 0,
|
8870
8871
|
width: '100%',
|
@@ -8877,16 +8878,16 @@ Made in Italy` })));
|
|
8877
8878
|
top: 0,
|
8878
8879
|
objectFit: 'cover',
|
8879
8880
|
width: '100%'
|
8880
|
-
}), src: (
|
8881
|
+
}), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: '' }))),
|
8881
8882
|
React.createElement("div", { className: 'pb-commondityDiroNew-content' },
|
8882
8883
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
|
8883
8884
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
|
8884
|
-
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (
|
8885
|
+
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'),
|
8885
8886
|
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')),
|
8886
8887
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
|
8887
8888
|
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),
|
8888
|
-
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 }, (
|
8889
|
-
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (
|
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 }, (_m = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _m !== void 0 ? _m : '税费'))),
|
8890
|
+
(!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')),
|
8890
8891
|
productInfoText({ isPost }))),
|
8891
8892
|
React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
|
8892
8893
|
};
|
@@ -11794,7 +11795,7 @@ const WaterFall = (props) => {
|
|
11794
11795
|
}
|
11795
11796
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
11796
11797
|
eventInfo: {
|
11797
|
-
|
11798
|
+
contentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
11798
11799
|
position: cacheActiveIndex + '',
|
11799
11800
|
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
11800
11801
|
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
@@ -11927,14 +11928,14 @@ var _materials_ = /*#__PURE__*/Object.freeze({
|
|
11927
11928
|
Prompt: Prompt
|
11928
11929
|
});
|
11929
11930
|
|
11930
|
-
const defaultUnLikeIconPath = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
11931
|
-
const defaultLikeIconPath = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
11931
|
+
const defaultUnLikeIconPath$1 = '/pb_static/f71266d2c64446c5ae6a5a7f5489cc0a.png';
|
11932
|
+
const defaultLikeIconPath$1 = '/pb_static/f07900fe3f0f4ae188ea1611d4801a44.png';
|
11932
11933
|
const LikeButton = (_a) => {
|
11933
11934
|
var { active, activeIcon, unActicveIcon, recData, position } = _a, props = __rest(_a, ["active", "activeIcon", "unActicveIcon", "recData", "position"]);
|
11934
11935
|
const { mutateLike, mutateUnlike, bffEventReport } = useSxpDataSource();
|
11935
11936
|
const [state, setState] = React.useState(active);
|
11936
|
-
const likeIcon = useIconLink(defaultLikeIconPath);
|
11937
|
-
const unlikeIcon = useIconLink(defaultUnLikeIconPath);
|
11937
|
+
const likeIcon = useIconLink(defaultLikeIconPath$1);
|
11938
|
+
const unlikeIcon = useIconLink(defaultUnLikeIconPath$1);
|
11938
11939
|
const handleClick = lodash.debounce(() => __awaiter(void 0, void 0, void 0, function* () {
|
11939
11940
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
11940
11941
|
if (state) {
|
@@ -11990,7 +11991,7 @@ var SXP_EVENT_TYPE;
|
|
11990
11991
|
SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
|
11991
11992
|
})(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
|
11992
11993
|
|
11993
|
-
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig }) => {
|
11994
|
+
const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig }) => {
|
11994
11995
|
const [isPauseVideo, setIsPauseVideo] = React.useState(false);
|
11995
11996
|
const videoRef = React.useRef(null);
|
11996
11997
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
|
@@ -12000,13 +12001,12 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12000
12001
|
const { isActive } = useSwiperSlide();
|
12001
12002
|
const canvasRef = React.useRef(null);
|
12002
12003
|
const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
|
12003
|
-
const videoId = `pb-video-${index}`;
|
12004
12004
|
React.useEffect(() => {
|
12005
12005
|
if (!videoRef.current)
|
12006
12006
|
return;
|
12007
|
-
videoRef.current.muted
|
12007
|
+
videoRef.current.muted = muted;
|
12008
12008
|
}, [muted]);
|
12009
|
-
const
|
12009
|
+
const handleVideoStart = React.useCallback(() => {
|
12010
12010
|
var _a;
|
12011
12011
|
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
12012
12012
|
}, []);
|
@@ -12015,10 +12015,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12015
12015
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
12016
12016
|
setIsPauseVideo(false);
|
12017
12017
|
const item = data[index];
|
12018
|
-
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration
|
12019
|
-
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime
|
12020
|
-
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration
|
12021
|
-
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime
|
12018
|
+
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
12019
|
+
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
12020
|
+
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
12021
|
+
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
12022
12022
|
const playType = isFirstPlay ? '0' : '1';
|
12023
12023
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12024
12024
|
eventInfo: {
|
@@ -12038,15 +12038,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12038
12038
|
setIsFirstPlay(false);
|
12039
12039
|
}
|
12040
12040
|
}, [bffEventReport, data, index, isFirstPlay]);
|
12041
|
-
const
|
12042
|
-
handLoadeddata();
|
12041
|
+
const handleLoadedMetadata = React.useCallback(() => {
|
12043
12042
|
setIsLoadFinish(true);
|
12044
12043
|
}, []);
|
12045
12044
|
const handleClickVideo = React.useCallback((type) => () => {
|
12046
12045
|
var _a, _b, _c, _d, _e;
|
12047
12046
|
if (!isLoadFinish)
|
12048
12047
|
return;
|
12049
|
-
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused
|
12048
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
12050
12049
|
switch (type) {
|
12051
12050
|
case 'start':
|
12052
12051
|
if (!isPause)
|
@@ -12071,13 +12070,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12071
12070
|
break;
|
12072
12071
|
}
|
12073
12072
|
}, [isLoadFinish]);
|
12074
|
-
const
|
12073
|
+
const onPause = React.useCallback(() => {
|
12075
12074
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
12076
12075
|
const item = data[index];
|
12077
|
-
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration
|
12078
|
-
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime
|
12079
|
-
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration
|
12080
|
-
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime
|
12076
|
+
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
12077
|
+
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
12078
|
+
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
|
12079
|
+
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
|
12081
12080
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12082
12081
|
eventInfo: {
|
12083
12082
|
eventSubject: 'playOverVideo',
|
@@ -12109,66 +12108,56 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12109
12108
|
return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
|
12110
12109
|
}, [firstFrameSrc, rec]);
|
12111
12110
|
const handLoadeddata = React.useCallback(() => {
|
12112
|
-
|
12113
|
-
const videoDomRef = document.getElementById(`${videoId}_html5_api`);
|
12114
|
-
if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !videoDomRef || !canvasRef.current)
|
12111
|
+
if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
|
12115
12112
|
return;
|
12116
|
-
const
|
12117
|
-
|
12118
|
-
|
12119
|
-
|
12120
|
-
|
12121
|
-
|
12122
|
-
|
12123
|
-
|
12124
|
-
|
12125
|
-
setFirstFrameSrc(canvas.toDataURL());
|
12126
|
-
};
|
12127
|
-
setFrameImg();
|
12128
|
-
setTimeout(() => {
|
12129
|
-
setFrameImg();
|
12130
|
-
}, 500);
|
12113
|
+
const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
|
12114
|
+
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
12115
|
+
const ctx = canvas.getContext('2d');
|
12116
|
+
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
12117
|
+
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
12118
|
+
canvas.height = targetHeight;
|
12119
|
+
canvas.width = targetWidth;
|
12120
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
12121
|
+
setFirstFrameSrc(canvas.toDataURL());
|
12131
12122
|
}, []);
|
12132
12123
|
React.useEffect(() => {
|
12133
|
-
var _a, _b, _c, _d
|
12124
|
+
var _a, _b, _c, _d;
|
12125
|
+
if (!videoRef.current)
|
12126
|
+
return;
|
12134
12127
|
setIsPauseVideo(false);
|
12135
|
-
|
12136
|
-
|
12137
|
-
|
12138
|
-
|
12139
|
-
|
12140
|
-
|
12141
|
-
|
12142
|
-
|
12143
|
-
|
12144
|
-
|
12145
|
-
|
12146
|
-
|
12147
|
-
|
12148
|
-
|
12149
|
-
|
12150
|
-
|
12151
|
-
|
12152
|
-
|
12153
|
-
videoRef.current.
|
12154
|
-
|
12155
|
-
|
12156
|
-
(
|
12157
|
-
(
|
12158
|
-
|
12159
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.
|
12160
|
-
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.on('ended', handleEnded);
|
12128
|
+
if (!videoRef.current.src) {
|
12129
|
+
const videoSrc = rec.video.url;
|
12130
|
+
// if (videoSrc.includes('.m3u8')) {
|
12131
|
+
// if (Hls.isSupported()) {
|
12132
|
+
// const hls = new Hls();
|
12133
|
+
// hls.loadSource(videoSrc);
|
12134
|
+
// hls.attachMedia(videoRef.current);
|
12135
|
+
// hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
12136
|
+
// videoRef?.current?.play();
|
12137
|
+
// });
|
12138
|
+
// } else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
|
12139
|
+
// videoRef.current.src = videoSrc;
|
12140
|
+
// } else {
|
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);
|
12161
12153
|
return () => {
|
12162
|
-
var _a, _b, _c, _d
|
12163
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.
|
12164
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.
|
12165
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.
|
12166
|
-
|
12167
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.off('pause', handlePause);
|
12168
|
-
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.off('ended', handleEnded);
|
12169
|
-
videoRef.current.dispose();
|
12154
|
+
var _a, _b, _c, _d;
|
12155
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
|
12156
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
|
12157
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
|
12158
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
|
12170
12159
|
};
|
12171
|
-
}, []);
|
12160
|
+
}, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
|
12172
12161
|
React.useEffect(() => {
|
12173
12162
|
var _a;
|
12174
12163
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
@@ -12254,31 +12243,23 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
12254
12243
|
right: 0
|
12255
12244
|
} },
|
12256
12245
|
React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
12257
|
-
React.createElement("video", { id: `pb-video-${index}`,
|
12246
|
+
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: {
|
12258
12247
|
width: '100%',
|
12259
12248
|
height: '100%',
|
12260
|
-
objectFit: 'contain'
|
12261
|
-
backgroundColor: 'transparent',
|
12262
|
-
pointerEvents: 'none'
|
12249
|
+
objectFit: 'contain'
|
12263
12250
|
} }),
|
12264
12251
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
|
12265
|
-
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
|
12252
|
+
renderPoster)) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
|
12266
12253
|
position: 'relative',
|
12267
12254
|
width: '100%',
|
12268
12255
|
height,
|
12269
12256
|
overflow: 'hidden'
|
12270
|
-
}
|
12271
|
-
React.createElement("video", { id: `pb-video-${index}`,
|
12272
|
-
backgroundColor: 'transparent',
|
12273
|
-
width: '100%',
|
12274
|
-
height: '100%',
|
12275
|
-
objectFit: 'cover',
|
12276
|
-
pointerEvents: 'none'
|
12277
|
-
} }),
|
12257
|
+
} },
|
12258
|
+
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 }),
|
12278
12259
|
renderPoster,
|
12279
12260
|
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
|
12280
12261
|
};
|
12281
|
-
var VideoWidget$
|
12262
|
+
var VideoWidget$3 = React.memo(VideoWidget$2);
|
12282
12263
|
|
12283
12264
|
/*
|
12284
12265
|
* @Author: binruan@chatlabs.com
|
@@ -12329,7 +12310,7 @@ const FingerSwipeTip = ({ imageUrl }) => {
|
|
12329
12310
|
* @Author: binruan@chatlabs.com
|
12330
12311
|
* @Date: 2024-03-20 10:27:31
|
12331
12312
|
* @LastEditors: binruan@chatlabs.com
|
12332
|
-
* @LastEditTime: 2024-04-
|
12313
|
+
* @LastEditTime: 2024-04-26 14:33:25
|
12333
12314
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12334
12315
|
*
|
12335
12316
|
*/
|
@@ -12361,6 +12342,7 @@ const Picture = (props) => {
|
|
12361
12342
|
React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) }),
|
12362
12343
|
blur && (React.createElement(FormatImage$1, { src: src, style: {
|
12363
12344
|
width: '100%',
|
12345
|
+
height: '100%',
|
12364
12346
|
objectFit: 'contain',
|
12365
12347
|
position: 'absolute',
|
12366
12348
|
top: '50%',
|
@@ -12377,7 +12359,7 @@ const Picture = (props) => {
|
|
12377
12359
|
* @LastEditTime: 2024-04-18 19:56:22
|
12378
12360
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
|
12379
12361
|
*/
|
12380
|
-
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
|
12362
|
+
const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
|
12381
12363
|
var _a;
|
12382
12364
|
const ref = React.useRef();
|
12383
12365
|
const { isActive } = useSwiperSlide();
|
@@ -12406,7 +12388,7 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
|
|
12406
12388
|
React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
|
12407
12389
|
})));
|
12408
12390
|
};
|
12409
|
-
var PictureGroup$
|
12391
|
+
var PictureGroup$3 = React.memo(PictureGroup$2);
|
12410
12392
|
|
12411
12393
|
/*
|
12412
12394
|
* @Author: binruan@chatlabs.com
|
@@ -12585,7 +12567,7 @@ const Nudge = ({ nudge }) => {
|
|
12585
12567
|
* @Author: binruan@chatlabs.com
|
12586
12568
|
* @Date: 2024-01-15 19:03:09
|
12587
12569
|
* @LastEditors: binruan@chatlabs.com
|
12588
|
-
* @LastEditTime: 2024-04-
|
12570
|
+
* @LastEditTime: 2024-04-23 15:48:32
|
12589
12571
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12590
12572
|
*
|
12591
12573
|
*/
|
@@ -12667,8 +12649,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12667
12649
|
// sessionDuration: Math.floor(((new Date() as any) - curTime) / 1000) + '',
|
12668
12650
|
// eventSubject: 'sessionCompleted',
|
12669
12651
|
// eventDescription: 'Session completed',
|
12670
|
-
//
|
12671
|
-
//
|
12652
|
+
// contentId: item?.video?.itemId,
|
12653
|
+
// productId: item?.product?.itemId,
|
12672
12654
|
// position: item?.position
|
12673
12655
|
// }
|
12674
12656
|
// });
|
@@ -12712,12 +12694,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12712
12694
|
sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
|
12713
12695
|
eventSubject: 'sessionCompleted',
|
12714
12696
|
eventDescription: 'Session completed',
|
12715
|
-
|
12716
|
-
|
12697
|
+
contentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
|
12698
|
+
productId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
|
12717
12699
|
position: activeIndex + '',
|
12718
12700
|
fromKName,
|
12719
12701
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
12720
|
-
|
12702
|
+
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 : ''
|
12721
12703
|
}
|
12722
12704
|
});
|
12723
12705
|
}
|
@@ -12746,10 +12728,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12746
12728
|
const renderContent = React.useCallback((rec, index) => {
|
12747
12729
|
var _a, _b, _c, _d;
|
12748
12730
|
if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
12749
|
-
return (React.createElement(VideoWidget$
|
12731
|
+
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 }));
|
12750
12732
|
}
|
12751
12733
|
if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
|
12752
|
-
return (React.createElement(PictureGroup$
|
12734
|
+
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 }));
|
12753
12735
|
}
|
12754
12736
|
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) {
|
12755
12737
|
return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
|
@@ -12851,8 +12833,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12851
12833
|
eventInfo: {
|
12852
12834
|
eventSubject: 'scrollDown',
|
12853
12835
|
eventDescription: 'User scroll down',
|
12854
|
-
|
12855
|
-
|
12836
|
+
contentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
|
12837
|
+
productId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
12856
12838
|
requestId: null
|
12857
12839
|
}
|
12858
12840
|
});
|
@@ -12864,8 +12846,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12864
12846
|
eventInfo: {
|
12865
12847
|
eventSubject: 'scrollUp',
|
12866
12848
|
eventDescription: 'User scroll up',
|
12867
|
-
|
12868
|
-
|
12849
|
+
contentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
|
12850
|
+
productId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
12869
12851
|
requestId: null
|
12870
12852
|
}
|
12871
12853
|
});
|
@@ -12946,12 +12928,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12946
12928
|
} })),
|
12947
12929
|
renderLogo,
|
12948
12930
|
isShowFingerTip ? React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
|
12949
|
-
React.createElement(Swiper, { ref: swiperRef,
|
12950
|
-
swiperRef.current.swiper.allowTouchMove = false;
|
12951
|
-
setTimeout(() => {
|
12952
|
-
swiperRef.current.swiper.allowTouchMove = true;
|
12953
|
-
}, 500);
|
12954
|
-
}, onActiveIndexChange: (swiper) => {
|
12931
|
+
React.createElement(Swiper, { ref: swiperRef, onActiveIndexChange: (swiper) => {
|
12955
12932
|
setActiveIndex(swiper.activeIndex);
|
12956
12933
|
if (openHashtag)
|
12957
12934
|
return;
|
@@ -12968,9 +12945,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12968
12945
|
}
|
12969
12946
|
}
|
12970
12947
|
},
|
12971
|
-
// style={{
|
12972
|
-
// pointerEvents: canSwiper ? 'auto' : 'none'
|
12973
|
-
// }}
|
12974
12948
|
// onReachEnd={() => {
|
12975
12949
|
// // 由hashtaglist跳转过来时不执行下面的方法
|
12976
12950
|
// if (waterFallData) return;
|
@@ -12996,6 +12970,351 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12996
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))));
|
12997
12971
|
};
|
12998
12972
|
|
12973
|
+
const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index }) => {
|
12974
|
+
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) => {
|
12975
|
+
return (React.createElement(SwiperSlide, { key: url },
|
12976
|
+
React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
|
12977
|
+
})));
|
12978
|
+
};
|
12979
|
+
var PictureGroup$1 = React.memo(PictureGroup);
|
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
|
+
})));
|
13315
|
+
};
|
13316
|
+
var index$1 = React.memo(DiyPortalPreview);
|
13317
|
+
|
12999
13318
|
/*
|
13000
13319
|
* @Author: binruan@chatlabs.com
|
13001
13320
|
* @Date: 2023-10-31 10:56:01
|
@@ -13136,12 +13455,13 @@ function useEditorDataProvider() {
|
|
13136
13455
|
* @FilePath: \pb-sxp-ui\src\index.ts
|
13137
13456
|
*/
|
13138
13457
|
|
13458
|
+
exports.DiyPortalPreview = index$1;
|
13139
13459
|
exports.EditorDataProvider = EditorDataProvider;
|
13140
13460
|
exports.Modal = Modal$1;
|
13141
13461
|
exports.SxpDataSourceProvider = SxpDataSourceProvider$1;
|
13142
13462
|
exports.SxpPageCore = index;
|
13143
13463
|
exports.SxpPageRender = SxpPageRender;
|
13144
|
-
exports.core = index$
|
13464
|
+
exports.core = index$2;
|
13145
13465
|
exports.default = Pagebuilder;
|
13146
13466
|
exports.defaultSetting = defaultSetting;
|
13147
13467
|
exports.materials = _materials_;
|