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 CHANGED
@@ -673,7 +673,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
673
673
  const themeTag = React.useRef();
674
674
  const curTime = React.useRef();
675
675
  const multiPostTimeRef = React.useRef();
676
- const sessionTimeRef = React.useRef();
677
676
  const [selectTag, setSelectTag] = React.useState(DEFAULT_TAG);
678
677
  const checkCommodityIndexRef = React.useRef(-1);
679
678
  const popupCurTimeRef = React.useRef(null);
@@ -855,20 +854,27 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
855
854
  setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
856
855
  return data;
857
856
  }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
858
- const refreshFeSession = React.useCallback(() => {
859
- var _a, _b, _c, _d, _e, _f;
857
+ const refreshFeSession = React.useCallback((enableReSid, event) => {
858
+ var _a, _b, _c, _d, _e;
859
+ let expire = false;
860
860
  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;
861
861
  if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
862
- if (Math.floor((new Date() - ((_d = sessionTimeRef.current) !== null && _d !== void 0 ? _d : new Date())) / (1000 * 60)) >=
863
- ((_f = (_e = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _e === void 0 ? void 0 : _e.expires) !== null && _f !== void 0 ? _f : 30)) {
862
+ const sessionStartTime = localStorage.getItem('sessionStartTime');
863
+ const sst = sessionStartTime ? JSON.parse(sessionStartTime) : new Date().getTime();
864
+ if (Math.floor((new Date().getTime() - sst) / 1000 / 60) >=
865
+ ((_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)) {
866
+ event === null || event === void 0 ? void 0 : event('sessionTimeOut');
864
867
  refreshFeSessionId();
868
+ curTime.current = new Date();
869
+ expire = true;
865
870
  }
871
+ localStorage.setItem('sessionStartTime', JSON.stringify(new Date().getTime()));
866
872
  }
867
- else {
873
+ else if (enableReSid) {
868
874
  refreshFeSessionId();
869
875
  }
870
- sessionTimeRef.current = new Date();
871
- }, [data, sessionTimeRef]);
876
+ return expire;
877
+ }, [data]);
872
878
  const bffEventReport = React.useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
873
879
  // 关闭 BFF 事件上报
874
880
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
@@ -881,7 +887,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
881
887
  // tpChannelId: 'H5' // 后端处理
882
888
  };
883
889
  }
884
- refreshFeSession();
885
890
  const sessionID = storeAndLoadFeSessionId();
886
891
  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 + '' }));
887
892
  const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
@@ -897,16 +902,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
897
902
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
898
903
  type: 'beacon'
899
904
  });
900
- }, [
901
- bffFetch,
902
- curReqInfo,
903
- enableReportEvent,
904
- globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
905
- layoutVariantId,
906
- globalConfig,
907
- playbookType,
908
- refreshFeSession
909
- ]);
905
+ }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
910
906
  const bffFbReport = React.useCallback(({ eventName, product }) => {
911
907
  var _a, _b, _c, _d, _e;
912
908
  if (!enableReportEvent ||
@@ -1032,7 +1028,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1032
1028
  });
1033
1029
  }, [bffEventReport, isFromHashtag]);
1034
1030
  const h5EnterLink = React.useCallback(() => {
1035
- var _a, _b;
1031
+ var _a, _b, _c, _d, _e;
1036
1032
  const queryString = location.search.slice(1);
1037
1033
  const params = qs.parse(queryString.replace(/\+/g, '%2B'));
1038
1034
  for (const key in params) {
@@ -1040,7 +1036,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1040
1036
  }
1041
1037
  const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
1042
1038
  const time = new Date();
1043
- curTime.current = time;
1039
+ 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;
1040
+ 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)) {
1041
+ curTime.current = time;
1042
+ }
1044
1043
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
1045
1044
  eventInfo: {
1046
1045
  eventSubject: 'h5LinkEnterFeed',
@@ -1052,12 +1051,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1052
1051
  utmContent: getVal('utm_content'),
1053
1052
  enterTime: Math.floor(time / 1000) + '',
1054
1053
  requestId: null,
1055
- 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
+ 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 : '',
1056
1055
  clSource: getVal('cl_source')
1057
1056
  },
1058
1057
  reportLayId: false
1059
1058
  });
