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/index.js CHANGED
@@ -482,17 +482,17 @@ const storeAndLoadFeSessionId = () => {
482
482
  let result = getFeSessionId();
483
483
  if (!result) {
484
484
  result = generateFeSessionId();
485
- window.sessionStorage.setItem(feRealSessionIdKey, result);
485
+ window.localStorage.setItem(feRealSessionIdKey, result);
486
486
  }
487
487
  return result;
488
488
  };
489
489
  const refreshFeSessionId = () => {
490
490
  const result = generateFeSessionId();
491
- window.sessionStorage.setItem(feRealSessionIdKey, result);
491
+ window.localStorage.setItem(feRealSessionIdKey, result);
492
492
  };
493
493
  // 获取 sessionID
494
494
  const getFeSessionId = () => {
495
- return window.sessionStorage.getItem(feRealSessionIdKey);
495
+ return window.localStorage.getItem(feRealSessionIdKey);
496
496
  };
497
497
 
498
498
  const FAKE_USER_KEY = 'SXP_FAKE_USER_ID';
@@ -651,6 +651,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
651
651
  const themeTag = useRef();
652
652
  const curTime = useRef();
653
653
  const multiPostTimeRef = useRef();
654
+ const sessionTimeRef = useRef();
654
655
  const [selectTag, setSelectTag] = useState(DEFAULT_TAG);
655
656
  const checkCommodityIndexRef = useRef(-1);
656
657
  const popupCurTimeRef = useRef(null);
@@ -832,6 +833,20 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
832
833
  setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
833
834
  return data;
834
835
  }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
836
+ const refreshFeSession = useCallback(() => {
837
+ var _a, _b, _c, _d, _e, _f;
838
+ 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;
839
+ if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
840
+ if (Math.floor((new Date() - ((_d = sessionTimeRef.current) !== null && _d !== void 0 ? _d : new Date())) / (1000 * 60)) >=
841
+ ((_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)) {
842
+ refreshFeSessionId();
843
+ }
844
+ }
845
+ else {
846
+ refreshFeSessionId();
847
+ }
848
+ sessionTimeRef.current = new Date();
849
+ }, [data, sessionTimeRef]);
835
850
  const bffEventReport = useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
836
851
  // 关闭 BFF 事件上报
837
852
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
@@ -844,6 +859,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
844
859
  // tpChannelId: 'H5' // 后端处理
845
860
  };
846
861
  }
862
+ refreshFeSession();
847
863
  const sessionID = storeAndLoadFeSessionId();
848
864
  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 + '' }));
849
865
  const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
@@ -859,7 +875,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
859
875
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
860
876
  type: 'beacon'
861
877
  });
