pb-sxp-ui 1.10.12 → 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.
Files changed (35) hide show
  1. package/dist/index.cjs +61 -38
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +61 -38
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +4 -4
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +4 -4
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +61 -38
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +4 -4
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageRender/index.d.ts +4 -0
  14. package/es/core/components/SxpPageRender/index.js +2 -4
  15. package/es/core/context/EditorDataProvider.d.ts +1 -0
  16. package/es/core/context/EditorDataProvider.js +3 -2
  17. package/es/core/context/SxpDataSourceProvider.d.ts +1 -0
  18. package/es/core/context/SxpDataSourceProvider.js +39 -8
  19. package/es/core/utils/sessionStore.d.ts +1 -0
  20. package/es/core/utils/sessionStore.js +5 -5
  21. package/es/materials/sxp/popup/Iframe/index.d.ts +0 -4
  22. package/es/materials/sxp/popup/Iframe/index.js +4 -5
  23. package/es/materials/sxp/popup/Iframe/settingRender.js +0 -15
  24. package/lib/core/components/SxpPageRender/index.d.ts +4 -0
  25. package/lib/core/components/SxpPageRender/index.js +2 -4
  26. package/lib/core/context/EditorDataProvider.d.ts +1 -0
  27. package/lib/core/context/EditorDataProvider.js +3 -2
  28. package/lib/core/context/SxpDataSourceProvider.d.ts +1 -0
  29. package/lib/core/context/SxpDataSourceProvider.js +38 -7
  30. package/lib/core/utils/sessionStore.d.ts +1 -0
  31. package/lib/core/utils/sessionStore.js +7 -6
  32. package/lib/materials/sxp/popup/Iframe/index.d.ts +0 -4
  33. package/lib/materials/sxp/popup/Iframe/index.js +4 -5
  34. package/lib/materials/sxp/popup/Iframe/settingRender.js +0 -15
  35. package/package.json +1 -1
@@ -70,6 +70,10 @@ export interface ISxpPageRenderProps {
70
70
  consentPopup?: any;
71
71
  multiPosts?: any;
72
72
  playbook?: 'paid media' | 'organic menu';
73
+ session: {
74
+ expires?: number;
75
+ enable?: boolean;
76
+ };
73
77
  };
74
78
  descStyle?: CSSProperties;
75
79
  tipText?: {
@@ -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
- refreshFeSessionId();
49
+ refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true);
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?: (enableReSid?: boolean) => 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';
@@ -208,6 +208,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
208
208
  setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
209
209
  return data;
210
210
  }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
211
+ const refreshFeSession = useCallback((enableReSid) => {
212
+ var _a, _b, _c, _d, _e;
213
+ 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;
214
+ if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
215
+ const sessionStartTime = localStorage.getItem('sessionStartTime');
216
+ const sst = sessionStartTime ? new Date(sessionStartTime) : new Date();
217
+ if (Math.floor((new Date() - sst) / (1000 * 60)) >=
218
+ ((_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)) {
219
+ refreshFeSessionId();
220
+ curTime.current = new Date();
221
+ }
222
+ localStorage.setItem('sessionStartTime', new Date().toISOString());
223
+ }
224
+ else if (enableReSid) {
225
+ refreshFeSessionId();
226
+ }
227
+ }, [data]);
211
228
  const bffEventReport = useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
212
229
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
213
230
  return;
@@ -215,6 +232,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
215
232
  if (!userInfo) {
216
233
  userInfo = {};
217
234
  }
235
+ refreshFeSession();
218
236
  const sessionID = storeAndLoadFeSessionId();
219
237
  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
238
  const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
@@ -230,7 +248,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
230
248
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
231
249
  type: 'beacon'
232
250
  });
233
- }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
251
+ }, [
252
+ bffFetch,
253
+ curReqInfo,
254
+ enableReportEvent,
255
+ globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
256
+ layoutVariantId,
257
+ globalConfig,
258
+ playbookType,
259
+ refreshFeSession
260
+ ]);
234
261
  const bffFbReport = useCallback(({ eventName, product }) => {
235
262
  var _a, _b, _c, _d, _e;
236
263
  if (!enableReportEvent ||
@@ -355,7 +382,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
355
382
  });
356
383
  }, [bffEventReport, isFromHashtag]);
