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.
Files changed (35) hide show
  1. package/dist/index.cjs +51 -33
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +51 -33
  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 +51 -33
  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 +29 -3
  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 +28 -2
  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
package/dist/pb-ui.js CHANGED
@@ -497,17 +497,17 @@
497
497
  let result = getFeSessionId();
498
498
  if (!result) {
499
499
  result = generateFeSessionId();
500
- window.sessionStorage.setItem(feRealSessionIdKey, result);
500
+ window.localStorage.setItem(feRealSessionIdKey, result);
501
501
  }
502
502
  return result;
503
503
  };
504
504
  const refreshFeSessionId = () => {
505
505
  const result = generateFeSessionId();
506
- window.sessionStorage.setItem(feRealSessionIdKey, result);
506
+ window.localStorage.setItem(feRealSessionIdKey, result);
507
507
  };
508
508
  // 获取 sessionID
509
509
  const getFeSessionId = () => {
510
- return window.sessionStorage.getItem(feRealSessionIdKey);
510
+ return window.localStorage.getItem(feRealSessionIdKey);
511
511
  };
512
512
 
513
513
  const FAKE_USER_KEY = 'SXP_FAKE_USER_ID';
@@ -666,6 +666,7 @@
666
666
  const themeTag = React.useRef();
667
667
  const curTime = React.useRef();
668
668
  const multiPostTimeRef = React.useRef();
669
+ const sessionTimeRef = React.useRef();
669
670
  const [selectTag, setSelectTag] = React.useState(DEFAULT_TAG);
670
671
  const checkCommodityIndexRef = React.useRef(-1);
671
672
  const popupCurTimeRef = React.useRef(null);
@@ -847,6 +848,20 @@
847
848
  setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
848
849
  return data;
849
850
  }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
851
+ const refreshFeSession = React.useCallback(() => {
852
+ var _a, _b, _c, _d, _e, _f;
853
+ 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;
854
+ if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
855
+ if (Math.floor((new Date() - ((_d = sessionTimeRef.current) !== null && _d !== void 0 ? _d : new Date())) / (1000 * 60)) >=
856
+ ((_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)) {
857
+ refreshFeSessionId();
858
+ }
859
+ }
860
+ else {
861
+ refreshFeSessionId();
862
+ }
863
+ sessionTimeRef.current = new Date();
864
+ }, [data, sessionTimeRef]);
850
865
  const bffEventReport = React.useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
851
866
  // 关闭 BFF 事件上报
852
867
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
@@ -859,6 +874,7 @@
859
874
  // tpChannelId: 'H5' // 后端处理
860
875
  };
861
876
  }
877
+ refreshFeSession();
862
878
  const sessionID = storeAndLoadFeSessionId();
863
879
  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$1() && { sxpDevice: getDevice$1() })), (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 + '' }));
864
880
  const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
@@ -874,7 +890,16 @@
874
890
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
875
891
  type: 'beacon'
876
892
  });
877
- }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
893
+ }, [
894
+ bffFetch,
895
+ curReqInfo,
896
+ enableReportEvent,
897
+ globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
898
+ layoutVariantId,
899
+ globalConfig,
900
+ playbookType,
901
+ refreshFeSession
902
+ ]);
878
903
  const bffFbReport = React.useCallback(({ eventName, product }) => {
879
904
  var _a, _b, _c, _d, _e;
880
905
  if (!enableReportEvent ||
@@ -1173,7 +1198,8 @@
1173
1198
  channel,
1174
1199
  eventTimeList,
1175
1200
  setEventTimeList,
1176
- multiPostTimeRef
1201
+ multiPostTimeRef,
1202
+ refreshFeSession
1177
1203
  } }, isShowConsent ? (React.createElement(Consent$4, 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({
1178
1204
  rtcList,
1179
1205
  mutateLike: bffMutateLike,
@@ -11996,7 +12022,7 @@ Made in Italy` })));
11996
12022
  * @Author: binruan@chatlabs.com
11997
12023
  * @Date: 2023-10-27 14:06:35
11998
12024
  * @LastEditors: binruan@chatlabs.com
11999
- * @LastEditTime: 2024-12-12 15:12:57
12025
+ * @LastEditTime: 2024-08-08 17:32:11
12000
12026
  * @FilePath: \pb-sxp-ui\src\materials\sxp\popup\Iframe\settingRender.tsx
12001
12027
  *
12002
12028
  */
@@ -12010,32 +12036,16 @@ Made in Italy` })));
12010
12036
  name: ['style', 'backgroundColor']
12011
12037
  }
12012
12038
  ]
