pb-sxp-ui 1.11.1 → 1.12.1
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 +90 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +90 -83
- 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 +90 -83
- 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/SxpPageCore/index.js +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.d.ts +1 -0
- package/es/core/components/SxpPageRender/index.js +66 -38
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/es/core/context/SxpDataSourceProvider.js +14 -23
- package/lib/core/components/SxpPageCore/index.js +1 -1
- 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.d.ts +1 -0
- package/lib/core/components/SxpPageRender/index.js +65 -37
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -1
- package/lib/core/context/SxpDataSourceProvider.js +14 -23
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -847,22 +847,26 @@
|
|
847
847
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
848
848
|
return data;
|
849
849
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
850
|
-
const refreshFeSession = React.useCallback((enableReSid) => {
|
850
|
+
const refreshFeSession = React.useCallback((enableReSid, event) => {
|
851
851
|
var _a, _b, _c, _d, _e;
|
852
|
+
let expire = false;
|
852
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;
|
853
854
|
if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
|
854
855
|
const sessionStartTime = localStorage.getItem('sessionStartTime');
|
855
|
-
const sst = sessionStartTime ?
|
856
|
-
if (Math.floor((new Date() - sst) /
|
856
|
+
const sst = sessionStartTime ? JSON.parse(sessionStartTime) : new Date().getTime();
|
857
|
+
if (Math.floor((new Date().getTime() - sst) / 1000 / 60) >=
|
857
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');
|
858
860
|
refreshFeSessionId();
|
859
861
|
curTime.current = new Date();
|
862
|
+
expire = true;
|
860
863
|
}
|
861
|
-
localStorage.setItem('sessionStartTime', new Date().
|
864
|
+
localStorage.setItem('sessionStartTime', JSON.stringify(new Date().getTime()));
|
862
865
|
}
|
863
866
|
else if (enableReSid) {
|
864
867
|
refreshFeSessionId();
|
865
868
|
}
|
869
|
+
return expire;
|
866
870
|
}, [data]);
|
867
871
|
const bffEventReport = React.useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
|
868
872
|
// 关闭 BFF 事件上报
|
@@ -876,7 +880,6 @@
|
|
876
880
|
// tpChannelId: 'H5' // 后端处理
|
877
881
|
};
|
878
882
|
}
|
879
|
-
refreshFeSession();
|
880
883
|
const sessionID = storeAndLoadFeSessionId();
|
881
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 + '' }));
|
882
885
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
@@ -892,16 +895,7 @@
|
|
892
895
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
893
896
|
type: 'beacon'
|
894
897
|
});
|
895
|
-
}, [
|
896
|
-
bffFetch,
|
897
|
-
curReqInfo,
|
898
|
-
enableReportEvent,
|
899
|
-
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
900
|
-
layoutVariantId,
|
901
|
-
globalConfig,
|
902
|
-
playbookType,
|
903
|
-
refreshFeSession
|
904
|
-
]);
|
898
|
+
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
|
905
899
|
const bffFbReport = React.useCallback(({ eventName, product }) => {
|
906
900
|
var _a, _b, _c, _d, _e;
|
907
901
|
if (!enableReportEvent ||
|
@@ -1027,7 +1021,7 @@
|
|
1027
1021
|
});
|
1028
1022
|
}, [bffEventReport, isFromHashtag]);
|
1029
1023
|
const h5EnterLink = React.useCallback(() => {
|
1030
|
-
var _a, _b
|
1024
|
+
var _a, _b;
|
1031
1025
|
const queryString = location.search.slice(1);
|
1032
1026
|
const params = qs.parse(queryString.replace(/\+/g, '%2B'));
|
1033
1027
|
for (const key in params) {
|
@@ -1035,10 +1029,7 @@
|
|
1035
1029
|
}
|
1036
1030
|
const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
|
1037
1031
|
const time = new Date();
|
1038
|
-
|
1039
|
-
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)) {
|
1040
|
-
curTime.current = time;
|
1041
|
-
}
|
1032
|
+
curTime.current = time;
|
1042
1033
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
1043
1034
|
eventInfo: {
|
1044
1035
|
eventSubject: 'h5LinkEnterFeed',
|
@@ -1050,16 +1041,16 @@
|
|
1050
1041
|
utmContent: getVal('utm_content'),
|
1051
1042
|
enterTime: Math.floor(time / 1000) + '',
|
1052
1043
|
requestId: null,
|
1053
|
-
enterUrl: (
|
1044
|
+
enterUrl: (_b = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : '',
|
1054
1045
|
clSource: getVal('cl_source')
|
1055
1046
|
},
|
1056
1047
|
reportLayId: false
|
1057
1048
|
});
|
1058
|
-
}, [bffEventReport
|
1049
|
+
}, [bffEventReport]);
|
1059
1050
|
React.useEffect(() => {
|
1060
1051
|
if (!isShowConsent)
|
1061
1052
|
h5EnterLink();
|
1062
|
-
}, [isShowConsent
|
1053
|
+
}, [isShowConsent]);
|
1063
1054
|
React.useEffect(() => {
|
1064
1055
|
if (isShowConsent || isPreview)
|
1065
1056
|
return;
|
@@ -17186,7 +17177,6 @@ Made in Italy` })));
|
|
17186
17177
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
|
17187
17178
|
const videoStartTime = React.useRef(0);
|
17188
17179
|
const [isLoadFinish, setIsLoadFinish] = React.useState(false);
|
17189
|
-
const [isFirstPlay, setIsFirstPlay] = React.useState(true);
|
17190
17180
|
const { isActive } = useSwiperSlide();
|
17191
17181
|
const canvasRef = React.useRef(null);
|
17192
17182
|
const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
|
@@ -17197,6 +17187,7 @@ Made in Italy` })));
|
|
17197
17187
|
const hlsRef = React.useRef(null);
|
17198
17188
|
const initTimeRef = React.useRef();
|
17199
17189
|
const loadedTimeRef = React.useRef();
|
17190
|
+
const isFirstPlayRef = React.useRef(true);
|
17200
17191
|
const blur = React.useMemo(() => {
|
17201
17192
|
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
17202
17193
|
}, [videoPostConfig]);
|
@@ -17252,26 +17243,13 @@ Made in Italy` })));
|
|
17252
17243
|
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
17253
17244
|
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);
|
17254
17245
|
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);
|
17255
|
-
const playType =
|
17246
|
+
const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
|
17256
17247
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
17257
|
-
eventInfo: {
|
17258
|
-
eventSubject: 'playVideo',
|
17259
|
-
eventDescription: 'User played the video',
|
17260
|
-
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 : '',
|
17261
|
-
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 : '',
|
17262
|
-
playType,
|
17263
|
-
startTime: videoCurrentTime,
|
17264
|
-
videoDuration,
|
17265
|
-
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 : []),
|
17266
|
-
position: index + '',
|
17267
|
-
contentFormat: 'video',
|
17268
|
-
traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo,
|
17269
|
-
loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + ''
|
17270
|
-
}
|
17248
|
+
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) + '' }))
|
17271
17249
|
});
|
17272
|
-
|
17250
|
+
isFirstPlayRef.current = false;
|
17273
17251
|
}
|
17274
|
-
}), [bffEventReport, data, index,
|
17252
|
+
}), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
17275
17253
|
const handLoadeddata = React.useCallback(() => {
|
17276
17254
|
var _a;
|
17277
17255
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
|
@@ -17630,13 +17608,14 @@ Made in Italy` })));
|
|
17630
17608
|
|
17631
17609
|
const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
|
17632
17610
|
var _a, _b;
|
17633
|
-
const swiperRef = React.useRef();
|
17634
17611
|
const { isActive } = useSwiperSlide();
|
17635
17612
|
const { sxpParameter, openHashtag } = useSxpDataSource();
|
17636
17613
|
const [isLoad, setIsLoad] = React.useState(false);
|
17637
17614
|
const [imgInfo, setImgInfo] = React.useState();
|
17638
|
-
const initTime = new Date();
|
17639
17615
|
const [swiperActiveIndex, setSwiperActiveIndex] = React.useState(0);
|
17616
|
+
const swiperRef = React.useRef();
|
17617
|
+
const isFirstPlayRef = React.useRef(true);
|
17618
|
+
const initTime = new Date();
|
17640
17619
|
React.useEffect(() => {
|
17641
17620
|
if (isLoad && isActive) {
|
17642
17621
|
(swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.start();
|
@@ -17644,7 +17623,8 @@ Made in Italy` })));
|
|
17644
17623
|
onViewImageEndEvent(rec);
|
17645
17624
|
}
|
17646
17625
|
else {
|
17647
|
-
onViewImageStartEvent(index, imgInfo, true);
|
17626
|
+
onViewImageStartEvent(index, isFirstPlayRef.current ? imgInfo : undefined, true);
|
17627
|
+
isFirstPlayRef.current = false;
|
17648
17628
|
}
|
17649
17629
|
}
|
17650
17630
|
else {
|
@@ -17999,11 +17979,11 @@ Made in Italy` })));
|
|
17999
17979
|
* @Author: binruan@chatlabs.com
|
18000
17980
|
* @Date: 2024-03-20 10:27:31
|
18001
17981
|
* @LastEditors: binruan@chatlabs.com
|
18002
|
-
* @LastEditTime: 2024-12-
|
17982
|
+
* @LastEditTime: 2024-12-17 19:01:02
|
18003
17983
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
18004
17984
|
*
|
18005
17985
|
*/
|
18006
|
-
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [],
|
17986
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
|
18007
17987
|
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;
|
18008
17988
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
18009
17989
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
@@ -18033,12 +18013,17 @@ Made in Italy` })));
|
|
18033
18013
|
}
|
18034
18014
|
}, [data === null || data === void 0 ? void 0 : data.length]);
|
18035
18015
|
const handleH5EnterLink = React.useCallback(() => {
|
18016
|
+
var _a, _b, _c;
|
18017
|
+
const defaultGlobalConfig = (_b = (_a = defaultData === null || defaultData === void 0 ? void 0 : defaultData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig;
|
18018
|
+
if (!((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable)) {
|
18019
|
+
refreshFeSessionId();
|
18020
|
+
}
|
18036
18021
|
h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
|
18037
18022
|
if (data.length > 0) {
|
18038
18023
|
const now = new Date();
|
18039
18024
|
viewTime.current = now;
|
18040
18025
|
}
|
18041
|
-
}, [data.length, h5EnterLink]);
|
18026
|
+
}, [data.length, h5EnterLink, defaultData]);
|
18042
18027
|
React.useEffect(() => {
|
18043
18028
|
var _a;
|
18044
18029
|
if (!ctaType || (ctaType === null || ctaType === void 0 ? void 0 : ctaType.length) < 1)
|
@@ -18059,10 +18044,46 @@ Made in Italy` })));
|
|
18059
18044
|
if (index !== -1)
|
18060
18045
|
(_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
|
18061
18046
|
}, [data, ctaType, swiperRef]);
|
18047
|
+
const handleSessionCompleted = React.useCallback((fk) => {
|
18048
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
18049
|
+
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
18050
|
+
let fromKName = '';
|
18051
|
+
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))) {
|
18052
|
+
fromKName = 'pdpPage';
|
18053
|
+
}
|
18054
|
+
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') {
|
18055
|
+
fromKName = 'formPage';
|
18056
|
+
}
|
18057
|
+
else if (isFromHashtag) {
|
18058
|
+
fromKName = 'hashTagPage';
|
18059
|
+
}
|
18060
|
+
else if ((_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.url) {
|
18061
|
+
fromKName = 'videoPage';
|
18062
|
+
}
|
18063
|
+
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)) {
|
18064
|
+
fromKName = 'imagePage';
|
18065
|
+
}
|
18066
|
+
else if (item === null || item === void 0 ? void 0 : item.product) {
|
18067
|
+
fromKName = 'productPage';
|
18068
|
+
}
|
18069
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
18070
|
+
eventInfo: {
|
18071
|
+
sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
|
18072
|
+
eventSubject: 'sessionCompleted',
|
18073
|
+
eventDescription: 'Session completed',
|
18074
|
+
contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
|
18075
|
+
productId: (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.itemId,
|
18076
|
+
position: activeIndex + '',
|
18077
|
+
fromKName: fk ? fk : fromKName,
|
18078
|
+
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
18079
|
+
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 : '',
|
18080
|
+
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 : ''
|
18081
|
+
}
|
18082
|
+
});
|
18083
|
+
}, [data, bffEventReport, activeIndex, popupDetailData, tempMap, isFromHashtag, curTime]);
|
18062
18084
|
React.useEffect(() => {
|
18063
18085
|
const item = data === null || data === void 0 ? void 0 : data[activeIndex];
|
18064
18086
|
const visibleChange = () => {
|
18065
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
18066
18087
|
const repCond = !openHashtag && !isShowConsent;
|
18067
18088
|
if (document.visibilityState === 'hidden') {
|
18068
18089
|
// 当用户导航到新页面、切换标签页、关闭标签页、最小化或关闭浏览器、刷新原页面(即离开原页面时),或者在移动设备上从浏览器切换到不同的应用程序时
|
@@ -18071,40 +18092,10 @@ Made in Italy` })));
|
|
18071
18092
|
SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
|
18072
18093
|
handleReportProductView(item);
|
18073
18094
|
}
|
18074
|
-
let fromKName = '';
|
18075
|
-
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))) {
|
18076
|
-
fromKName = 'pdpPage';
|
18077
|
-
}
|
18078
|
-
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') {
|
18079
|
-
fromKName = 'formPage';
|
18080
|
-
}
|
18081
|
-
else if (isFromHashtag) {
|
18082
|
-
fromKName = 'hashTagPage';
|
18083
|
-
}
|
18084
|
-
else if ((_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.url) {
|
18085
|
-
fromKName = 'videoPage';
|
18086
|
-
}
|
18087
|
-
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)) {
|
18088
|
-
fromKName = 'imagePage';
|
18089
|
-
}
|
18090
|
-
else if (item === null || item === void 0 ? void 0 : item.product) {
|
18091
|
-
fromKName = 'productPage';
|
18092
|
-
}
|
18093
18095
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.playbook) !== 'organic menu' || activeIndex !== 0 || channel) {
|
18094
|
-
|
18095
|
-
|
18096
|
-
|
18097
|
-
eventSubject: 'sessionCompleted',
|
18098
|
-
eventDescription: 'Session completed',
|
18099
|
-
contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
|
18100
|
-
productId: (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.itemId,
|
18101
|
-
position: activeIndex + '',
|
18102
|
-
fromKName,
|
18103
|
-
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
18104
|
-
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 : '',
|
18105
|
-
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 : ''
|
18106
|
-
}
|
18107
|
-
});
|
18096
|
+
const isExpire = refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true, handleSessionCompleted);
|
18097
|
+
if (!isExpire)
|
18098
|
+
handleSessionCompleted();
|
18108
18099
|
}
|
18109
18100
|
}
|
18110
18101
|
else if (document.visibilityState === 'visible') {
|
@@ -18137,8 +18128,24 @@ Made in Italy` })));
|
|
18137
18128
|
openHashtag,
|
18138
18129
|
isShowConsent,
|
18139
18130
|
selectTag,
|
18140
|
-
channel
|
18131
|
+
channel,
|
18132
|
+
handleSessionCompleted,
|
18133
|
+
refreshFeSession
|
18141
18134
|
]);
|
18135
|
+
const handleSessionExpire = React.useCallback(lodash.debounce(() => {
|
18136
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
|
18137
|
+
}, 1000), [handleSessionCompleted, refreshFeSession]);
|
18138
|
+
React.useEffect(() => {
|
18139
|
+
const events = ['touchstart', 'touchcancel'];
|
18140
|
+
events.forEach((event) => {
|
18141
|
+
window.addEventListener(event, handleSessionExpire);
|
18142
|
+
});
|
18143
|
+
return () => {
|
18144
|
+
events.forEach((event) => {
|
18145
|
+
window.removeEventListener(event, handleSessionExpire);
|
18146
|
+
});
|
18147
|
+
};
|
18148
|
+
}, [handleSessionExpire]);
|
18142
18149
|
const tagHeight = React.useMemo(() => {
|
18143
18150
|
let h = 0;
|
18144
18151
|
if (tagList.length > 0) {
|
@@ -19062,7 +19069,7 @@ Made in Italy` })));
|
|
19062
19069
|
React.createElement(SxpDataSourceProvider$1, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: data, dataList: dataList, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
|
19063
19070
|
var _a;
|
19064
19071
|
return (React.createElement(React.Fragment, null,
|
19065
|
-
React.createElement(SxpPageRender, Object.assign({}, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
|
19072
|
+
React.createElement(SxpPageRender, Object.assign({ defaultData: data }, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
|
19066
19073
|
React.createElement(Popup, null)));
|
19067
19074
|
} })));
|
19068
19075
|
};
|