1060
- }, [bffEventReport]);
1059
+ }, [bffEventReport, data, curTime]);
1061
1060
  React.useEffect(() => {
1062
1061
  if (!isShowConsent)
1063
1062
  h5EnterLink();
@@ -17188,7 +17187,6 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
17188
17187
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
17189
17188
  const videoStartTime = React.useRef(0);
17190
17189
  const [isLoadFinish, setIsLoadFinish] = React.useState(false);
17191
- const [isFirstPlay, setIsFirstPlay] = React.useState(true);
17192
17190
  const { isActive } = useSwiperSlide();
17193
17191
  const canvasRef = React.useRef(null);
17194
17192
  const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
@@ -17199,6 +17197,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
17199
17197
  const hlsRef = React.useRef(null);
17200
17198
  const initTimeRef = React.useRef();
17201
17199
  const loadedTimeRef = React.useRef();
17200
+ const isFirstPlayRef = React.useRef(true);
17202
17201
  const blur = React.useMemo(() => {
17203
17202
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
17204
17203
  }, [videoPostConfig]);
@@ -17254,26 +17253,13 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
17254
17253
  videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
17255
17254
  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);
17256
17255
  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);
17257
- const playType = isFirstPlay ? '0' : '1';
17256
+ const playType = (isFirstPlayRef === null || isFirstPlayRef === void 0 ? void 0 : isFirstPlayRef.current) ? '0' : '1';
17258
17257
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
17259
- eventInfo: {
17260
- eventSubject: 'playVideo',
17261
- eventDescription: 'User played the video',
17262
- 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 : '',
17263
- 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 : '',
17264
- playType,
17265
- startTime: videoCurrentTime,
17266
- videoDuration,
17267
- 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 : []),
17268
- position: index + '',
17269
- contentFormat: 'video',
17270
- traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo,
17271
- loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + ''
17272
- }
17258
+ 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) + '' }))
17273
17259
  });
17274
- setIsFirstPlay(false);
17260
+ isFirstPlayRef.current = false;
17275
17261
  }
