pb-sxp-ui 1.15.43 → 1.16.1
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 +281 -205
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +125 -0
- package/dist/index.js +281 -205
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +281 -205
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/VideoWidget.js +8 -10
- package/es/core/components/SxpPageRender/LikeButton/index.js +15 -17
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +0 -5
- package/es/core/components/SxpPageRender/PictureGroup/index.js +13 -37
- package/es/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/es/core/components/SxpPageRender/RenderCard.js +6 -6
- package/es/core/components/SxpPageRender/VideoWidget/index.js +44 -34
- package/es/core/components/SxpPageRender/WaterFall/index.js +3 -4
- package/es/core/components/SxpPageRender/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/index.js +38 -47
- package/es/core/context/SxpDataSourceProvider.js +2 -2
- package/es/core/hooks/useEventReport.js +5 -6
- package/es/materials/sxp/template/NineCommodity/index.d.ts +18 -0
- package/es/materials/sxp/template/NineCommodity/index.js +39 -0
- package/es/materials/sxp/template/NineCommodity/interactionRender.d.ts +9 -0
- package/es/materials/sxp/template/NineCommodity/interactionRender.js +12 -0
- package/es/materials/sxp/template/NineCommodity/material.d.ts +2 -0
- package/es/materials/sxp/template/NineCommodity/material.js +52 -0
- package/es/materials/sxp/template/index.d.ts +1 -0
- package/es/materials/sxp/template/index.js +1 -0
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +8 -10
- package/lib/core/components/SxpPageRender/LikeButton/index.js +15 -17
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +0 -5
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +12 -36
- package/lib/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/lib/core/components/SxpPageRender/RenderCard.js +6 -6
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +44 -34
- package/lib/core/components/SxpPageRender/WaterFall/index.js +3 -4
- package/lib/core/components/SxpPageRender/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/index.js +38 -47
- package/lib/core/context/SxpDataSourceProvider.js +2 -2
- package/lib/core/hooks/useEventReport.js +5 -6
- package/lib/materials/sxp/template/NineCommodity/index.d.ts +18 -0
- package/lib/materials/sxp/template/NineCommodity/index.js +41 -0
- package/lib/materials/sxp/template/NineCommodity/interactionRender.d.ts +9 -0
- package/lib/materials/sxp/template/NineCommodity/interactionRender.js +14 -0
- package/lib/materials/sxp/template/NineCommodity/material.d.ts +2 -0
- package/lib/materials/sxp/template/NineCommodity/material.js +56 -0
- package/lib/materials/sxp/template/index.d.ts +1 -0
- package/lib/materials/sxp/template/index.js +1 -0
- package/package.json +1 -1
@@ -15,7 +15,7 @@ const LikeButton = (_a) => {
|
|
15
15
|
const likeIcon = (0, useIconLink_1.useIconLink)(defaultLikeIconPath);
|
16
16
|
const unlikeIcon = (0, useIconLink_1.useIconLink)(defaultUnLikeIconPath);
|
17
17
|
const handleClick = (0, lodash_1.debounce)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
18
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z
|
18
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
19
19
|
if (state) {
|
20
20
|
setState(false);
|
21
21
|
const result = (_e = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({ videoItemId: (_d = (_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '' })))) !== null && _e !== void 0 ? _e : false;
|
@@ -24,53 +24,51 @@ const LikeButton = (_a) => {
|
|
24
24
|
eventSubject: 'favoriteContentCanceled',
|
25
25
|
eventDescription: 'This content was unfavorite by the user',
|
26
26
|
contentId: (_g = (_f = recData === null || recData === void 0 ? void 0 : recData.video) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
|
27
|
-
|
28
|
-
|
29
|
-
contentTags: JSON.stringify((_p = (_o = recData === null || recData === void 0 ? void 0 : recData.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : []),
|
27
|
+
contentName: (_j = (_h = recData === null || recData === void 0 ? void 0 : recData.video) === null || _h === void 0 ? void 0 : _h.title) !== null && _j !== void 0 ? _j : '',
|
28
|
+
contentTags: JSON.stringify((_l = (_k = recData === null || recData === void 0 ? void 0 : recData.video) === null || _k === void 0 ? void 0 : _k.tags) !== null && _l !== void 0 ? _l : []),
|
30
29
|
position: position + '',
|
31
|
-
contentFormat: ((
|
32
|
-
traceInfo: (
|
30
|
+
contentFormat: ((_m = recData === null || recData === void 0 ? void 0 : recData.video) === null || _m === void 0 ? void 0 : _m.url) ? 'video' : 'image',
|
31
|
+
traceInfo: (_o = recData === null || recData === void 0 ? void 0 : recData.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
33
32
|
}
|
34
33
|
});
|
35
34
|
if (!result) {
|
36
35
|
setState(true);
|
37
36
|
}
|
38
37
|
else {
|
39
|
-
const nRtcList = (
|
38
|
+
const nRtcList = (_p = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
40
39
|
if (index === position) {
|
41
40
|
item.isCollected = false;
|
42
41
|
}
|
43
42
|
return item;
|
44
|
-
})) !== null &&
|
43
|
+
})) !== null && _p !== void 0 ? _p : [];
|
45
44
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
46
45
|
}
|
47
46
|
}
|
48
47
|
else {
|
49
48
|
setState(true);
|
50
|
-
const result = (
|
49
|
+
const result = (_q = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _q !== void 0 ? _q : false;
|
51
50
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
52
51
|
eventInfo: {
|
53
52
|
eventSubject: 'favoriteContent',
|
54
53
|
eventDescription: 'This content was favorite by the user',
|
55
|
-
contentId: (
|
56
|
-
|
57
|
-
|
58
|
-
contentTags: JSON.stringify((_2 = (_1 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _1 === void 0 ? void 0 : _1.tags) !== null && _2 !== void 0 ? _2 : []),
|
54
|
+
contentId: (_s = (_r = recData === null || recData === void 0 ? void 0 : recData.video) === null || _r === void 0 ? void 0 : _r.itemId) !== null && _s !== void 0 ? _s : '',
|
55
|
+
contentName: (_u = (_t = recData === null || recData === void 0 ? void 0 : recData.video) === null || _t === void 0 ? void 0 : _t.title) !== null && _u !== void 0 ? _u : '',
|
56
|
+
contentTags: JSON.stringify((_w = (_v = recData === null || recData === void 0 ? void 0 : recData.video) === null || _v === void 0 ? void 0 : _v.tags) !== null && _w !== void 0 ? _w : []),
|
59
57
|
position: position + '',
|
60
|
-
contentFormat: ((
|
61
|
-
traceInfo: (
|
58
|
+
contentFormat: ((_x = recData === null || recData === void 0 ? void 0 : recData.video) === null || _x === void 0 ? void 0 : _x.url) ? 'video' : 'image',
|
59
|
+
traceInfo: (_y = recData === null || recData === void 0 ? void 0 : recData.video) === null || _y === void 0 ? void 0 : _y.traceInfo
|
62
60
|
}
|
63
61
|
});
|
64
62
|
if (!result) {
|
65
63
|
setState(false);
|
66
64
|
}
|
67
65
|
else {
|
68
|
-
const nRtcList = (
|
66
|
+
const nRtcList = (_z = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
69
67
|
if (index === position) {
|
70
68
|
item.isCollected = true;
|
71
69
|
}
|
72
70
|
return item;
|
73
|
-
})) !== null &&
|
71
|
+
})) !== null && _z !== void 0 ? _z : [];
|
74
72
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
75
73
|
}
|
76
74
|
}
|
@@ -12,11 +12,6 @@ interface IPictureGroupProps {
|
|
12
12
|
loadTime: string;
|
13
13
|
}, enableCapi?: boolean) => void;
|
14
14
|
imgUrlsPostConfig?: postConfigType;
|
15
|
-
data: RecItemType[];
|
16
|
-
swiperRef?: any;
|
17
|
-
}
|
18
|
-
export interface IPictureGroupRef {
|
19
|
-
setLoopPlay: (v: boolean) => void;
|
20
15
|
}
|
21
16
|
declare const _default: React.NamedExoticComponent<IPictureGroupProps>;
|
22
17
|
export default _default;
|
@@ -4,48 +4,24 @@ const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
5
5
|
const modules_1 = require("swiper/modules");
|
6
6
|
const react_2 = require("swiper/react");
|
7
|
-
const css_1 = require("@emotion/css");
|
8
7
|
const Picture_1 = tslib_1.__importDefault(require("./Picture"));
|
9
8
|
const hooks_1 = require("../../../../core/hooks");
|
9
|
+
const css_1 = require("@emotion/css");
|
10
10
|
const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
|
11
11
|
const tool_1 = require("../../../../core/utils/tool");
|
12
|
-
const PictureGroup = (
|
12
|
+
const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
|
13
13
|
var _a, _b;
|
14
14
|
const { isActive } = (0, react_2.useSwiperSlide)();
|
15
|
-
const { sxpParameter, openHashtag
|
15
|
+
const { sxpParameter, openHashtag } = (0, hooks_1.useSxpDataSource)();
|
16
16
|
const [isLoad, setIsLoad] = (0, react_1.useState)(false);
|
17
17
|
const [imgInfo, setImgInfo] = (0, react_1.useState)();
|
18
18
|
const [swiperActiveIndex, setSwiperActiveIndex] = (0, react_1.useState)(0);
|
19
|
-
const
|
19
|
+
const swiperRef = (0, react_1.useRef)();
|
20
20
|
const isFirstPlayRef = (0, react_1.useRef)(true);
|
21
|
-
const loopPlayRef = (0, react_1.useRef)(true);
|
22
21
|
const initTime = new Date();
|
23
|
-
(0, react_1.useImperativeHandle)(ref, () => {
|
24
|
-
return {
|
25
|
-
setLoopPlay(v) {
|
26
|
-
loopPlayRef.current = v;
|
27
|
-
}
|
28
|
-
};
|
29
|
-
});
|
30
|
-
(0, react_1.useEffect)(() => {
|
31
|
-
if (isLoad && isActive && isDiyH5) {
|
32
|
-
setTimeout(() => {
|
33
|
-
var _a, _b, _c, _d, _e, _f;
|
34
|
-
if (!loopPlayRef.current)
|
35
|
-
return;
|
36
|
-
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
37
|
-
(_b = (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(0);
|
38
|
-
}
|
39
|
-
else {
|
40
|
-
const i = (_d = (_c = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _c === void 0 ? void 0 : _c.swiper) === null || _d === void 0 ? void 0 : _d.activeIndex;
|
41
|
-
(_f = (_e = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _e === void 0 ? void 0 : _e.swiper) === null || _f === void 0 ? void 0 : _f.slideTo(i + 1);
|
42
|
-
}
|
43
|
-
}, 3000);
|
44
|
-
}
|
45
|
-
}, [isLoad, isActive, isDiyH5, data, index, swiperRef]);
|
46
22
|
(0, react_1.useEffect)(() => {
|
47
23
|
if (isLoad && isActive) {
|
48
|
-
(
|
24
|
+
(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.start();
|
49
25
|
if (openHashtag) {
|
50
26
|
onViewImageEndEvent(rec);
|
51
27
|
}
|
@@ -55,7 +31,7 @@ const PictureGroup = (0, react_1.forwardRef)(({ imgUrls, data, height, rec, inde
|
|
55
31
|
}
|
56
32
|
}
|
57
33
|
else {
|
58
|
-
(
|
34
|
+
(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.stop();
|
59
35
|
}
|
60
36
|
}, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
|
61
37
|
const showFirstImageFn = (0, react_1.useCallback)((e) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
@@ -79,13 +55,13 @@ const PictureGroup = (0, react_1.forwardRef)(({ imgUrls, data, height, rec, inde
|
|
79
55
|
};
|
80
56
|
}, [isActive, imgInfo]);
|
81
57
|
const handleMouseEnter = (0, react_1.useCallback)(() => {
|
82
|
-
if (
|
83
|
-
|
58
|
+
if (swiperRef.current && swiperRef.current.swiper && isAlly) {
|
59
|
+
swiperRef.current.swiper.autoplay.stop();
|
84
60
|
}
|
85
61
|
}, []);
|
86
62
|
const handleMouseLeave = (0, react_1.useCallback)(() => {
|
87
|
-
if (
|
88
|
-
|
63
|
+
if (swiperRef.current && swiperRef.current.swiper && isAlly) {
|
64
|
+
swiperRef.current.swiper.autoplay.start();
|
89
65
|
}
|
90
66
|
}, []);
|
91
67
|
const handleSlideChange = (0, react_1.useCallback)((swiper) => {
|
@@ -106,7 +82,7 @@ const PictureGroup = (0, react_1.forwardRef)(({ imgUrls, data, height, rec, inde
|
|
106
82
|
enabled: true
|
107
83
|
}
|
108
84
|
}
|
109
|
-
: {}), { loop: true, ref:
|
85
|
+
: {}), { loop: true, ref: swiperRef, onSlideChange: handleSlideChange, className: (0, css_1.css)(Object.assign(Object.assign({ '.swiper-pagination': {
|
110
86
|
bottom: (_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.marginBottom) !== null && _a !== void 0 ? _a : 0,
|
111
87
|
fontSize: '14px'
|
112
88
|
} }, ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor) && {
|
@@ -123,5 +99,5 @@ const PictureGroup = (0, react_1.forwardRef)(({ imgUrls, data, height, rec, inde
|
|
123
99
|
return (react_1.default.createElement(react_2.SwiperSlide, { key: srcKey, "aria-hidden": srcKey !== swiperActiveIndex },
|
124
100
|
react_1.default.createElement(Picture_1.default, { src: !isLoad && srcKey > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
|
125
101
|
}))));
|
126
|
-
}
|
102
|
+
};
|
127
103
|
exports.default = (0, react_1.memo)(PictureGroup);
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
5
5
|
require("./index.less");
|
6
|
+
const lodash_1 = require("lodash");
|
6
7
|
const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
|
7
8
|
const hooks_1 = require("../../../core/hooks");
|
8
|
-
const
|
9
|
-
const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive, value }) => {
|
9
|
+
const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive, value, isNineProduct }) => {
|
10
10
|
const { schema } = (0, hooks_1.useEditor)();
|
11
11
|
if (!(rec === null || rec === void 0 ? void 0 : rec.video))
|
12
12
|
return null;
|
@@ -25,14 +25,14 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive,
|
|
25
25
|
return null;
|
26
26
|
}
|
27
27
|
if (value && resolver) {
|
28
|
-
const t = resolver[(_t = value === null || value === void 0 ? void 0 : value.item) === null || _t === void 0 ? void 0 : _t.type];
|
28
|
+
const t = resolver[isNineProduct ? 'NineCommodity' : (_t = value === null || value === void 0 ? void 0 : value.item) === null || _t === void 0 ? void 0 : _t.type];
|
29
29
|
const Component = (0, withBindDataSource_1.default)(t);
|
30
30
|
const defaulSetting = (_u = t === null || t === void 0 ? void 0 : t.extend) === null || _u === void 0 ? void 0 : _u.defaulSetting;
|
31
31
|
const isExternalLink = ((_x = (_w = (_v = value === null || value === void 0 ? void 0 : value.item) === null || _v === void 0 ? void 0 : _v.event) === null || _w === void 0 ? void 0 : _w.onClick) === null || _x === void 0 ? void 0 : _x.linkType) === 'externalLink';
|
32
|
-
|
32
|
+
const style = (0, lodash_1.cloneDeep)((_y = value === null || value === void 0 ? void 0 : value.item) === null || _y === void 0 ? void 0 : _y.style);
|
33
33
|
if (style.hasOwnProperty('backdropFilter')) {
|
34
|
-
|
35
|
-
style
|
34
|
+
const sbf = style.backdropFilter;
|
35
|
+
style.backdropFilter = `blur(${sbf !== null && sbf !== void 0 ? sbf : 0}px)`;
|
36
36
|
}
|
37
37
|
return (react_1.default.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box', transform: 'translate3d(0px, 0px, 0px)' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_z = value === null || value === void 0 ? void 0 : value.item) === null || _z === void 0 ? void 0 : _z.textStyle), bindDatas: (_1 = (_0 = value === null || value === void 0 ? void 0 : value.item) === null || _0 === void 0 ? void 0 : _0.bindDatas) !== null && _1 !== void 0 ? _1 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_2 = value === null || value === void 0 ? void 0 : value.item) === null || _2 === void 0 ? void 0 : _2.props, { event: ((_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index, isActive: isActive })));
|
38
38
|
}
|
@@ -78,26 +78,6 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
78
78
|
return;
|
79
79
|
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
80
80
|
}, [videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
81
|
-
const handleEnd = () => {
|
82
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
83
|
-
if (!videoRef.current)
|
84
|
-
return;
|
85
|
-
if (isDiyH5) {
|
86
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
87
|
-
if (!loopPlayRef.current)
|
88
|
-
return;
|
89
|
-
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
90
|
-
(_c = (_b = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _b === void 0 ? void 0 : _b.swiper) === null || _c === void 0 ? void 0 : _c.slideTo(0);
|
91
|
-
}
|
92
|
-
else {
|
93
|
-
const i = (_e = (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper) === null || _e === void 0 ? void 0 : _e.activeIndex;
|
94
|
-
(_g = (_f = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _f === void 0 ? void 0 : _f.swiper) === null || _g === void 0 ? void 0 : _g.slideTo(i + 1);
|
95
|
-
}
|
96
|
-
}
|
97
|
-
else {
|
98
|
-
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
|
99
|
-
}
|
100
|
-
};
|
101
81
|
const PAUSE_ICON = (0, useIconLink_1.useIconLink)('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
102
82
|
const handlePlaying = (0, react_1.useCallback)(() => {
|
103
83
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
@@ -106,7 +86,7 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
106
86
|
setIsLoadFinish(true);
|
107
87
|
}, []);
|
108
88
|
const handleStartPlay = (0, react_1.useCallback)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
109
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
89
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
110
90
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
111
91
|
return;
|
112
92
|
setIsPauseVideo(false);
|
@@ -117,11 +97,16 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
117
97
|
const videoCurrentTime = ((_h = (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.currentTime) !== null && _h !== void 0 ? _h : 0).toFixed(2);
|
118
98
|
const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
|
119
99
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
120
|
-
eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', contentId: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.itemId) !== null && _k !== void 0 ? _k : '',
|
100
|
+
eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', contentId: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.itemId) !== null && _k !== void 0 ? _k : '', contentName: (_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.title) !== null && _m !== void 0 ? _m : '', playType, startTime: videoCurrentTime, videoDuration, contentTags: JSON.stringify((_p = (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : []), position: index + '', contentFormat: 'video', traceInfo: (_q = item === null || item === void 0 ? void 0 : item.video) === null || _q === void 0 ? void 0 : _q.traceInfo }, ((isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) && { loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + '' }))
|
121
101
|
});
|
122
102
|
isFirstPlayRef.current = false;
|
123
103
|
}
|
124
104
|
}), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
105
|
+
const setCurrentTimeByStartTime = (0, react_1.useCallback)(() => {
|
106
|
+
if (isDiyH5) {
|
107
|
+
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
108
|
+
}
|
109
|
+
}, []);
|
125
110
|
const handLoadeddata = (0, react_1.useCallback)(() => {
|
126
111
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
|
127
112
|
return;
|
@@ -146,12 +131,13 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
146
131
|
const handleLoadedmetadata = (0, react_1.useCallback)(() => {
|
147
132
|
if (!videoRef.current)
|
148
133
|
return;
|
134
|
+
setCurrentTimeByStartTime();
|
149
135
|
loadedTimeRef.current = new Date();
|
150
136
|
handleStartPlay();
|
151
137
|
handLoadeddata();
|
152
138
|
}, [videoRef.current, handLoadeddata, handleStartPlay]);
|
153
139
|
const handleClickVideo = (0, react_1.useCallback)((type) => () => {
|
154
|
-
var _a, _b, _c, _d, _e;
|
140
|
+
var _a, _b, _c, _d, _e, _f;
|
155
141
|
if (!videoRef.current)
|
156
142
|
return;
|
157
143
|
if (!isLoadFinish)
|
@@ -172,17 +158,20 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
172
158
|
break;
|
173
159
|
default:
|
174
160
|
if (isPause) {
|
175
|
-
(_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.
|
161
|
+
if (isDiyH5 && Math.round((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) >= (scene === null || scene === void 0 ? void 0 : scene.endTime)) {
|
162
|
+
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
163
|
+
}
|
164
|
+
(_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
|
176
165
|
}
|
177
166
|
else {
|
178
|
-
(
|
167
|
+
(_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
|
179
168
|
}
|
180
169
|
setIsPauseVideo(!isPause);
|
181
170
|
break;
|
182
171
|
}
|
183
172
|
}, [isLoadFinish, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
184
173
|
const handlePause = (0, react_1.useCallback)(() => {
|
185
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
174
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
186
175
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
187
176
|
return;
|
188
177
|
if (activeIndex !== index)
|
@@ -198,15 +187,14 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
198
187
|
eventSubject: 'playOverVideo',
|
199
188
|
eventDescription: 'User finished playing the video',
|
200
189
|
contentId: (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
201
|
-
|
202
|
-
contentName: (_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.title) !== null && _o !== void 0 ? _o : '',
|
190
|
+
contentName: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
|
203
191
|
endTime: videoCurrentTime,
|
204
192
|
videoDuration,
|
205
193
|
playDuration,
|
206
|
-
contentTags: JSON.stringify((
|
194
|
+
contentTags: JSON.stringify((_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
|
207
195
|
position: index + '',
|
208
196
|
contentFormat: 'video',
|
209
|
-
traceInfo: (
|
197
|
+
traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
210
198
|
}
|
211
199
|
});
|
212
200
|
}
|
@@ -214,8 +202,27 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
214
202
|
const handleWaiting = (0, react_1.useCallback)(() => {
|
215
203
|
setWaiting(true);
|
216
204
|
}, []);
|
205
|
+
const handleTimeUpload = () => {
|
206
|
+
if (!videoRef.current || !isDiyH5)
|
207
|
+
return;
|
208
|
+
setTimeout(() => {
|
209
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
210
|
+
if (Math.round((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) >= ((_b = scene === null || scene === void 0 ? void 0 : scene.endTime) !== null && _b !== void 0 ? _b : 0)) {
|
211
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
212
|
+
if (!loopPlayRef.current)
|
213
|
+
return;
|
214
|
+
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
215
|
+
(_e = (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper) === null || _e === void 0 ? void 0 : _e.slideTo(0);
|
216
|
+
}
|
217
|
+
else {
|
218
|
+
const i = (_g = (_f = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _f === void 0 ? void 0 : _f.swiper) === null || _g === void 0 ? void 0 : _g.activeIndex;
|
219
|
+
(_j = (_h = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _h === void 0 ? void 0 : _h.swiper) === null || _j === void 0 ? void 0 : _j.slideTo(i + 1);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
});
|
223
|
+
};
|
217
224
|
(0, react_1.useEffect)(() => {
|
218
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
225
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
219
226
|
if (!isActive)
|
220
227
|
return;
|
221
228
|
const videoSrc = videoUrl;
|
@@ -236,6 +243,7 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
236
243
|
hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
|
237
244
|
hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
238
245
|
var _a;
|
246
|
+
setCurrentTimeByStartTime();
|
239
247
|
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
240
248
|
});
|
241
249
|
}
|
@@ -249,11 +257,12 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
249
257
|
(_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.addEventListener('play', handleStartPlay);
|
250
258
|
(_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.addEventListener('playing', handlePlaying);
|
251
259
|
(_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.addEventListener('pause', handlePause);
|
252
|
-
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.addEventListener('ended',
|
260
|
+
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.addEventListener('ended', handlePlay);
|
253
261
|
(_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.addEventListener('canplay', handlePlay);
|
254
262
|
(_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.addEventListener('waiting', handleWaiting);
|
263
|
+
(_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.addEventListener('timeupdate', handleTimeUpload);
|
255
264
|
return () => {
|
256
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
265
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
257
266
|
const isPause = (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
258
267
|
if (!isPause)
|
259
268
|
handlePause();
|
@@ -265,9 +274,10 @@ const VideoWidget = (0, react_1.forwardRef)(({ rec, index, height, data, muted,
|
|
265
274
|
(_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('play', handleStartPlay);
|
266
275
|
(_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.removeEventListener('playing', handlePlaying);
|
267
276
|
(_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.removeEventListener('pause', handlePause);
|
268
|
-
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('ended',
|
277
|
+
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('ended', handlePlay);
|
269
278
|
(_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.removeEventListener('canplay', handlePlay);
|
270
279
|
(_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.removeEventListener('waiting', handleWaiting);
|
280
|
+
(_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.removeEventListener('timeupdate', handleTimeUpload);
|
271
281
|
};
|
272
282
|
}, [isActive]);
|
273
283
|
(0, react_1.useEffect)(() => {
|
@@ -44,7 +44,7 @@ const WaterFall = (props) => {
|
|
44
44
|
}
|
45
45
|
}, [waterFallData]);
|
46
46
|
const reportTagsView = (0, react_1.useCallback)(() => {
|
47
|
-
var _a, _b, _c, _d, _e, _f
|
47
|
+
var _a, _b, _c, _d, _e, _f;
|
48
48
|
const rec = recData === null || recData === void 0 ? void 0 : recData.rec;
|
49
49
|
if (!rec)
|
50
50
|
return;
|
@@ -64,10 +64,9 @@ const WaterFall = (props) => {
|
|
64
64
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
65
65
|
eventInfo: {
|
66
66
|
contentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
67
|
-
sceneId: (_g = (_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
68
67
|
position: cacheActiveIndex + '',
|
69
|
-
contentTags: JSON.stringify((
|
70
|
-
traceInfo: (
|
68
|
+
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
69
|
+
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
71
70
|
hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
|
72
71
|
fromKName,
|
73
72
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|