pb-sxp-ui 1.0.42 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +111 -111
  3. package/dist/index.cjs +237 -600
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.css +4 -54
  6. package/dist/index.js +237 -599
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.min.cjs +3 -4
  9. package/dist/index.min.cjs.map +1 -1
  10. package/dist/index.min.js +3 -4
  11. package/dist/index.min.js.map +1 -1
  12. package/dist/pb-ui.js +241 -603
  13. package/dist/pb-ui.js.map +1 -1
  14. package/dist/pb-ui.min.js +3 -4
  15. package/dist/pb-ui.min.js.map +1 -1
  16. package/es/core/components/SxpPageCore/index.js +2 -2
  17. package/es/core/components/SxpPageRender/Nudge/index.js +5 -6
  18. package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
  19. package/es/core/components/SxpPageRender/VideoWidget/index.js +119 -88
  20. package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
  21. package/es/core/components/SxpPageRender/index.d.ts +0 -2
  22. package/es/core/components/SxpPageRender/index.js +63 -25
  23. package/es/core/context/SxpDataSourceProvider.d.ts +2 -3
  24. package/es/core/context/SxpDataSourceProvider.js +7 -28
  25. package/es/core/hooks/useEventReport.js +4 -4
  26. package/es/index.d.ts +0 -1
  27. package/es/index.js +0 -1
  28. package/es/materials/sxp/popup/CommodityDetail/index.js +10 -10
  29. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +10 -10
  30. package/lib/core/components/SxpPageCore/index.js +2 -2
  31. package/lib/core/components/SxpPageRender/Nudge/index.js +5 -6
  32. package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
  33. package/lib/core/components/SxpPageRender/VideoWidget/index.js +119 -88
  34. package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
  35. package/lib/core/components/SxpPageRender/index.d.ts +0 -2
  36. package/lib/core/components/SxpPageRender/index.js +63 -25
  37. package/lib/core/context/SxpDataSourceProvider.d.ts +2 -3
  38. package/lib/core/context/SxpDataSourceProvider.js +7 -28
  39. package/lib/core/hooks/useEventReport.js +4 -4
  40. package/lib/index.d.ts +0 -1
  41. package/lib/index.js +1 -3
  42. package/lib/materials/sxp/popup/CommodityDetail/index.js +10 -10
  43. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +10 -10
  44. package/package.json +114 -115
  45. package/es/core/components/DiyPortalPreview/PictureGroup.d.ts +0 -13
  46. package/es/core/components/DiyPortalPreview/PictureGroup.js +0 -11
  47. package/es/core/components/DiyPortalPreview/VideoWidget.d.ts +0 -15
  48. package/es/core/components/DiyPortalPreview/VideoWidget.js +0 -236
  49. package/es/core/components/DiyPortalPreview/index.d.ts +0 -6
  50. package/es/core/components/DiyPortalPreview/index.js +0 -127
  51. package/es/core/components/SxpPageRender/Tagbar.d.ts +0 -7
  52. package/es/core/components/SxpPageRender/Tagbar.js +0 -37
  53. package/lib/core/components/DiyPortalPreview/PictureGroup.d.ts +0 -13
  54. package/lib/core/components/DiyPortalPreview/PictureGroup.js +0 -14
  55. package/lib/core/components/DiyPortalPreview/VideoWidget.d.ts +0 -15
  56. package/lib/core/components/DiyPortalPreview/VideoWidget.js +0 -239
  57. package/lib/core/components/DiyPortalPreview/index.d.ts +0 -6
  58. package/lib/core/components/DiyPortalPreview/index.js +0 -130
  59. package/lib/core/components/SxpPageRender/Tagbar.d.ts +0 -7
  60. package/lib/core/components/SxpPageRender/Tagbar.js +0 -40
@@ -7,9 +7,8 @@ const useIconLink_1 = require("../useIconLink");
7
7
  const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
8
8
  const hooks_1 = require("../../../../core/hooks");
9
9
  const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
