pb-sxp-ui 1.10.11 → 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 +47 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +47 -13
- 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 +47 -13
- 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/Modal/index.js +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/lib/core/components/SxpPageRender/Modal/index.js +1 -1
- 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/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.
|
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.
|
491
|
+
window.localStorage.setItem(feRealSessionIdKey, result);
|
492
492
|
};
|
493
493
|
// 获取 sessionID
|
494
494
|
const getFeSessionId = () => {
|
495
|
-
return window.
|
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
|
-
}, [
|
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,
|
@@ -9763,7 +9789,7 @@ SwiperSlide.displayName = 'SwiperSlide';
|
|
9763
9789
|
* @Author: binruan@chatlabs.com
|
9764
9790
|
* @Date: 2023-11-02 18:34:34
|
9765
9791
|
* @LastEditors: binruan@chatlabs.com
|
9766
|
-
* @LastEditTime: 2024-
|
9792
|
+
* @LastEditTime: 2024-12-12 16:35:54
|
9767
9793
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Modal\index.tsx
|
9768
9794
|
*
|
9769
9795
|
*/
|
@@ -9821,7 +9847,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
9821
9847
|
}, [isOpen, popup]);
|
9822
9848
|
const child = useCallback(() => {
|
9823
9849
|
return children;
|
9824
|
-
}, [_popup, openState, globalConfig]);
|
9850
|
+
}, [_popup, openState, globalConfig, schema]);
|
9825
9851
|
useEffect(() => {
|
9826
9852
|
const trapFocus = (element) => {
|
9827
9853
|
var focusableEls = element === null || element === void 0 ? void 0 : element.querySelectorAll('[role="button"],a, a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
|
@@ -16587,13 +16613,13 @@ var settingRender$1 = [
|
|
16587
16613
|
* @Author: binruan@chatlabs.com
|
16588
16614
|
* @Date: 2023-12-26 10:38:53
|
16589
16615
|
* @LastEditors: binruan@chatlabs.com
|
16590
|
-
* @LastEditTime: 2024-
|
16616
|
+
* @LastEditTime: 2024-12-11 18:24:31
|
16591
16617
|
* @FilePath: \pb-sxp-ui\src\core\context\EditorDataProvider.tsx
|
16592
16618
|
*
|
16593
16619
|
*/
|
16594
16620
|
const EditorDataContext = createContext({});
|
16595
16621
|
const EditorDataProvider = ({ children, data }) => {
|
16596
|
-
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;
|
16597
16623
|
const [openHashtag, setOpenHashtag] = useState(false);
|
16598
16624
|
const [openConsent, setOpenConsent] = useState(false);
|
16599
16625
|
const [consentPopupCate, setConsentPopupCate] = useState('');
|
@@ -16624,7 +16650,8 @@ const EditorDataProvider = ({ children, data }) => {
|
|
16624
16650
|
consentPopupCate,
|
16625
16651
|
setConsentPopupCate,
|
16626
16652
|
openMultiPosts,
|
16627
|
-
setOpenMultiPosts
|
16653
|
+
setOpenMultiPosts,
|
16654
|
+
pageTypeList: (_p = data === null || data === void 0 ? void 0 : data.pageTypeList) !== null && _p !== void 0 ? _p : []
|
16628
16655
|
} }, children));
|
16629
16656
|
};
|
16630
16657
|
function useEditorDataProvider() {
|
@@ -17948,6 +17975,14 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
|
17948
17975
|
};
|
17949
17976
|
var NavBack$1 = memo(NavBack);
|
17950
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
|
+
*/
|
17951
17986
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], licenseUrl }) => {
|
17952
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;
|
17953
17988
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
@@ -17963,13 +17998,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
17963
17998
|
const [isReload, setIsReload] = useState(new Date().getTime());
|
17964
17999
|
const skipLinkRef = useRef(false);
|
17965
18000
|
const [pageNum, setPageNum] = useState(2);
|
17966
|
-
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();
|
17967
18002
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
17968
18003
|
const isShowFingerTip = useMemo(() => {
|
17969
18004
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
17970
18005
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
17971
18006
|
useEffect(() => {
|
17972
|
-
|
18007
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
|
17973
18008
|
}, []);
|
17974
18009
|
useEffect(() => {
|
17975
18010
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
@@ -17978,7 +18013,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
17978
18013
|
}
|
17979
18014
|
}, [data === null || data === void 0 ? void 0 : data.length]);
|
17980
18015
|
const handleH5EnterLink = useCallback(() => {
|
17981
|
-
refreshFeSessionId();
|
17982
18016
|
h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
|
17983
18017
|
if (data.length > 0) {
|
17984
18018
|
const now = new Date();
|