pb-sxp-ui 1.15.23-alpha.1 → 1.15.24
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 +143 -157
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +143 -157
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +5 -5
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +5 -5
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +143 -157
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +5 -5
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/VideoWidget.js +8 -10
- package/es/core/components/SxpPageRender/ExpandableText.js +52 -44
- package/es/core/components/SxpPageRender/LikeButton/index.js +15 -17
- package/es/core/components/SxpPageRender/VideoWidget/index.js +18 -20
- package/es/core/components/SxpPageRender/WaterFall/index.js +3 -4
- package/es/core/components/SxpPageRender/index.js +33 -42
- package/es/core/context/SxpDataSourceProvider.js +2 -2
- package/es/core/hooks/useEventReport.js +5 -6
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +8 -10
- package/lib/core/components/SxpPageRender/ExpandableText.js +51 -44
- package/lib/core/components/SxpPageRender/LikeButton/index.js +15 -17
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +18 -20
- package/lib/core/components/SxpPageRender/WaterFall/index.js +3 -4
- package/lib/core/components/SxpPageRender/index.js +33 -42
- package/lib/core/context/SxpDataSourceProvider.js +2 -2
- package/lib/core/hooks/useEventReport.js +5 -6
- package/package.json +1 -1
@@ -22,7 +22,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
22
22
|
}, []);
|
23
23
|
const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
24
24
|
const handlePlaying = useCallback(() => {
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
26
26
|
setIsPauseVideo(false);
|
27
27
|
const item = data[index];
|
28
28
|
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
@@ -35,15 +35,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
35
35
|
eventSubject: 'playVideo',
|
36
36
|
eventDescription: 'User played the video',
|
37
37
|
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 : '',
|
38
|
-
|
39
|
-
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 : '',
|
38
|
+
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 : '',
|
40
39
|
playType,
|
41
40
|
startTime: videoCurrentTime,
|
42
41
|
videoDuration,
|
43
|
-
contentTags: JSON.stringify((
|
42
|
+
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 : []),
|
44
43
|
position: index + '',
|
45
44
|
contentFormat: 'video',
|
46
|
-
traceInfo: (
|
45
|
+
traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
47
46
|
}
|
48
47
|
});
|
49
48
|
setIsFirstPlay(false);
|
@@ -82,7 +81,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
82
81
|
}
|
83
82
|
}, [isLoadFinish]);
|
84
83
|
const onPause = useCallback(() => {
|
85
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
84
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
86
85
|
const item = data[index];
|
87
86
|
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
88
87
|
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
@@ -93,15 +92,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
93
92
|
eventSubject: 'playOverVideo',
|
94
93
|
eventDescription: 'User finished playing the video',
|
95
94
|
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 : '',
|
96
|
-
|
97
|
-
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 : '',
|
95
|
+
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 : '',
|
98
96
|
endTime: videoCurrentTime,
|
99
97
|
videoDuration,
|
100
98
|
playDuration,
|
101
|
-
contentTags: JSON.stringify((
|
99
|
+
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 : []),
|
102
100
|
position: index + '',
|
103
101
|
contentFormat: 'video',
|
104
|
-
traceInfo: (
|
102
|
+
traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
105
103
|
}
|
106
104
|
});
|
107
105
|
}
|
@@ -1,57 +1,65 @@
|
|
1
|
+
import { __rest } from "tslib";
|
2
|
+
import React, { memo, useState, useCallback, useRef, useEffect } from 'react';
|
1
3
|
import { setFontForText } from '../../../core/utils/tool';
|
2
|
-
import React, { memo, useMemo, useState, useCallback, useRef, useEffect } from 'react';
|
3
|
-
const limitTextLastWholeWord = (originalText = '', limit) => {
|
4
|
-
const chineseRegex = /[\u4e00-\u9fa5]+/;
|
5
|
-
if (chineseRegex.test(originalText)) {
|
6
|
-
return originalText.slice(0, 54);
|
7
|
-
}
|
8
|
-
const words = originalText.split(' ');
|
9
|
-
const newWords = [];
|
10
|
-
for (let i = 0; i < words.length; i++) {
|
11
|
-
newWords.push(words[i]);
|
12
|
-
const tempText = newWords.join(' ');
|
13
|
-
if (tempText.length >= limit)
|
14
|
-
break;
|
15
|
-
}
|
16
|
-
const _words = newWords.length > 1 && newWords.length < words.length ? newWords.slice(0, newWords.length - 1) : newWords;
|
17
|
-
return _words.join(' ') + ' ';
|
18
|
-
};
|
19
4
|
const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost, onChange }) => {
|
20
5
|
const [isShowMore, setIsShowMore] = useState(false);
|
21
6
|
const [isShow, setIsShow] = useState(false);
|
22
|
-
const
|
7
|
+
const _a = style || {}, { lineClamp } = _a, textStyle = __rest(_a, ["lineClamp"]);
|
8
|
+
const textLineClamp = Number(lineClamp || 2);
|
23
9
|
const multiRow = useRef(null);
|
24
|
-
const
|
25
|
-
const handleClick =
|
10
|
+
const observerRef = useRef();
|
11
|
+
const handleClick = () => {
|
26
12
|
setIsShowMore(!isShowMore);
|
27
|
-
}
|
28
|
-
const
|
29
|
-
|
30
|
-
|
13
|
+
};
|
14
|
+
const checkOverflow = useCallback(() => {
|
15
|
+
if (!multiRow.current || !isPost || !text)
|
16
|
+
return;
|
17
|
+
const triggerReflow = (el) => el.offsetHeight;
|
18
|
+
requestAnimationFrame(() => {
|
19
|
+
const el = multiRow.current;
|
20
|
+
triggerReflow(el);
|
21
|
+
const originalStyle = el.style.cssText;
|
22
|
+
el.style.webkitLineClamp = 'unset';
|
23
|
+
el.style.display = 'block';
|
24
|
+
triggerReflow(el);
|
25
|
+
const realHeight = el.getBoundingClientRect().height;
|
26
|
+
el.style.cssText = originalStyle;
|
27
|
+
triggerReflow(el);
|
28
|
+
const clampHeight = el.getBoundingClientRect().height;
|
29
|
+
const isActuallyClamped = realHeight > clampHeight + 1;
|
30
|
+
console.log('[精确测量]', { realHeight, clampHeight, isActuallyClamped });
|
31
|
+
setIsShow(isActuallyClamped);
|
32
|
+
});
|
33
|
+
}, [isPost, text, textLineClamp]);
|
31
34
|
useEffect(() => {
|
32
|
-
|
33
|
-
if (
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
}
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
35
|
+
const el = multiRow.current;
|
36
|
+
if (!el)
|
37
|
+
return;
|
38
|
+
const fontCheck = () => {
|
39
|
+
document.fonts.ready.then(checkOverflow);
|
40
|
+
};
|
41
|
+
const observer = new ResizeObserver((entries) => {
|
42
|
+
entries.forEach((entry) => {
|
43
|
+
if (entry.contentBoxSize) {
|
44
|
+
}
|
45
|
+
});
|
46
|
+
});
|
47
|
+
fontCheck();
|
48
|
+
observer.observe(el);
|
49
|
+
return () => observer.disconnect();
|
50
|
+
}, [checkOverflow]);
|
51
|
+
return (React.createElement("div", { className: className, style: Object.assign(Object.assign({}, textStyle), { transform: 'translate3d(0px, 0px, 0px)' }), hidden: !text || text === '' },
|
52
|
+
React.createElement("div", { ref: multiRow, style: Object.assign(Object.assign({}, (!isShowMore &&
|
53
|
+
isPost && {
|
54
|
+
WebkitLineClamp: textLineClamp,
|
55
|
+
lineClamp: textLineClamp,
|
47
56
|
textOverflow: 'ellipsis',
|
57
|
+
overflow: 'hidden',
|
48
58
|
display: '-webkit-box',
|
49
|
-
WebkitBoxOrient: 'vertical'
|
50
|
-
|
51
|
-
}, dangerouslySetInnerHTML: { __html: setFontForText(text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>'), style) } }),
|
52
|
-
React.createElement("div", { ref: multiRowCopy, dangerouslySetInnerHTML: { __html: setFontForText(text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>'), style) } }),
|
59
|
+
WebkitBoxOrient: 'vertical'
|
60
|
+
})), { wordBreak: 'break-word', textRendering: 'geometricPrecision', fontKerning: 'none', textSizeAdjust: '100%', boxSizing: 'border-box', contain: 'content' }), dangerouslySetInnerHTML: { __html: setFontForText(text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>'), textStyle) } }),
|
53
61
|
text && isPost && isShow && (React.createElement("button", { "aria-label": isShowMore ? unfoldText || 'show less' : foldText || 'show more', style: { textDecoration: 'underline', cursor: 'pointer' }, onClick: onClick !== null && onClick !== void 0 ? onClick : handleClick, dangerouslySetInnerHTML: {
|
54
|
-
__html: setFontForText(isShowMore ? unfoldText || 'show less' : foldText || 'show more',
|
62
|
+
__html: setFontForText(isShowMore ? unfoldText || 'show less' : foldText || 'show more', textStyle)
|
55
63
|
} }))));
|
56
64
|
};
|
57
65
|
export default memo(ExpandableText);
|
@@ -13,7 +13,7 @@ const LikeButton = (_a) => {
|
|
13
13
|
const likeIcon = useIconLink(defaultLikeIconPath);
|
14
14
|
const unlikeIcon = useIconLink(defaultUnLikeIconPath);
|
15
15
|
const handleClick = debounce(() => __awaiter(void 0, void 0, void 0, function* () {
|
16
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z
|
16
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
17
17
|
if (state) {
|
18
18
|
setState(false);
|
19
19
|
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;
|
@@ -22,53 +22,51 @@ const LikeButton = (_a) => {
|
|
22
22
|
eventSubject: 'favoriteContentCanceled',
|
23
23
|
eventDescription: 'This content was unfavorite by the user',
|
24
24
|
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 : '',
|
25
|
-
|
26
|
-
|
27
|
-
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 : []),
|
25
|
+
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 : '',
|
26
|
+
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 : []),
|
28
27
|
position: position + '',
|
29
|
-
contentFormat: ((
|
30
|
-
traceInfo: (
|
28
|
+
contentFormat: ((_m = recData === null || recData === void 0 ? void 0 : recData.video) === null || _m === void 0 ? void 0 : _m.url) ? 'video' : 'image',
|
29
|
+
traceInfo: (_o = recData === null || recData === void 0 ? void 0 : recData.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
31
30
|
}
|
32
31
|
});
|
33
32
|
if (!result) {
|
34
33
|
setState(true);
|
35
34
|
}
|
36
35
|
else {
|
37
|
-
const nRtcList = (
|
36
|
+
const nRtcList = (_p = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
38
37
|
if (index === position) {
|
39
38
|
item.isCollected = false;
|
40
39
|
}
|
41
40
|
return item;
|
42
|
-
})) !== null &&
|
41
|
+
})) !== null && _p !== void 0 ? _p : [];
|
43
42
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
44
43
|
}
|
45
44
|
}
|
46
45
|
else {
|
47
46
|
setState(true);
|
48
|
-
const result = (
|
47
|
+
const result = (_q = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _q !== void 0 ? _q : false;
|
49
48
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
50
49
|
eventInfo: {
|
51
50
|
eventSubject: 'favoriteContent',
|
52
51
|
eventDescription: 'This content was favorite by the user',
|
53
|
-
contentId: (
|
54
|
-
|
55
|
-
|
56
|
-
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 : []),
|
52
|
+
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 : '',
|
53
|
+
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 : '',
|
54
|
+
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 : []),
|
57
55
|
position: position + '',
|
58
|
-
contentFormat: ((
|
59
|
-
traceInfo: (
|
56
|
+
contentFormat: ((_x = recData === null || recData === void 0 ? void 0 : recData.video) === null || _x === void 0 ? void 0 : _x.url) ? 'video' : 'image',
|
57
|
+
traceInfo: (_y = recData === null || recData === void 0 ? void 0 : recData.video) === null || _y === void 0 ? void 0 : _y.traceInfo
|
60
58
|
}
|
61
59
|
});
|
62
60
|
if (!result) {
|
63
61
|
setState(false);
|
64
62
|
}
|
65
63
|
else {
|
66
|
-
const nRtcList = (
|
64
|
+
const nRtcList = (_z = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
67
65
|
if (index === position) {
|
68
66
|
item.isCollected = true;
|
69
67
|
}
|
70
68
|
return item;
|
71
|
-
})) !== null &&
|
69
|
+
})) !== null && _z !== void 0 ? _z : [];
|
72
70
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
73
71
|
}
|
74
72
|
}
|
@@ -84,7 +84,7 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
|
|
84
84
|
setIsLoadFinish(true);
|
85
85
|
}, []);
|
86
86
|
const handleStartPlay = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
87
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
87
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
88
88
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
89
89
|
return;
|
90
90
|
setIsPauseVideo(false);
|
@@ -95,15 +95,14 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
|
|
95
95
|
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);
|
96
96
|
const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
|
97
97
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
98
|
-
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 : '',
|
98
|
+
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) + '' }))
|
99
99
|
});
|
100
100
|
isFirstPlayRef.current = false;
|
101
101
|
}
|
102
102
|
}), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
103
103
|
const setCurrentTimeByStartTime = useCallback(() => {
|
104
|
-
var _a;
|
105
104
|
if (isDiyH5) {
|
106
|
-
videoRef.current.currentTime =
|
105
|
+
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
107
106
|
}
|
108
107
|
}, []);
|
109
108
|
const handLoadeddata = useCallback(() => {
|
@@ -136,7 +135,7 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
|
|
136
135
|
handLoadeddata();
|
137
136
|
}, [videoRef.current, handLoadeddata, handleStartPlay]);
|
138
137
|
const handleClickVideo = useCallback((type) => () => {
|
139
|
-
var _a, _b, _c, _d, _e, _f
|
138
|
+
var _a, _b, _c, _d, _e, _f;
|
140
139
|
if (!videoRef.current)
|
141
140
|
return;
|
142
141
|
if (!isLoadFinish)
|
@@ -157,20 +156,20 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
|
|
157
156
|
break;
|
158
157
|
default:
|
159
158
|
if (isPause) {
|
160
|
-
if (Math.round((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) >= (
|
161
|
-
|
159
|
+
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)) {
|
160
|
+
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
162
161
|
}
|
163
|
-
(
|
162
|
+
(_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
|
164
163
|
}
|
165
164
|
else {
|
166
|
-
(
|
165
|
+
(_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
|
167
166
|
}
|
168
167
|
setIsPauseVideo(!isPause);
|
169
168
|
break;
|
170
169
|
}
|
171
170
|
}, [isLoadFinish, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
172
171
|
const handlePause = useCallback(() => {
|
173
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o
|
172
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
174
173
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
175
174
|
return;
|
176
175
|
if (activeIndex !== index)
|
@@ -186,15 +185,14 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
|
|
186
185
|
eventSubject: 'playOverVideo',
|
187
186
|
eventDescription: 'User finished playing the video',
|
188
187
|
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 : '',
|
189
|
-
|
190
|
-
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 : '',
|
188
|
+
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 : '',
|
191
189
|
endTime: videoCurrentTime,
|
192
190
|
videoDuration,
|
193
191
|
playDuration,
|
194
|
-
contentTags: JSON.stringify((
|
192
|
+
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 : []),
|
195
193
|
position: index + '',
|
196
194
|
contentFormat: 'video',
|
197
|
-
traceInfo: (
|
195
|
+
traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
198
196
|
}
|
199
197
|
});
|
200
198
|
}
|
@@ -206,17 +204,17 @@ const VideoWidget = forwardRef(({ rec, index, height, data, muted, activeIndex,
|
|
206
204
|
if (!videoRef.current || !isDiyH5)
|
207
205
|
return;
|
208
206
|
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 :
|
211
|
-
(
|
207
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
208
|
+
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)) {
|
209
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
212
210
|
if (!loopPlayRef.current)
|
213
211
|
return;
|
214
212
|
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
215
|
-
(
|
213
|
+
(_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
214
|
}
|
217
215
|
else {
|
218
|
-
const i = (
|
219
|
-
(
|
216
|
+
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;
|
217
|
+
(_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
218
|
}
|
221
219
|
}
|
222
220
|
});
|
@@ -41,7 +41,7 @@ const WaterFall = (props) => {
|
|
41
41
|
}
|
42
42
|
}, [waterFallData]);
|
43
43
|
const reportTagsView = useCallback(() => {
|
44
|
-
var _a, _b, _c, _d, _e, _f
|
44
|
+
var _a, _b, _c, _d, _e, _f;
|
45
45
|
const rec = recData === null || recData === void 0 ? void 0 : recData.rec;
|
46
46
|
if (!rec)
|
47
47
|
return;
|
@@ -61,10 +61,9 @@ const WaterFall = (props) => {
|
|
61
61
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
62
62
|
eventInfo: {
|
63
63
|
contentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
64
|
-
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 : '',
|
65
64
|
position: cacheActiveIndex + '',
|
66
|
-
contentTags: JSON.stringify((
|
67
|
-
traceInfo: (
|
65
|
+
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
66
|
+
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
68
67
|
hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
|
69
68
|
fromKName,
|
70
69
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|