10
- const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig }) => {
10
+ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
11
11
  const [isPauseVideo, setIsPauseVideo] = (0, react_1.useState)(false);
12
- const videoRef = (0, react_1.useRef)(null);
13
12
  const { bffEventReport, sxpParameter, waterFallData, openHashtag } = (0, hooks_1.useSxpDataSource)();
14
13
  const videoStartTime = (0, react_1.useRef)(0);
15
14
  const [isLoadFinish, setIsLoadFinish] = (0, react_1.useState)(false);
@@ -17,99 +16,118 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
17
16
  const { isActive } = (0, react_2.useSwiperSlide)();
18
17
  const canvasRef = (0, react_1.useRef)(null);
19
18
  const [firstFrameSrc, setFirstFrameSrc] = (0, react_1.useState)('');
19
+ const videoId = `pb-cache-video-${index}`;
20
+ const videoEleRef = (0, react_1.useRef)(null);
20
21
  (0, react_1.useEffect)(() => {
21
- if (!videoRef.current)
22
+ if (!videoRef)
22
23
  return;
23
- videoRef.current.muted = muted;
24
- }, [muted]);
25
- const handleVideoStart = (0, react_1.useCallback)(() => {
26
- var _a;
27
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
28
- }, []);
24
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.muted(muted);
25
+ }, [muted, videoRef]);
26
+ const handleEnded = (0, react_1.useCallback)(() => {
27
+ if (!videoRef)
28
+ return;
29
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
30
+ }, [videoRef]);
29
31
  const PAUSE_ICON = (0, useIconLink_1.useIconLink)('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
30
32
  const handlePlaying = (0, react_1.useCallback)(() => {
31
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
33
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
34
+ if (!videoRef)
35
+ return;
32
36
  setIsPauseVideo(false);
33
37
  const item = data[index];
34
- if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
35
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
36
- const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
37
- const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
38
+ if (item && (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration())) {
39
+ videoStartTime.current = (videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) || 0;
40
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
41
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
38
42
  const playType = isFirstPlay ? '0' : '1';
39
43
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
40
44
  eventInfo: {
41
45
  eventSubject: 'playVideo',
42
46
  eventDescription: 'User played the video',
43
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
44
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
47
+ contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
48
+ contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
45
49
  playType,
46
50
  startTime: videoCurrentTime,
47
51
  videoDuration,
48
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
52
+ contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
49
53
  position: index + '',
50
54
  contentFormat: 'video',
51
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
55
+ traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
52
56
  }
53
57
  });
54
58
  setIsFirstPlay(false);
55
59
  }
56
- }, [bffEventReport, data, index, isFirstPlay]);
57
- const handleLoadedMetadata = (0, react_1.useCallback)(() => {
60
+ }, [bffEventReport, data, index, isFirstPlay, videoRef]);
61
+ const handleLoadedmetadata = (0, react_1.useCallback)(() => {
62
+ if (!videoRef)
63
+ return;
64
+ if (activeIndex !== index) {
65
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
66
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
67
+ }
68
+ setIsLoadFinish(true);
69
+ }, [activeIndex, index, videoRef]);
70
+ const handleCanplay = (0, react_1.useCallback)(() => {
58
71
  setIsLoadFinish(true);
59
72
  }, []);
60
73
  const handleClickVideo = (0, react_1.useCallback)((type) => () => {
61
- var _a, _b, _c, _d, _e;
74
+ if (!videoRef)
75
+ return;
62
76
  if (!isLoadFinish)
63
77
  return;
64
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
78
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
65
79
  switch (type) {
66
80
  case 'start':
67
81
  if (!isPause)
68
82
  return;
69
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
83
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
70
84
  setIsPauseVideo(false);
71
85
  break;
72
86
  case 'pause':
73
87
  if (isPause)
74
88
  return;
75
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
89
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
76
90
  setIsPauseVideo(true);
77
91
  break;
78
92
  default:
79
93
  if (isPause) {
80
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
94
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
81
95
  }
82
96
  else {
83
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
97
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
84
98
  }
85
99
  setIsPauseVideo(!isPause);
86
100
  break;
87
101
  }
88
- }, [isLoadFinish]);
89
- const onPause = (0, react_1.useCallback)(() => {
90
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
102
+ }, [isLoadFinish, videoRef]);
103
+ const handlePause = (0, react_1.useCallback)(() => {
104
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
105
+ if (!videoRef)
106
+ return;
107
+ if (activeIndex !== index)
108
+ return;
91
109
  const item = data[index];
92
- const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
93
- const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
94
- if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration) {
95
- const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime) - videoStartTime.current).toFixed(2);
110
+ const videoDuration = ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) !== null && _a !== void 0 ? _a : 0).toFixed(2);
111
+ const videoCurrentTime = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
112
+ if (videoRef === null || videoRef === void 0 ? void 0 : videoRef.duration()) {
113
+ const playDuration = ((videoRef === null || videoRef === void 0 ? void 0 : videoRef.currentTime()) - videoStartTime.current).toFixed(2);
96
114
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
97
115
  eventInfo: {
98
116
  eventSubject: 'playOverVideo',
99
117
  eventDescription: 'User finished playing the video',
100
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
101
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
118
+ contentId: (_d = (_c = item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
119
+ contentName: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : '',
102
120
  endTime: videoCurrentTime,
103
121
  videoDuration,
104
122
  playDuration,
105
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
123
+ contentTags: JSON.stringify((_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []),
106
124
  position: index + '',
107
125
  contentFormat: 'video',
108
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
126
+ traceInfo: (_j = item.video) === null || _j === void 0 ? void 0 : _j.traceInfo
109
127
  }
110
128
  });
111
129
  }
112
- }, [data, index, bffEventReport]);
130
+ }, [data, index, bffEventReport, videoRef]);
113
131
  const blur = (0, react_1.useMemo)(() => {
114
132
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
115
133
  }, [videoPostConfig]);