17276
- }), [bffEventReport, data, index, isFirstPlay, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17262
+ }), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17277
17263
  const handLoadeddata = React.useCallback(() => {
17278
17264
  var _a;
17279
17265
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
@@ -17632,13 +17618,14 @@ const Picture = (props) => {
17632
17618
 
17633
17619
  const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
17634
17620
  var _a, _b;
17635
- const swiperRef = React.useRef();
17636
17621
  const { isActive } = useSwiperSlide();
17637
17622
  const { sxpParameter, openHashtag } = useSxpDataSource();
17638
17623
  const [isLoad, setIsLoad] = React.useState(false);
17639
17624
  const [imgInfo, setImgInfo] = React.useState();
17640
- const initTime = new Date();
17641
17625
  const [swiperActiveIndex, setSwiperActiveIndex] = React.useState(0);
17626
+ const swiperRef = React.useRef();
17627
+ const isFirstPlayRef = React.useRef(true);
17628
+ const initTime = new Date();
17642
17629
  React.useEffect(() => {
17643
17630
  if (isLoad && isActive) {
17644
17631
  (swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.start();
@@ -17646,7 +17633,8 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
17646
17633
  onViewImageEndEvent(rec);
17647
17634
  }
17648
17635
  else {
17649
- onViewImageStartEvent(index, imgInfo, true);
17636
+ onViewImageStartEvent(index, isFirstPlayRef.current ? imgInfo : undefined, true);
17637
+ isFirstPlayRef.current = false;
17650
17638
  }
17651
17639
  }
17652
17640
  else {
@@ -18001,7 +17989,7 @@ var NavBack$1 = React.memo(NavBack);
18001
17989
  * @Author: binruan@chatlabs.com
18002
17990
  * @Date: 2024-03-20 10:27:31
18003
17991
  * @LastEditors: binruan@chatlabs.com
18004
- * @LastEditTime: 2024-12-13 17:20:22
17992
+ * @LastEditTime: 2024-12-17 15:46:14
18005
17993
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
18006
17994
  *
18007
17995
  */
@@ -18026,7 +18014,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18026
18014
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
18027
18015
  }, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
18028
18016
  React.useEffect(() => {
18029
- refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
18017
+ refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true);
18030
18018
  }, []);
18031
18019
  React.useEffect(() => {
18032
18020
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
@@ -18061,10 +18049,46 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18061
18049
  if (index !== -1)
18062
18050
  (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
18063
18051
  }, [data, ctaType, swiperRef]);
18052
+ const handleSessionCompleted = React.useCallback((fk) => {
18053
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
18054
+ const item = data === null || data === void 0 ? void 0 : data[activeIndex];
18055
+ let fromKName = '';
18056
+ 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))) {
18057
+ fromKName = 'pdpPage';
18058
+ }
18059
+ 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') {
18060
+ fromKName = 'formPage';
18061
+ }
18062
+ else if (isFromHashtag) {
18063
+ fromKName = 'hashTagPage';
18064
+ }
18065
+ else if ((_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.url) {
18066
+ fromKName = 'videoPage';
18067
+ }
18068
+ 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)) {
18069
+ fromKName = 'imagePage';
18070
+ }
18071
+ else if (item === null || item === void 0 ? void 0 : item.product) {
18072
+ fromKName = 'productPage';
18073
+ }
18074
+ bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
18075
+ eventInfo: {
18076
+ sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
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: fk ? fk : 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
+ });
18088
+ }, [data, bffEventReport, activeIndex, popupDetailData, tempMap, isFromHashtag, curTime]);
18064
18089
  React.useEffect(() => {
18065
18090
  const item = data === null || data === void 0 ? void 0 : data[activeIndex];
18066
18091
  const visibleChange = () => {
18067
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
18068
18092
  const repCond = !openHashtag && !isShowConsent;
18069
18093
  if (document.visibilityState === 'hidden') {
18070
18094
  // 当用户导航到新页面、切换标签页、关闭标签页、最小化或关闭浏览器、刷新原页面(即离开原页面时),或者在移动设备上从浏览器切换到不同的应用程序时
@@ -18073,40 +18097,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18073
18097
  SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
18074
18098
  handleReportProductView(item);
18075
18099
  }
18076
- let fromKName = '';
18077
- 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))) {
18078
- fromKName = 'pdpPage';
18079
- }
18080
- 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') {
18081
- fromKName = 'formPage';
18082
- }
18083
- else if (isFromHashtag) {
18084
- fromKName = 'hashTagPage';
18085
- }
18086
- else if ((_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.url) {
18087
- fromKName = 'videoPage';
18088
- }
18089
- 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)) {
18090
- fromKName = 'imagePage';
18091
- }
18092
- else if (item === null || item === void 0 ? void 0 : item.product) {
18093
- fromKName = 'productPage';
18094
- }
18095
18100
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.playbook) !== 'organic menu' || activeIndex !== 0 || channel) {
18096
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
18097
- eventInfo: {
18098
- sessionDuration: Math.floor((new Date() - curTime.current) / 1000) + '',
18099
- eventSubject: 'sessionCompleted',
18100
- eventDescription: 'Session completed',
18101
- contentId: (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.itemId,
18102
- productId: (_o = item === null || item === void 0 ? void 0 : item.product) === null || _o === void 0 ? void 0 : _o.itemId,
18103
- position: activeIndex + '',
18104
- fromKName,
18105
- fromKPage: location === null || location === void 0 ? void 0 : location.href,
18106
- 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 : '',
18107
- 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 : ''
18108
- }
18109
- });
18101
+ const isExpire = refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true, handleSessionCompleted);
18102
+ if (!isExpire)
18103
+ handleSessionCompleted();
18110
18104
  }
18111
18105
  }
18112
18106
  else if (document.visibilityState === 'visible') {
@@ -18139,8 +18133,24 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18139
18133
  openHashtag,
18140
18134
  isShowConsent,
18141
18135
  selectTag,
18142
- channel
18136
+ channel,
18137
+ handleSessionCompleted,
18138
+ refreshFeSession
18143
18139
  ]);
18140
+ const handleSessionExpire = React.useCallback(lodash.debounce(() => {
18141
+ refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
18142
+ }, 1000), [handleSessionCompleted, refreshFeSession]);
18143
+ React.useEffect(() => {
18144
+ const events = ['touchstart', 'touchcancel'];
18145
+ events.forEach((event) => {
18146
+ window.addEventListener(event, handleSessionExpire);
18147
+ });
18148
+ return () => {
18149
+ events.forEach((event) => {
18150
+ window.removeEventListener(event, handleSessionExpire);
18151
+ });
18152
+ };
18153
+ }, [handleSessionExpire]);
18144
18154
  const tagHeight = React.useMemo(() => {
18145
18155
  let h = 0;
18146
18156
  if (tagList.length > 0) {