357
384
  const h5EnterLink = useCallback(() => {
358
- var _a, _b;
385
+ var _a, _b, _c, _d, _e;
359
386
  const queryString = location.search.slice(1);
360
387
  const params = qs.parse(queryString.replace(/\+/g, '%2B'));
361
388
  for (const key in params) {
@@ -363,7 +390,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
363
390
  }
364
391
  const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
365
392
  const time = new Date();
366
- curTime.current = time;
393
+ 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;
394
+ 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)) {
395
+ curTime.current = time;
396
+ }
367
397
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
368
398
  eventInfo: {
369
399
  eventSubject: 'h5LinkEnterFeed',
@@ -375,16 +405,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
375
405
  utmContent: getVal('utm_content'),
376
406
  enterTime: Math.floor(time / 1000) + '',
377
407
  requestId: null,
378
- 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 : '',
408
+ 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 : '',
379
409
  clSource: getVal('cl_source')
380
410
  },
381
411
  reportLayId: false
382
412
  });
383
- }, [bffEventReport]);
413
+ }, [bffEventReport, data, curTime]);
384
414
  useEffect(() => {
385
415
  if (!isShowConsent)
386
416
  h5EnterLink();
387
- }, [isShowConsent]);
417
+ }, [isShowConsent, h5EnterLink]);
388
418
  useEffect(() => {
389
419
  if (isShowConsent || isPreview)
390
420
  return;
@@ -527,7 +557,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
527
557
  channel,
528
558
  eventTimeList,
529
559
  setEventTimeList,
530
- multiPostTimeRef
560
+ multiPostTimeRef,
561
+ refreshFeSession
531
562
  } }, 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
563
  rtcList,
533
564
  mutateLike: bffMutateLike,
@@ -1,3 +1,4 @@
1
1
  export declare const storeAndLoadFeSessionId: () => string;
2
2
  export declare const refreshFeSessionId: () => void;
3
+ export declare const getFeSessionId: () => string | null;
3
4
  export declare const removeFeSessionId: () => void;
@@ -10,17 +10,17 @@ export const storeAndLoadFeSessionId = () => {
10
10
  let result = getFeSessionId();
11
11
  if (!result) {
12
12
  result = generateFeSessionId();
13
- window.sessionStorage.setItem(feRealSessionIdKey, result);
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.sessionStorage.setItem(feRealSessionIdKey, result);
19
+ window.localStorage.setItem(feRealSessionIdKey, result);
20
20
  };
21
- const getFeSessionId = () => {
22
- return window.sessionStorage.getItem(feRealSessionIdKey);
21
+ export const getFeSessionId = () => {
22
+ return window.localStorage.getItem(feRealSessionIdKey);
23
23
  };
24
24
  export const removeFeSessionId = () => {
25
- window.sessionStorage.removeItem(feRealSessionIdKey);
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, iframe } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel", "iframe"]);
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 { src, allow } = iframe || {};
11
- const iframeUrl = src || ((_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);
12
- return (React.createElement("div", Object.assign({ className: `${css(Object.assign(Object.assign({}, style), { overflow: 'hidden' }))}` }, props),
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
  ];
@@ -70,6 +70,10 @@ export interface ISxpPageRenderProps {
70
70
  consentPopup?: any;
71
71
  multiPosts?: any;
72
72
  playbook?: 'paid media' | 'organic menu';
73
+ session: {
74
+ expires?: number;
75
+ enable?: boolean;
76
+ };
73
77
  };
74
78
  descStyle?: CSSProperties;
75
79
  tipText?: {
@@ -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
- (0, sessionStore_1.refreshFeSessionId)();
52
+ refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true);
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?: (enableReSid?: boolean) => void;
92
93
  }
93
94
  export declare const SxpDataSourceContext: React.Context<ISxpDataSourceContext>;
94
95
  export interface SxpDataSourceProviderProps {
@@ -211,6 +211,23 @@ 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) => {
215
+ var _a, _b, _c, _d, _e;
216
+ 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
+ if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
218
+ const sessionStartTime = localStorage.getItem('sessionStartTime');
219
+ const sst = sessionStartTime ? new Date(sessionStartTime) : new Date();
220
+ if (Math.floor((new Date() - sst) / (1000 * 60)) >=
221
+ ((_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)) {
222
+ (0, sessionStore_1.refreshFeSessionId)();
223
+ curTime.current = new Date();
224
+ }
225
+ localStorage.setItem('sessionStartTime', new Date().toISOString());
226
+ }
227
+ else if (enableReSid) {
228
+ (0, sessionStore_1.refreshFeSessionId)();
229
+ }
230
+ }, [data]);
214
231
  const bffEventReport = (0, react_1.useCallback)(({ userInfo, eventInfo, reportLayId = true }) => {
215
232
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
216
233
  return;
@@ -218,6 +235,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
218
235
  if (!userInfo) {
219
236
  userInfo = {};
220
237
  }
238
+ refreshFeSession();
221
239
  const sessionID = (0, sessionStore_1.storeAndLoadFeSessionId)();
222
240
  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
241
  const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
@@ -233,7 +251,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
233
251
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
234
252
  type: 'beacon'
235
253
  });
236
- }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
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
+ ]);
237
264
  const bffFbReport = (0, react_1.useCallback)(({ eventName, product }) => {
238
265
  var _a, _b, _c, _d, _e;
239
266
  if (!enableReportEvent ||
@@ -358,7 +385,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
358
385
  });
359
386
  }, [bffEventReport, isFromHashtag]);