@@ -124,64 +142,79 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
124
142
  return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
125
143
  }, [firstFrameSrc, rec]);
126
144
  const handLoadeddata = (0, react_1.useCallback)(() => {
127
- if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
145
+ var _a;
146
+ if (!videoRef)
128
147
  return;
129
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
130
- const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
131
- const ctx = canvas.getContext('2d');
132
- const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
133
- const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
134
- canvas.height = targetHeight;
135
- canvas.width = targetWidth;
136
- ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
137
- setFirstFrameSrc(canvas.toDataURL());
138
- }, []);
148
+ const videoDomRef = document.getElementById(`${videoId}_html5_api`);
149
+ if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !videoDomRef || !canvasRef.current)
150
+ return;
151
+ const setFrameImg = () => {
152
+ const video = videoDomRef;
153
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
154
+ const ctx = canvas.getContext('2d');
155
+ const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
156
+ const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
157
+ canvas.height = targetHeight;
158
+ canvas.width = targetWidth;
159
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
160
+ setFirstFrameSrc(canvas.toDataURL());
161
+ };
162
+ setFrameImg();
163
+ setTimeout(() => {
164
+ setFrameImg();
165
+ }, 500);
166
+ }, [videoRef]);
139
167
  (0, react_1.useEffect)(() => {
140
- var _a, _b, _c, _d;
141
- if (!videoRef.current)
168
+ if (!isActive || !videoRef)
169
+ return;
170
+ const videoSrc = rec.video.url;
171
+ if (!videoSrc)
142
172
  return;
143
173
  setIsPauseVideo(false);
144
- if (!videoRef.current.src) {
145
- const videoSrc = rec.video.url;
146
- videoRef.current.src = videoSrc;
147
- videoRef.current.setAttribute('x5-playsinline', 'true');
148
- videoRef.current.setAttribute('webkit-playsinline', 'true');
149
- }
150
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
151
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
152
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
153
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
174
+ const videoPlayerWrapperNode = document.querySelector(`#${videoId}`);
175
+ const dom = document.querySelector('#player-container-id');
176
+ const dom2 = document.querySelector('#player-container-id-copy');
177
+ if (!dom && !dom2)
178
+ return;
179
+ videoPlayerWrapperNode === null || videoPlayerWrapperNode === void 0 ? void 0 : videoPlayerWrapperNode.appendChild(dom || dom2);
180
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.src(videoSrc);
181
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadedmetadata', handleLoadedmetadata);
182
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('loadeddata', handLoadeddata);
183
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('canplay', handleCanplay);
184
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('playing', handlePlaying);
185
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('pause', handlePause);
186
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.on('ended', handleEnded);
154
187
  return () => {
155
- var _a, _b, _c, _d;
156
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
157
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
158
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
159
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
188
+ dom2 === null || dom2 === void 0 ? void 0 : dom2.appendChild(dom);
189
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadedmetadata', handleLoadedmetadata);
190
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('loadeddata', handLoadeddata);
191
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('canplay', handleCanplay);
192
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('playing', handlePlaying);
193
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('pause', handlePause);
194
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.off('ended', handleEnded);
160
195
  };
161
- }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
196
+ }, [isActive, videoId, rec, videoRef]);
162
197
  (0, react_1.useEffect)(() => {
163
- var _a;
164
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
198
+ if (!videoRef || !isLoadFinish)
165
199
  return;
166
200
  if (isActive) {
167
- videoRef.current.play();
201
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
168
202
  }
169
203
  else {
170
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
204
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
171
205
  }
172
- }, [isActive, isLoadFinish]);
206
+ }, [isActive, isLoadFinish, videoRef]);
173
207
  (0, react_1.useEffect)(() => {
174
- var _a, _b, _c;
175
- if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
208
+ if (!isActive || !videoRef)
176
209
  return;
177
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
210
+ const isPause = videoRef === null || videoRef === void 0 ? void 0 : videoRef.paused();
178
211
  if (!isPause && openHashtag) {
179
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
212
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.pause();
180
213
  }
181
214
  else if (!openHashtag) {
182
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
215
+ videoRef === null || videoRef === void 0 ? void 0 : videoRef.play();
183
216
  }
184
- }, [openHashtag, isActive]);
217
+ }, [openHashtag, isActive, videoRef]);
185
218
  (0, react_1.useEffect)(() => {
186
219
  if (!isActive)
187
220
  return;
@@ -201,9 +234,11 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
201
234
  return (react_1.default.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image }));
202
235
  }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
203
236
  (0, react_1.useEffect)(() => {
237
+ if (!videoRef)
238
+ return;
204
239
  const handleBeforeUnload = () => {
205
- var _a, _b;
206
- if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.src) && !isPauseVideo) {
240
+ var _a;
241
+ if (activeIndex === index && ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) && videoRef && !isPauseVideo) {
207
242
  handleClickVideo('pause')();
208
243
  }
209
244
  };
@@ -241,19 +276,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
241
276
  right: 0
242
277
  } },
243
278
  react_1.default.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
244
- react_1.default.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
245
- width: '100%',
246
- height: '100%',
247
- objectFit: 'contain'
248
- } }),
279
+ react_1.default.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
249
280
  react_1.default.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))),
250
- renderPoster)) : (react_1.default.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
281
+ renderPoster)) : (react_1.default.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
251
282
  position: 'relative',
252
283
  width: '100%',
253
284
  height,
254
285
  overflow: 'hidden'
255
- } },
256
- react_1.default.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
286
+ }, onClick: handleClickVideo() },
287
+ react_1.default.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
257
288
  renderPoster,
258
289
  react_1.default.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
259
290
  };
@@ -66,7 +66,7 @@ const WaterFall = (props) => {
66
66
  }
67
67
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
68
68
  eventInfo: {
69
- contentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
69
+ relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
70
70
  position: cacheActiveIndex + '',
71
71
  contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
72
72
  traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
@@ -9,7 +9,6 @@ export type postConfigType = {
9
9
  export interface ISxpPageRenderProps {
10
10
  globalConfig?: {
11
11
  isShowLogo?: boolean;
12
- isShowCTA?: boolean;
13
12
  logoUrl?: string;
14
13
  muteIcon?: string;
15
14
  unMuteIcon?: string;
@@ -56,7 +55,6 @@ export interface ISxpPageRenderProps {
56
55
  containerWidth?: number;
57
56
  tempMap?: Record<string, any>;
58
57
  data?: RecItemType[];
59
- tagList?: string[];
60
58
  resolver: any;
61
59
  ctaType?: string;
62
60
  _schema?: any;
@@ -24,8 +24,7 @@ require("./index.less");
24
24
  const useEventReport_1 = require("../../../core/hooks/useEventReport");
25
25
  const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
26
26
  const localStore_1 = require("../../../core/utils/localStore");
27
- const Tagbar_1 = tslib_1.__importDefault(require("./Tagbar"));
28
- const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, tagList = [] }) => {
27
+ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle }) => {
29
28
  var _a, _b, _c, _d, _e, _f, _g;
30
29
  const { schema } = (0, hooks_1.useEditor)();
31
30
  const [activeIndex, setActiveIndex] = (0, react_1.useState)(0);
@@ -37,6 +36,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
37
36
  const [isLoadMore, setIsLoadMore] = (0, react_1.useState)(false);
38
37
  const [isShowMore, setIsShowMore] = (0, react_1.useState)(false);
39
38
  const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = (0, hooks_1.useSxpDataSource)();
39
+ const [videoRef, setVideoRef] = (0, react_1.useState)(null);
40
+ const playerRef = (0, react_1.useRef)();
40
41
  const { productView } = (0, useEventReport_1.useEventReport)();
41
42
  const isShowFingerTip = (0, react_1.useMemo)(() => {
42
43
  return data.length > 0 && !loading && (0, localStore_1.getFeUserId)();
@@ -72,6 +73,25 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
72
73
  viewTime.current = new Date();
73
74
  (0, sessionStore_1.refreshFeSessionId)();
74
75
  };
76
+ const firstRef = (0, react_1.useRef)();
77
+ (0, react_1.useEffect)(() => {
78
+ if (!firstRef.current && !videoRef) {
79
+ firstRef.current = true;
80
+ const player = TCPlayer('player-container-id', {
81
+ licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license',
82
+ controls: false,
83
+ autoplay: false,
84
+ loop: false,
85
+ muted: true,
86
+ preload: 'auto',
87
+ posterImage: false,
88
+ bigPlayButton: true
89
+ });
90
+ player === null || player === void 0 ? void 0 : player.ready(() => {
91
+ setVideoRef(player);
92
+ });
93
+ }
94
+ }, [videoRef]);
75
95
  (0, react_1.useEffect)(() => {
76
96
  if (!isInit)
77
97
  handleH5EnterLink();
@@ -124,12 +144,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
124
144
  sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
125
145
  eventSubject: 'sessionCompleted',
126
146
  eventDescription: 'Session completed',
127
- contentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
128
- productId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
147
+ relatedContentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
148
+ relatedProductId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
129
149
  position: activeIndex + '',
130
150
  fromKName,
131
151
  fromKPage: location === null || location === void 0 ? void 0 : location.href,
132
- ctatId: (_q = (_p = (_o = item.video) === null || _o === void 0 ? void 0 : _o.bindCta) === null || _p === void 0 ? void 0 : _p.itemId) !== null && _q !== void 0 ? _q : ''
152
+ relatedCtatId: (_q = (_p = (_o = item.video) === null || _o === void 0 ? void 0 : _o.bindCta) === null || _p === void 0 ? void 0 : _p.itemId) !== null && _q !== void 0 ? _q : ''
133
153
  }
134
154
  });
135
155
  }
@@ -145,15 +165,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
145
165
  };
146
166
  }, [activeIndex, bffEventReport, curTime, data, handleH5EnterLink, popupDetailData, isFromHashtag, tempMap]);
147
167
  const height = (0, react_1.useMemo)(() => {
148
- let minusHeight = 0;
149
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
150
- minusHeight += 45;
151
- }
152
- if (tagList.length > 0) {
153
- minusHeight += 45;
154
- }
155
- return containerHeight - minusHeight;
156
- }, [globalConfig, containerHeight, tagList]);
168
+ return (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo) ? containerHeight - 45 : containerHeight;
169
+ }, [globalConfig, containerHeight]);
157
170
  const renderLogo = (0, react_1.useMemo)(() => {
158
171
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
159
172
  return (react_1.default.createElement("div", { className: 'clc-sxp-logo-banner', style: { backgroundColor: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.color } },
@@ -164,7 +177,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
164
177
  const renderContent = (0, react_1.useCallback)((rec, index) => {
165
178
  var _a, _b, _c, _d;
166
179
  if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
167
- return (react_1.default.createElement(VideoWidget_1.default, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost }));
180
+ return (react_1.default.createElement(VideoWidget_1.default, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoRef: videoRef }));
168
181
  }
169
182
  if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
170
183
  return (react_1.default.createElement(PictureGroup_1.default, { key: rec.video.itemId, imgUrls: rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onReportViewImageEnd: handleReportViewImageEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
@@ -179,7 +192,19 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
179
192
  });
180
193
  }
181
194
  return null;
182
- }, [containerWidth, data, height, isMuted, activeIndex, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost, viewTime, tipText, resolver, schema]);
195
+ }, [
196
+ containerWidth,
197
+ data,
198
+ height,
199
+ isMuted,
200
+ activeIndex,
201
+ globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost,
202
+ viewTime,
203
+ tipText,
204
+ resolver,
205
+ schema,
206
+ videoRef
207
+ ]);
183
208
  const onExpandableChange = (0, react_1.useCallback)((v) => {
184
209
  setIsShowMore(v);
185
210
  }, []);
@@ -201,8 +226,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
201
226
  ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && !isShowMore && react_1.default.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
202
227
  react_1.default.createElement("div", { className: 'clc-sxp-bottom' },
203
228
  react_1.default.createElement(Nudge_1.default, { nudge: nudge }),
204
- (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) ? (react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
205
- react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver }))) : null,
229
+ react_1.default.createElement("div", { className: 'clc-sxp-bottom-card' },
230
+ react_1.default.createElement(RenderCard_1.default, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
206
231
  react_1.default.createElement("div", null,
207
232
  react_1.default.createElement(ExpandableText_1.default, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }), onChange: onExpandableChange }),
208
233
  react_1.default.createElement(Hashtag_1.default, { index: activeIndex, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle })))));
@@ -269,8 +294,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
269
294
  eventInfo: {
270
295
  eventSubject: 'scrollDown',
271
296
  eventDescription: 'User scroll down',
272
- contentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
273
- productId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
297
+ relatedContentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
298
+ relatedProductId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
274
299
  requestId: null
275
300
  }
276
301
  });
@@ -281,8 +306,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
281
306
  eventInfo: {
282
307
  eventSubject: 'scrollUp',
283
308
  eventDescription: 'User scroll up',
284
- contentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
285
- productId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
309
+ relatedContentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
310
+ relatedProductId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
286
311
  requestId: null
287
312
  }
288
313
  });
@@ -359,9 +384,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
359
384
  setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
360
385
  } })),
361
386
  renderLogo,
362
- react_1.default.createElement(Tagbar_1.default, { tagList: tagList, setActiveIndex: setActiveIndex }),
363
387
  isShowFingerTip ? react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
364
- react_1.default.createElement(react_2.Swiper, { ref: swiperRef, onActiveIndexChange: (swiper) => {
388
+ react_1.default.createElement(react_2.Swiper, { ref: swiperRef, onSlideChange: () => {
389
+ swiperRef.current.swiper.allowTouchMove = false;
390
+ setTimeout(() => {
391
+ swiperRef.current.swiper.allowTouchMove = true;
392
+ }, 500);
393
+ }, onActiveIndexChange: (swiper) => {
365
394
  setActiveIndex(swiper.activeIndex);
366
395
  if (openHashtag)
367
396
  return;
@@ -385,6 +414,15 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
385
414
  zIndex: 999
386
415
  }, 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 }),
387
416
  renderView),
388
- react_1.default.createElement(WaterFall_1.default, Object.assign({}, (_g = (_f = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.item) === null || _g === void 0 ? void 0 : _g.props))));
417
+ react_1.default.createElement(WaterFall_1.default, Object.assign({}, (_g = (_f = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.item) === null || _g === void 0 ? void 0 : _g.props)),
418
+ react_1.default.createElement("div", { style: { position: 'absolute', zIndex: -100 } },
419
+ react_1.default.createElement("video", { ref: playerRef, id: 'player-container-id', playsInline: true, crossOrigin: 'anonymous', style: {
420
+ backgroundColor: 'transparent',
421
+ width: '100%',
422
+ height: '100%',
423
+ objectFit: 'cover',
424
+ pointerEvents: 'none'
425
+ } }),
426
+ react_1.default.createElement("div", { id: 'player-container-id-copy' }))));
389
427
  };
390
428
  exports.default = SxpPageRender;
@@ -60,15 +60,14 @@ export interface ISxpDataSourceContext {
60
60
  hashTagSize?: number;
61
61
  loadingImage?: string;
62
62
  isOpenHashTag?: boolean;
63
- tagList: string[];
64
- setLoading?: React.Dispatch<React.SetStateAction<boolean>>;
63
+ videoRef?: any;
64
+ setVideoRef?: React.Dispatch<React.SetStateAction<any>>;
65
65
  }
66
66
  export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
67
67
  export interface SxpDataSourceProviderProps {
68
68
  dataSources?: DataSource[];
69
69
  render: (data: {
70
70
  rtcList: RecItemType[];
71
- tagList: string[];
72
71
  submitForm: (body: {
73
72
  attributes: Array<{
74
73
  name: string;