pb-sxp-ui 1.0.30 → 1.0.32
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 +33 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -30
- 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 +36 -34
- 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/VideoWidget/index.js +17 -1
- package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/es/core/components/SxpPageRender/index.js +7 -7
- package/es/core/context/SxpDataSourceProvider.js +1 -1
- package/es/core/hooks/useEventReport.js +4 -4
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +17 -1
- package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/lib/core/components/SxpPageRender/index.js +7 -7
- package/lib/core/context/SxpDataSourceProvider.js +1 -1
- package/lib/core/hooks/useEventReport.js +4 -4
- package/package.json +2 -1
@@ -1,5 +1,6 @@
|
|
1
1
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
2
2
|
import { useSwiperSlide } from 'swiper/react';
|
3
|
+
import Hls from 'hls.js';
|
3
4
|
import { useIconLink } from '../useIconLink';
|
4
5
|
import FormatImage from '../FormatImage';
|
5
6
|
import { useSxpDataSource } from '../../../../core/hooks';
|
@@ -140,7 +141,22 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
140
141
|
setIsPauseVideo(false);
|
141
142
|
if (!videoRef.current.src) {
|
142
143
|
const videoSrc = rec.video.url;
|
143
|
-
|
144
|
+
if (videoSrc.includes('.m3u8')) {
|
145
|
+
if (Hls.isSupported()) {
|
146
|
+
const hls = new Hls();
|
147
|
+
hls.loadSource(videoSrc);
|
148
|
+
hls.attachMedia(videoRef.current);
|
149
|
+
}
|
150
|
+
else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
|
151
|
+
videoRef.current.src = videoSrc;
|
152
|
+
}
|
153
|
+
else {
|
154
|
+
videoRef.current.src = videoSrc;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
videoRef.current.src = videoSrc;
|
159
|
+
}
|
144
160
|
videoRef.current.setAttribute('x5-playsinline', 'true');
|
145
161
|
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
146
162
|
}
|
@@ -63,7 +63,7 @@ const WaterFall = (props) => {
|
|
63
63
|
}
|
64
64
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
65
65
|
eventInfo: {
|
66
|
-
|
66
|
+
contentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
67
67
|
position: cacheActiveIndex + '',
|
68
68
|
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
69
69
|
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
@@ -120,12 +120,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
120
120
|
sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
|
121
121
|
eventSubject: 'sessionCompleted',
|
122
122
|
eventDescription: 'Session completed',
|
123
|
-
|
124
|
-
|
123
|
+
contentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
|
124
|
+
productId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
|
125
125
|
position: activeIndex + '',
|
126
126
|
fromKName,
|
127
127
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
128
|
-
|
128
|
+
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 : ''
|
129
129
|
}
|
130
130
|
});
|
131
131
|
}
|
@@ -258,8 +258,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
258
258
|
eventInfo: {
|
259
259
|
eventSubject: 'scrollDown',
|
260
260
|
eventDescription: 'User scroll down',
|
261
|
-
|
262
|
-
|
261
|
+
contentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
|
262
|
+
productId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
263
263
|
requestId: null
|
264
264
|
}
|
265
265
|
});
|
@@ -270,8 +270,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
270
270
|
eventInfo: {
|
271
271
|
eventSubject: 'scrollUp',
|
272
272
|
eventDescription: 'User scroll up',
|
273
|
-
|
274
|
-
|
273
|
+
contentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
|
274
|
+
productId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
275
275
|
requestId: null
|
276
276
|
}
|
277
277
|
});
|
@@ -141,7 +141,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
141
141
|
fromKName = 'imagePage';
|
142
142
|
}
|
143
143
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
144
|
-
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '',
|
144
|
+
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '', contentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : '', fromKName })
|
145
145
|
});
|
146
146
|
}, [bffEventReport, isFromHashtag]);
|
147
147
|
useEffect(() => {
|
@@ -32,8 +32,8 @@ export function useEventReport() {
|
|
32
32
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
33
33
|
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
34
34
|
position: position + '',
|
35
|
-
|
36
|
-
|
35
|
+
contentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
|
36
|
+
ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
|
37
37
|
traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
|
38
38
|
}
|
39
39
|
});
|
@@ -57,8 +57,8 @@ export function useEventReport() {
|
|
57
57
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
58
58
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
59
59
|
position: position + '',
|
60
|
-
|
61
|
-
|
60
|
+
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
61
|
+
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
62
62
|
traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
|
63
63
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
64
64
|
eventSubject: 'productView',
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
5
5
|
const react_2 = require("swiper/react");
|
6
|
+
const hls_js_1 = tslib_1.__importDefault(require("hls.js"));
|
6
7
|
const useIconLink_1 = require("../useIconLink");
|
7
8
|
const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
|
8
9
|
const hooks_1 = require("../../../../core/hooks");
|
@@ -143,7 +144,22 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
143
144
|
setIsPauseVideo(false);
|
144
145
|
if (!videoRef.current.src) {
|
145
146
|
const videoSrc = rec.video.url;
|
146
|
-
|
147
|
+
if (videoSrc.includes('.m3u8')) {
|
148
|
+
if (hls_js_1.default.isSupported()) {
|
149
|
+
const hls = new hls_js_1.default();
|
150
|
+
hls.loadSource(videoSrc);
|
151
|
+
hls.attachMedia(videoRef.current);
|
152
|
+
}
|
153
|
+
else if (videoRef.current.canPlayType('application/vnd.apple.mpegurl')) {
|
154
|
+
videoRef.current.src = videoSrc;
|
155
|
+
}
|
156
|
+
else {
|
157
|
+
videoRef.current.src = videoSrc;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
else {
|
161
|
+
videoRef.current.src = videoSrc;
|
162
|
+
}
|
147
163
|
videoRef.current.setAttribute('x5-playsinline', 'true');
|
148
164
|
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
149
165
|
}
|
@@ -66,7 +66,7 @@ const WaterFall = (props) => {
|
|
66
66
|
}
|
67
67
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
68
68
|
eventInfo: {
|
69
|
-
|
69
|
+
contentId: (_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,
|
@@ -123,12 +123,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
123
123
|
sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
|
124
124
|
eventSubject: 'sessionCompleted',
|
125
125
|
eventDescription: 'Session completed',
|
126
|
-
|
127
|
-
|
126
|
+
contentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
|
127
|
+
productId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
|
128
128
|
position: activeIndex + '',
|
129
129
|
fromKName,
|
130
130
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
131
|
-
|
131
|
+
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 : ''
|
132
132
|
}
|
133
133
|
});
|
134
134
|
}
|
@@ -261,8 +261,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
261
261
|
eventInfo: {
|
262
262
|
eventSubject: 'scrollDown',
|
263
263
|
eventDescription: 'User scroll down',
|
264
|
-
|
265
|
-
|
264
|
+
contentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
|
265
|
+
productId: (_d = (_c = item.product) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
266
266
|
requestId: null
|
267
267
|
}
|
268
268
|
});
|
@@ -273,8 +273,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
273
273
|
eventInfo: {
|
274
274
|
eventSubject: 'scrollUp',
|
275
275
|
eventDescription: 'User scroll up',
|
276
|
-
|
277
|
-
|
276
|
+
contentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
|
277
|
+
productId: (_h = (_g = item.product) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
278
278
|
requestId: null
|
279
279
|
}
|
280
280
|
});
|
@@ -144,7 +144,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
144
144
|
fromKName = 'imagePage';
|
145
145
|
}
|
146
146
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
147
|
-
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '',
|
147
|
+
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '', contentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : '', fromKName })
|
148
148
|
});
|
149
149
|
}, [bffEventReport, isFromHashtag]);
|
150
150
|
(0, react_1.useEffect)(() => {
|
@@ -35,8 +35,8 @@ function useEventReport() {
|
|
35
35
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
36
36
|
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
37
37
|
position: position + '',
|
38
|
-
|
39
|
-
|
38
|
+
contentId: (_m = (_l = data === null || data === void 0 ? void 0 : data.video) === null || _l === void 0 ? void 0 : _l.itemId) !== null && _m !== void 0 ? _m : '',
|
39
|
+
ctatId: (_o = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _o !== void 0 ? _o : '',
|
40
40
|
traceInfo: (_p = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _p !== void 0 ? _p : ''
|
41
41
|
}
|
42
42
|
});
|
@@ -60,8 +60,8 @@ function useEventReport() {
|
|
60
60
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
61
61
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
62
62
|
position: position + '',
|
63
|
-
|
64
|
-
|
63
|
+
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
64
|
+
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
65
65
|
traceInfo: product === null || product === void 0 ? void 0 : product.traceInfo,
|
66
66
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
67
67
|
eventSubject: 'productView',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "pb-sxp-ui",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.32",
|
4
4
|
"description": "React enterprise-class UI components",
|
5
5
|
"main": "dist/index.cjs",
|
6
6
|
"module": "dist/index.js",
|
@@ -42,6 +42,7 @@
|
|
42
42
|
"antd": "^5.15.3",
|
43
43
|
"eslint": "^8.48.0",
|
44
44
|
"eventemitter3": "^5.0.1",
|
45
|
+
"hls.js": "^1.5.8",
|
45
46
|
"less": "^4.2.0",
|
46
47
|
"lodash": "^4.17.21",
|
47
48
|
"pako": "^2.1.0",
|