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/index.js
CHANGED
@@ -651,7 +651,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
651
651
|
const themeTag = useRef();
|
652
652
|
const curTime = useRef();
|
653
653
|
const multiPostTimeRef = useRef();
|
654
|
-
const sessionTimeRef = useRef();
|
655
654
|
const [selectTag, setSelectTag] = useState(DEFAULT_TAG);
|
656
655
|
const checkCommodityIndexRef = useRef(-1);
|
657
656
|
const popupCurTimeRef = useRef(null);
|
@@ -833,20 +832,27 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
833
832
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
834
833
|
return data;
|
835
834
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
836
|
-
const refreshFeSession = useCallback(() => {
|
837
|
-
var _a, _b, _c, _d, _e
|
835
|
+
const refreshFeSession = useCallback((enableReSid, event) => {
|
836
|
+
var _a, _b, _c, _d, _e;
|
837
|
+
let expire = false;
|
838
838
|
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;
|
839
839
|
if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
|
840
|
-
|
841
|
-
|
840
|
+
const sessionStartTime = localStorage.getItem('sessionStartTime');
|
841
|
+
const sst = sessionStartTime ? JSON.parse(sessionStartTime) : new Date().getTime();
|
842
|
+
if (Math.floor((new Date().getTime() - sst) / 1000 / 60) >=
|
843
|
+
((_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)) {
|
844
|
+
event === null || event === void 0 ? void 0 : event('sessionTimeOut');
|
842
845
|
refreshFeSessionId();
|
846
|
+
curTime.current = new Date();
|
847
|
+
expire = true;
|
843
848
|
}
|
849
|
+
localStorage.setItem('sessionStartTime', JSON.stringify(new Date().getTime()));
|
844
850
|
}
|
845
|
-
else {
|
851
|
+
else if (enableReSid) {
|
846
852
|
refreshFeSessionId();
|
847
853
|
}
|
848
|
-
|
849
|
-
}, [data
|
854
|
+
return expire;
|
855
|
+
}, [data]);
|
850
856
|
const bffEventReport = useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
|
851
857
|
// 关闭 BFF 事件上报
|
852
858
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
@@ -859,7 +865,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
859
865
|
// tpChannelId: 'H5' // 后端处理
|
860
866
|
};
|
861
867
|
}
|
862
|
-
refreshFeSession();
|
863
868
|
const sessionID = storeAndLoadFeSessionId();
|
864
869
|
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 + '' }));
|
865
870
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
@@ -875,16 +880,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
875
880
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
876
881
|
type: 'beacon'
|
877
882
|
});
|
878
|
-
}, [
|
879
|
-
bffFetch,
|
880
|
-
curReqInfo,
|
881
|
-
enableReportEvent,
|
882
|
-
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
883
|
-
layoutVariantId,
|
884
|
-
globalConfig,
|
885
|
-
playbookType,
|
886
|
-
refreshFeSession
|
887
|
-
]);
|
883
|
+
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
|
888
884
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
889
885
|
var _a, _b, _c, _d, _e;
|
890
886
|
if (!enableReportEvent ||
|
@@ -1010,7 +1006,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1010
1006
|
});
|
1011
1007
|
}, [bffEventReport, isFromHashtag]);
|
1012
1008
|
const h5EnterLink = useCallback(() => {
|
1013
|
-
var _a, _b;
|
1009
|
+
var _a, _b, _c, _d, _e;
|
1014
1010
|
const queryString = location.search.slice(1);
|
1015
1011
|
const params = qs.parse(queryString.replace(/\+/g, '%2B'));
|
1016
1012
|
for (const key in params) {
|
@@ -1018,7 +1014,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1018
1014
|
}
|
1019
1015
|
const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
|
1020
1016
|
const time = new Date();
|
1021
|
-
|
1017
|
+
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;
|
1018
|
+
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)) {
|
1019
|
+
curTime.current = time;
|
1020
|
+
}
|
1022
1021
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
1023
1022
|
eventInfo: {
|
1024
1023
|
eventSubject: 'h5LinkEnterFeed',
|
@@ -1030,12 +1029,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1030
1029
|
utmContent: getVal('utm_content'),
|
1031
1030
|
enterTime: Math.floor(time / 1000) + '',
|
1032
1031
|
requestId: null,
|
1033
|
-
enterUrl: (
|
1032
|
+
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 : '',
|
1034
1033
|
clSource: getVal('cl_source')
|
1035
1034
|
},
|
1036
1035
|
reportLayId: false
|
1037
1036
|
});
|
1038
|
-
}, [bffEventReport]);
|
1037
|
+
}, [bffEventReport, data, curTime]);
|
1039
1038
|
useEffect(() => {
|
1040
1039
|
if (!isShowConsent)
|
1041
1040
|
h5EnterLink();
|
@@ -17166,7 +17165,6 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
17166
17165
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
|
17167
17166
|
const videoStartTime = useRef(0);
|
17168
17167
|
const [isLoadFinish, setIsLoadFinish] = useState(false);
|
17169
|
-
const [isFirstPlay, setIsFirstPlay] = useState(true);
|
17170
17168
|
const { isActive } = useSwiperSlide();
|
17171
17169
|
const canvasRef = useRef(null);
|
17172
17170
|
const [firstFrameSrc, setFirstFrameSrc] = useState('');
|
@@ -17177,6 +17175,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
17177
17175
|
const hlsRef = useRef(null);
|
17178
17176
|
const initTimeRef = useRef();
|
17179
17177
|
const loadedTimeRef = useRef();
|
17178
|
+
const isFirstPlayRef = useRef(true);
|
17180
17179
|
const blur = useMemo(() => {
|
17181
17180
|
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
17182
17181
|
}, [videoPostConfig]);
|
@@ -17232,26 +17231,13 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
|
|
17232
17231
|
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
17233
17232
|
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);
|
17234
17233
|
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);
|
17235
|
-
const playType =
|
17234
|
+
const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
|
17236
17235
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
17237
|
-
eventInfo: {
|
17238
|
-
eventSubject: 'playVideo',
|
17239
|
-
eventDescription: 'User played the video',
|
17240
|
-
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 : '',
|
17241
|
-
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 : '',
|
17242
|
-
playType,
|
17243
|
-
startTime: videoCurrentTime,
|
17244
|
-
videoDuration,
|
17245
|
-
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 : []),
|
17246
|
-
position: index + '',
|
17247
|
-
contentFormat: 'video',
|
17248
|
-
traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo,
|
17249
|
-
loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + ''
|
17250
|
-
}
|
17236
|
+
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) + '' }))
|
17251
17237
|
});
|
17252
|
-
|
17238
|
+
isFirstPlayRef.current = false;
|
17253
17239
|
}
|
17254
|
-
}), [bffEventReport, data, index,
|
17240
|
+
}), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
17255
17241
|
const handLoadeddata = useCallback(() => {
|
17256
17242
|
var _a;
|
17257
17243
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
|
@@ -17610,13 +17596,14 @@ const Picture = (props) => {
|
|
17610
17596
|
|
17611
17597
|
const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
|
17612
17598
|
var _a, _b;
|
17613
|
-
const swiperRef = useRef();
|
17614
17599
|
const { isActive } = useSwiperSlide();
|
17615
17600
|
const { sxpParameter, openHashtag } = useSxpDataSource();
|
17616
17601
|
const [isLoad, setIsLoad] = useState(false);
|
17617
17602
|
const [imgInfo, setImgInfo] = useState();
|
17618
|
-
const initTime = new Date();
|
17619
17603
|
const [swiperActiveIndex, setSwiperActiveIndex] = useState(0);
|
17604
|
+
const swiperRef = useRef();
|
17605
|
+
const isFirstPlayRef = useRef(true);
|
17606
|
+
const initTime = new Date();
|
17620
17607
|
useEffect(() => {
|
17621
17608
|
if (isLoad && isActive) {
|
17622
17609
|
(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.start();
|
@@ -17624,7 +17611,8 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
|
|
17624
17611
|
onViewImageEndEvent(rec);
|
17625
17612
|
}
|
17626
17613
|
else {
|
17627
|
-
onViewImageStartEvent(index, imgInfo, true);
|
17614
|
+
onViewImageStartEvent(index, isFirstPlayRef.current ? imgInfo : undefined, true);
|
17615
|
+
isFirstPlayRef.current = false;
|
17628
17616
|
}
|
17629
17617
|
}
|
17630
17618
|
else {
|
@@ -17979,7 +17967,7 @@ var NavBack$1 = memo(NavBack);
|
|
17979
17967
|
* @Author: binruan@chatlabs.com
|
17980
17968
|
* @Date: 2024-03-20 10:27:31
|
17981
17969
|
* @LastEditors: binruan@chatlabs.com
|
17982
|
-
* @LastEditTime: 2024-12-
|
17970
|
+
* @LastEditTime: 2024-12-17 15:46:14
|
17983
17971
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
17984
17972
|
*
|
17985
17973
|
*/
|
@@ -18004,7 +17992,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
18004
17992
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
18005
17993
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
18006
17994
|
useEffect(() => {
|
18007
|
-
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
|
17995
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true);
|
18008
17996
|
}, []);
|
18009
17997
|
useEffect(() => {
|
18010
17998
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
@@ -18039,10 +18027,46 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
18039
18027
|
if (index !== -1)
|
18040
18028
|
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
18041
18029
|
}, [data, ctaType, swiperRef]);
|
18030
|
+
const handleSessionCompleted = useCallback((fk) => {
|
18031
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
18032
|
+
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
18033
|
+
let fromKName = '';
|
18034
|
+
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))) {
|
18035
|
+
fromKName = 'pdpPage';
|
18036
|
+
}
|
18037
|
+
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') {
|
18038
|
+
fromKName = 'formPage';
|
18039
|
+
}
|
18040
|
+
else if (isFromHashtag) {
|
18041
|
+
fromKName = 'hashTagPage';
|
18042
|
+
}
|
18043
|
+
else if ((_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.url) {
|
18044
|
+
fromKName = 'videoPage';
|
18045
|
+
}
|
18046
|
+
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)) {
|
18047
|
+
fromKName = 'imagePage';
|
18048
|
+
}
|
18049
|
+
else if (item === null || item === void 0 ? void 0 : item.product) {
|
18050
|
+
fromKName = 'productPage';
|
18051
|
+
}
|
18052
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
18053
|
+
eventInfo: {
|
18054
|
+
sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
|
18055
|
+
eventSubject: 'sessionCompleted',
|
18056
|
+
eventDescription: 'Session completed',
|
18057
|
+
contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
|
18058
|
+
productId: (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.itemId,
|
18059
|
+
position: activeIndex + '',
|
18060
|
+
fromKName: fk ? fk : fromKName,
|
18061
|
+
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
18062
|
+
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 : '',
|
18063
|
+
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 : ''
|
18064
|
+
}
|
18065
|
+
});
|
18066
|
+
}, [data, bffEventReport, activeIndex, popupDetailData, tempMap, isFromHashtag, curTime]);
|
18042
18067
|
useEffect(() => {
|
18043
18068
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
18044
18069
|
const visibleChange = () => {
|
18045
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
18046
18070
|
const repCond = !openHashtag && !isShowConsent;
|
18047
18071
|
if (document.visibilityState === 'hidden') {
|
18048
18072
|
// 当用户导航到新页面、切换标签页、关闭标签页、最小化或关闭浏览器、刷新原页面(即离开原页面时),或者在移动设备上从浏览器切换到不同的应用程序时
|
@@ -18051,40 +18075,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
18051
18075
|
SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
|
18052
18076
|
handleReportProductView(item);
|
18053
18077
|
}
|
18054
|
-
let fromKName = '';
|
18055
|
-
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))) {
|
18056
|
-
fromKName = 'pdpPage';
|
18057
|
-
}
|
18058
|
-
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') {
|
18059
|
-
fromKName = 'formPage';
|
18060
|
-
}
|
18061
|
-
else if (isFromHashtag) {
|
18062
|
-
fromKName = 'hashTagPage';
|
18063
|
-
}
|
18064
|
-
else if ((_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.url) {
|
18065
|
-
fromKName = 'videoPage';
|
18066
|
-
}
|
18067
|
-
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)) {
|
18068
|
-
fromKName = 'imagePage';
|
18069
|
-
}
|
18070
|
-
else if (item === null || item === void 0 ? void 0 : item.product) {
|
18071
|
-
fromKName = 'productPage';
|
18072
|
-
}
|
18073
18078
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.playbook) !== 'organic menu' || activeIndex !== 0 || channel) {
|
18074
|
-
|
18075
|
-
|
18076
|
-
|
18077
|
-
eventSubject: 'sessionCompleted',
|
18078
|
-
eventDescription: 'Session completed',
|
18079
|
-
contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
|
18080
|
-
productId: (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.itemId,
|
18081
|
-
position: activeIndex + '',
|
18082
|
-
fromKName,
|
18083
|
-
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
18084
|
-
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 : '',
|
18085
|
-
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 : ''
|
18086
|
-
}
|
18087
|
-
});
|
18079
|
+
const isExpire = refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true, handleSessionCompleted);
|
18080
|
+
if (!isExpire)
|
18081
|
+
handleSessionCompleted();
|
18088
18082
|
}
|
18089
18083
|
}
|
18090
18084
|
else if (document.visibilityState === 'visible') {
|
@@ -18117,8 +18111,24 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
18117
18111
|
openHashtag,
|
18118
18112
|
isShowConsent,
|
18119
18113
|
selectTag,
|
18120
|
-
channel
|
18114
|
+
channel,
|
18115
|
+
handleSessionCompleted,
|
18116
|
+
refreshFeSession
|
18121
18117
|
]);
|
18118
|
+
const handleSessionExpire = useCallback(debounce(() => {
|
18119
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
|
18120
|
+
}, 1000), [handleSessionCompleted, refreshFeSession]);
|
18121
|
+
useEffect(() => {
|
18122
|
+
const events = ['touchstart', 'touchcancel'];
|
18123
|
+
events.forEach((event) => {
|
18124
|
+
window.addEventListener(event, handleSessionExpire);
|
18125
|
+
});
|
18126
|
+
return () => {
|
18127
|
+
events.forEach((event) => {
|
18128
|
+
window.removeEventListener(event, handleSessionExpire);
|
18129
|
+
});
|
18130
|
+
};
|
18131
|
+
}, [handleSessionExpire]);
|
18122
18132
|
const tagHeight = useMemo(() => {
|
18123
18133
|
let h = 0;
|
18124
18134
|
if (tagList.length > 0) {
|