pb-sxp-ui 1.10.12 → 1.11.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 +51 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -33
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +51 -33
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/index.d.ts +4 -0
- package/es/core/components/SxpPageRender/index.js +2 -4
- package/es/core/context/EditorDataProvider.d.ts +1 -0
- package/es/core/context/EditorDataProvider.js +3 -2
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -0
- package/es/core/context/SxpDataSourceProvider.js +29 -3
- package/es/core/utils/sessionStore.d.ts +1 -0
- package/es/core/utils/sessionStore.js +5 -5
- package/es/materials/sxp/popup/Iframe/index.d.ts +0 -4
- package/es/materials/sxp/popup/Iframe/index.js +4 -5
- package/es/materials/sxp/popup/Iframe/settingRender.js +0 -15
- package/lib/core/components/SxpPageRender/index.d.ts +4 -0
- package/lib/core/components/SxpPageRender/index.js +2 -4
- package/lib/core/context/EditorDataProvider.d.ts +1 -0
- package/lib/core/context/EditorDataProvider.js +3 -2
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -0
- package/lib/core/context/SxpDataSourceProvider.js +28 -2
- package/lib/core/utils/sessionStore.d.ts +1 -0
- package/lib/core/utils/sessionStore.js +7 -6
- package/lib/materials/sxp/popup/Iframe/index.d.ts +0 -4
- package/lib/materials/sxp/popup/Iframe/index.js +4 -5
- package/lib/materials/sxp/popup/Iframe/settingRender.js +0 -15
- package/package.json +1 -1
@@ -15,7 +15,6 @@ import WaterFall from './WaterFall';
|
|
15
15
|
import Nudge from './Nudge';
|
16
16
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../core/utils/event';
|
17
17
|
import { useEditor, useSxpDataSource } from '../../../core/hooks';
|
18
|
-
import { refreshFeSessionId } from '../../../core/utils/sessionStore';
|
19
18
|
import './index.less';
|
20
19
|
import { useEventReport } from '../../../core/hooks/useEventReport';
|
21
20
|
import withBindDataSource from '../../../core/hoc/withBindDataSource';
|
@@ -41,13 +40,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
41
40
|
const [isReload, setIsReload] = useState(new Date().getTime());
|
42
41
|
const skipLinkRef = useRef(false);
|
43
42
|
const [pageNum, setPageNum] = useState(2);
|
44
|
-
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel } = useSxpDataSource();
|
43
|
+
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel, refreshFeSession } = useSxpDataSource();
|
45
44
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
46
45
|
const isShowFingerTip = useMemo(() => {
|
47
46
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
48
47
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
49
48
|
useEffect(() => {
|
50
|
-
|
49
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
|
51
50
|
}, []);
|
52
51
|
useEffect(() => {
|
53
52
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
@@ -56,7 +55,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
56
55
|
}
|
57
56
|
}, [data === null || data === void 0 ? void 0 : data.length]);
|
58
57
|
const handleH5EnterLink = useCallback(() => {
|
59
|
-
refreshFeSessionId();
|
60
58
|
h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
|
61
59
|
if (data.length > 0) {
|
62
60
|
const now = new Date();
|
@@ -28,6 +28,7 @@ interface IEditorDataContext {
|
|
28
28
|
setConsentPopupCate?: React.Dispatch<React.SetStateAction<string>>;
|
29
29
|
openMultiPosts?: boolean;
|
30
30
|
setOpenMultiPosts?: React.Dispatch<React.SetStateAction<boolean>>;
|
31
|
+
pageTypeList?: Array<any>;
|
31
32
|
}
|
32
33
|
interface IEditorProviderProps {
|
33
34
|
data?: any;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { createContext, useContext, useState } from 'react';
|
2
2
|
const EditorDataContext = createContext({});
|
3
3
|
const EditorDataProvider = ({ children, data }) => {
|
4
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
4
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
5
5
|
const [openHashtag, setOpenHashtag] = useState(false);
|
6
6
|
const [openConsent, setOpenConsent] = useState(false);
|
7
7
|
const [consentPopupCate, setConsentPopupCate] = useState('');
|
@@ -32,7 +32,8 @@ const EditorDataProvider = ({ children, data }) => {
|
|
32
32
|
consentPopupCate,
|
33
33
|
setConsentPopupCate,
|
34
34
|
openMultiPosts,
|
35
|
-
setOpenMultiPosts
|
35
|
+
setOpenMultiPosts,
|
36
|
+
pageTypeList: (_p = data === null || data === void 0 ? void 0 : data.pageTypeList) !== null && _p !== void 0 ? _p : []
|
36
37
|
} }, children));
|
37
38
|
};
|
38
39
|
export function useEditorDataProvider() {
|
@@ -89,6 +89,7 @@ export interface ISxpDataSourceContext {
|
|
89
89
|
eventTimeList?: Array<IEventTimeType>;
|
90
90
|
setEventTimeList?: React.Dispatch<React.SetStateAction<Array<IEventTimeType>>>;
|
91
91
|
multiPostTimeRef?: any;
|
92
|
+
refreshFeSession?: () => void;
|
92
93
|
}
|
93
94
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
94
95
|
export interface SxpDataSourceProviderProps {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { __awaiter } from "tslib";
|
2
2
|
import React, { createContext, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
3
3
|
import qs from 'qs';
|
4
|
-
import { storeAndLoadFeSessionId } from '../utils/sessionStore';
|
4
|
+
import { refreshFeSessionId, storeAndLoadFeSessionId } from '../utils/sessionStore';
|
5
5
|
import { storeAndLoadFeUserId, AGREE_POLICY } from '../utils/localStore';
|
6
6
|
import { useIconLink } from '../components/SxpPageRender/useIconLink';
|
7
7
|
import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../utils/event';
|
@@ -36,6 +36,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
36
36
|
const themeTag = useRef();
|
37
37
|
const curTime = useRef();
|
38
38
|
const multiPostTimeRef = useRef();
|
39
|
+
const sessionTimeRef = useRef();
|
39
40
|
const [selectTag, setSelectTag] = useState(DEFAULT_TAG);
|
40
41
|
const checkCommodityIndexRef = useRef(-1);
|
41
42
|
const popupCurTimeRef = useRef(null);
|
@@ -208,6 +209,20 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
208
209
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
209
210
|
return data;
|
210
211
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
212
|
+
const refreshFeSession = useCallback(() => {
|
213
|
+
var _a, _b, _c, _d, _e, _f;
|
214
|
+
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;
|
215
|
+
if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
|
216
|
+
if (Math.floor((new Date() - ((_d = sessionTimeRef.current) !== null && _d !== void 0 ? _d : new Date())) / (1000 * 60)) >=
|
217
|
+
((_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)) {
|
218
|
+
refreshFeSessionId();
|
219
|
+
}
|
220
|
+
}
|
221
|
+
else {
|
222
|
+
refreshFeSessionId();
|
223
|
+
}
|
224
|
+
sessionTimeRef.current = new Date();
|
225
|
+
}, [data, sessionTimeRef]);
|
211
226
|
const bffEventReport = useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
|
212
227
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
213
228
|
return;
|
@@ -215,6 +230,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
215
230
|
if (!userInfo) {
|
216
231
|
userInfo = {};
|
217
232
|
}
|
233
|
+
refreshFeSession();
|
218
234
|
const sessionID = storeAndLoadFeSessionId();
|
219
235
|
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() && { sxpDevice: getDevice() })), (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 + '' }));
|
220
236
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
@@ -230,7 +246,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
230
246
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
231
247
|
type: 'beacon'
|
232
248
|
});
|
233
|
-
}, [
|
249
|
+
}, [
|
250
|
+
bffFetch,
|
251
|
+
curReqInfo,
|
252
|
+
enableReportEvent,
|
253
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
254
|
+
layoutVariantId,
|
255
|
+
globalConfig,
|
256
|
+
playbookType,
|
257
|
+
refreshFeSession
|
258
|
+
]);
|
234
259
|
const bffFbReport = useCallback(({ eventName, product }) => {
|
235
260
|
var _a, _b, _c, _d, _e;
|
236
261
|
if (!enableReportEvent ||
|
@@ -527,7 +552,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
527
552
|
channel,
|
528
553
|
eventTimeList,
|
529
554
|
setEventTimeList,
|
530
|
-
multiPostTimeRef
|
555
|
+
multiPostTimeRef,
|
556
|
+
refreshFeSession
|
531
557
|
} }, isShowConsent ? (React.createElement(Consent, Object.assign({}, (_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.item) === null || _e === void 0 ? void 0 : _e.props))) : (render({
|
532
558
|
rtcList,
|
533
559
|
mutateLike: bffMutateLike,
|
@@ -10,17 +10,17 @@ export const storeAndLoadFeSessionId = () => {
|
|
10
10
|
let result = getFeSessionId();
|
11
11
|
if (!result) {
|
12
12
|
result = generateFeSessionId();
|
13
|
-
window.
|
13
|
+
window.localStorage.setItem(feRealSessionIdKey, result);
|
14
14
|
}
|
15
15
|
return result;
|
16
16
|
};
|
17
17
|
export const refreshFeSessionId = () => {
|
18
18
|
const result = generateFeSessionId();
|
19
|
-
window.
|
19
|
+
window.localStorage.setItem(feRealSessionIdKey, result);
|
20
20
|
};
|
21
|
-
const getFeSessionId = () => {
|
22
|
-
return window.
|
21
|
+
export const getFeSessionId = () => {
|
22
|
+
return window.localStorage.getItem(feRealSessionIdKey);
|
23
23
|
};
|
24
24
|
export const removeFeSessionId = () => {
|
25
|
-
window.
|
25
|
+
window.localStorage.removeItem(feRealSessionIdKey);
|
26
26
|
};
|
@@ -12,10 +12,6 @@ export interface IIframeProps {
|
|
12
12
|
submitButtonStyle?: CSSProperties;
|
13
13
|
contentStyle?: CSSProperties;
|
14
14
|
isTel?: boolean;
|
15
|
-
iframe?: {
|
16
|
-
src?: string;
|
17
|
-
allow?: string;
|
18
|
-
};
|
19
15
|
}
|
20
16
|
declare const _default: React.NamedExoticComponent<IIframeProps>;
|
21
17
|
export default _default;
|
@@ -5,12 +5,11 @@ import './index.less';
|
|
5
5
|
import { useSxpDataSource } from '../../../../core/hooks';
|
6
6
|
const Iframe = (_a) => {
|
7
7
|
var _b, _c;
|
8
|
-
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel
|
8
|
+
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel"]);
|
9
9
|
const { popupDetailData } = useSxpDataSource();
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
React.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
|
10
|
+
const iframeUrl = (_c = (_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.video) === null || _b === void 0 ? void 0 : _b.bindCta) === null || _c === void 0 ? void 0 : _c.remark;
|
11
|
+
return (React.createElement("div", Object.assign({ className: `${css(Object.assign({}, style))}` }, props),
|
12
|
+
React.createElement("iframe", { src: iframeUrl, style: {
|
14
13
|
width: '100%',
|
15
14
|
height: 'calc(100% - 50px)',
|
16
15
|
marginTop: '50px',
|
@@ -8,20 +8,5 @@ export default [
|
|
8
8
|
name: ['style', 'backgroundColor']
|
9
9
|
}
|
10
10
|
]
|
11
|
-
},
|
12
|
-
{
|
13
|
-
title: 'iframe',
|
14
|
-
child: [
|
15
|
-
{
|
16
|
-
type: 'TextArea',
|
17
|
-
label: 'url',
|
18
|
-
name: ['props', 'iframe', 'src']
|
19
|
-
},
|
20
|
-
{
|
21
|
-
type: 'TextArea',
|
22
|
-
label: 'allow',
|
23
|
-
name: ['props', 'iframe', 'allow']
|
24
|
-
}
|
25
|
-
]
|
26
11
|
}
|
27
12
|
];
|
@@ -18,7 +18,6 @@ const WaterFall_1 = tslib_1.__importDefault(require("./WaterFall"));
|
|
18
18
|
const Nudge_1 = tslib_1.__importDefault(require("./Nudge"));
|
19
19
|
const event_1 = tslib_1.__importStar(require("../../../core/utils/event"));
|
20
20
|
const hooks_1 = require("../../../core/hooks");
|
21
|
-
const sessionStore_1 = require("../../../core/utils/sessionStore");
|
22
21
|
require("./index.less");
|
23
22
|
const useEventReport_1 = require("../../../core/hooks/useEventReport");
|
24
23
|
const withBindDataSource_1 = tslib_1.__importDefault(require("../../../core/hoc/withBindDataSource"));
|
@@ -44,13 +43,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
44
43
|
const [isReload, setIsReload] = (0, react_1.useState)(new Date().getTime());
|
45
44
|
const skipLinkRef = (0, react_1.useRef)(false);
|
46
45
|
const [pageNum, setPageNum] = (0, react_1.useState)(2);
|
47
|
-
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel } = (0, hooks_1.useSxpDataSource)();
|
46
|
+
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel, refreshFeSession } = (0, hooks_1.useSxpDataSource)();
|
48
47
|
const { backMainFeed, productView, jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
49
48
|
const isShowFingerTip = (0, react_1.useMemo)(() => {
|
50
49
|
return data.length > 0 && !loading && ((0, localStore_1.getFeUserState)() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
51
50
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
52
51
|
(0, react_1.useEffect)(() => {
|
53
|
-
|
52
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
|
54
53
|
}, []);
|
55
54
|
(0, react_1.useEffect)(() => {
|
56
55
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
@@ -59,7 +58,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
59
58
|
}
|
60
59
|
}, [data === null || data === void 0 ? void 0 : data.length]);
|
61
60
|
const handleH5EnterLink = (0, react_1.useCallback)(() => {
|
62
|
-
(0, sessionStore_1.refreshFeSessionId)();
|
63
61
|
h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
|
64
62
|
if (data.length > 0) {
|
65
63
|
const now = new Date();
|
@@ -28,6 +28,7 @@ interface IEditorDataContext {
|
|
28
28
|
setConsentPopupCate?: React.Dispatch<React.SetStateAction<string>>;
|
29
29
|
openMultiPosts?: boolean;
|
30
30
|
setOpenMultiPosts?: React.Dispatch<React.SetStateAction<boolean>>;
|
31
|
+
pageTypeList?: Array<any>;
|
31
32
|
}
|
32
33
|
interface IEditorProviderProps {
|
33
34
|
data?: any;
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
6
6
|
const EditorDataContext = (0, react_1.createContext)({});
|
7
7
|
const EditorDataProvider = ({ children, data }) => {
|
8
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
9
9
|
const [openHashtag, setOpenHashtag] = (0, react_1.useState)(false);
|
10
10
|
const [openConsent, setOpenConsent] = (0, react_1.useState)(false);
|
11
11
|
const [consentPopupCate, setConsentPopupCate] = (0, react_1.useState)('');
|
@@ -36,7 +36,8 @@ const EditorDataProvider = ({ children, data }) => {
|
|
36
36
|
consentPopupCate,
|
37
37
|
setConsentPopupCate,
|
38
38
|
openMultiPosts,
|
39
|
-
setOpenMultiPosts
|
39
|
+
setOpenMultiPosts,
|
40
|
+
pageTypeList: (_p = data === null || data === void 0 ? void 0 : data.pageTypeList) !== null && _p !== void 0 ? _p : []
|
40
41
|
} }, children));
|
41
42
|
};
|
42
43
|
function useEditorDataProvider() {
|
@@ -89,6 +89,7 @@ export interface ISxpDataSourceContext {
|
|
89
89
|
eventTimeList?: Array<IEventTimeType>;
|
90
90
|
setEventTimeList?: React.Dispatch<React.SetStateAction<Array<IEventTimeType>>>;
|
91
91
|
multiPostTimeRef?: any;
|
92
|
+
refreshFeSession?: () => void;
|
92
93
|
}
|
93
94
|
export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
|
94
95
|
export interface SxpDataSourceProviderProps {
|
@@ -39,6 +39,7 @@ 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)();
|
42
43
|
const [selectTag, setSelectTag] = (0, react_1.useState)(exports.DEFAULT_TAG);
|
43
44
|
const checkCommodityIndexRef = (0, react_1.useRef)(-1);
|
44
45
|
const popupCurTimeRef = (0, react_1.useRef)(null);
|
@@ -211,6 +212,20 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
211
212
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
212
213
|
return data;
|
213
214
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
215
|
+
const refreshFeSession = (0, react_1.useCallback)(() => {
|
216
|
+
var _a, _b, _c, _d, _e, _f;
|
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
|
+
if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
|
219
|
+
if (Math.floor((new Date() - ((_d = sessionTimeRef.current) !== null && _d !== void 0 ? _d : new Date())) / (1000 * 60)) >=
|
220
|
+
((_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)) {
|
221
|
+
(0, sessionStore_1.refreshFeSessionId)();
|
222
|
+
}
|
223
|
+
}
|
224
|
+
else {
|
225
|
+
(0, sessionStore_1.refreshFeSessionId)();
|
226
|
+
}
|
227
|
+
sessionTimeRef.current = new Date();
|
228
|
+
}, [data, sessionTimeRef]);
|
214
229
|
const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo, reportLayId = true }) => {
|
215
230
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
216
231
|
return;
|
@@ -218,6 +233,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
218
233
|
if (!userInfo) {
|
219
234
|
userInfo = {};
|
220
235
|
}
|
236
|
+
refreshFeSession();
|
221
237
|
const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
|
222
238
|
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 + '' }));
|
223
239
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
@@ -233,7 +249,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
233
249
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
234
250
|
type: 'beacon'
|
235
251
|
});
|
236
|
-
}, [
|
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
|
+
]);
|
237
262
|
const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
|
238
263
|
var _a, _b, _c, _d, _e;
|
239
264
|
if (!enableReportEvent ||
|
@@ -530,7 +555,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
530
555
|
channel,
|
531
556
|
eventTimeList,
|
532
557
|
setEventTimeList,
|
533
|
-
multiPostTimeRef
|
558
|
+
multiPostTimeRef,
|
559
|
+
refreshFeSession
|
534
560
|
} }, isShowConsent ? (react_1.default.createElement(Consent_1.default, Object.assign({}, (_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.item) === null || _e === void 0 ? void 0 : _e.props))) : (render({
|
535
561
|
rtcList,
|
536
562
|
mutateLike: bffMutateLike,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.removeFeSessionId = exports.refreshFeSessionId = exports.storeAndLoadFeSessionId = void 0;
|
3
|
+
exports.removeFeSessionId = exports.getFeSessionId = exports.refreshFeSessionId = exports.storeAndLoadFeSessionId = void 0;
|
4
4
|
const tool_1 = require("./tool");
|
5
5
|
const feRealSessionIdKey = 'feRealSessionIdKey';
|
6
6
|
const generateFeSessionId = () => {
|
@@ -10,23 +10,24 @@ const generateFeSessionId = () => {
|
|
10
10
|
return result;
|
11
11
|
};
|
12
12
|
const storeAndLoadFeSessionId = () => {
|
13
|
-
let result = getFeSessionId();
|
13
|
+
let result = (0, exports.getFeSessionId)();
|
14
14
|
if (!result) {
|
15
15
|
result = generateFeSessionId();
|
16
|
-
window.
|
16
|
+
window.localStorage.setItem(feRealSessionIdKey, result);
|
17
17
|
}
|
18
18
|
return result;
|
19
19
|
};
|
20
20
|
exports.storeAndLoadFeSessionId = storeAndLoadFeSessionId;
|
21
21
|
const refreshFeSessionId = () => {
|
22
22
|
const result = generateFeSessionId();
|
23
|
-
window.
|
23
|
+
window.localStorage.setItem(feRealSessionIdKey, result);
|
24
24
|
};
|
25
25
|
exports.refreshFeSessionId = refreshFeSessionId;
|
26
26
|
const getFeSessionId = () => {
|
27
|
-
return window.
|
27
|
+
return window.localStorage.getItem(feRealSessionIdKey);
|
28
28
|
};
|
29
|
+
exports.getFeSessionId = getFeSessionId;
|
29
30
|
const removeFeSessionId = () => {
|
30
|
-
window.
|
31
|
+
window.localStorage.removeItem(feRealSessionIdKey);
|
31
32
|
};
|
32
33
|
exports.removeFeSessionId = removeFeSessionId;
|
@@ -12,10 +12,6 @@ export interface IIframeProps {
|
|
12
12
|
submitButtonStyle?: CSSProperties;
|
13
13
|
contentStyle?: CSSProperties;
|
14
14
|
isTel?: boolean;
|
15
|
-
iframe?: {
|
16
|
-
src?: string;
|
17
|
-
allow?: string;
|
18
|
-
};
|
19
15
|
}
|
20
16
|
declare const _default: React.NamedExoticComponent<IIframeProps>;
|
21
17
|
export default _default;
|
@@ -7,12 +7,11 @@ require("./index.less");
|
|
7
7
|
const hooks_1 = require("../../../../core/hooks");
|
8
8
|
const Iframe = (_a) => {
|
9
9
|
var _b, _c;
|
10
|
-
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel
|
10
|
+
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel } = _a, props = tslib_1.__rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel"]);
|
11
11
|
const { popupDetailData } = (0, hooks_1.useSxpDataSource)();
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
react_1.default.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
|
12
|
+
const iframeUrl = (_c = (_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.video) === null || _b === void 0 ? void 0 : _b.bindCta) === null || _c === void 0 ? void 0 : _c.remark;
|
13
|
+
return (react_1.default.createElement("div", Object.assign({ className: `${(0, css_1.css)(Object.assign({}, style))}` }, props),
|
14
|
+
react_1.default.createElement("iframe", { src: iframeUrl, style: {
|
16
15
|
width: '100%',
|
17
16
|
height: 'calc(100% - 50px)',
|
18
17
|
marginTop: '50px',
|
@@ -10,20 +10,5 @@ exports.default = [
|
|
10
10
|
name: ['style', 'backgroundColor']
|
11
11
|
}
|
12
12
|
]
|
13
|
-
},
|
14
|
-
{
|
15
|
-
title: 'iframe',
|
16
|
-
child: [
|
17
|
-
{
|
18
|
-
type: 'TextArea',
|
19
|
-
label: 'url',
|
20
|
-
name: ['props', 'iframe', 'src']
|
21
|
-
},
|
22
|
-
{
|
23
|
-
type: 'TextArea',
|
24
|
-
label: 'allow',
|
25
|
-
name: ['props', 'iframe', 'allow']
|
26
|
-
}
|
27
|
-
]
|
28
13
|
}
|
29
14
|
];
|