862
- }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
878
+ }, [
879
+ bffFetch,
880
+ curReqInfo,
881
+ enableReportEvent,
882
+ globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
883
+ layoutVariantId,
884
+ globalConfig,
885
+ playbookType,
886
+ refreshFeSession
887
+ ]);
863
888
  const bffFbReport = useCallback(({ eventName, product }) => {
864
889
  var _a, _b, _c, _d, _e;
865
890
  if (!enableReportEvent ||
@@ -1158,7 +1183,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1158
1183
  channel,
1159
1184
  eventTimeList,
1160
1185
  setEventTimeList,
1161
- multiPostTimeRef
1186
+ multiPostTimeRef,
1187
+ refreshFeSession
1162
1188
  } }, 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({
1163
1189
  rtcList,
1164
1190
  mutateLike: bffMutateLike,
@@ -11981,7 +12007,7 @@ const CommodityList = createMaterial(CommodityListComponent, {
11981
12007
  * @Author: binruan@chatlabs.com
11982
12008
  * @Date: 2023-10-27 14:06:35
11983
12009
  * @LastEditors: binruan@chatlabs.com
11984
- * @LastEditTime: 2024-12-12 15:12:57
12010
+ * @LastEditTime: 2024-08-08 17:32:11
11985
12011
  * @FilePath: \pb-sxp-ui\src\materials\sxp\popup\Iframe\settingRender.tsx
11986
12012
  *
11987
12013
  */
@@ -11995,32 +12021,16 @@ var settingRender$8 = [
11995
12021
  name: ['style', 'backgroundColor']
11996
12022
  }
11997
12023
  ]
11998
- },
11999
- {
12000
- title: 'iframe',
12001
- child: [
12002
- {
12003
- type: 'TextArea',
12004
- label: 'url',
12005
- name: ['props', 'iframe', 'src']
12006
- },
12007
- {
12008
- type: 'TextArea',
12009
- label: 'allow',
12010
- name: ['props', 'iframe', 'allow']
12011
- }
12012
- ]
12013
12024
  }
12014
12025
  ];
12015
12026
 
12016
12027
  const Iframe$1 = (_a) => {
12017
12028
  var _b, _c;
12018
- 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"]);
12029
+ 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"]);
12019
12030
  const { popupDetailData } = useSxpDataSource();
12020
- const { src, allow } = iframe || {};
12021
- 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);
12022
- return (React.createElement("div", Object.assign({ className: `${css(Object.assign(Object.assign({}, style), { overflow: 'hidden' }))}` }, props),
12023
- React.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
12031
+ 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;
12032
+ return (React.createElement("div", Object.assign({ className: `${css(Object.assign({}, style))}` }, props),
12033
+ React.createElement("iframe", { src: iframeUrl, style: {
12024
12034
  width: '100%',
12025
12035
  height: 'calc(100% - 50px)',
12026
12036
  marginTop: '50px',
@@ -16603,13 +16613,13 @@ var settingRender$1 = [
16603
16613
  * @Author: binruan@chatlabs.com
16604
16614
  * @Date: 2023-12-26 10:38:53
16605
16615
  * @LastEditors: binruan@chatlabs.com
16606
- * @LastEditTime: 2024-10-29 18:04:27
16616
+ * @LastEditTime: 2024-12-11 18:24:31
16607
16617
  * @FilePath: \pb-sxp-ui\src\core\context\EditorDataProvider.tsx
16608
16618
  *
16609
16619
  */
16610
16620
  const EditorDataContext = createContext({});
16611
16621
  const EditorDataProvider = ({ children, data }) => {
16612
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
16622
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
16613
16623
  const [openHashtag, setOpenHashtag] = useState(false);
16614
16624
  const [openConsent, setOpenConsent] = useState(false);
16615
16625
  const [consentPopupCate, setConsentPopupCate] = useState('');
@@ -16640,7 +16650,8 @@ const EditorDataProvider = ({ children, data }) => {
16640
16650
  consentPopupCate,
16641
16651
  setConsentPopupCate,
16642
16652
  openMultiPosts,
16643
- setOpenMultiPosts
16653
+ setOpenMultiPosts,
16654
+ pageTypeList: (_p = data === null || data === void 0 ? void 0 : data.pageTypeList) !== null && _p !== void 0 ? _p : []
16644
16655
  } }, children));
16645
16656
  };
16646
16657
  function useEditorDataProvider() {
@@ -17964,6 +17975,14 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
17964
17975
  };
17965
17976
  var NavBack$1 = memo(NavBack);
17966
17977
 
17978
+ /*
17979
+ * @Author: binruan@chatlabs.com
17980
+ * @Date: 2024-03-20 10:27:31
17981
+ * @LastEditors: binruan@chatlabs.com
17982
+ * @LastEditTime: 2024-12-13 17:20:22
17983
+ * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
17984
+ *
17985
+ */
17967
17986
  const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], licenseUrl }) => {
17968
17987
  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;
17969
17988
  const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
@@ -17979,13 +17998,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
17979
17998
  const [isReload, setIsReload] = useState(new Date().getTime());
17980
17999
  const skipLinkRef = useRef(false);
17981
18000
  const [pageNum, setPageNum] = useState(2);
17982
- 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();
18001
+ 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();
17983
18002
  const { backMainFeed, productView, jumpToWeb } = useEventReport();
17984
18003
  const isShowFingerTip = useMemo(() => {
17985
18004
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
17986
18005
  }, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
17987
18006
  useEffect(() => {
17988
- refreshFeSessionId();
18007
+ refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
17989
18008
  }, []);
17990
18009
  useEffect(() => {
17991
18010
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
@@ -17994,7 +18013,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
17994
18013
  }
17995
18014
  }, [data === null || data === void 0 ? void 0 : data.length]);
17996
18015
  const handleH5EnterLink = useCallback(() => {
17997
- refreshFeSessionId();
17998
18016
  h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
17999
18017
  if (data.length > 0) {
18000
18018
  const now = new Date();
@@ -18901,7 +18919,7 @@ var index$1 = memo(DiyPortalPreview);
18901
18919
  * @Author: binruan@chatlabs.com
18902
18920
  * @Date: 2023-10-31 10:56:01
18903
18921
  * @LastEditors: binruan@chatlabs.com
18904
- * @LastEditTime: 2024-12-12 14:48:31
18922
+ * @LastEditTime: 2024-10-23 15:07:29
18905
18923
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
18906
18924
  *
18907
18925
  */