pb-sxp-ui 1.16.5 → 1.16.6
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 +162 -126
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +162 -126
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +162 -126
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/DiyPortalPreview/VideoWidget.js +10 -8
- package/es/core/components/SxpPageRender/LikeButton/index.js +17 -15
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +5 -0
- package/es/core/components/SxpPageRender/PictureGroup/index.js +42 -13
- package/es/core/components/SxpPageRender/VideoWidget/index.js +34 -44
- package/es/core/components/SxpPageRender/WaterFall/index.js +4 -3
- package/es/core/components/SxpPageRender/index.js +46 -35
- package/es/core/context/SxpDataSourceProvider.js +2 -2
- package/es/core/hooks/useEventReport.js +6 -5
- package/lib/core/components/DiyPortalPreview/VideoWidget.js +10 -8
- package/lib/core/components/SxpPageRender/LikeButton/index.js +17 -15
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +5 -0
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +41 -12
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +34 -44
- package/lib/core/components/SxpPageRender/WaterFall/index.js +4 -3
- package/lib/core/components/SxpPageRender/index.js +46 -35
- package/lib/core/context/SxpDataSourceProvider.js +2 -2
- package/lib/core/hooks/useEventReport.js +6 -5
- package/package.json +1 -1
@@ -42,6 +42,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
42
42
|
const skipLinkRef = useRef(false);
|
43
43
|
const [pageNum, setPageNum] = useState(2);
|
44
44
|
const videoWidgetRef = useRef(null);
|
45
|
+
const pictureGroupRef = useRef(null);
|
45
46
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel, refreshFeSession, isDiyH5 } = useSxpDataSource();
|
46
47
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
47
48
|
const isShowFingerTip = useMemo(() => {
|
@@ -89,7 +90,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
89
90
|
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
90
91
|
}, [data, ctaType, swiperRef]);
|
91
92
|
const handleSessionCompleted = useCallback((fk) => {
|
92
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
93
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
93
94
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
94
95
|
let fromKName = '';
|
95
96
|
if (popupDetailData && (((_b = (_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
@@ -116,12 +117,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
116
117
|
eventSubject: 'sessionCompleted',
|
117
118
|
eventDescription: 'Session completed',
|
118
119
|
contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
|
119
|
-
|
120
|
+
sceneId: (_q = (_p = (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.scene) === null || _p === void 0 ? void 0 : _p.sceneId) !== null && _q !== void 0 ? _q : '',
|
121
|
+
productId: (_r = item === null || item === void 0 ? void 0 : item.product) === null || _r === void 0 ? void 0 : _r.itemId,
|
120
122
|
position: activeIndex + '',
|
121
123
|
fromKName: fk || fromKName,
|
122
124
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
123
|
-
ctatId: (
|
124
|
-
traceInfo: (
|
125
|
+
ctatId: (_u = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.bindCta) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '',
|
126
|
+
traceInfo: (_y = (_w = (_v = item === null || item === void 0 ? void 0 : item.video) === null || _v === void 0 ? void 0 : _v.traceInfo) !== null && _w !== void 0 ? _w : (_x = item === null || item === void 0 ? void 0 : item.product) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : ''
|
125
127
|
}
|
126
128
|
});
|
127
129
|
}, [data, bffEventReport, activeIndex, popupDetailData, tempMap, isFromHashtag, curTime]);
|
@@ -177,8 +179,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
177
179
|
refreshFeSession
|
178
180
|
]);
|
179
181
|
const handleSessionExpire = useCallback(debounce(() => {
|
180
|
-
var _a;
|
182
|
+
var _a, _b;
|
181
183
|
(_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
|
184
|
+
(_b = pictureGroupRef.current) === null || _b === void 0 ? void 0 : _b.setLoopPlay(false);
|
182
185
|
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
|
183
186
|
}, 1000), [handleSessionCompleted, refreshFeSession]);
|
184
187
|
useEffect(() => {
|
@@ -248,18 +251,18 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
248
251
|
return null;
|
249
252
|
}, [globalConfig, activeIndex, visList]);
|
250
253
|
const renderContent = useCallback((rec, index) => {
|
251
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
254
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
252
255
|
if (rec === 'organic menu') {
|
253
256
|
return (React.createElement(MultiPosts, Object.assign({ recData: data === null || data === void 0 ? void 0 : data[1] }, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props, (_f = (_e = (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.item) === null || _f === void 0 ? void 0 : _f.event)));
|
254
257
|
}
|
255
|
-
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null ||
|
258
|
+
if (((_h = (_g = rec.video) === null || _g === void 0 ? void 0 : _g.scene) === null || _h === void 0 ? void 0 : _h.mediaUrl) || ((_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.url)) {
|
256
259
|
return (React.createElement(VideoWidget, Object.assign({ key: isReload }, (activeIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, loopPlay: true, swiperRef: swiperRef })));
|
257
260
|
}
|
258
|
-
if ((
|
259
|
-
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, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
|
261
|
+
if ((_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.imgUrls) {
|
262
|
+
return (React.createElement(PictureGroup, Object.assign({ data: data }, (activeIndex === index && { ref: pictureGroupRef }), { 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, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost, swiperRef: swiperRef })));
|
260
263
|
}
|
261
|
-
if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((
|
262
|
-
return (
|
264
|
+
if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((_l = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _l === void 0 ? void 0 : _l.length) > 0) {
|
265
|
+
return (_m = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _m === void 0 ? void 0 : _m.map((value, idx) => {
|
263
266
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
264
267
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
265
268
|
const Component = withBindDataSource(t);
|
@@ -297,7 +300,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
297
300
|
};
|
298
301
|
}, [isShowMore]);
|
299
302
|
const renderBottom = useCallback((rec, index) => {
|
300
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
303
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
301
304
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
302
305
|
let cta = null;
|
303
306
|
if ((_b = (_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) {
|
@@ -306,22 +309,25 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
306
309
|
else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProduct) {
|
307
310
|
cta = '商品CTA';
|
308
311
|
}
|
312
|
+
else if (tempMap && ((_d = Object.keys(tempMap)) === null || _d === void 0 ? void 0 : _d.includes('服务CTA')) && ((_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.bindCta) === null || _f === void 0 ? void 0 : _f.itemId)) {
|
313
|
+
cta = '服务CTA';
|
314
|
+
}
|
309
315
|
else {
|
310
|
-
cta = (
|
316
|
+
cta = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.bindCta) === null || _h === void 0 ? void 0 : _h.itemId;
|
311
317
|
}
|
312
318
|
const value = tempMap === null || tempMap === void 0 ? void 0 : tempMap[cta];
|
313
319
|
const isNineProduct = (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.nineProductEnable) && index === ((rtcList === null || rtcList === void 0 ? void 0 : rtcList[0]) === 'organic menu' ? 2 : 1);
|
314
320
|
return (React.createElement(React.Fragment, null,
|
315
321
|
isNineProduct && (React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, isActive: index === activeIndex, value: value, isNineProduct: isNineProduct })),
|
316
|
-
((
|
317
|
-
React.createElement("div", { className: 'clc-sxp-bottom', style: { marginBottom: `${(
|
322
|
+
((_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.title) && !isShowMore && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
323
|
+
React.createElement("div", { className: 'clc-sxp-bottom', style: { marginBottom: `${(_k = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.bottomInfoDist) !== null && _k !== void 0 ? _k : 40}px` } },
|
318
324
|
React.createElement(Nudge, { nudge: nudge }),
|
319
325
|
((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowCTA)) && !isNineProduct ? (React.createElement("div", { className: 'clc-sxp-bottom-card' },
|
320
326
|
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, isActive: index === activeIndex, value: value }))) : null,
|
321
327
|
React.createElement("div", null,
|
322
|
-
React.createElement(ExpandableText, { 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: (
|
328
|
+
React.createElement(ExpandableText, { 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: (_m = (_l = rec === null || rec === void 0 ? void 0 : rec.video) === null || _l === void 0 ? void 0 : _l.title) !== null && _m !== void 0 ? _m : '', 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 }),
|
323
329
|
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLink'], isActive: index === activeIndex, value: value }),
|
324
|
-
React.createElement(Hashtag, { index: activeIndex, tags: (
|
330
|
+
React.createElement(Hashtag, { index: activeIndex, tags: (_p = (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.hashTags) !== null && _p !== void 0 ? _p : [], itemId: (_q = rec === null || rec === void 0 ? void 0 : rec.video) === null || _q === void 0 ? void 0 : _q.itemId, itemType: ((_r = rec === null || rec === void 0 ? void 0 : rec.video) === null || _r === void 0 ? void 0 : _r.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle, hashTagRightMargin: containerWidth - (hashTagRightMargin !== null && hashTagRightMargin !== void 0 ? hashTagRightMargin : 0) }))),
|
325
331
|
React.createElement(RenderCard, { rec: rec, index: index, tempMap: tempMap, resolver: resolver, includesCtaType: ['AniLinkPopup'], isActive: index === activeIndex, value: value })));
|
326
332
|
}
|
327
333
|
return null;
|
@@ -360,7 +366,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
360
366
|
return null;
|
361
367
|
}, [globalConfig, waterFallData]);
|
362
368
|
const handleViewImageStartEnd = (item) => {
|
363
|
-
var _a, _b, _c, _d, _e, _f;
|
369
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
364
370
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
|
365
371
|
const endTime = Date.now();
|
366
372
|
const duration = viewImageStartTime.current === 0 ? 0 : (endTime - viewImageStartTime.current) / 1000;
|
@@ -369,10 +375,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
369
375
|
eventSubject: 'viewImageCarouselEnd',
|
370
376
|
eventDescription: 'User end view the image carousel',
|
371
377
|
contentId: (_d = (_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
372
|
-
|
378
|
+
sceneId: (_g = (_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
379
|
+
contentName: (_h = item === null || item === void 0 ? void 0 : item.video.title) !== null && _h !== void 0 ? _h : '',
|
373
380
|
imageEndTime: `${endTime}`,
|
374
381
|
playDuration: `${duration}`,
|
375
|
-
contentTags: JSON.stringify((
|
382
|
+
contentTags: JSON.stringify((_j = item === null || item === void 0 ? void 0 : item.video.tags) !== null && _j !== void 0 ? _j : []),
|
376
383
|
position: activeIndex + '',
|
377
384
|
contentFormat: 'image',
|
378
385
|
traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo
|
@@ -381,7 +388,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
381
388
|
}
|
382
389
|
};
|
383
390
|
const handleSlideSkip = (item, position) => {
|
384
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
391
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
385
392
|
if (isPreview || waterFallData)
|
386
393
|
return;
|
387
394
|
const t = new Date() - curTime.current;
|
@@ -407,7 +414,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
407
414
|
contentTags: (product === null || product === void 0 ? void 0 : product.tags) ? JSON.stringify(product === null || product === void 0 ? void 0 : product.tags) : '',
|
408
415
|
position: position + '',
|
409
416
|
contentId: (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.itemId) !== null && _t !== void 0 ? _t : '',
|
410
|
-
|
417
|
+
sceneId: (_w = (_v = (_u = item === null || item === void 0 ? void 0 : item.video) === null || _u === void 0 ? void 0 : _u.scene) === null || _v === void 0 ? void 0 : _v.sceneId) !== null && _w !== void 0 ? _w : '',
|
418
|
+
traceInfo: (_0 = (_y = (_x = item === null || item === void 0 ? void 0 : item.video) === null || _x === void 0 ? void 0 : _x.traceInfo) !== null && _y !== void 0 ? _y : (_z = item === null || item === void 0 ? void 0 : item.product) === null || _z === void 0 ? void 0 : _z.traceInfo) !== null && _0 !== void 0 ? _0 : '',
|
411
419
|
contentFormat
|
412
420
|
}
|
413
421
|
});
|
@@ -417,7 +425,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
417
425
|
}
|
418
426
|
};
|
419
427
|
const handleScrollEvent = (swiper) => {
|
420
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
428
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
421
429
|
const item = data[swiper.previousIndex];
|
422
430
|
if (!item)
|
423
431
|
return;
|
@@ -434,11 +442,12 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
434
442
|
eventSubject: 'scrollDown',
|
435
443
|
eventDescription: 'User scroll down',
|
436
444
|
contentId: (_e = (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.itemId) !== null && _e !== void 0 ? _e : '',
|
437
|
-
|
445
|
+
sceneId: (_h = (_g = (_f = item === null || item === void 0 ? void 0 : item.video) === null || _f === void 0 ? void 0 : _f.scene) === null || _g === void 0 ? void 0 : _g.sceneId) !== null && _h !== void 0 ? _h : '',
|
446
|
+
productId: (_k = (_j = item === null || item === void 0 ? void 0 : item.product) === null || _j === void 0 ? void 0 : _j.itemId) !== null && _k !== void 0 ? _k : '',
|
438
447
|
requestId: null,
|
439
|
-
traceInfo: (
|
448
|
+
traceInfo: (_p = (_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.traceInfo) !== null && _m !== void 0 ? _m : (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.traceInfo) !== null && _p !== void 0 ? _p : '',
|
440
449
|
contentFormat,
|
441
|
-
position: ((
|
450
|
+
position: ((_q = swiper.previousIndex) !== null && _q !== void 0 ? _q : 0) + ''
|
442
451
|
}
|
443
452
|
});
|
444
453
|
handleViewImageStartEnd(item);
|
@@ -449,12 +458,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
449
458
|
eventInfo: {
|
450
459
|
eventSubject: 'scrollUp',
|
451
460
|
eventDescription: 'User scroll up',
|
452
|
-
contentId: (
|
453
|
-
|
461
|
+
contentId: (_s = (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.itemId) !== null && _s !== void 0 ? _s : '',
|
462
|
+
sceneId: (_v = (_u = (_t = item === null || item === void 0 ? void 0 : item.video) === null || _t === void 0 ? void 0 : _t.scene) === null || _u === void 0 ? void 0 : _u.sceneId) !== null && _v !== void 0 ? _v : '',
|
463
|
+
productId: (_x = (_w = item.product) === null || _w === void 0 ? void 0 : _w.itemId) !== null && _x !== void 0 ? _x : '',
|
454
464
|
requestId: null,
|
455
|
-
traceInfo: (
|
465
|
+
traceInfo: (_1 = (_z = (_y = item === null || item === void 0 ? void 0 : item.video) === null || _y === void 0 ? void 0 : _y.traceInfo) !== null && _z !== void 0 ? _z : (_0 = item === null || item === void 0 ? void 0 : item.product) === null || _0 === void 0 ? void 0 : _0.traceInfo) !== null && _1 !== void 0 ? _1 : '',
|
456
466
|
contentFormat,
|
457
|
-
position: ((
|
467
|
+
position: ((_2 = swiper.previousIndex) !== null && _2 !== void 0 ? _2 : 0) + ''
|
458
468
|
}
|
459
469
|
});
|
460
470
|
handleViewImageStartEnd(item);
|
@@ -478,7 +488,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
478
488
|
}
|
479
489
|
}, [openHashtag, data, activeIndex]);
|
480
490
|
const handleViewImageStartEvent = (activeIndex, imgInfo, enableCapi) => {
|
481
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
491
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
482
492
|
const item = data[activeIndex];
|
483
493
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
|
484
494
|
const startTime = Date.now();
|
@@ -488,9 +498,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
488
498
|
eventSubject: 'viewImageCarouselStart',
|
489
499
|
eventDescription: 'User start view the image carousel',
|
490
500
|
contentId: (_d = (_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '',
|
491
|
-
|
501
|
+
sceneId: (_g = (_f = (_e = item === null || item === void 0 ? void 0 : item.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
502
|
+
contentName: (_h = item === null || item === void 0 ? void 0 : item.video.title) !== null && _h !== void 0 ? _h : '',
|
492
503
|
imageStartTime: `${startTime}`,
|
493
|
-
contentTags: JSON.stringify((
|
504
|
+
contentTags: JSON.stringify((_j = item === null || item === void 0 ? void 0 : item.video.tags) !== null && _j !== void 0 ? _j : []),
|
494
505
|
position: activeIndex + '',
|
495
506
|
contentFormat: 'image',
|
496
507
|
traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo,
|
@@ -500,11 +511,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
500
511
|
if (enableCapi) {
|
501
512
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
502
513
|
eventName: 'ViewContent',
|
503
|
-
product: (
|
514
|
+
product: (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.bindProduct
|
504
515
|
});
|
505
516
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
506
517
|
eventName: 'PageView',
|
507
|
-
product: (
|
518
|
+
product: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.bindProduct
|
508
519
|
});
|
509
520
|
}
|
510
521
|
}
|
@@ -449,7 +449,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
449
449
|
}
|
450
450
|
}), [bffFetch, utmVal]);
|
451
451
|
const ctaEvent = useCallback((eventInfo, rec, product, position) => {
|
452
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
452
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
|
453
453
|
const cta = product === null || product === void 0 ? void 0 : product.bindCta;
|
454
454
|
const isProd = ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.bindProduct) || (((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.bindProducts) && ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.bindProducts) === null || _d === void 0 ? void 0 : _d.length) > 0);
|
455
455
|
let fromKName = '';
|
@@ -467,7 +467,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
467
467
|
}
|
468
468
|
const contentTags = (_p = (_m = (_h = product === null || product === void 0 ? void 0 : product.tags) !== null && _h !== void 0 ? _h : (_l = (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : (_o = rec === null || rec === void 0 ? void 0 : rec.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : (_q = rec === null || rec === void 0 ? void 0 : rec.product) === null || _q === void 0 ? void 0 : _q.tags;
|
469
469
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
470
|
-
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_r = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _r !== void 0 ? _r : '', ctaName: (_s = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _s !== void 0 ? _s : '', contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_u = (_t = rec === null || rec === void 0 ? void 0 : rec.video) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (
|
470
|
+
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_r = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _r !== void 0 ? _r : '', ctaName: (_s = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _s !== void 0 ? _s : '', contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_u = (_t = rec === null || rec === void 0 ? void 0 : rec.video) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '', sceneId: (_x = (_w = (_v = rec === null || rec === void 0 ? void 0 : rec.video) === null || _v === void 0 ? void 0 : _v.scene) === null || _w === void 0 ? void 0 : _w.sceneId) !== null && _x !== void 0 ? _x : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_13 = (_10 = (_5 = (_1 = (_y = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _y !== void 0 ? _y : (_0 = (_z = rec === null || rec === void 0 ? void 0 : rec.video) === null || _z === void 0 ? void 0 : _z.bindCta) === null || _0 === void 0 ? void 0 : _0.traceInfo) !== null && _1 !== void 0 ? _1 : (_4 = (_3 = (_2 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _2 === void 0 ? void 0 : _2.bindProduct) === null || _3 === void 0 ? void 0 : _3.bindCta) === null || _4 === void 0 ? void 0 : _4.traceInfo) !== null && _5 !== void 0 ? _5 : (_9 = (_8 = (_7 = (_6 = rec === null || rec === void 0 ? void 0 : rec.video) === null || _6 === void 0 ? void 0 : _6.bindProducts) === null || _7 === void 0 ? void 0 : _7[0]) === null || _8 === void 0 ? void 0 : _8.bindCta) === null || _9 === void 0 ? void 0 : _9.traceInfo) !== null && _10 !== void 0 ? _10 : (_12 = (_11 = rec === null || rec === void 0 ? void 0 : rec.product) === null || _11 === void 0 ? void 0 : _11.bindCta) === null || _12 === void 0 ? void 0 : _12.traceInfo) !== null && _13 !== void 0 ? _13 : '', fromKName, fromKPage: (_14 = location === null || location === void 0 ? void 0 : location.href) !== null && _14 !== void 0 ? _14 : '', contentFormat })
|
471
471
|
});
|
472
472
|
}, [bffEventReport, isFromHashtag]);
|
473
473
|
const h5EnterLink = useCallback(() => {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { useCallback } from 'react';
|
2
|
-
import { useSxpDataSource } from './useSxpDataSource';
|
3
2
|
import { DEFAULT_TAG } from '../context/SxpDataSourceProvider';
|
3
|
+
import { useSxpDataSource } from './useSxpDataSource';
|
4
4
|
export function useEventReport() {
|
5
5
|
const { bffEventReport, popupDetailData, isFromHashtag, eventTimeList, setEventTimeList } = useSxpDataSource();
|
6
6
|
const jumpToWeb = useCallback((e, data, product, cta, position, traceInfo) => {
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
|
8
8
|
const i = eventTimeList === null || eventTimeList === void 0 ? void 0 : eventTimeList.findIndex((item) => item.target === (e === null || e === void 0 ? void 0 : e.target));
|
9
9
|
if (i !== -1) {
|
10
10
|
return;
|
@@ -37,11 +37,11 @@ export function useEventReport() {
|
|
37
37
|
contentFormat = 'image';
|
38
38
|
}
|
39
39
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
40
|
-
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '',
|
40
|
+
eventInfo: Object.assign({ eventSubject: 'jumpToWeb', eventDescription: 'User jumped to website', productId: (_v = product === null || product === void 0 ? void 0 : product.itemId) !== null && _v !== void 0 ? _v : '', productName: (_w = product === null || product === void 0 ? void 0 : product.title) !== null && _w !== void 0 ? _w : '', price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0', productCollection: (_x = product === null || product === void 0 ? void 0 : product.collection) !== null && _x !== void 0 ? _x : '', fromKName, fromKPage: location === null || location === void 0 ? void 0 : location.href, contentTags: contentTags ? JSON.stringify(contentTags) : '', position: position + '', contentId: (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.itemId) !== null && _z !== void 0 ? _z : '', sceneId: (_2 = (_1 = (_0 = data === null || data === void 0 ? void 0 : data.video) === null || _0 === void 0 ? void 0 : _0.scene) === null || _1 === void 0 ? void 0 : _1.sceneId) !== null && _2 !== void 0 ? _2 : '', ctatId: (_3 = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _3 !== void 0 ? _3 : '', traceInfo: (_16 = (_13 = (_11 = (_7 = (_4 = traceInfo !== null && traceInfo !== void 0 ? traceInfo : product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _4 !== void 0 ? _4 : (_6 = (_5 = data === null || data === void 0 ? void 0 : data.video) === null || _5 === void 0 ? void 0 : _5.bindProduct) === null || _6 === void 0 ? void 0 : _6.traceInfo) !== null && _7 !== void 0 ? _7 : (_10 = (_9 = (_8 = data === null || data === void 0 ? void 0 : data.video) === null || _8 === void 0 ? void 0 : _8.bindProducts) === null || _9 === void 0 ? void 0 : _9[0]) === null || _10 === void 0 ? void 0 : _10.traceInfo) !== null && _11 !== void 0 ? _11 : (_12 = data === null || data === void 0 ? void 0 : data.product) === null || _12 === void 0 ? void 0 : _12.traceInfo) !== null && _13 !== void 0 ? _13 : (_15 = (_14 = data === null || data === void 0 ? void 0 : data.video) === null || _14 === void 0 ? void 0 : _14.bindCta) === null || _15 === void 0 ? void 0 : _15.traceInfo) !== null && _16 !== void 0 ? _16 : '' }, (contentFormat && { contentFormat }))
|
41
41
|
});
|
42
42
|
}, [bffEventReport, popupDetailData, isFromHashtag, eventTimeList]);
|
43
43
|
const productView = useCallback((data, product, cta, viewTime, position) => {
|
44
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
45
45
|
let fromKName = '';
|
46
46
|
if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
47
47
|
fromKName = 'pdpPage';
|
@@ -60,8 +60,9 @@ export function useEventReport() {
|
|
60
60
|
contentTags: JSON.stringify(product === null || product === void 0 ? void 0 : product.tags),
|
61
61
|
position: position + '',
|
62
62
|
contentId: (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
63
|
+
sceneId: (_g = (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.scene) === null || _f === void 0 ? void 0 : _f.sceneId) !== null && _g !== void 0 ? _g : '',
|
63
64
|
ctatId: cta === null || cta === void 0 ? void 0 : cta.itemId,
|
64
|
-
traceInfo: (
|
65
|
+
traceInfo: (_s = (_q = (_l = (_h = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _h !== void 0 ? _h : (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProduct) === null || _k === void 0 ? void 0 : _k.traceInfo) !== null && _l !== void 0 ? _l : (_p = (_o = (_m = data === null || data === void 0 ? void 0 : data.video) === null || _m === void 0 ? void 0 : _m.bindProducts) === null || _o === void 0 ? void 0 : _o[0]) === null || _p === void 0 ? void 0 : _p.traceInfo) !== null && _q !== void 0 ? _q : (_r = data === null || data === void 0 ? void 0 : data.product) === null || _r === void 0 ? void 0 : _r.traceInfo) !== null && _s !== void 0 ? _s : '',
|
65
66
|
timeOnSite: Math.floor((new Date() - viewTime) / 1000) + '',
|
66
67
|
eventSubject: 'productView',
|
67
68
|
eventDescription: 'User browsed the product'
|
@@ -25,7 +25,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
25
25
|
}, []);
|
26
26
|
const PAUSE_ICON = (0, useIconLink_1.useIconLink)('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
27
27
|
const handlePlaying = (0, react_1.useCallback)(() => {
|
28
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
29
29
|
setIsPauseVideo(false);
|
30
30
|
const item = data[index];
|
31
31
|
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
@@ -38,14 +38,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
38
38
|
eventSubject: 'playVideo',
|
39
39
|
eventDescription: 'User played the video',
|
40
40
|
contentId: (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
41
|
-
|
41
|
+
sceneId: (_l = (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.scene) === null || _k === void 0 ? void 0 : _k.sceneId) !== null && _l !== void 0 ? _l : '',
|
42
|
+
contentName: (_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.title) !== null && _o !== void 0 ? _o : '',
|
42
43
|
playType,
|
43
44
|
startTime: videoCurrentTime,
|
44
45
|
videoDuration,
|
45
|
-
contentTags: JSON.stringify((
|
46
|
+
contentTags: JSON.stringify((_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.tags) !== null && _q !== void 0 ? _q : []),
|
46
47
|
position: index + '',
|
47
48
|
contentFormat: 'video',
|
48
|
-
traceInfo: (
|
49
|
+
traceInfo: (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo
|
49
50
|
}
|
50
51
|
});
|
51
52
|
setIsFirstPlay(false);
|
@@ -84,7 +85,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
84
85
|
}
|
85
86
|
}, [isLoadFinish]);
|
86
87
|
const onPause = (0, react_1.useCallback)(() => {
|
87
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
88
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
88
89
|
const item = data[index];
|
89
90
|
const videoDuration = ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
90
91
|
const videoCurrentTime = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
@@ -95,14 +96,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
|
|
95
96
|
eventSubject: 'playOverVideo',
|
96
97
|
eventDescription: 'User finished playing the video',
|
97
98
|
contentId: (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
98
|
-
|
99
|
+
sceneId: (_l = (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.scene) === null || _k === void 0 ? void 0 : _k.sceneId) !== null && _l !== void 0 ? _l : '',
|
100
|
+
contentName: (_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.title) !== null && _o !== void 0 ? _o : '',
|
99
101
|
endTime: videoCurrentTime,
|
100
102
|
videoDuration,
|
101
103
|
playDuration,
|
102
|
-
contentTags: JSON.stringify((
|
104
|
+
contentTags: JSON.stringify((_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.tags) !== null && _q !== void 0 ? _q : []),
|
103
105
|
position: index + '',
|
104
106
|
contentFormat: 'video',
|
105
|
-
traceInfo: (
|
107
|
+
traceInfo: (_r = item === null || item === void 0 ? void 0 : item.video) === null || _r === void 0 ? void 0 : _r.traceInfo
|
106
108
|
}
|
107
109
|
});
|
108
110
|
}
|
@@ -15,7 +15,7 @@ const LikeButton = (_a) => {
|
|
15
15
|
const likeIcon = (0, useIconLink_1.useIconLink)(defaultLikeIconPath);
|
16
16
|
const unlikeIcon = (0, useIconLink_1.useIconLink)(defaultUnLikeIconPath);
|
17
17
|
const handleClick = (0, lodash_1.debounce)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
18
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
18
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
19
19
|
if (state) {
|
20
20
|
setState(false);
|
21
21
|
const result = (_e = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({ videoItemId: (_d = (_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '' })))) !== null && _e !== void 0 ? _e : false;
|
@@ -24,51 +24,53 @@ const LikeButton = (_a) => {
|
|
24
24
|
eventSubject: 'favoriteContentCanceled',
|
25
25
|
eventDescription: 'This content was unfavorite by the user',
|
26
26
|
contentId: (_g = (_f = recData === null || recData === void 0 ? void 0 : recData.video) === null || _f === void 0 ? void 0 : _f.itemId) !== null && _g !== void 0 ? _g : '',
|
27
|
-
|
28
|
-
|
27
|
+
sceneId: (_k = (_j = (_h = recData === null || recData === void 0 ? void 0 : recData.video) === null || _h === void 0 ? void 0 : _h.scene) === null || _j === void 0 ? void 0 : _j.sceneId) !== null && _k !== void 0 ? _k : '',
|
28
|
+
contentName: (_m = (_l = recData === null || recData === void 0 ? void 0 : recData.video) === null || _l === void 0 ? void 0 : _l.title) !== null && _m !== void 0 ? _m : '',
|
29
|
+
contentTags: JSON.stringify((_p = (_o = recData === null || recData === void 0 ? void 0 : recData.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : []),
|
29
30
|
position: position + '',
|
30
|
-
contentFormat: ((
|
31
|
-
traceInfo: (
|
31
|
+
contentFormat: ((_q = recData === null || recData === void 0 ? void 0 : recData.video) === null || _q === void 0 ? void 0 : _q.url) ? 'video' : 'image',
|
32
|
+
traceInfo: (_r = recData === null || recData === void 0 ? void 0 : recData.video) === null || _r === void 0 ? void 0 : _r.traceInfo
|
32
33
|
}
|
33
34
|
});
|
34
35
|
if (!result) {
|
35
36
|
setState(true);
|
36
37
|
}
|
37
38
|
else {
|
38
|
-
const nRtcList = (
|
39
|
+
const nRtcList = (_s = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
39
40
|
if (index === position) {
|
40
41
|
item.isCollected = false;
|
41
42
|
}
|
42
43
|
return item;
|
43
|
-
})) !== null &&
|
44
|
+
})) !== null && _s !== void 0 ? _s : [];
|
44
45
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
45
46
|
}
|
46
47
|
}
|
47
48
|
else {
|
48
49
|
setState(true);
|
49
|
-
const result = (
|
50
|
+
const result = (_t = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _t !== void 0 ? _t : false;
|
50
51
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
51
52
|
eventInfo: {
|
52
53
|
eventSubject: 'favoriteContent',
|
53
54
|
eventDescription: 'This content was favorite by the user',
|
54
|
-
contentId: (
|
55
|
-
|
56
|
-
|
55
|
+
contentId: (_v = (_u = recData === null || recData === void 0 ? void 0 : recData.video) === null || _u === void 0 ? void 0 : _u.itemId) !== null && _v !== void 0 ? _v : '',
|
56
|
+
sceneId: (_y = (_x = (_w = recData === null || recData === void 0 ? void 0 : recData.video) === null || _w === void 0 ? void 0 : _w.scene) === null || _x === void 0 ? void 0 : _x.sceneId) !== null && _y !== void 0 ? _y : '',
|
57
|
+
contentName: (_0 = (_z = recData === null || recData === void 0 ? void 0 : recData.video) === null || _z === void 0 ? void 0 : _z.title) !== null && _0 !== void 0 ? _0 : '',
|
58
|
+
contentTags: JSON.stringify((_2 = (_1 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _1 === void 0 ? void 0 : _1.tags) !== null && _2 !== void 0 ? _2 : []),
|
57
59
|
position: position + '',
|
58
|
-
contentFormat: ((
|
59
|
-
traceInfo: (
|
60
|
+
contentFormat: ((_3 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _3 === void 0 ? void 0 : _3.url) ? 'video' : 'image',
|
61
|
+
traceInfo: (_4 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _4 === void 0 ? void 0 : _4.traceInfo
|
60
62
|
}
|
61
63
|
});
|
62
64
|
if (!result) {
|
63
65
|
setState(false);
|
64
66
|
}
|
65
67
|
else {
|
66
|
-
const nRtcList = (
|
68
|
+
const nRtcList = (_5 = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
67
69
|
if (index === position) {
|
68
70
|
item.isCollected = true;
|
69
71
|
}
|
70
72
|
return item;
|
71
|
-
})) !== null &&
|
73
|
+
})) !== null && _5 !== void 0 ? _5 : [];
|
72
74
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
73
75
|
}
|
74
76
|
}
|
@@ -12,6 +12,11 @@ interface IPictureGroupProps {
|
|
12
12
|
loadTime: string;
|
13
13
|
}, enableCapi?: boolean) => void;
|
14
14
|
imgUrlsPostConfig?: postConfigType;
|
15
|
+
data: RecItemType[];
|
16
|
+
swiperRef?: any;
|
17
|
+
}
|
18
|
+
export interface IPictureGroupRef {
|
19
|
+
setLoopPlay: (v: boolean) => void;
|
15
20
|
}
|
16
21
|
declare const _default: React.NamedExoticComponent<IPictureGroupProps>;
|
17
22
|
export default _default;
|
@@ -4,24 +4,53 @@ const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
5
5
|
const modules_1 = require("swiper/modules");
|
6
6
|
const react_2 = require("swiper/react");
|
7
|
+
const css_1 = require("@emotion/css");
|
7
8
|
const Picture_1 = tslib_1.__importDefault(require("./Picture"));
|
8
9
|
const hooks_1 = require("../../../../core/hooks");
|
9
|
-
const css_1 = require("@emotion/css");
|
10
10
|
const event_1 = tslib_1.__importStar(require("../../../../core/utils/event"));
|
11
11
|
const tool_1 = require("../../../../core/utils/tool");
|
12
|
-
const PictureGroup = ({ imgUrls,
|
12
|
+
const PictureGroup = (0, react_1.forwardRef)(({ imgUrls, data, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig, swiperRef }, ref) => {
|
13
13
|
var _a, _b;
|
14
14
|
const { isActive } = (0, react_2.useSwiperSlide)();
|
15
|
-
const { sxpParameter, openHashtag } = (0, hooks_1.useSxpDataSource)();
|
15
|
+
const { sxpParameter, openHashtag, isDiyH5 } = (0, hooks_1.useSxpDataSource)();
|
16
16
|
const [isLoad, setIsLoad] = (0, react_1.useState)(false);
|
17
17
|
const [imgInfo, setImgInfo] = (0, react_1.useState)();
|
18
18
|
const [swiperActiveIndex, setSwiperActiveIndex] = (0, react_1.useState)(0);
|
19
|
-
const
|
19
|
+
const imgsSwiperRef = (0, react_1.useRef)();
|
20
20
|
const isFirstPlayRef = (0, react_1.useRef)(true);
|
21
|
+
const loopPlayRef = (0, react_1.useRef)(true);
|
21
22
|
const initTime = new Date();
|
23
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
24
|
+
return {
|
25
|
+
setLoopPlay(v) {
|
26
|
+
loopPlayRef.current = v;
|
27
|
+
}
|
28
|
+
};
|
29
|
+
});
|
30
|
+
(0, react_1.useEffect)(() => {
|
31
|
+
let timerId;
|
32
|
+
if (isLoad && isActive && isDiyH5) {
|
33
|
+
timerId = setTimeout(() => {
|
34
|
+
var _a, _b, _c, _d, _e, _f;
|
35
|
+
if (!loopPlayRef.current)
|
36
|
+
return;
|
37
|
+
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
38
|
+
(_b = (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(0);
|
39
|
+
}
|
40
|
+
else {
|
41
|
+
const i = (_d = (_c = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _c === void 0 ? void 0 : _c.swiper) === null || _d === void 0 ? void 0 : _d.activeIndex;
|
42
|
+
(_f = (_e = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _e === void 0 ? void 0 : _e.swiper) === null || _f === void 0 ? void 0 : _f.slideTo(i + 1);
|
43
|
+
}
|
44
|
+
}, 3000);
|
45
|
+
}
|
46
|
+
return () => {
|
47
|
+
if (timerId)
|
48
|
+
clearTimeout(timerId);
|
49
|
+
};
|
50
|
+
}, [isLoad, isActive, isDiyH5, data, index, swiperRef]);
|
22
51
|
(0, react_1.useEffect)(() => {
|
23
52
|
if (isLoad && isActive) {
|
24
|
-
(
|
53
|
+
(imgsSwiperRef === null || imgsSwiperRef === void 0 ? void 0 : imgsSwiperRef.current) && imgsSwiperRef.current.swiper.autoplay.start();
|
25
54
|
if (openHashtag) {
|
26
55
|
onViewImageEndEvent(rec);
|
27
56
|
}
|
@@ -31,7 +60,7 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent,
|
|
31
60
|
}
|
32
61
|
}
|
33
62
|
else {
|
34
|
-
(
|
63
|
+
(imgsSwiperRef === null || imgsSwiperRef === void 0 ? void 0 : imgsSwiperRef.current) && imgsSwiperRef.current.swiper.autoplay.stop();
|
35
64
|
}
|
36
65
|
}, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
|
37
66
|
const showFirstImageFn = (0, react_1.useCallback)((e) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
@@ -55,13 +84,13 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent,
|
|
55
84
|
};
|
56
85
|
}, [isActive, imgInfo]);
|
57
86
|
const handleMouseEnter = (0, react_1.useCallback)(() => {
|
58
|
-
if (
|
59
|
-
|
87
|
+
if (imgsSwiperRef.current && imgsSwiperRef.current.swiper && isAlly) {
|
88
|
+
imgsSwiperRef.current.swiper.autoplay.stop();
|
60
89
|
}
|
61
90
|
}, []);
|
62
91
|
const handleMouseLeave = (0, react_1.useCallback)(() => {
|
63
|
-
if (
|
64
|
-
|
92
|
+
if (imgsSwiperRef.current && imgsSwiperRef.current.swiper && isAlly) {
|
93
|
+
imgsSwiperRef.current.swiper.autoplay.start();
|
65
94
|
}
|
66
95
|
}, []);
|
67
96
|
const handleSlideChange = (0, react_1.useCallback)((swiper) => {
|
@@ -82,7 +111,7 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent,
|
|
82
111
|
enabled: true
|
83
112
|
}
|
84
113
|
}
|
85
|
-
: {}), { loop: true, ref:
|
114
|
+
: {}), { loop: true, ref: imgsSwiperRef, onSlideChange: handleSlideChange, className: (0, css_1.css)(Object.assign(Object.assign({ '.swiper-pagination': {
|
86
115
|
bottom: (_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.marginBottom) !== null && _a !== void 0 ? _a : 0,
|
87
116
|
fontSize: '14px'
|
88
117
|
} }, ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor) && {
|
@@ -99,5 +128,5 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent,
|
|
99
128
|
return (react_1.default.createElement(react_2.SwiperSlide, { key: srcKey, "aria-hidden": srcKey !== swiperActiveIndex },
|
100
129
|
react_1.default.createElement(Picture_1.default, { src: !isLoad && srcKey > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
|
101
130
|
}))));
|
102
|
-
};
|
131
|
+
});
|
103
132
|
exports.default = (0, react_1.memo)(PictureGroup);
|