pb-sxp-ui 1.11.0 → 1.11.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/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,23 @@
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, _f;
850
+ const refreshFeSession = React.useCallback((enableReSid) => {
851
+ var _a, _b, _c, _d, _e;
853
852
  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
853
  if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
855
- if (Math.floor((new Date() - ((_d = sessionTimeRef.current) !== null && _d !== void 0 ? _d : new Date())) / (1000 * 60)) >=
856
- ((_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)) {
854
+ const sessionStartTime = localStorage.getItem('sessionStartTime');
855
+ const sst = sessionStartTime ? new Date(sessionStartTime) : new Date();
856
+ if (Math.floor((new Date() - sst) / (1000 * 60)) >=
857
+ ((_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)) {
857
858
  refreshFeSessionId();
859
+ curTime.current = new Date();
858
860
  }
861
+ localStorage.setItem('sessionStartTime', new Date().toISOString());
859
862
  }
860
- else {
863
+ else if (enableReSid) {
861
864
  refreshFeSessionId();
862
865
  }
863
- sessionTimeRef.current = new Date();
864
- }, [data, sessionTimeRef]);
866
+ }, [data]);
865
867
  const bffEventReport = React.useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
866
868
  // 关闭 BFF 事件上报
867
869
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
@@ -1025,7 +1027,7 @@
1025
1027
  });
1026
1028
  }, [bffEventReport, isFromHashtag]);
1027
1029
  const h5EnterLink = React.useCallback(() => {
1028
- var _a, _b;
1030
+ var _a, _b, _c, _d, _e;
1029
1031
  const queryString = location.search.slice(1);
1030
1032
  const params = qs.parse(queryString.replace(/\+/g, '%2B'));
1031
1033
  for (const key in params) {
@@ -1033,7 +1035,10 @@
1033
1035
  }
1034
1036
  const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
1035
1037
  const time = new Date();
1036
- curTime.current = time;
1038
+ 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;
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
+ }
1037
1042
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
1038
1043
  eventInfo: {
1039
1044
  eventSubject: 'h5LinkEnterFeed',
@@ -1045,16 +1050,16 @@
1045
1050
  utmContent: getVal('utm_content'),
1046
1051
  enterTime: Math.floor(time / 1000) + '',
1047
1052
  requestId: null,
1048
- 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 : '',
1053
+ 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
1054
  clSource: getVal('cl_source')
1050
1055
  },
1051
1056
  reportLayId: false
1052
1057
  });
1053
- }, [bffEventReport]);
1058
+ }, [bffEventReport, data, curTime]);
1054
1059
  React.useEffect(() => {
1055
1060
  if (!isShowConsent)
1056
1061
  h5EnterLink();
1057
- }, [isShowConsent]);
1062
+ }, [isShowConsent, h5EnterLink]);
1058
1063
  React.useEffect(() => {
1059
1064
  if (isShowConsent || isPreview)
1060
1065
  return;
@@ -17994,7 +17999,7 @@ Made in Italy` })));
17994
17999
  * @Author: binruan@chatlabs.com
17995
18000
  * @Date: 2024-03-20 10:27:31
17996
18001
  * @LastEditors: binruan@chatlabs.com
17997
- * @LastEditTime: 2024-12-13 17:20:22
18002
+ * @LastEditTime: 2024-12-16 15:03:38
17998
18003
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
17999
18004
  *
18000
18005
  */
@@ -18019,7 +18024,7 @@ Made in Italy` })));
18019
18024
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
18020
18025
  }, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
18021
18026
  React.useEffect(() => {
18022
- refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
18027
+ refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true);
18023
18028
  }, []);
18024
18029
  React.useEffect(() => {
18025
18030
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {