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.
- package/dist/index.cjs +51 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -33
- 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 +51 -33
- 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/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/es/materials/sxp/popup/Iframe/index.d.ts +0 -4
- package/es/materials/sxp/popup/Iframe/index.js +4 -5
- package/es/materials/sxp/popup/Iframe/settingRender.js +0 -15
- 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/lib/materials/sxp/popup/Iframe/index.d.ts +0 -4
- package/lib/materials/sxp/popup/Iframe/index.js +4 -5
- package/lib/materials/sxp/popup/Iframe/settingRender.js +0 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -504,17 +504,17 @@ const storeAndLoadFeSessionId = () => {
|
|
504
504
|
let result = getFeSessionId();
|
505
505
|
if (!result) {
|
506
506
|
result = generateFeSessionId();
|
507
|
-
window.
|
507
|
+
window.localStorage.setItem(feRealSessionIdKey, result);
|
508
508
|
}
|
509
509
|
return result;
|
510
510
|
};
|
511
511
|
const refreshFeSessionId = () => {
|
512
512
|
const result = generateFeSessionId();
|
513
|
-
window.
|
513
|
+
window.localStorage.setItem(feRealSessionIdKey, result);
|
514
514
|
};
|
515
515
|
// 获取 sessionID
|
516
516
|
const getFeSessionId = () => {
|
517
|
-
return window.
|
517
|
+
return window.localStorage.getItem(feRealSessionIdKey);
|
518
518
|
};
|
519
519
|
|
520
520
|
const FAKE_USER_KEY = 'SXP_FAKE_USER_ID';
|
@@ -673,6 +673,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
673
673
|
const themeTag = React.useRef();
|
674
674
|
const curTime = React.useRef();
|
675
675
|
const multiPostTimeRef = React.useRef();
|
676
|
+
const sessionTimeRef = React.useRef();
|
676
677
|
const [selectTag, setSelectTag] = React.useState(DEFAULT_TAG);
|
677
678
|
const checkCommodityIndexRef = React.useRef(-1);
|
678
679
|
const popupCurTimeRef = React.useRef(null);
|
@@ -854,6 +855,20 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
854
855
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
855
856
|
return data;
|
856
857
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
858
|
+
const refreshFeSession = React.useCallback(() => {
|
859
|
+
var _a, _b, _c, _d, _e, _f;
|
860
|
+
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;
|
861
|
+
if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
|
862
|
+
if (Math.floor((new Date() - ((_d = sessionTimeRef.current) !== null && _d !== void 0 ? _d : new Date())) / (1000 * 60)) >=
|
863
|
+
((_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)) {
|
864
|
+
refreshFeSessionId();
|
865
|
+
}
|
866
|
+
}
|
867
|
+
else {
|
868
|
+
refreshFeSessionId();
|
869
|
+
}
|
870
|
+
sessionTimeRef.current = new Date();
|
871
|
+
}, [data, sessionTimeRef]);
|
857
872
|
const bffEventReport = React.useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
|
858
873
|
// 关闭 BFF 事件上报
|
859
874
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
@@ -866,6 +881,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
866
881
|
// tpChannelId: 'H5' // 后端处理
|
867
882
|
};
|
868
883
|
}
|
884
|
+
refreshFeSession();
|
869
885
|
const sessionID = storeAndLoadFeSessionId();
|
870
886
|
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 + '' }));
|
871
887
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
@@ -881,7 +897,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
881
897
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
882
898
|
type: 'beacon'
|
883
899
|
});
|
884
|
-
}, [
|
900
|
+
}, [
|
901
|
+
bffFetch,
|
902
|
+
curReqInfo,
|
903
|
+
enableReportEvent,
|
904
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
905
|
+
layoutVariantId,
|
906
|
+
globalConfig,
|
907
|
+
playbookType,
|
908
|
+
refreshFeSession
|
909
|
+
]);
|
885
910
|
const bffFbReport = React.useCallback(({ eventName, product }) => {
|
886
911
|
var _a, _b, _c, _d, _e;
|
887
912
|
if (!enableReportEvent ||
|
@@ -1180,7 +1205,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1180
1205
|
channel,
|
1181
1206
|
eventTimeList,
|
1182
1207
|
setEventTimeList,
|
1183
|
-
multiPostTimeRef
|
1208
|
+
multiPostTimeRef,
|
1209
|
+
refreshFeSession
|
1184
1210
|
} }, 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({
|
1185
1211
|
rtcList,
|
1186
1212
|
mutateLike: bffMutateLike,
|
@@ -12003,7 +12029,7 @@ const CommodityList = createMaterial(CommodityListComponent, {
|
|
12003
12029
|
* @Author: binruan@chatlabs.com
|
12004
12030
|
* @Date: 2023-10-27 14:06:35
|
12005
12031
|
* @LastEditors: binruan@chatlabs.com
|
12006
|
-
* @LastEditTime: 2024-
|
12032
|
+
* @LastEditTime: 2024-08-08 17:32:11
|
12007
12033
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\popup\Iframe\settingRender.tsx
|
12008
12034
|
*
|
12009
12035
|
*/
|
@@ -12017,32 +12043,16 @@ var settingRender$8 = [
|
|
12017
12043
|
name: ['style', 'backgroundColor']
|
12018
12044
|
}
|
12019
12045
|
]
|
12020
|
-
},
|
12021
|
-
{
|
12022
|
-
title: 'iframe',
|
12023
|
-
child: [
|
12024
|
-
{
|
12025
|
-
type: 'TextArea',
|
12026
|
-
label: 'url',
|
12027
|
-
name: ['props', 'iframe', 'src']
|
12028
|
-
},
|
12029
|
-
{
|
12030
|
-
type: 'TextArea',
|
12031
|
-
label: 'allow',
|
12032
|
-
name: ['props', 'iframe', 'allow']
|
12033
|
-
}
|
12034
|
-
]
|
12035
12046
|
}
|
12036
12047
|
];
|
12037
12048
|
|
12038
12049
|
const Iframe$1 = (_a) => {
|
12039
12050
|
var _b, _c;
|
12040
|
-
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel
|
12051
|
+
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"]);
|
12041
12052
|
const { popupDetailData } = useSxpDataSource();
|
12042
|
-
const
|
12043
|
-
|
12044
|
-
|
12045
|
-
React.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
|
12053
|
+
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;
|
12054
|
+
return (React.createElement("div", Object.assign({ className: `${css.css(Object.assign({}, style))}` }, props),
|
12055
|
+
React.createElement("iframe", { src: iframeUrl, style: {
|
12046
12056
|
width: '100%',
|
12047
12057
|
height: 'calc(100% - 50px)',
|
12048
12058
|
marginTop: '50px',
|
@@ -16625,13 +16635,13 @@ var settingRender$1 = [
|
|
16625
16635
|
* @Author: binruan@chatlabs.com
|
16626
16636
|
* @Date: 2023-12-26 10:38:53
|
16627
16637
|
* @LastEditors: binruan@chatlabs.com
|
16628
|
-
* @LastEditTime: 2024-
|
16638
|
+
* @LastEditTime: 2024-12-11 18:24:31
|
16629
16639
|
* @FilePath: \pb-sxp-ui\src\core\context\EditorDataProvider.tsx
|
16630
16640
|
*
|
16631
16641
|
*/
|
16632
16642
|
const EditorDataContext = React.createContext({});
|
16633
16643
|
const EditorDataProvider = ({ children, data }) => {
|
16634
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
16644
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
16635
16645
|
const [openHashtag, setOpenHashtag] = React.useState(false);
|
16636
16646
|
const [openConsent, setOpenConsent] = React.useState(false);
|
16637
16647
|
const [consentPopupCate, setConsentPopupCate] = React.useState('');
|
@@ -16662,7 +16672,8 @@ const EditorDataProvider = ({ children, data }) => {
|
|
16662
16672
|
consentPopupCate,
|
16663
16673
|
setConsentPopupCate,
|
16664
16674
|
openMultiPosts,
|
16665
|
-
setOpenMultiPosts
|
16675
|
+
setOpenMultiPosts,
|
16676
|
+
pageTypeList: (_p = data === null || data === void 0 ? void 0 : data.pageTypeList) !== null && _p !== void 0 ? _p : []
|
16666
16677
|
} }, children));
|
16667
16678
|
};
|
16668
16679
|
function useEditorDataProvider() {
|
@@ -17986,6 +17997,14 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
|
17986
17997
|
};
|
17987
17998
|
var NavBack$1 = React.memo(NavBack);
|
17988
17999
|
|
18000
|
+
/*
|
18001
|
+
* @Author: binruan@chatlabs.com
|
18002
|
+
* @Date: 2024-03-20 10:27:31
|
18003
|
+
* @LastEditors: binruan@chatlabs.com
|
18004
|
+
* @LastEditTime: 2024-12-13 17:20:22
|
18005
|
+
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
18006
|
+
*
|
18007
|
+
*/
|
17989
18008
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], licenseUrl }) => {
|
17990
18009
|
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;
|
17991
18010
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
@@ -18001,13 +18020,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
18001
18020
|
const [isReload, setIsReload] = React.useState(new Date().getTime());
|
18002
18021
|
const skipLinkRef = React.useRef(false);
|
18003
18022
|
const [pageNum, setPageNum] = React.useState(2);
|
18004
|
-
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();
|
18023
|
+
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();
|
18005
18024
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
18006
18025
|
const isShowFingerTip = React.useMemo(() => {
|
18007
18026
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
18008
18027
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
18009
18028
|
React.useEffect(() => {
|
18010
|
-
|
18029
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession();
|
18011
18030
|
}, []);
|
18012
18031
|
React.useEffect(() => {
|
18013
18032
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
@@ -18016,7 +18035,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
18016
18035
|
}
|
18017
18036
|
}, [data === null || data === void 0 ? void 0 : data.length]);
|
18018
18037
|
const handleH5EnterLink = React.useCallback(() => {
|
18019
|
-
refreshFeSessionId();
|
18020
18038
|
h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
|
18021
18039
|
if (data.length > 0) {
|
18022
18040
|
const now = new Date();
|
@@ -18923,7 +18941,7 @@ var index$1 = React.memo(DiyPortalPreview);
|
|
18923
18941
|
* @Author: binruan@chatlabs.com
|
18924
18942
|
* @Date: 2023-10-31 10:56:01
|
18925
18943
|
* @LastEditors: binruan@chatlabs.com
|
18926
|
-
* @LastEditTime: 2024-
|
18944
|
+
* @LastEditTime: 2024-10-23 15:07:29
|
18927
18945
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
|
18928
18946
|
*
|
18929
18947
|
*/
|