pb-sxp-ui 1.0.37 → 1.0.39
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 +125 -452
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -6
- package/dist/index.js +125 -451
- 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 +129 -455
- 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 +79 -46
- 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/es/index.d.ts +0 -1
- package/es/index.js +0 -1
- package/es/materials/sxp/popup/CommodityDetail/index.js +6 -6
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -9
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +79 -46
- 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/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/materials/sxp/popup/CommodityDetail/index.js +6 -6
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +9 -9
- package/package.json +1 -2
- package/es/core/components/DiyPortalPreview/PictureGroup.d.ts +0 -13
- package/es/core/components/DiyPortalPreview/PictureGroup.js +0 -11
- package/es/core/components/DiyPortalPreview/VideoWidget.d.ts +0 -15
- package/es/core/components/DiyPortalPreview/VideoWidget.js +0 -236
- package/es/core/components/DiyPortalPreview/index.d.ts +0 -6
- package/es/core/components/DiyPortalPreview/index.js +0 -112
- package/lib/core/components/DiyPortalPreview/PictureGroup.d.ts +0 -13
- package/lib/core/components/DiyPortalPreview/PictureGroup.js +0 -14
- package/lib/core/components/DiyPortalPreview/VideoWidget.d.ts +0 -15
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +0 -239
- package/lib/core/components/DiyPortalPreview/index.d.ts +0 -6
- package/lib/core/components/DiyPortalPreview/index.js +0 -115
@@ -17,12 +17,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
17
17
|
const { isActive } = (0, react_2.useSwiperSlide)();
|
18
18
|
const canvasRef = (0, react_1.useRef)(null);
|
19
19
|
const [firstFrameSrc, setFirstFrameSrc] = (0, react_1.useState)('');
|
20
|
+
const videoId = `pb-video-${index}`;
|
20
21
|
(0, react_1.useEffect)(() => {
|
21
22
|
if (!videoRef.current)
|
22
23
|
return;
|
23
|
-
videoRef.current.muted
|
24
|
+
videoRef.current.muted(muted);
|
24
25
|
}, [muted]);
|
25
|
-
const
|
26
|
+
const handleEnded = (0, react_1.useCallback)(() => {
|
26
27
|
var _a;
|
27
28
|
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
28
29
|
}, []);
|
@@ -31,10 +32,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
31
32
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
32
33
|
setIsPauseVideo(false);
|
33
34
|
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);
|
35
|
+
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration())) {
|
36
|
+
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime()) || 0;
|
37
|
+
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration()) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
38
|
+
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime()) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
38
39
|
const playType = isFirstPlay ? '0' : '1';
|
39
40
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
40
41
|
eventInfo: {
|
@@ -54,14 +55,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
54
55
|
setIsFirstPlay(false);
|
55
56
|
}
|
56
57
|
}, [bffEventReport, data, index, isFirstPlay]);
|
57
|
-
const
|
58
|
+
const handleCanplay = (0, react_1.useCallback)(() => {
|
59
|
+
handLoadeddata();
|
58
60
|
setIsLoadFinish(true);
|
59
61
|
}, []);
|
60
62
|
const handleClickVideo = (0, react_1.useCallback)((type) => () => {
|
61
63
|
var _a, _b, _c, _d, _e;
|
62
64
|
if (!isLoadFinish)
|
63
65
|
return;
|
64
|
-
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
66
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused();
|
65
67
|
switch (type) {
|
66
68
|
case 'start':
|
67
69
|
if (!isPause)
|
@@ -86,13 +88,13 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
86
88
|
break;
|
87
89
|
}
|
88
90
|
}, [isLoadFinish]);
|
89
|
-
const
|
91
|
+
const handlePause = (0, react_1.useCallback)(() => {
|
90
92
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
91
93
|
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);
|
94
|
+
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration()) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
95
|
+
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime()) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
96
|
+
if ((_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.duration()) {
|
97
|
+
const playDuration = (((_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.currentTime()) - videoStartTime.current).toFixed(2);
|
96
98
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
97
99
|
eventInfo: {
|
98
100
|
eventSubject: 'playOverVideo',
|
@@ -124,41 +126,64 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
124
126
|
return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
|
125
127
|
}, [firstFrameSrc, rec]);
|
126
128
|
const handLoadeddata = (0, react_1.useCallback)(() => {
|
127
|
-
|
129
|
+
var _a;
|
130
|
+
const videoDomRef = document.getElementById(`${videoId}_html5_api`);
|
131
|
+
if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !videoDomRef || !canvasRef.current)
|
128
132
|
return;
|
129
|
-
const
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
const setFrameImg = () => {
|
134
|
+
const video = videoDomRef;
|
135
|
+
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
136
|
+
const ctx = canvas.getContext('2d');
|
137
|
+
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
138
|
+
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
139
|
+
canvas.height = targetHeight;
|
140
|
+
canvas.width = targetWidth;
|
141
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
142
|
+
setFirstFrameSrc(canvas.toDataURL());
|
143
|
+
};
|
144
|
+
setFrameImg();
|
145
|
+
setTimeout(() => {
|
146
|
+
setFrameImg();
|
147
|
+
}, 500);
|
138
148
|
}, []);
|
139
149
|
(0, react_1.useEffect)(() => {
|
140
|
-
var _a, _b, _c, _d;
|
141
|
-
if (!videoRef.current)
|
142
|
-
return;
|
150
|
+
var _a, _b, _c, _d, _e;
|
143
151
|
setIsPauseVideo(false);
|
144
|
-
|
145
|
-
|
146
|
-
videoRef.current
|
147
|
-
|
148
|
-
|
152
|
+
const videoSrc = rec.video.url;
|
153
|
+
if (videoSrc && typeof TCPlayer === 'function') {
|
154
|
+
videoRef.current = TCPlayer(videoId, {
|
155
|
+
sources: [
|
156
|
+
{
|
157
|
+
src: videoSrc
|
158
|
+
}
|
159
|
+
],
|
160
|
+
licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1325816236_1/v_cube.license',
|
161
|
+
controls: false,
|
162
|
+
autoplay: false,
|
163
|
+
loop: false,
|
164
|
+
muted: true,
|
165
|
+
preload: 'auto',
|
166
|
+
posterImage: false,
|
167
|
+
bigPlayButton: true
|
168
|
+
});
|
169
|
+
videoRef.current.play();
|
170
|
+
videoRef.current.pause();
|
149
171
|
}
|
150
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.
|
151
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.
|
152
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.
|
153
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.
|
172
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.on('loadedmetadata', handleCanplay);
|
173
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.on('canplay', handleCanplay);
|
174
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.on('playing', handlePlaying);
|
175
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.on('pause', handlePause);
|
176
|
+
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.on('ended', handleEnded);
|
154
177
|
return () => {
|
155
|
-
var _a, _b, _c, _d;
|
156
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.
|
157
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.
|
158
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.
|
159
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.
|
178
|
+
var _a, _b, _c, _d, _e;
|
179
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.off('loadedmetadata', handleCanplay);
|
180
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.off('canplay', handleCanplay);
|
181
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.off('playing', handlePlaying);
|
182
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.off('pause', handlePause);
|
183
|
+
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.off('ended', handleEnded);
|
184
|
+
videoRef.current.dispose();
|
160
185
|
};
|
161
|
-
}, [
|
186
|
+
}, []);
|
162
187
|
(0, react_1.useEffect)(() => {
|
163
188
|
var _a;
|
164
189
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
@@ -241,19 +266,27 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
241
266
|
right: 0
|
242
267
|
} },
|
243
268
|
react_1.default.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
|
244
|
-
react_1.default.createElement("video", { id: `pb-video-${index}`,
|
269
|
+
react_1.default.createElement("video", { id: `pb-video-${index}`, playsInline: true, crossOrigin: 'anonymous', style: {
|
245
270
|
width: '100%',
|
246
271
|
height: '100%',
|
247
|
-
objectFit: 'contain'
|
272
|
+
objectFit: 'contain',
|
273
|
+
backgroundColor: 'transparent',
|
274
|
+
pointerEvents: 'none'
|
248
275
|
} }),
|
249
276
|
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,
|
277
|
+
renderPoster)) : (react_1.default.createElement("div", { className: 'video-container', key: rec.video.itemId, style: {
|
251
278
|
position: 'relative',
|
252
279
|
width: '100%',
|
253
280
|
height,
|
254
281
|
overflow: 'hidden'
|
255
|
-
} },
|
256
|
-
react_1.default.createElement("video", { id: `pb-video-${index}`,
|
282
|
+
}, onClick: handleClickVideo() },
|
283
|
+
react_1.default.createElement("video", { id: `pb-video-${index}`, playsInline: true, crossOrigin: 'anonymous', style: {
|
284
|
+
backgroundColor: 'transparent',
|
285
|
+
width: '100%',
|
286
|
+
height: '100%',
|
287
|
+
objectFit: 'cover',
|
288
|
+
pointerEvents: 'none'
|
289
|
+
} }),
|
257
290
|
renderPoster,
|
258
291
|
react_1.default.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
|
259
292
|
};
|
@@ -66,7 +66,7 @@ const WaterFall = (props) => {
|
|
66
66
|
}
|
67
67
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
68
68
|
eventInfo: {
|
69
|
-
|
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,
|
@@ -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
|
+
relatedContentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
|
127
|
+
relatedProductId: (_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
|
+
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 : ''
|
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
|
+
relatedContentId: (_b = (_a = item.video) === null || _a === void 0 ? void 0 : _a.itemId) !== null && _b !== void 0 ? _b : '',
|
265
|
+
relatedProductId: (_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
|
+
relatedContentId: (_f = (_e = item.video) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : '',
|
277
|
+
relatedProductId: (_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 + '', relatedContentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', relatedProductId: 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
|
+
relatedContentId: (_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
|
+
relatedCtatId: (_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
|
+
relatedContentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
64
|
+
relatedCtatId: 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/lib/index.d.ts
CHANGED
@@ -2,7 +2,6 @@ import { Pagebuilder } from './core/Pagebuilder';
|
|
2
2
|
export * as core from './core';
|
3
3
|
export * as materials from './materials';
|
4
4
|
export { default as SxpPageRender } from './core/components/SxpPageRender';
|
5
|
-
export { default as DiyPortalPreview } from './core/components/DiyPortalPreview';
|
6
5
|
export { default as Modal } from './core/components/SxpPageRender/Modal';
|
7
6
|
export { default as SxpDataSourceProvider } from './core/context/SxpDataSourceProvider';
|
8
7
|
export { default as SxpPageCore } from './core/components/SxpPageCore';
|
package/lib/index.js
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.defaultSetting = exports.useEditorDataProvider = exports.EditorDataProvider = exports.SxpPageCore = exports.SxpDataSourceProvider = exports.Modal = exports.
|
3
|
+
exports.defaultSetting = exports.useEditorDataProvider = exports.EditorDataProvider = exports.SxpPageCore = exports.SxpDataSourceProvider = exports.Modal = exports.SxpPageRender = exports.materials = exports.core = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const Pagebuilder_1 = require("./core/Pagebuilder");
|
6
6
|
exports.core = tslib_1.__importStar(require("./core"));
|
7
7
|
exports.materials = tslib_1.__importStar(require("./materials"));
|
8
8
|
var SxpPageRender_1 = require("./core/components/SxpPageRender");
|
9
9
|
Object.defineProperty(exports, "SxpPageRender", { enumerable: true, get: function () { return tslib_1.__importDefault(SxpPageRender_1).default; } });
|
10
|
-
var DiyPortalPreview_1 = require("./core/components/DiyPortalPreview");
|
11
|
-
Object.defineProperty(exports, "DiyPortalPreview", { enumerable: true, get: function () { return tslib_1.__importDefault(DiyPortalPreview_1).default; } });
|
12
10
|
var Modal_1 = require("./core/components/SxpPageRender/Modal");
|
13
11
|
Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return tslib_1.__importDefault(Modal_1).default; } });
|
14
12
|
var SxpDataSourceProvider_1 = require("./core/context/SxpDataSourceProvider");
|
@@ -12,7 +12,7 @@ const Modal_1 = tslib_1.__importDefault(require("../../../../core/components/Sxp
|
|
12
12
|
const ExpandableText_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/ExpandableText"));
|
13
13
|
const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
|
14
14
|
const CommodityDetail = (_a) => {
|
15
|
-
var _b, _c, _d, _e, _f, _g, _h, _j
|
15
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
16
16
|
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index } = _a, props = tslib_1.__rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index"]);
|
17
17
|
const { sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
18
18
|
const { popupDetailData, bffEventReport, isPreview, waterFallData } = (0, hooks_1.useSxpDataSource)();
|
@@ -53,7 +53,7 @@ const CommodityDetail = (_a) => {
|
|
53
53
|
return '$7,000';
|
54
54
|
}
|
55
55
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
56
|
-
const width = isPreview ? 375 :
|
56
|
+
const width = isPreview ? 375 : window.innerWidth;
|
57
57
|
const renderContent = ({ isPost }) => {
|
58
58
|
var _a, _b, _c;
|
59
59
|
return (react_1.default.createElement("div", null,
|
@@ -73,7 +73,7 @@ const CommodityDetail = (_a) => {
|
|
73
73
|
};
|
74
74
|
return (react_1.default.createElement("div", { className: 'pb-commondity' },
|
75
75
|
react_1.default.createElement("div", Object.assign({ className: (0, css_1.css)(Object.assign({}, style)) }, props),
|
76
|
-
product && ((
|
76
|
+
product && ((_f = product === null || product === void 0 ? void 0 : product.homePage) === null || _f === void 0 ? void 0 : _f.length) > 0 && (react_1.default.createElement(react_2.Swiper, { height: width, modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
|
77
77
|
clickable: true,
|
78
78
|
bulletActiveClass: 'swipe-item-active-bullet',
|
79
79
|
clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
|
@@ -81,7 +81,7 @@ const CommodityDetail = (_a) => {
|
|
81
81
|
: 'commondityDetail-swiper-clickable-center'
|
82
82
|
}, loop: true, autoplay: {
|
83
83
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
84
|
-
} }, (
|
84
|
+
} }, (_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.map((src) => {
|
85
85
|
return (react_1.default.createElement(react_2.SwiperSlide, { key: src },
|
86
86
|
react_1.default.createElement("div", { style: {
|
87
87
|
overflow: 'hidden',
|
@@ -90,7 +90,7 @@ const CommodityDetail = (_a) => {
|
|
90
90
|
} },
|
91
91
|
react_1.default.createElement(FormatImage_1.default, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
92
92
|
}))),
|
93
|
-
!((
|
93
|
+
!((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (react_1.default.createElement("div", { className: (0, css_1.css)({
|
94
94
|
position: 'relative',
|
95
95
|
height: 0,
|
96
96
|
width: '100%',
|
@@ -103,7 +103,7 @@ const CommodityDetail = (_a) => {
|
|
103
103
|
top: 0,
|
104
104
|
objectFit: 'cover',
|
105
105
|
width: '100%'
|
106
|
-
}), src: (
|
106
|
+
}), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
|
107
107
|
react_1.default.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
|
108
108
|
renderBtn(),
|
109
109
|
react_1.default.createElement(Modal_1.default, { visible: showModal, onClose: () => setShowModal(false) },
|
@@ -12,7 +12,7 @@ const ExpandableText_1 = tslib_1.__importDefault(require("../../../../core/compo
|
|
12
12
|
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
13
13
|
const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
|
14
14
|
const CommodityDetailDiroNew = (_a) => {
|
15
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
15
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
16
16
|
var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index } = _a, props = tslib_1.__rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index"]);
|
17
17
|
const [spread, setSpread] = (0, react_1.useState)(true);
|
18
18
|
const { sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
@@ -60,7 +60,7 @@ const CommodityDetailDiroNew = (_a) => {
|
|
60
60
|
return '£102,300.00';
|
61
61
|
}
|
62
62
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
63
|
-
const width = isPreview ? 375 :
|
63
|
+
const width = isPreview ? 375 : window.innerWidth;
|
64
64
|
const handleClickCollapse = () => {
|
65
65
|
setSpread(!spread);
|
66
66
|
};
|
@@ -91,7 +91,7 @@ Made in Italy` })));
|
|
91
91
|
};
|
92
92
|
return (react_1.default.createElement("div", { className: 'pb-commondityDiroNew' },
|
93
93
|
react_1.default.createElement("div", Object.assign({ ref: scrollRef, className: (0, css_1.css)(Object.assign({}, style)) }, props),
|
94
|
-
product && ((
|
94
|
+
product && ((_f = product === null || product === void 0 ? void 0 : product.homePage) === null || _f === void 0 ? void 0 : _f.length) > 0 && (react_1.default.createElement(react_2.Swiper, { height: width, modules: [modules_1.Pagination, modules_1.Autoplay], pagination: {
|
95
95
|
clickable: true,
|
96
96
|
bulletActiveClass: 'commondityDiroNew-swipe-item-active-bullet',
|
97
97
|
clickableClass: (swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign) === 'left'
|
@@ -99,7 +99,7 @@ Made in Italy` })));
|
|
99
99
|
: 'commondityDiroNew-swiper-clickable-center'
|
100
100
|
}, loop: true, autoplay: {
|
101
101
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
102
|
-
} }, (
|
102
|
+
} }, (_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.map((src) => {
|
103
103
|
return (react_1.default.createElement(react_2.SwiperSlide, { key: src },
|
104
104
|
react_1.default.createElement("div", { style: {
|
105
105
|
overflow: 'hidden',
|
@@ -108,7 +108,7 @@ Made in Italy` })));
|
|
108
108
|
} },
|
109
109
|
react_1.default.createElement(FormatImage_1.default, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
110
110
|
}))),
|
111
|
-
!((
|
111
|
+
!((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (react_1.default.createElement("div", { className: (0, css_1.css)({
|
112
112
|
position: 'relative',
|
113
113
|
height: 0,
|
114
114
|
width: '100%',
|
@@ -121,16 +121,16 @@ Made in Italy` })));
|
|
121
121
|
top: 0,
|
122
122
|
objectFit: 'cover',
|
123
123
|
width: '100%'
|
124
|
-
}), src: (
|
124
|
+
}), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
|
125
125
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content' },
|
126
126
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
|
127
127
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
|
128
|
-
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (
|
128
|
+
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-left-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_k = product === null || product === void 0 ? void 0 : product.title) !== null && _k !== void 0 ? _k : 'Large Dior Toujours Bag'),
|
129
129
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage Calfskin')),
|
130
130
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
|
131
131
|
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
|
132
|
-
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo }, (
|
133
|
-
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (react_1.default.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (
|
132
|
+
react_1.default.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo }, (_l = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _l !== void 0 ? _l : '税费'))),
|
133
|
+
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (react_1.default.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (_m = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _m !== void 0 ? _m : 'Shop now')),
|
134
134
|
productInfoText({ isPost }))),
|
135
135
|
react_1.default.createElement(Modal_1.default, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
|
136
136
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "pb-sxp-ui",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.39",
|
4
4
|
"description": "React enterprise-class UI components",
|
5
5
|
"main": "dist/index.cjs",
|
6
6
|
"module": "dist/index.js",
|
@@ -42,7 +42,6 @@
|
|
42
42
|
"antd": "^5.15.3",
|
43
43
|
"eslint": "^8.48.0",
|
44
44
|
"eventemitter3": "^5.0.1",
|
45
|
-
"hls.js": "^1.5.8",
|
46
45
|
"less": "^4.2.0",
|
47
46
|
"lodash": "^4.17.21",
|
48
47
|
"pako": "^2.1.0",
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { RecItemType } from '../SxpPageRender/typing';
|
3
|
-
import { postConfigType } from '../SxpPageRender';
|
4
|
-
interface IPictureGroupProps {
|
5
|
-
imgUrls?: string[];
|
6
|
-
width: number;
|
7
|
-
height: number;
|
8
|
-
rec: RecItemType;
|
9
|
-
index: number;
|
10
|
-
imgUrlsPostConfig?: postConfigType;
|
11
|
-
}
|
12
|
-
declare const _default: React.NamedExoticComponent<IPictureGroupProps>;
|
13
|
-
export default _default;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import React, { memo } from 'react';
|
2
|
-
import { Autoplay, Pagination } from 'swiper/modules';
|
3
|
-
import { Swiper, SwiperSlide } from 'swiper/react';
|
4
|
-
import Picture from '../SxpPageRender/PictureGroup/Picture';
|
5
|
-
const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index }) => {
|
6
|
-
return (React.createElement(Swiper, { defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, style: { width }, loop: true, autoplay: false }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
|
7
|
-
return (React.createElement(SwiperSlide, { key: url },
|
8
|
-
React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
|
9
|
-
})));
|
10
|
-
};
|
11
|
-
export default memo(PictureGroup);
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { RecItemType } from '../SxpPageRender/typing';
|
3
|
-
import { postConfigType } from '../SxpPageRender';
|
4
|
-
interface IVideoWidgetProps {
|
5
|
-
rec: RecItemType;
|
6
|
-
index: number;
|
7
|
-
height: number;
|
8
|
-
width: number;
|
9
|
-
data: RecItemType[];
|
10
|
-
muted: boolean;
|
11
|
-
activeIndex?: number;
|
12
|
-
videoPostConfig?: postConfigType;
|
13
|
-
}
|
14
|
-
declare const _default: React.NamedExoticComponent<IVideoWidgetProps>;
|
15
|
-
export default _default;
|