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/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,23 @@ 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) => {
858
+ var _a, _b, _c, _d, _e;
860
859
  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
860
  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)) {
861
+ const sessionStartTime = localStorage.getItem('sessionStartTime');
862
+ const sst = sessionStartTime ? new Date(sessionStartTime) : new Date();
863
+ if (Math.floor((new Date() - sst) / (1000 * 60)) >=
864
+ ((_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)) {
864
865
  refreshFeSessionId();
866
+ curTime.current = new Date();
865
867
  }
868
+ localStorage.setItem('sessionStartTime', new Date().toISOString());
866
869
  }
867
- else {
870
+ else if (enableReSid) {
868
871
  refreshFeSessionId();
869
872
  }
870
- sessionTimeRef.current = new Date();
871
- }, [data, sessionTimeRef]);
873
+ }, [data]);
872
874
  const bffEventReport = React.useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
873
875
  // 关闭 BFF 事件上报
874
876
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
@@ -1032,7 +1034,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1032
1034
  });
1033
1035
  }, [bffEventReport, isFromHashtag]);
1034
1036
  const h5EnterLink = React.useCallback(() => {
1035
- var _a, _b;
1037
+ var _a, _b, _c, _d, _e;
1036
1038
  const queryString = location.search.slice(1);
1037
1039
  const params = qs.parse(queryString.replace(/\+/g, '%2B'));
1038
1040
  for (const key in params) {
@@ -1040,7 +1042,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1040
1042
  }
1041
1043
  const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
1042
1044
  const time = new Date();
1043
- curTime.current = time;
1045
+ 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;
1046
+ 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)) {
1047
+ curTime.current = time;
1048
+ }
1044
1049
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
1045
1050
  eventInfo: {
1046
1051
  eventSubject: 'h5LinkEnterFeed',
@@ -1052,16 +1057,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1052
1057
  utmContent: getVal('utm_content'),
1053
1058
  enterTime: Math.floor(time / 1000) + '',
1054
1059
  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 : '',
1060
+ 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
1061
  clSource: getVal('cl_source')
1057
1062
  },
1058
1063
  reportLayId: false
1059
1064
  });
1060
- }, [bffEventReport]);
1065
+ }, [bffEventReport, data, curTime]);
1061
1066
  React.useEffect(() => {
1062
1067
  if (!isShowConsent)
1063
1068
  h5EnterLink();
1064
- }, [isShowConsent]);
1069
+ }, [isShowConsent, h5EnterLink]);
1065
1070
  React.useEffect(() => {
1066
1071
  if (isShowConsent || isPreview)
1067
1072
  return;
@@ -18001,7 +18006,7 @@ var NavBack$1 = React.memo(NavBack);
18001
18006
  * @Author: binruan@chatlabs.com
18002
18007
  * @Date: 2024-03-20 10:27:31
18003
18008
  * @LastEditors: binruan@chatlabs.com
18004
- * @LastEditTime: 2024-12-13 17:20:22
18009
+ * @LastEditTime: 2024-12-16 15:03:38
18005
18010
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
18006
18011
  *
18007
18012
  */
@@ -18026,7 +18031,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18026
18031
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
18027
18032
  }, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
18028
18033
  React.useEffect(() => {
18029
- refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
18034
+ refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true);
18030
18035
  }, []);
18031
18036
  React.useEffect(() => {
18032
18037
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {