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
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';
@@ -832,6 +832,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
832
832
  setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
833
833
  return data;
834
834
  }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
835
+ const refreshFeSession = useCallback((enableReSid) => {
836
+ var _a, _b, _c, _d, _e;
837
+ 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;
838
+ if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
839
+ const sessionStartTime = localStorage.getItem('sessionStartTime');
840
+ const sst = sessionStartTime ? new Date(sessionStartTime) : new Date();
841
+ if (Math.floor((new Date() - sst) / (1000 * 60)) >=
842
+ ((_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)) {
843
+ refreshFeSessionId();
844
+ curTime.current = new Date();
845
+ }
846
+ localStorage.setItem('sessionStartTime', new Date().toISOString());
847
+ }
848
+ else if (enableReSid) {
849
+ refreshFeSessionId();
850
+ }
851
+ }, [data]);
835
852
  const bffEventReport = useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
836
853
  // 关闭 BFF 事件上报
837
854
  if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
@@ -844,6 +861,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
844
861
  // tpChannelId: 'H5' // 后端处理
845
862
  };
846
863
  }
864
+ refreshFeSession();
847
865
  const sessionID = storeAndLoadFeSessionId();
848
866
  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
867
  const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
@@ -859,7 +877,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
859
877
  body: { userInfo: realUserInfo, eventInfo: realEventInfo },
860
878
  type: 'beacon'
861
879
  });
862
- }, [bffFetch, curReqInfo, enableReportEvent, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview, layoutVariantId, globalConfig, playbookType]);
880
+ }, [
881
+ bffFetch,
882
+ curReqInfo,
883
+ enableReportEvent,
884
+ globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
885
+ layoutVariantId,
886
+ globalConfig,
887
+ playbookType,
888
+ refreshFeSession
889
+ ]);
863
890
  const bffFbReport = useCallback(({ eventName, product }) => {
864
891
  var _a, _b, _c, _d, _e;
865
892
  if (!enableReportEvent ||
@@ -985,7 +1012,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
985
1012
  });
986
1013
  }, [bffEventReport, isFromHashtag]);
987
1014
  const h5EnterLink = useCallback(() => {
988
- var _a, _b;
1015
+ var _a, _b, _c, _d, _e;
989
1016
  const queryString = location.search.slice(1);
990
1017
  const params = qs.parse(queryString.replace(/\+/g, '%2B'));
991
1018
  for (const key in params) {
@@ -993,7 +1020,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
993
1020
  }
994
1021
  const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
995
1022
  const time = new Date();
996
- curTime.current = time;
1023
+ 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;
1024
+ 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)) {
1025
+ curTime.current = time;
1026
+ }
997
1027
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
998
1028
  eventInfo: {
999
1029
  eventSubject: 'h5LinkEnterFeed',
@@ -1005,16 +1035,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1005
1035
  utmContent: getVal('utm_content'),
1006
1036
  enterTime: Math.floor(time / 1000) + '',
1007
1037
  requestId: null,
1008
- 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 : '',
1038
+ 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 : '',
1009
1039
  clSource: getVal('cl_source')
1010
1040
  },
1011
1041
  reportLayId: false
1012
1042
  });
1013
- }, [bffEventReport]);
1043
+ }, [bffEventReport, data, curTime]);
1014
1044
  useEffect(() => {
1015
1045
  if (!isShowConsent)
1016
1046
  h5EnterLink();
1017
- }, [isShowConsent]);
1047
+ }, [isShowConsent, h5EnterLink]);
1018
1048
  useEffect(() => {
1019
1049
  if (isShowConsent || isPreview)
1020
1050
  return;
@@ -1158,7 +1188,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1158
1188
  channel,
1159
1189
  eventTimeList,
1160
1190
  setEventTimeList,
1161
- multiPostTimeRef
1191
+ multiPostTimeRef,
1192
+ refreshFeSession
1162
1193
  } }, 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
1194
  rtcList,
1164
1195
  mutateLike: bffMutateLike,
@@ -11981,7 +12012,7 @@ const CommodityList = createMaterial(CommodityListComponent, {
11981
12012
  * @Author: binruan@chatlabs.com
11982
12013
  * @Date: 2023-10-27 14:06:35
11983
12014
  * @LastEditors: binruan@chatlabs.com
11984
- * @LastEditTime: 2024-12-12 15:12:57
12015
+ * @LastEditTime: 2024-08-08 17:32:11
11985
12016
  * @FilePath: \pb-sxp-ui\src\materials\sxp\popup\Iframe\settingRender.tsx
11986
12017
  *
11987
12018
  */
@@ -11995,32 +12026,16 @@ var settingRender$8 = [
11995
12026
  name: ['style', 'backgroundColor']
11996
12027
  }
11997
12028
  ]
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
12029
  }
12014
12030
  ];
12015
12031
 
12016
12032
  const Iframe$1 = (_a) => {
12017
12033
  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"]);
12034
+ 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
12035
  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: {
12036
+ 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;
12037
+ return (React.createElement("div", Object.assign({ className: `${css(Object.assign({}, style))}` }, props),
12038
+ React.createElement("iframe", { src: iframeUrl, style: {
12024
12039
  width: '100%',
12025
12040
  height: 'calc(100% - 50px)',
12026
12041
  marginTop: '50px',
@@ -16603,13 +16618,13 @@ var settingRender$1 = [
16603
16618
  * @Author: binruan@chatlabs.com
16604
16619
  * @Date: 2023-12-26 10:38:53
16605
16620
  * @LastEditors: binruan@chatlabs.com
16606
- * @LastEditTime: 2024-10-29 18:04:27
16621
+ * @LastEditTime: 2024-12-11 18:24:31
16607
16622
  * @FilePath: \pb-sxp-ui\src\core\context\EditorDataProvider.tsx
16608
16623
  *
16609
16624
  */
16610
16625
  const EditorDataContext = createContext({});
16611
16626
  const EditorDataProvider = ({ children, data }) => {
16612
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
16627
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
16613
16628
  const [openHashtag, setOpenHashtag] = useState(false);
16614
16629
  const [openConsent, setOpenConsent] = useState(false);
16615
16630
  const [consentPopupCate, setConsentPopupCate] = useState('');
@@ -16640,7 +16655,8 @@ const EditorDataProvider = ({ children, data }) => {
16640
16655
  consentPopupCate,
16641
16656
  setConsentPopupCate,
16642
16657
  openMultiPosts,
16643
- setOpenMultiPosts
16658
+ setOpenMultiPosts,
16659
+ pageTypeList: (_p = data === null || data === void 0 ? void 0 : data.pageTypeList) !== null && _p !== void 0 ? _p : []
16644
16660
  } }, children));
16645
16661
  };
16646
16662
  function useEditorDataProvider() {
@@ -17964,6 +17980,14 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
17964
17980
  };
17965
17981
  var NavBack$1 = memo(NavBack);
17966
17982
 
17983
+ /*
17984
+ * @Author: binruan@chatlabs.com
17985
+ * @Date: 2024-03-20 10:27:31
17986
+ * @LastEditors: binruan@chatlabs.com
17987
+ * @LastEditTime: 2024-12-16 15:03:38
17988
+ * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
17989
+ *
17990
+ */
17967
17991
  const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], licenseUrl }) => {
17968
17992
  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
17993
  const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
@@ -17979,13 +18003,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
17979
18003
  const [isReload, setIsReload] = useState(new Date().getTime());
17980
18004
  const skipLinkRef = useRef(false);
17981
18005
  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();
18006
+ 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
18007
  const { backMainFeed, productView, jumpToWeb } = useEventReport();
17984
18008
  const isShowFingerTip = useMemo(() => {
17985
18009
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
17986
18010
  }, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
17987
18011
  useEffect(() => {
17988
- refreshFeSessionId();
18012
+ refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true);
17989
18013
  }, []);
17990
18014
  useEffect(() => {
17991
18015
  if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
@@ -17994,7 +18018,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
17994
18018
  }
17995
18019
  }, [data === null || data === void 0 ? void 0 : data.length]);
17996
18020
  const handleH5EnterLink = useCallback(() => {
17997
- refreshFeSessionId();
17998
18021
  h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
17999
18022
  if (data.length > 0) {
18000
18023
  const now = new Date();
@@ -18901,7 +18924,7 @@ var index$1 = memo(DiyPortalPreview);
18901
18924
  * @Author: binruan@chatlabs.com
18902
18925
  * @Date: 2023-10-31 10:56:01
18903
18926
  * @LastEditors: binruan@chatlabs.com
18904
- * @LastEditTime: 2024-12-12 14:48:31
18927
+ * @LastEditTime: 2024-10-23 15:07:29
18905
18928
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
18906
18929
  *
18907
18930
  */