pb-sxp-ui 1.11.0 → 1.12.0
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 +91 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +91 -81
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +5 -5
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +5 -5
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +91 -81
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +5 -5
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/PictureGroup/index.js +5 -3
- package/es/core/components/SxpPageRender/VideoWidget/index.js +5 -18
- package/es/core/components/SxpPageRender/index.js +59 -37
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/es/core/context/SxpDataSourceProvider.js +22 -23
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +5 -3
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +5 -18
- package/lib/core/components/SxpPageRender/index.js +58 -36
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/lib/core/context/SxpDataSourceProvider.js +22 -23
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -666,7 +666,6 @@
|
|
666
666
|
const themeTag = React.useRef();
|
667
667
|
const curTime = React.useRef();
|
668
668
|
const multiPostTimeRef = React.useRef();
|
669
|
-
const sessionTimeRef = React.useRef();
|
670
669
|
const [selectTag, setSelectTag] = React.useState(DEFAULT_TAG);
|
671
670
|
const checkCommodityIndexRef = React.useRef(-1);
|
672
671
|
const popupCurTimeRef = React.useRef(null);
|
@@ -848,20 +847,27 @@
|
|
848
847
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
849
848
|
return data;
|
850
849
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
851
|
-
const refreshFeSession = React.useCallback(() => {
|
852
|
-
var _a, _b, _c, _d, _e
|
850
|
+
const refreshFeSession = React.useCallback((enableReSid, event) => {
|
851
|
+
var _a, _b, _c, _d, _e;
|
852
|
+
let expire = false;
|
853
853
|
const defaultGlobalConfig = (_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig;
|
854
854
|
if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
|
855
|
-
|
856
|
-
|
855
|
+
const sessionStartTime = localStorage.getItem('sessionStartTime');
|
856
|
+
const sst = sessionStartTime ? JSON.parse(sessionStartTime) : new Date().getTime();
|
857
|
+
if (Math.floor((new Date().getTime() - sst) / 1000 / 60) >=
|
858
|
+
((_e = (_d = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _d === void 0 ? void 0 : _d.expires) !== null && _e !== void 0 ? _e : 30)) {
|
859
|
+
event === null || event === void 0 ? void 0 : event('sessionTimeOut');
|
857
860
|
refreshFeSessionId();
|
861
|
+
curTime.current = new Date();
|
862
|
+
expire = true;
|
858
863
|
}
|
864
|
+
localStorage.setItem('sessionStartTime', JSON.stringify(new Date().getTime()));
|
859
865
|
}
|
860
|
-
else {
|
866
|
+
else if (enableReSid) {
|
861
867
|
refreshFeSessionId();
|
862
868
|
}
|
863
|
-
|
864
|
-
}, [data
|
869
|
+
return expire;
|
870
|
+
}, [data]);
|
865
871
|
const bffEventReport = React.useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
|
866
872
|
// 关闭 BFF 事件上报
|
867
873
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
@@ -874,7 +880,6 @@
|
|
874
880
|
// tpChannelId: 'H5' // 后端处理
|
875
881
|
};
|
876
882
|
}
|
877
|
-
refreshFeSession();
|
878
883
|
const sessionID = storeAndLoadFeSessionId();
|
879
884
|
const ef = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ sessionID, rtc: curReqInfo.rtc, requestId: curReqInfo.requestId }, { playbookType }), (layoutVariantId && reportLayId && { layoutVariantId })), eventInfo), (getDevice$1() && { sxpDevice: getDevice$1() })), (getSystem() && { sxpSystem: getSystem() })), (getBrowserInfo() && { sxpBrowser: getBrowserInfo() })), ((eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.position) && channel && { position: Number(eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.position) + 1 + '' }));
|
880
885
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
@@ -890,16 +895,7 @@
|
|
890
895
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
891
896
|
type: 'beacon'
|
892
897
|
});
|
893
|
-
}, [
|
894
|
-
bffFetch,
|
895
|
-
curReqInfo,
|
896
|
-
enableReportEvent,
|
897
|
-
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
898
|
-
layoutVariantId,
|
899
|
-
globalConfig,
|
900
|
-
playbookType,
|
901
|
-
refreshFeSession
|
902
|
-
]);
|
898
|
+
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
|
903
899
|
const bffFbReport = React.useCallback(({ eventName, product }) => {
|
904
900
|
var _a, _b, _c, _d, _e;
|
905
901
|
if (!enableReportEvent ||
|
@@ -1025,7 +1021,7 @@
|
|
1025
1021
|
});
|
1026
1022
|
}, [bffEventReport, isFromHashtag]);
|
1027
1023
|
const h5EnterLink = React.useCallback(() => {
|
1028
|
-
var _a, _b;
|
1024
|
+
var _a, _b, _c, _d, _e;
|
1029
1025
|
const queryString = location.search.slice(1);
|
1030
1026
|
const params = qs.parse(queryString.replace(/\+/g, '%2B'));
|
1031
1027
|
for (const key in params) {
|
@@ -1033,7 +1029,10 @@
|
|
1033
1029
|
}
|
1034
1030
|
const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
|
1035
1031
|
const time = new Date();
|
1036
|
-
|
1032
|
+
const defaultGlobalConfig = (_b = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig;
|
1033
|
+
if (!((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) || !(curTime === null || curTime === void 0 ? void 0 : curTime.current)) {
|
1034
|
+
curTime.current = time;
|
1035
|
+
}
|
1037
1036
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
1038
1037
|
eventInfo: {
|
1039
1038
|
eventSubject: 'h5LinkEnterFeed',
|
@@ -1045,12 +1044,12 @@
|
|
1045
1044
|
utmContent: getVal('utm_content'),
|
1046
1045
|
enterTime: Math.floor(time / 1000) + '',
|
1047
1046
|
requestId: null,
|
1048
|
-
enterUrl: (
|
1047
|
+
enterUrl: (_e = (_d = window === null || window === void 0 ? void 0 : window.location) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : '',
|
1049
1048
|
clSource: getVal('cl_source')
|
1050
1049
|
},
|
1051
1050
|
reportLayId: false
|
1052
1051
|
});
|
1053
|
-
}, [bffEventReport]);
|
1052
|
+
}, [bffEventReport, data, curTime]);
|
1054
1053
|
React.useEffect(() => {
|
1055
1054
|
if (!isShowConsent)
|
1056
1055
|
h5EnterLink();
|
@@ -17181,7 +17180,6 @@ Made in Italy` })));
|
|
17181
17180
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
|
17182
17181
|
const videoStartTime = React.useRef(0);
|
17183
17182
|
const [isLoadFinish, setIsLoadFinish] = React.useState(false);
|
17184
|
-
const [isFirstPlay, setIsFirstPlay] = React.useState(true);
|
17185
17183
|
const { isActive } = useSwiperSlide();
|
17186
17184
|
const canvasRef = React.useRef(null);
|
17187
17185
|
const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
|
@@ -17192,6 +17190,7 @@ Made in Italy` })));
|
|
17192
17190
|
const hlsRef = React.useRef(null);
|
17193
17191
|
const initTimeRef = React.useRef();
|
17194
17192
|
const loadedTimeRef = React.useRef();
|
17193
|
+
const isFirstPlayRef = React.useRef(true);
|
17195
17194
|
const blur = React.useMemo(() => {
|
17196
17195
|
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
17197
17196
|
}, [videoPostConfig]);
|
@@ -17247,26 +17246,13 @@ Made in Italy` })));
|
|
17247
17246
|
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
17248
17247
|
const videoDuration = ((_d = (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
17249
17248
|
const videoCurrentTime = ((_f = (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
17250
|
-
const playType =
|
17249
|
+
const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
|
17251
17250
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
17252
|
-
eventInfo: {
|
17253
|
-
eventSubject: 'playVideo',
|
17254
|
-
eventDescription: 'User played the video',
|
17255
|
-
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 : '',
|
17256
|
-
contentName: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
|
17257
|
-
playType,
|
17258
|
-
startTime: videoCurrentTime,
|
17259
|
-
videoDuration,
|
17260
|
-
contentTags: JSON.stringify((_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
|
17261
|
-
position: index + '',
|
17262
|
-
contentFormat: 'video',
|
17263
|
-
traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo,
|
17264
|
-
loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + ''
|
17265
|
-
}
|
17251
|
+
eventInfo: Object.assign({ eventSubject: 'playVideo', eventDescription: 'User played the video', 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 : '', contentName: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '', playType, startTime: videoCurrentTime, videoDuration, contentTags: JSON.stringify((_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []), position: index + '', contentFormat: 'video', traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo }, ((isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) && { loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + '' }))
|
17266
17252
|
});
|
17267
|
-
|
17253
|
+
isFirstPlayRef.current = false;
|
17268
17254
|
}
|
17269
|
-
}), [bffEventReport, data, index,
|
17255
|
+
}), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
17270
17256
|
const handLoadeddata = React.useCallback(() => {
|
17271
17257
|
var _a;
|
17272
17258
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
|
@@ -17625,13 +17611,14 @@ Made in Italy` })));
|
|
17625
17611
|
|
17626
17612
|
const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
|
17627
17613
|
var _a, _b;
|
17628
|
-
const swiperRef = React.useRef();
|
17629
17614
|
const { isActive } = useSwiperSlide();
|
17630
17615
|
const { sxpParameter, openHashtag } = useSxpDataSource();
|
17631
17616
|
const [isLoad, setIsLoad] = React.useState(false);
|
17632
17617
|
const [imgInfo, setImgInfo] = React.useState();
|
17633
|
-
const initTime = new Date();
|
17634
17618
|
const [swiperActiveIndex, setSwiperActiveIndex] = React.useState(0);
|
17619
|
+
const swiperRef = React.useRef();
|
17620
|
+
const isFirstPlayRef = React.useRef(true);
|
17621
|
+
const initTime = new Date();
|
17635
17622
|
React.useEffect(() => {
|
17636
17623
|
if (isLoad && isActive) {
|
17637
17624
|
(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.start();
|
@@ -17639,7 +17626,8 @@ Made in Italy` })));
|
|
17639
17626
|
onViewImageEndEvent(rec);
|
17640
17627
|
}
|
17641
17628
|
else {
|
17642
|
-
onViewImageStartEvent(index, imgInfo, true);
|
17629
|
+
onViewImageStartEvent(index, isFirstPlayRef.current ? imgInfo : undefined, true);
|
17630
|
+
isFirstPlayRef.current = false;
|
17643
17631
|
}
|
17644
17632
|
}
|
17645
17633
|
else {
|
@@ -17994,7 +17982,7 @@ Made in Italy` })));
|
|
17994
17982
|
* @Author: binruan@chatlabs.com
|
17995
17983
|
* @Date: 2024-03-20 10:27:31
|
17996
17984
|
* @LastEditors: binruan@chatlabs.com
|
17997
|
-
* @LastEditTime: 2024-12-
|
17985
|
+
* @LastEditTime: 2024-12-17 15:46:14
|
17998
17986
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
17999
17987
|
*
|
18000
17988
|
*/
|
@@ -18019,7 +18007,7 @@ Made in Italy` })));
|
|
18019
18007
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
18020
18008
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
18021
18009
|
React.useEffect(() => {
|
18022
|
-
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
|
18010
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true);
|
18023
18011
|
}, []);
|
18024
18012
|
React.useEffect(() => {
|
18025
18013
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
@@ -18054,10 +18042,46 @@ Made in Italy` })));
|
|
18054
18042
|
if (index !== -1)
|
18055
18043
|
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
18056
18044
|
}, [data, ctaType, swiperRef]);
|
18045
|
+
const handleSessionCompleted = React.useCallback((fk) => {
|
18046
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
18047
|
+
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
18048
|
+
let fromKName = '';
|
18049
|
+
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))) {
|
18050
|
+
fromKName = 'pdpPage';
|
18051
|
+
}
|
18052
|
+
else if (popupDetailData && ((_g = tempMap === null || tempMap === void 0 ? void 0 : tempMap[(_f = (_e = (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.bindCta) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : ''].item) === null || _g === void 0 ? void 0 : _g.type) === 'Appoint') {
|
18053
|
+
fromKName = 'formPage';
|
18054
|
+
}
|
18055
|
+
else if (isFromHashtag) {
|
18056
|
+
fromKName = 'hashTagPage';
|
18057
|
+
}
|
18058
|
+
else if ((_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.url) {
|
18059
|
+
fromKName = 'videoPage';
|
18060
|
+
}
|
18061
|
+
else if (((_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.imgUrls) && ((_l = (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.imgUrls) === null || _l === void 0 ? void 0 : _l.length)) {
|
18062
|
+
fromKName = 'imagePage';
|
18063
|
+
}
|
18064
|
+
else if (item === null || item === void 0 ? void 0 : item.product) {
|
18065
|
+
fromKName = 'productPage';
|
18066
|
+
}
|
18067
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
18068
|
+
eventInfo: {
|
18069
|
+
sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
|
18070
|
+
eventSubject: 'sessionCompleted',
|
18071
|
+
eventDescription: 'Session completed',
|
18072
|
+
contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
|
18073
|
+
productId: (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.itemId,
|
18074
|
+
position: activeIndex + '',
|
18075
|
+
fromKName: fk ? fk : fromKName,
|
18076
|
+
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
18077
|
+
ctatId: (_r = (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.bindCta) === null || _q === void 0 ? void 0 : _q.itemId) !== null && _r !== void 0 ? _r : '',
|
18078
|
+
traceInfo: (_v = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : (_u = item === null || item === void 0 ? void 0 : item.product) === null || _u === void 0 ? void 0 : _u.traceInfo) !== null && _v !== void 0 ? _v : ''
|
18079
|
+
}
|
18080
|
+
});
|
18081
|
+
}, [data, bffEventReport, activeIndex, popupDetailData, tempMap, isFromHashtag, curTime]);
|
18057
18082
|
React.useEffect(() => {
|
18058
18083
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
18059
18084
|
const visibleChange = () => {
|
18060
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
18061
18085
|
const repCond = !openHashtag && !isShowConsent;
|
18062
18086
|
if (document.visibilityState === 'hidden') {
|
18063
18087
|
// 当用户导航到新页面、切换标签页、关闭标签页、最小化或关闭浏览器、刷新原页面(即离开原页面时),或者在移动设备上从浏览器切换到不同的应用程序时
|
@@ -18066,40 +18090,10 @@ Made in Italy` })));
|
|
18066
18090
|
SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
|
18067
18091
|
handleReportProductView(item);
|
18068
18092
|
}
|
18069
|
-
let fromKName = '';
|
18070
|
-
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))) {
|
18071
|
-
fromKName = 'pdpPage';
|
18072
|
-
}
|
18073
|
-
else if (popupDetailData && ((_g = tempMap === null || tempMap === void 0 ? void 0 : tempMap[(_f = (_e = (_d = item === null || item === void 0 ? void 0 : item.video) === null || _d === void 0 ? void 0 : _d.bindCta) === null || _e === void 0 ? void 0 : _e.itemId) !== null && _f !== void 0 ? _f : ''].item) === null || _g === void 0 ? void 0 : _g.type) === 'Appoint') {
|
18074
|
-
fromKName = 'formPage';
|
18075
|
-
}
|
18076
|
-
else if (isFromHashtag) {
|
18077
|
-
fromKName = 'hashTagPage';
|
18078
|
-
}
|
18079
|
-
else if ((_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.url) {
|
18080
|
-
fromKName = 'videoPage';
|
18081
|
-
}
|
18082
|
-
else if (((_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.imgUrls) && ((_l = (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.imgUrls) === null || _l === void 0 ? void 0 : _l.length)) {
|
18083
|
-
fromKName = 'imagePage';
|
18084
|
-
}
|
18085
|
-
else if (item === null || item === void 0 ? void 0 : item.product) {
|
18086
|
-
fromKName = 'productPage';
|
18087
|
-
}
|
18088
18093
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.playbook) !== 'organic menu' || activeIndex !== 0 || channel) {
|
18089
|
-
|
18090
|
-
|
18091
|
-
|
18092
|
-
eventSubject: 'sessionCompleted',
|
18093
|
-
eventDescription: 'Session completed',
|
18094
|
-
contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
|
18095
|
-
productId: (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.itemId,
|
18096
|
-
position: activeIndex + '',
|
18097
|
-
fromKName,
|
18098
|
-
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
18099
|
-
ctatId: (_r = (_q = (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.bindCta) === null || _q === void 0 ? void 0 : _q.itemId) !== null && _r !== void 0 ? _r : '',
|
18100
|
-
traceInfo: (_v = (_t = (_s = item === null || item === void 0 ? void 0 : item.video) === null || _s === void 0 ? void 0 : _s.traceInfo) !== null && _t !== void 0 ? _t : (_u = item === null || item === void 0 ? void 0 : item.product) === null || _u === void 0 ? void 0 : _u.traceInfo) !== null && _v !== void 0 ? _v : ''
|
18101
|
-
}
|
18102
|
-
});
|
18094
|
+
const isExpire = refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true, handleSessionCompleted);
|
18095
|
+
if (!isExpire)
|
18096
|
+
handleSessionCompleted();
|
18103
18097
|
}
|
18104
18098
|
}
|
18105
18099
|
else if (document.visibilityState === 'visible') {
|
@@ -18132,8 +18126,24 @@ Made in Italy` })));
|
|
18132
18126
|
openHashtag,
|
18133
18127
|
isShowConsent,
|
18134
18128
|
selectTag,
|
18135
|
-
channel
|
18129
|
+
channel,
|
18130
|
+
handleSessionCompleted,
|
18131
|
+
refreshFeSession
|
18136
18132
|
]);
|
18133
|
+
const handleSessionExpire = React.useCallback(lodash.debounce(() => {
|
18134
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
|
18135
|
+
}, 1000), [handleSessionCompleted, refreshFeSession]);
|
18136
|
+
React.useEffect(() => {
|
18137
|
+
const events = ['touchstart', 'touchcancel'];
|
18138
|
+
events.forEach((event) => {
|
18139
|
+
window.addEventListener(event, handleSessionExpire);
|
18140
|
+
});
|
18141
|
+
return () => {
|
18142
|
+
events.forEach((event) => {
|
18143
|
+
window.removeEventListener(event, handleSessionExpire);
|
18144
|
+
});
|
18145
|
+
};
|
18146
|
+
}, [handleSessionExpire]);
|
18137
18147
|
const tagHeight = React.useMemo(() => {
|
18138
18148
|
let h = 0;
|
18139
18149
|
if (tagList.length > 0) {
|