12013
- },
12014
- {
12015
- title: 'iframe',
12016
- child: [
12017
- {
12018
- type: 'TextArea',
12019
- label: 'url',
12020
- name: ['props', 'iframe', 'src']
12021
- },
12022
- {
12023
- type: 'TextArea',
12024
- label: 'allow',
12025
- name: ['props', 'iframe', 'allow']
12026
- }
12027
- ]
12028
12039
  }
12029
12040
  ];
12030
12041
 
12031
12042
  const Iframe$1 = (_a) => {
12032
12043
  var _b, _c;
12033
- 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"]);
12044
+ 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"]);
12034
12045
  const { popupDetailData } = useSxpDataSource();
12035
- const { src, allow } = iframe || {};
12036
- 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);
12037
- return (React.createElement("div", Object.assign({ className: `${css.css(Object.assign(Object.assign({}, style), { overflow: 'hidden' }))}` }, props),
12038
- React.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
12046
+ 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;
12047
+ return (React.createElement("div", Object.assign({ className: `${css.css(Object.assign({}, style))}` }, props),
12048
+ React.createElement("iframe", { src: iframeUrl, style: {
12039
12049
  width: '100%',
12040
12050
  height: 'calc(100% - 50px)',
12041
12051
  marginTop: '50px',
@@ -16618,13 +16628,13 @@ Made in Italy` })));
16618
16628
  * @Author: binruan@chatlabs.com
16619
16629
  * @Date: 2023-12-26 10:38:53
16620
16630
  * @LastEditors: binruan@chatlabs.com
16621
- * @LastEditTime: 2024-10-29 18:04:27
16631
+ * @LastEditTime: 2024-12-11 18:24:31
16622
16632
  * @FilePath: \pb-sxp-ui\src\core\context\EditorDataProvider.tsx
16623
16633
  *
16624
16634
  */
16625
16635
  const EditorDataContext = React.createContext({});
16626
16636
  const EditorDataProvider = ({ children, data }) => {
16627
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
16637
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
16628
16638
  const [openHashtag, setOpenHashtag] = React.useState(false);
16629
16639
  const [openConsent, setOpenConsent] = React.useState(false);
16630
16640
  const [consentPopupCate, setConsentPopupCate] = React.useState('');
@@ -16655,7 +16665,8 @@ Made in Italy` })));
16655
16665
  consentPopupCate,
16656
16666
  setConsentPopupCate,
16657
16667
  openMultiPosts,
16658
- setOpenMultiPosts
16668
+ setOpenMultiPosts,
16669
+ pageTypeList: (_p = data === null || data === void 0 ? void 0 : data.pageTypeList) !== null && _p !== void 0 ? _p : []
16659
16670
  } }, children));
16660
16671
  };
16661
16672
  function useEditorDataProvider() {
@@ -17979,6 +17990,14 @@ Made in Italy` })));
17979
17990
  };
17980
17991
  var NavBack$1 = React.memo(NavBack);
17981
17992
 
17993
+ /*
17994
+ * @Author: binruan@chatlabs.com
17995
+ * @Date: 2024-03-20 10:27:31
17996
+ * @LastEditors: binruan@chatlabs.com
17997
+ * @LastEditTime: 2024-12-13 17:20:22
17998
+ * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
17999
+ *
18000
+ */
17982
18001
  const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], licenseUrl }) => {
17983
18002
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
17984
18003
  const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
@@ -17994,13 +18013,13 @@ Made in Italy` })));
17994
18013
  const [isReload, setIsReload] = React.useState(new Date().getTime());
17995
18014
  const skipLinkRef = React.useRef(false);
17996
18015
  const [pageNum, setPageNum] = React.useState(2);
17997
- 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();
18016
+ 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();
17998
18017
  const { backMainFeed, productView, jumpToWeb } = useEventReport();
17999
18018
  const isShowFingerTip = React.useMemo(() => {
18000
18019
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
18001
18020
  }, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
18002
18021
  React.useEffect(() => {
18003
- refreshFeSessionId();
18022
+ refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
18004
18023
  }, []);
18005
18024
  React.useEffect(() => {
18006
18025
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
@@ -18009,7 +18028,6 @@ Made in Italy` })));
18009
18028
  }
18010
18029
  }, [data === null || data === void 0 ? void 0 : data.length]);
18011
18030
  const handleH5EnterLink = React.useCallback(() => {
18012
- refreshFeSessionId();
18013
18031
  h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
18014
18032
  if (data.length > 0) {
18015
18033
  const now = new Date();
@@ -18916,7 +18934,7 @@ Made in Italy` })));
18916
18934
  * @Author: binruan@chatlabs.com
18917
18935
  * @Date: 2023-10-31 10:56:01
18918
18936
  * @LastEditors: binruan@chatlabs.com
18919
- * @LastEditTime: 2024-12-12 14:48:31
18937
+ * @LastEditTime: 2024-10-23 15:07:29
18920
18938
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
18921
18939
  *
18922
18940
  */