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
@@ -39,7 +39,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
39
39
|
const themeTag = (0, react_1.useRef)();
|
40
40
|
const curTime = (0, react_1.useRef)();
|
41
41
|
const multiPostTimeRef = (0, react_1.useRef)();
|
42
|
-
const sessionTimeRef = (0, react_1.useRef)();
|
43
42
|
const [selectTag, setSelectTag] = (0, react_1.useState)(exports.DEFAULT_TAG);
|
44
43
|
const checkCommodityIndexRef = (0, react_1.useRef)(-1);
|
45
44
|
const popupCurTimeRef = (0, react_1.useRef)(null);
|
@@ -212,20 +211,27 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
212
211
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
213
212
|
return data;
|
214
213
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
215
|
-
const refreshFeSession = (0, react_1.useCallback)(() => {
|
216
|
-
var _a, _b, _c, _d, _e
|
214
|
+
const refreshFeSession = (0, react_1.useCallback)((enableReSid, event) => {
|
215
|
+
var _a, _b, _c, _d, _e;
|
216
|
+
let expire = false;
|
217
217
|
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;
|
218
218
|
if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
|
219
|
-
|
220
|
-
|
219
|
+
const sessionStartTime = localStorage.getItem('sessionStartTime');
|
220
|
+
const sst = sessionStartTime ? JSON.parse(sessionStartTime) : new Date().getTime();
|
221
|
+
if (Math.floor((new Date().getTime() - sst) / 1000 / 60) >=
|
222
|
+
((_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)) {
|
223
|
+
event === null || event === void 0 ? void 0 : event('sessionTimeOut');
|
221
224
|
(0, sessionStore_1.refreshFeSessionId)();
|
225
|
+
curTime.current = new Date();
|
226
|
+
expire = true;
|
222
227
|
}
|
228
|
+
localStorage.setItem('sessionStartTime', JSON.stringify(new Date().getTime()));
|
223
229
|
}
|
224
|
-
else {
|
230
|
+
else if (enableReSid) {
|
225
231
|
(0, sessionStore_1.refreshFeSessionId)();
|
226
232
|
}
|
227
|
-
|
228
|
-
}, [data
|
233
|
+
return expire;
|
234
|
+
}, [data]);
|
229
235
|
const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo, reportLayId = true }) => {
|
230
236
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
231
237
|
return;
|
@@ -233,7 +239,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
233
239
|
if (!userInfo) {
|
234
240
|
userInfo = {};
|
235
241
|
}
|
236
|
-
refreshFeSession();
|
237
242
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
238
243
|
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), ((0, tool_1.getDevice)() && { sxpDevice: (0, tool_1.getDevice)() })), ((0, tool_1.getSystem)() && { sxpSystem: (0, tool_1.getSystem)() })), ((0, tool_1.getBrowserInfo)() && { sxpBrowser: (0, tool_1.getBrowserInfo)() })), ((eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.position) && channel && { position: Number(eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.position) + 1 + '' }));
|
239
244
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
@@ -249,16 +254,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
249
254
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
250
255
|
type: 'beacon'
|
251
256
|
});
|
252
|
-
}, [
|
253
|
-
bffFetch,
|
254
|
-
curReqInfo,
|
255
|
-
enableReportEvent,
|
256
|
-
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
257
|
-
layoutVariantId,
|
258
|
-
globalConfig,
|
259
|
-
playbookType,
|
260
|
-
refreshFeSession
|
261
|
-
]);
|
257
|
+
}, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
|
262
258
|
const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
|
263
259
|
var _a, _b, _c, _d, _e;
|
264
260
|
if (!enableReportEvent ||
|
@@ -383,7 +379,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
383
379
|
});
|
384
380
|
}, [bffEventReport, isFromHashtag]);
|
385
381
|
const h5EnterLink = (0, react_1.useCallback)(() => {
|
386
|
-
var _a, _b;
|
382
|
+
var _a, _b, _c, _d, _e;
|
387
383
|
const queryString = location.search.slice(1);
|
388
384
|
const params = qs_1.default.parse(queryString.replace(/\+/g, '%2B'));
|
389
385
|
for (const key in params) {
|
@@ -391,7 +387,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
391
387
|
}
|
392
388
|
const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
|
393
389
|
const time = new Date();
|
394
|
-
|
390
|
+
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;
|
391
|
+
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)) {
|
392
|
+
curTime.current = time;
|
393
|
+
}
|
395
394
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
396
395
|
eventInfo: {
|
397
396
|
eventSubject: 'h5LinkEnterFeed',
|
@@ -403,12 +402,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
403
402
|
utmContent: getVal('utm_content'),
|
404
403
|
enterTime: Math.floor(time / 1000) + '',
|
405
404
|
requestId: null,
|
406
|
-
enterUrl: (
|
405
|
+
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 : '',
|
407
406
|
clSource: getVal('cl_source')
|
408
407
|
},
|
409
408
|
reportLayId: false
|
410
409
|
});
|
411
|
-
}, [bffEventReport]);
|
410
|
+
}, [bffEventReport, data, curTime]);
|
412
411
|
(0, react_1.useEffect)(() => {
|
413
412
|
if (!isShowConsent)
|
414
413
|
h5EnterLink();
|