pb-sxp-ui 1.0.87 → 1.0.89
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 +297 -353
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +298 -354
- 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 +300 -356
- 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/SxpPageRender/FormatImage.js +2 -7
- package/es/core/components/SxpPageRender/VideoWidget/index.js +39 -31
- package/es/core/components/SxpPageRender/index.js +78 -91
- package/es/core/context/SxpDataSourceProvider.js +19 -16
- package/es/materials/sxp/popup/AppointForm/index.js +1 -3
- package/es/materials/sxp/template/Appoint/index.js +7 -6
- package/es/materials/sxp/template/Commodity/index.js +7 -14
- package/es/materials/sxp/template/CommodityDiro/index.js +7 -14
- package/es/materials/sxp/template/CommodityDiroNew/index.js +7 -14
- package/es/materials/sxp/template/Link/index.js +5 -5
- package/es/materials/sxp/template/MultiCommodity/index.js +3 -6
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +3 -6
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +3 -6
- package/es/materials/sxp/template/components/EventProvider.js +1 -13
- package/es/materials/sxp/template/components/Img.d.ts +5 -3
- package/es/materials/sxp/template/components/Img.js +4 -3
- package/lib/core/components/SxpPageRender/FormatImage.js +2 -7
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +39 -31
- package/lib/core/components/SxpPageRender/index.js +78 -91
- package/lib/core/context/SxpDataSourceProvider.js +19 -16
- package/lib/materials/sxp/popup/AppointForm/index.js +1 -3
- package/lib/materials/sxp/template/Appoint/index.js +7 -6
- package/lib/materials/sxp/template/Commodity/index.js +7 -14
- package/lib/materials/sxp/template/CommodityDiro/index.js +7 -14
- package/lib/materials/sxp/template/CommodityDiroNew/index.js +7 -14
- package/lib/materials/sxp/template/Link/index.js +5 -5
- package/lib/materials/sxp/template/MultiCommodity/index.js +3 -6
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +3 -6
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +3 -6
- package/lib/materials/sxp/template/components/EventProvider.js +0 -12
- package/lib/materials/sxp/template/components/Img.d.ts +5 -3
- package/lib/materials/sxp/template/components/Img.js +4 -3
- package/package.json +2 -4
@@ -1,20 +1,15 @@
|
|
1
1
|
import React, { forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
2
|
-
import { useSxpDataSource } from '../../../core/hooks';
|
3
2
|
const FormatImage = forwardRef((props, ref) => {
|
4
3
|
const { src, onLoad, style, className, loading } = props;
|
5
4
|
const [imgSrc, setImgSrc] = useState();
|
6
|
-
const { swiperRef } = useSxpDataSource();
|
7
5
|
useImperativeHandle(ref, () => ({
|
8
6
|
setSrc: (v) => {
|
9
7
|
setImgSrc(v);
|
10
8
|
}
|
11
9
|
}));
|
12
10
|
useEffect(() => {
|
13
|
-
|
14
|
-
|
15
|
-
if (index === 0 || index > 0)
|
16
|
-
setImgSrc(src);
|
17
|
-
}, [src, swiperRef]);
|
11
|
+
setImgSrc(src);
|
12
|
+
}, [src]);
|
18
13
|
const imgRef = useRef(null);
|
19
14
|
return (React.createElement(React.Fragment, null, (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
|
20
15
|
React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
|
@@ -4,6 +4,7 @@ import { useIconLink } from '../useIconLink';
|
|
4
4
|
import FormatImage from '../FormatImage';
|
5
5
|
import { useSxpDataSource } from '../../../../core/hooks';
|
6
6
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../../core/utils/event';
|
7
|
+
import Hls from 'hls.js';
|
7
8
|
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
|
8
9
|
const [isPauseVideo, setIsPauseVideo] = useState(false);
|
9
10
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
|
@@ -45,7 +46,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
45
46
|
useEffect(() => {
|
46
47
|
if (!videoRef)
|
47
48
|
return;
|
48
|
-
videoRef
|
49
|
+
videoRef.muted = muted;
|
49
50
|
}, [muted, videoRef]);
|
50
51
|
const handleEnded = useCallback(() => {
|
51
52
|
if (!videoRef)
|
@@ -60,10 +61,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
60
61
|
setIsLoadFinish(true);
|
61
62
|
setIsPauseVideo(false);
|
62
63
|
const item = data[index];
|
63
|
-
if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration
|
64
|
-
videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime
|
65
|
-
const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration
|
66
|
-
const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime
|
64
|
+
if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration)) {
|
65
|
+
videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) || 0;
|
66
|
+
const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) !== null && _a !== void 0 ? _a : 0).toFixed(2);
|
67
|
+
const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
67
68
|
const playType = isFirstPlay ? '0' : '1';
|
68
69
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
69
70
|
eventInfo: {
|
@@ -87,21 +88,17 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
87
88
|
var _a;
|
88
89
|
if (!videoRef || firstFrameSrc || !blur)
|
89
90
|
return;
|
90
|
-
|
91
|
-
if (!videoDomRef)
|
92
|
-
return;
|
93
|
-
videoDomRef.style.objectFit = 'contain';
|
91
|
+
videoRef.style.objectFit = 'contain';
|
94
92
|
if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !canvasRef.current || isBgColor)
|
95
93
|
return;
|
96
94
|
const setFrameImg = () => {
|
97
|
-
const video = videoDomRef;
|
98
95
|
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
99
96
|
const ctx = canvas.getContext('2d');
|
100
97
|
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
101
98
|
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
102
99
|
canvas.height = targetHeight;
|
103
100
|
canvas.width = targetWidth;
|
104
|
-
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(
|
101
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(videoRef, 0, 0, canvas.width, canvas.height);
|
105
102
|
setFirstFrameSrc(canvas.toDataURL());
|
106
103
|
};
|
107
104
|
setFrameImg();
|
@@ -114,15 +111,12 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
114
111
|
return;
|
115
112
|
handLoadeddata();
|
116
113
|
}, [videoRef, handLoadeddata]);
|
117
|
-
const handleCanplay = useCallback(() => {
|
118
|
-
setIsLoadFinish(true);
|
119
|
-
}, []);
|
120
114
|
const handleClickVideo = useCallback((type) => () => {
|
121
115
|
if (!videoRef)
|
122
116
|
return;
|
123
117
|
if (!isLoadFinish)
|
124
118
|
return;
|
125
|
-
const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused
|
119
|
+
const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused;
|
126
120
|
switch (type) {
|
127
121
|
case 'start':
|
128
122
|
if (!isPause)
|
@@ -154,10 +148,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
154
148
|
if (activeIndex !== index)
|
155
149
|
return;
|
156
150
|
const item = data[index];
|
157
|
-
const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration
|
158
|
-
const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime
|
159
|
-
if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration
|
160
|
-
const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime
|
151
|
+
const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) !== null && _a !== void 0 ? _a : 0).toFixed(2);
|
152
|
+
const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
153
|
+
if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration) {
|
154
|
+
const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime) - videoStartTime.current).toFixed(2);
|
161
155
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
162
156
|
eventInfo: {
|
163
157
|
eventSubject: 'playOverVideo',
|
@@ -181,7 +175,19 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
181
175
|
const videoSrc = rec === null || rec === void 0 ? void 0 : rec.video.url;
|
182
176
|
if (!videoSrc)
|
183
177
|
return;
|
184
|
-
|
178
|
+
if (videoSrc.includes('.m3u8')) {
|
179
|
+
if (Hls.isSupported()) {
|
180
|
+
const hls = new Hls();
|
181
|
+
hls.loadSource(videoSrc);
|
182
|
+
hls.attachMedia(videoRef.current);
|
183
|
+
}
|
184
|
+
else {
|
185
|
+
videoRef.src = videoSrc;
|
186
|
+
}
|
187
|
+
}
|
188
|
+
else {
|
189
|
+
videoRef.src = videoSrc;
|
190
|
+
}
|
185
191
|
setIsPauseVideo(false);
|
186
192
|
const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
|
187
193
|
const dom = document.querySelector('#player-container-id');
|
@@ -189,18 +195,20 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
189
195
|
if (!dom && !dom2)
|
190
196
|
return;
|
191
197
|
videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
|
192
|
-
videoRef
|
193
|
-
videoRef
|
194
|
-
videoRef === null || videoRef === void 0 ? void 0 : videoRef.
|
195
|
-
videoRef === null || videoRef === void 0 ? void 0 : videoRef.
|
196
|
-
videoRef === null || videoRef === void 0 ? void 0 : videoRef.
|
198
|
+
videoRef.setAttribute('x5-playsinline', 'true');
|
199
|
+
videoRef.setAttribute('webkit-playsinline', 'true');
|
200
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadedmetadata', handleLoadedmetadata);
|
201
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('loadeddata', handLoadeddata);
|
202
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('playing', handlePlaying);
|
203
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('pause', handlePause);
|
204
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.addEventListener('ended', handleEnded);
|
197
205
|
return () => {
|
198
206
|
dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
|
199
|
-
videoRef === null || videoRef === void 0 ? void 0 : videoRef.
|
200
|
-
videoRef === null || videoRef === void 0 ? void 0 : videoRef.
|
201
|
-
videoRef === null || videoRef === void 0 ? void 0 : videoRef.
|
202
|
-
videoRef === null || videoRef === void 0 ? void 0 : videoRef.
|
203
|
-
videoRef === null || videoRef === void 0 ? void 0 : videoRef.
|
207
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadedmetadata', handleLoadedmetadata);
|
208
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('loadeddata', handLoadeddata);
|
209
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('playing', handlePlaying);
|
210
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('pause', handlePause);
|
211
|
+
videoRef === null || videoRef === void 0 ? void 0 : videoRef.removeEventListener('ended', handleEnded);
|
204
212
|
};
|
205
213
|
}, [isActive, videoId, rec, videoRef]);
|
206
214
|
useEffect(() => {
|
@@ -219,7 +227,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
219
227
|
useEffect(() => {
|
220
228
|
if (!isActive || !videoRef)
|
221
229
|
return;
|
222
|
-
const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused
|
230
|
+
const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused;
|
223
231
|
if (!isPause && openHashtag) {
|
224
232
|
videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
|
225
233
|
}
|
@@ -21,9 +21,8 @@ import { useEventReport } from '../../../core/hooks/useEventReport';
|
|
21
21
|
import withBindDataSource from '../../../core/hoc/withBindDataSource';
|
22
22
|
import Tagbar from './Tagbar';
|
23
23
|
import { getFeUserId } from '../../../core/utils/localStore';
|
24
|
-
import Consent from '../Consent';
|
25
24
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [], licenseUrl }) => {
|
26
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
27
26
|
const { schema } = useEditor();
|
28
27
|
const [activeIndex, setActiveIndex] = useState(0);
|
29
28
|
const viewImageStartTime = useRef(0);
|
@@ -34,58 +33,44 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
34
33
|
const [isShowMore, setIsShowMore] = useState(false);
|
35
34
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag } = useSxpDataSource();
|
36
35
|
const { backMainFeed } = useEventReport();
|
37
|
-
const
|
38
|
-
const playerRef = useRef();
|
36
|
+
const videoRef = useRef();
|
39
37
|
const { productView } = useEventReport();
|
40
38
|
const isShowFingerTip = useMemo(() => {
|
41
39
|
return data.length > 0 && !loading && getFeUserId();
|
42
40
|
}, [data, loading]);
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
useEffect(() => {
|
42
|
+
refreshFeSessionId();
|
43
|
+
}, []);
|
44
|
+
useEffect(() => {
|
45
|
+
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
46
|
+
const now = new Date();
|
47
|
+
viewTime.current = now;
|
48
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
49
|
+
eventName: 'PageView'
|
50
|
+
});
|
46
51
|
}
|
52
|
+
}, [data === null || data === void 0 ? void 0 : data.length]);
|
53
|
+
const handleH5EnterLink = useCallback(() => {
|
47
54
|
refreshFeSessionId();
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
55
|
+
h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
|
56
|
+
if (data.length > 0) {
|
57
|
+
const now = new Date();
|
58
|
+
viewTime.current = now;
|
59
|
+
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
60
|
+
eventName: 'PageView'
|
61
|
+
});
|
52
62
|
}
|
53
|
-
|
54
|
-
eventName: 'PageView'
|
55
|
-
});
|
56
|
-
setIsInit(true);
|
57
|
-
}, [data.length, bffFbReport, h5EnterLink, isInit]);
|
63
|
+
}, [data.length, bffFbReport, h5EnterLink]);
|
58
64
|
const firstRef = useRef();
|
59
65
|
useEffect(() => {
|
60
66
|
var _a, _b, _c, _d;
|
61
|
-
if (!firstRef.current &&
|
67
|
+
if (!firstRef.current && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) && (data === null || data === void 0 ? void 0 : data.length) > 0) {
|
62
68
|
firstRef.current = true;
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
loop: false,
|
67
|
-
autoplay: true,
|
68
|
-
muted: true,
|
69
|
-
preload: 'auto',
|
70
|
-
posterImage: false,
|
71
|
-
bigPlayButton: true,
|
72
|
-
sources: ((_b = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.url)
|
73
|
-
? [
|
74
|
-
{
|
75
|
-
src: (_d = (_c = data === null || data === void 0 ? void 0 : data[0]) === null || _c === void 0 ? void 0 : _c.video) === null || _d === void 0 ? void 0 : _d.url
|
76
|
-
}
|
77
|
-
]
|
78
|
-
: []
|
79
|
-
});
|
80
|
-
player === null || player === void 0 ? void 0 : player.ready(() => {
|
81
|
-
setVideoRef(player);
|
82
|
-
});
|
69
|
+
if ((_b = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.video) === null || _b === void 0 ? void 0 : _b.url) {
|
70
|
+
videoRef.current.src = (_d = (_c = data === null || data === void 0 ? void 0 : data[0]) === null || _c === void 0 ? void 0 : _c.video) === null || _d === void 0 ? void 0 : _d.url;
|
71
|
+
}
|
83
72
|
}
|
84
|
-
}, [videoRef,
|
85
|
-
useEffect(() => {
|
86
|
-
if (!isInit)
|
87
|
-
handleH5EnterLink();
|
88
|
-
}, [handleH5EnterLink, isInit]);
|
73
|
+
}, [videoRef, data]);
|
89
74
|
useEffect(() => {
|
90
75
|
var _a;
|
91
76
|
const index = (data === null || data === void 0 ? void 0 : data.findIndex((item) => {
|
@@ -200,7 +185,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
200
185
|
const renderContent = useCallback((rec, index) => {
|
201
186
|
var _a, _b, _c, _d;
|
202
187
|
if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
203
|
-
return (React.createElement(VideoWidget, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoRef: videoRef }));
|
188
|
+
return (React.createElement(VideoWidget, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoRef: videoRef.current }));
|
204
189
|
}
|
205
190
|
if ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
|
206
191
|
return (React.createElement(PictureGroup, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : 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 }));
|
@@ -226,7 +211,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
226
211
|
tipText,
|
227
212
|
resolver,
|
228
213
|
schema,
|
229
|
-
videoRef
|
214
|
+
videoRef.current
|
230
215
|
]);
|
231
216
|
const onExpandableChange = useCallback((v) => {
|
232
217
|
setIsShowMore(v);
|
@@ -380,14 +365,17 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
380
365
|
}
|
381
366
|
};
|
382
367
|
const visList = useMemo(() => {
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
368
|
+
var _a;
|
369
|
+
const list = activeIndex === 0
|
370
|
+
? [(_a = data === null || data === void 0 ? void 0 : data[0]) !== null && _a !== void 0 ? _a : null]
|
371
|
+
: data === null || data === void 0 ? void 0 : data.map((item, index) => {
|
372
|
+
if (activeIndex === index || index - 1 === activeIndex || index + 1 === activeIndex) {
|
373
|
+
return item;
|
374
|
+
}
|
375
|
+
else {
|
376
|
+
return null;
|
377
|
+
}
|
378
|
+
});
|
391
379
|
return !waterFallData ? list.concat([{ loading: true }]) : list;
|
392
380
|
}, [data, activeIndex, waterFallData]);
|
393
381
|
const renderView = useMemo(() => {
|
@@ -412,47 +400,46 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
412
400
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
413
401
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
414
402
|
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
if (
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
});
|
442
|
-
}
|
403
|
+
waterFallData && (React.createElement(Navbar, { icon: left, styles: { background: 'rgba(0,0,0,.3)', color: '#fff' }, onClose: () => {
|
404
|
+
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
|
405
|
+
} })),
|
406
|
+
renderLogo,
|
407
|
+
React.createElement(Tagbar, { tagList: tagList, setActiveIndex: setActiveIndex }),
|
408
|
+
isShowFingerTip ? (React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 + ((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _a !== void 0 ? _a : 0)}%` } })) : null,
|
409
|
+
React.createElement(Swiper, { style: {
|
410
|
+
marginTop: tagHeight
|
411
|
+
}, ref: swiperRef, onSlideChange: () => {
|
412
|
+
swiperRef.current.swiper.allowTouchMove = false;
|
413
|
+
setTimeout(() => {
|
414
|
+
swiperRef.current.swiper.allowTouchMove = true;
|
415
|
+
}, 500);
|
416
|
+
}, onActiveIndexChange: (swiper) => {
|
417
|
+
setActiveIndex(swiper.activeIndex);
|
418
|
+
if (openHashtag)
|
419
|
+
return;
|
420
|
+
handleScrollEvent(swiper);
|
421
|
+
if (waterFallData)
|
422
|
+
return;
|
423
|
+
if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 2 >= (data === null || data === void 0 ? void 0 : data.length)) {
|
424
|
+
if (!isLoadMore) {
|
425
|
+
setIsLoadMore(true);
|
426
|
+
loadVideos === null || loadVideos === void 0 ? void 0 : loadVideos(Math.ceil(activeIndex / 10) + 1).then(() => {
|
427
|
+
setIsLoadMore(false);
|
428
|
+
});
|
443
429
|
}
|
444
|
-
}
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
430
|
+
}
|
431
|
+
}, direction: 'vertical', height: height },
|
432
|
+
React.createElement(ToggleButton, { style: {
|
433
|
+
position: 'fixed',
|
434
|
+
visibility: ((_c = (_b = data === null || data === void 0 ? void 0 : data[activeIndex]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
|
435
|
+
zIndex: 999,
|
436
|
+
[(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _d !== void 0 ? _d : 'right']: (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _e !== void 0 ? _e : 0,
|
437
|
+
[(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: (_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconY) !== null && _g !== void 0 ? _g : 23
|
438
|
+
}, defaultValue: isMuted, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon, onChange: setIsMuted }),
|
439
|
+
renderView),
|
440
|
+
React.createElement(WaterFall, Object.assign({}, (_k = (_j = (_h = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.item) === null || _k === void 0 ? void 0 : _k.props)),
|
454
441
|
React.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
|
455
|
-
React.createElement("video", { ref:
|
442
|
+
React.createElement("video", { ref: videoRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', preload: 'auto', controls: false, muted: true, style: {
|
456
443
|
backgroundColor: 'transparent',
|
457
444
|
width: '100%',
|
458
445
|
height: '100%',
|
@@ -5,6 +5,7 @@ import { storeAndLoadFeSessionId } from '../utils/sessionStore';
|
|
5
5
|
import { storeAndLoadFeUserId, AGREE_POLICY } from '../utils/localStore';
|
6
6
|
import { useIconLink } from '../components/SxpPageRender/useIconLink';
|
7
7
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../utils/event';
|
8
|
+
import Consent from '../components/Consent';
|
8
9
|
export const SxpDataSourceContext = createContext({
|
9
10
|
rtcList: [],
|
10
11
|
tagList: []
|
@@ -16,6 +17,7 @@ var DataSourceType;
|
|
16
17
|
const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
|
17
18
|
export const DEFAULT_TAG = 'FOR U';
|
18
19
|
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig, isEditor = false }) => {
|
20
|
+
var _a, _b, _c;
|
19
21
|
const [rtcList, setRtcList] = useState([]);
|
20
22
|
const [tagList, setTagList] = useState([]);
|
21
23
|
const [loading, setLoading] = useState(false);
|
@@ -76,10 +78,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
76
78
|
.catch((err) => Promise.reject(err));
|
77
79
|
}, [bffDataSource]);
|
78
80
|
const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
|
79
|
-
var
|
81
|
+
var _d, _e, _f, _g, _h;
|
80
82
|
query = {
|
81
|
-
maxSize: (
|
82
|
-
defaultSize: (
|
83
|
+
maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize,
|
84
|
+
defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize,
|
83
85
|
'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
|
84
86
|
'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
|
85
87
|
hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
|
@@ -87,10 +89,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
87
89
|
themeTag: query === null || query === void 0 ? void 0 : query.themeTag
|
88
90
|
};
|
89
91
|
if (utmVal) {
|
90
|
-
const val = (
|
92
|
+
const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
|
91
93
|
const key = val.split('=')[0];
|
92
94
|
return UTM_KEYS.includes(key);
|
93
|
-
})) === null ||
|
95
|
+
})) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
|
94
96
|
query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
|
95
97
|
}
|
96
98
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
|
@@ -102,7 +104,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
102
104
|
return result === null || result === void 0 ? void 0 : result.data;
|
103
105
|
}), [bffFetch, utmVal, maxSize, defaultSize]);
|
104
106
|
const loadVideos = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
105
|
-
var
|
107
|
+
var _j, _k;
|
106
108
|
if (rtcList.length <= 0) {
|
107
109
|
return;
|
108
110
|
}
|
@@ -112,8 +114,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
112
114
|
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
113
115
|
themeTag: themeTag.current
|
114
116
|
});
|
115
|
-
setRtcList(rtcList.concat((
|
116
|
-
setCacheRtcList(cacheRtcList.concat((
|
117
|
+
setRtcList(rtcList.concat((_j = data === null || data === void 0 ? void 0 : data.recList) !== null && _j !== void 0 ? _j : []));
|
118
|
+
setCacheRtcList(cacheRtcList.concat((_k = data === null || data === void 0 ? void 0 : data.recList) !== null && _k !== void 0 ? _k : []));
|
117
119
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
118
120
|
const bffEventReport = useCallback(({ userInfo, eventInfo }) => {
|
119
121
|
if (!enableReportEvent) {
|
@@ -171,16 +173,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
171
173
|
return res === null || res === void 0 ? void 0 : res.success;
|
172
174
|
}), [bffFetch]);
|
173
175
|
const bffGetTagList = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
174
|
-
var
|
176
|
+
var _l, _m, _o, _p, _q;
|
175
177
|
if (!utmVal || !isShowTag)
|
176
178
|
return;
|
177
179
|
try {
|
178
|
-
const val = (
|
180
|
+
const val = (_o = (_m = (_l = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _l === void 0 ? void 0 : _l.filter((val) => {
|
179
181
|
const key = val.split('=')[0];
|
180
182
|
return UTM_KEYS.includes(key);
|
181
|
-
})) === null ||
|
183
|
+
})) === null || _m === void 0 ? void 0 : _m.join('&')) !== null && _o !== void 0 ? _o : '';
|
182
184
|
const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
|
183
|
-
setTagList((
|
185
|
+
setTagList((_q = (_p = result === null || result === void 0 ? void 0 : result.data) === null || _p === void 0 ? void 0 : _p.tags) !== null && _q !== void 0 ? _q : []);
|
184
186
|
}
|
185
187
|
catch (e) {
|
186
188
|
console.log('e', e);
|
@@ -231,8 +233,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
231
233
|
});
|
232
234
|
}, [bffEventReport]);
|
233
235
|
useEffect(() => {
|
234
|
-
|
235
|
-
|
236
|
+
if (!isShowConsent)
|
237
|
+
h5EnterLink();
|
238
|
+
}, [isShowConsent]);
|
236
239
|
useEffect(() => {
|
237
240
|
if (isShowConsent)
|
238
241
|
return;
|
@@ -315,12 +318,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
315
318
|
isShowConsent,
|
316
319
|
selectTag,
|
317
320
|
setSelectTag
|
318
|
-
} }, render({
|
321
|
+
} }, isShowConsent ? (React.createElement(Consent, Object.assign({}, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props))) : (render({
|
319
322
|
rtcList,
|
320
323
|
mutateLike: bffMutateLike,
|
321
324
|
mutateUnlike: bffMutateUnlike,
|
322
325
|
submitForm: bffSubmitForm,
|
323
326
|
tagList
|
324
|
-
})));
|
327
|
+
}))));
|
325
328
|
};
|
326
329
|
export default memo(SxpDataSourceProvider);
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { __awaiter, __rest } from "tslib";
|
2
2
|
import { css } from '@emotion/css';
|
3
3
|
import React, { memo, useMemo, useRef, useState } from 'react';
|
4
|
-
import { BetaSchemaForm } from '@ant-design/pro-components';
|
5
4
|
import { cloneDeep, debounce } from 'lodash';
|
6
5
|
import { useSxpDataSource } from '../../../../core/hooks';
|
7
6
|
import './index.less';
|
@@ -81,8 +80,7 @@ const AppointForm = (_a) => {
|
|
81
80
|
return (React.createElement("div", { className: 'pb-appoint-form' },
|
82
81
|
React.createElement("div", { className: `pb-appoint-form-title ${css(Object.assign({}, textStyle))}` }, title),
|
83
82
|
React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
|
84
|
-
React.createElement("div", { className: 'pb-appoint-form-container' },
|
85
|
-
React.createElement(BetaSchemaForm, { columns: columnsData, submitter: false, layout: layoutType, autoFocusFirstInput: false, size: 'large', formRef: formRef, className: 'panel-reset' }))),
|
83
|
+
React.createElement("div", { className: 'pb-appoint-form-container' })),
|
86
84
|
React.createElement("div", { className: 'pb-appoint-form-btn-wrapper' },
|
87
85
|
React.createElement("button", { "aria-label": submitText, onClick: handleSubmit, className: 'pb-appoint-form-btn', style: Object.assign({ color: submitColor, background: submitBgColor }, submitButtonStyle) }, loading ? React.createElement(React.Fragment, null, "loading...") : submitText))));
|
88
86
|
};
|
@@ -3,14 +3,15 @@ import { css } from '@emotion/css';
|
|
3
3
|
import React, { memo } from 'react';
|
4
4
|
import EventProvider from '../components/EventProvider';
|
5
5
|
import { useSxpDataSource } from '../../../../core/hooks';
|
6
|
+
import Img from '../components/Img';
|
6
7
|
const Appoint = (_a) => {
|
7
|
-
var _b, _c, _d, _e;
|
8
|
-
var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink"]);
|
8
|
+
var _b, _c, _d, _e, _f, _g;
|
9
|
+
var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "index"]);
|
9
10
|
const { sxpParameter } = useSxpDataSource();
|
10
11
|
const cta = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindCta;
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', textOverflow: 'ellipsis' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (
|
12
|
+
const src = (_d = (_c = cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _c !== void 0 ? _c : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image;
|
13
|
+
return (React.createElement(EventProvider, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' }, index: index }, props),
|
14
|
+
React.createElement(Img, { src: src, rec: recData, item: (_f = (_e = recData === null || recData === void 0 ? void 0 : recData.video) === null || _e === void 0 ? void 0 : _e.bindProduct) !== null && _f !== void 0 ? _f : recData === null || recData === void 0 ? void 0 : recData.video, index: index, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
|
15
|
+
React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', textOverflow: 'ellipsis' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_g = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _g !== void 0 ? _g : 'Product Name')));
|
15
16
|
};
|
16
17
|
export default memo(Appoint);
|
@@ -4,22 +4,15 @@ import React, { memo } from 'react';
|
|
4
4
|
import EventProvider from '../components/EventProvider';
|
5
5
|
import styles from './index.module.less';
|
6
6
|
import { useSxpDataSource } from '../../../../core/hooks';
|
7
|
-
import
|
7
|
+
import Img from '../components/Img';
|
8
8
|
const Commodity = (_a) => {
|
9
|
-
var _b, _c, _d, _e, _f, _g, _h, _j;
|
10
|
-
var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0 } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY"]);
|
9
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
10
|
+
var { content, style, bgImg, recData, bottom_image, ctaTempStyles, isExternalLink, translateY = 0, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "bottom_image", "ctaTempStyles", "isExternalLink", "translateY", "index"]);
|
11
11
|
const { sxpParameter } = useSxpDataSource();
|
12
12
|
const product = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
|
13
13
|
const src = (_f = (_e = (_c = product === null || product === void 0 ? void 0 : product.cover) !== null && _c !== void 0 ? _c : (_d = product === null || product === void 0 ? void 0 : product.homePage) === null || _d === void 0 ? void 0 : _d[0]) !== null && _e !== void 0 ? _e : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _f !== void 0 ? _f : bottom_image;
|
14
|
-
return (React.createElement(EventProvider, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' } }, props),
|
15
|
-
React.createElement(
|
16
|
-
React.createElement(FormatImage, { className: css({
|
17
|
-
width: '100%',
|
18
|
-
objectFit: 'cover',
|
19
|
-
height: '100%',
|
20
|
-
display: 'block',
|
21
|
-
objectPosition: `50% ${translateY ? -translateY + 50 : 50}%`
|
22
|
-
}), src: src })),
|
14
|
+
return (React.createElement(EventProvider, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' }, index: index }, props),
|
15
|
+
React.createElement(Img, { src: src, rec: recData, item: (_h = (_g = recData === null || recData === void 0 ? void 0 : recData.video) === null || _g === void 0 ? void 0 : _g.bindProduct) !== null && _h !== void 0 ? _h : recData === null || recData === void 0 ? void 0 : recData.video, index: index, translateY: translateY, imgStyle: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img }),
|
23
16
|
React.createElement("div", { className: css({
|
24
17
|
color: '#fff',
|
25
18
|
display: 'flex',
|
@@ -28,7 +21,7 @@ const Commodity = (_a) => {
|
|
28
21
|
width: '100%',
|
29
22
|
overflow: 'hidden'
|
30
23
|
}) },
|
31
|
-
React.createElement("div", { className: styles['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (
|
32
|
-
React.createElement("div", { className: css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (
|
24
|
+
React.createElement("div", { className: styles['tow-line-ellipsis'], style: ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.title }, (_j = product === null || product === void 0 ? void 0 : product.title) !== null && _j !== void 0 ? _j : 'Product Name'),
|
25
|
+
React.createElement("div", { className: css(Object.assign({ padding: '2px 7px', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.ctaTitle)) }, (_l = (_k = product === null || product === void 0 ? void 0 : product.bindCta) === null || _k === void 0 ? void 0 : _k.enTitle) !== null && _l !== void 0 ? _l : 'Shop Now'))));
|
33
26
|
};
|
34
27
|
export default memo(Commodity);
|