360
387
  const h5EnterLink = (0, react_1.useCallback)(() => {
361
- var _a, _b;
388
+ var _a, _b, _c, _d, _e;
362
389
  const queryString = location.search.slice(1);
363
390
  const params = qs_1.default.parse(queryString.replace(/\+/g, '%2B'));
364
391
  for (const key in params) {
@@ -366,7 +393,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
366
393
  }
367
394
  const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
368
395
  const time = new Date();
369
- curTime.current = time;
396
+ 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;
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
+ }
370
400
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
371
401
  eventInfo: {
372
402
  eventSubject: 'h5LinkEnterFeed',
@@ -378,16 +408,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
378
408
  utmContent: getVal('utm_content'),
379
409
  enterTime: Math.floor(time / 1000) + '',
380
410
  requestId: null,
381
- 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 : '',
411
+ 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 : '',
382
412
  clSource: getVal('cl_source')
383
413
  },
384
414
  reportLayId: false
385
415
  });
386
- }, [bffEventReport]);
416
+ }, [bffEventReport, data, curTime]);
387
417
  (0, react_1.useEffect)(() => {
388
418
  if (!isShowConsent)
389
419
  h5EnterLink();
390
- }, [isShowConsent]);
420
+ }, [isShowConsent, h5EnterLink]);
391
421
  (0, react_1.useEffect)(() => {
392
422
  if (isShowConsent || isPreview)
393
423
  return;
@@ -530,7 +560,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
530
560
  channel,
531
561
  eventTimeList,
532
562
  setEventTimeList,
533
- multiPostTimeRef
563
+ multiPostTimeRef,
564
+ refreshFeSession
534
565
  } }, 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
566
  rtcList,
536
567
  mutateLike: bffMutateLike,
@@ -1,3 +1,4 @@
1
1
  export declare const storeAndLoadFeSessionId: () => string;
2
2
  export declare const refreshFeSessionId: () => void;
3
+ export declare const getFeSessionId: () => string | null;
3
4
  export declare const removeFeSessionId: () => void;
@@ -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.sessionStorage.setItem(feRealSessionIdKey, result);
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.sessionStorage.setItem(feRealSessionIdKey, result);
23
+ window.localStorage.setItem(feRealSessionIdKey, result);
24
24
  };
25
25
  exports.refreshFeSessionId = refreshFeSessionId;
26
26
  const getFeSessionId = () => {
27
- return window.sessionStorage.getItem(feRealSessionIdKey);
27
+ return window.localStorage.getItem(feRealSessionIdKey);
28
28
  };
29
+ exports.getFeSessionId = getFeSessionId;
29
30
  const removeFeSessionId = () => {
30
- window.sessionStorage.removeItem(feRealSessionIdKey);
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, iframe } = _a, props = tslib_1.__rest(_a, ["content", "btnText", "style", "icon", "isPopup", "isExternalLink", "onClose", "onClick", "submitButtonStyle", "contentStyle", "isTel", "iframe"]);
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 { src, allow } = iframe || {};
13
- const iframeUrl = src || ((_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);
14
- return (react_1.default.createElement("div", Object.assign({ className: `${(0, css_1.css)(Object.assign(Object.assign({}, style), { overflow: 'hidden' }))}` }, props),
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
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.10.12",
3
+ "version": "1.11.1",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",