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