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.
- package/dist/index.cjs +61 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +61 -38
- 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 +61 -38
- 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 +39 -8
- 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 +38 -7
- 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';
|
@@ -854,6 +854,23 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
854
854
|
setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
|
855
855
|
return data;
|
856
856
|
}), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
|
857
|
+
const refreshFeSession = React.useCallback((enableReSid) => {
|
858
|
+
var _a, _b, _c, _d, _e;
|
859
|
+
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;
|
860
|
+
if ((_c = defaultGlobalConfig === null || defaultGlobalConfig === void 0 ? void 0 : defaultGlobalConfig.session) === null || _c === void 0 ? void 0 : _c.enable) {
|
861
|
+
const sessionStartTime = localStorage.getItem('sessionStartTime');
|
862
|
+
const sst = sessionStartTime ? new Date(sessionStartTime) : new Date();
|
863
|
+
if (Math.floor((new Date() - sst) / (1000 * 60)) >=
|
864
|
+
((_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)) {
|
865
|
+
refreshFeSessionId();
|
866
|
+
curTime.current = new Date();
|
867
|
+
}
|
868
|
+
localStorage.setItem('sessionStartTime', new Date().toISOString());
|
869
|
+
}
|
870
|
+
else if (enableReSid) {
|
871
|
+
refreshFeSessionId();
|
872
|
+
}
|
873
|
+
}, [data]);
|
857
874
|
const bffEventReport = React.useCallback(({ userInfo, eventInfo, reportLayId = true }) => {
|
858
875
|
// 关闭 BFF 事件上报
|
859
876
|
if (!enableReportEvent || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview)) {
|
@@ -866,6 +883,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
866
883
|
// tpChannelId: 'H5' // 后端处理
|
867
884
|
};
|
868
885
|
}
|
886
|
+
refreshFeSession();
|
869
887
|
const sessionID = storeAndLoadFeSessionId();
|
870
888
|
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
889
|
const realUserInfo = Object.entries(userInfo).map(([k, v]) => ({ name: k, value: v }));
|
@@ -881,7 +899,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
881
899
|
body: { userInfo: realUserInfo, eventInfo: realEventInfo },
|
882
900
|
type: 'beacon'
|
883
901
|
});
|
884
|
-
}, [
|
902
|
+
}, [
|
903
|
+
bffFetch,
|
904
|
+
curReqInfo,
|
905
|
+
enableReportEvent,
|
906
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview,
|
907
|
+
layoutVariantId,
|
908
|
+
globalConfig,
|
909
|
+
playbookType,
|
910
|
+
refreshFeSession
|
911
|
+
]);
|
885
912
|
const bffFbReport = React.useCallback(({ eventName, product }) => {
|
886
913
|
var _a, _b, _c, _d, _e;
|
887
914
|
if (!enableReportEvent ||
|
@@ -1007,7 +1034,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1007
1034
|
});
|
1008
1035
|
}, [bffEventReport, isFromHashtag]);
|
1009
1036
|
const h5EnterLink = React.useCallback(() => {
|
1010
|
-
var _a, _b;
|
1037
|
+
var _a, _b, _c, _d, _e;
|
1011
1038
|
const queryString = location.search.slice(1);
|
1012
1039
|
const params = qs.parse(queryString.replace(/\+/g, '%2B'));
|
1013
1040
|
for (const key in params) {
|
@@ -1015,7 +1042,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1015
1042
|
}
|
1016
1043
|
const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
|
1017
1044
|
const time = new Date();
|
1018
|
-
|
1045
|
+
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;
|
1046
|
+
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)) {
|
1047
|
+
curTime.current = time;
|
1048
|
+
}
|
1019
1049
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
1020
1050
|
eventInfo: {
|
1021
1051
|
eventSubject: 'h5LinkEnterFeed',
|
@@ -1027,16 +1057,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1027
1057
|
utmContent: getVal('utm_content'),
|
1028
1058
|
enterTime: Math.floor(time / 1000) + '',
|
1029
1059
|
requestId: null,
|
1030
|
-
enterUrl: (
|
1060
|
+
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 : '',
|
1031
1061
|
clSource: getVal('cl_source')
|
1032
1062
|
},
|
1033
1063
|
reportLayId: false
|
1034
1064
|
});
|
1035
|
-
}, [bffEventReport]);
|
1065
|
+
}, [bffEventReport, data, curTime]);
|
1036
1066
|
React.useEffect(() => {
|
1037
1067
|
if (!isShowConsent)
|
1038
1068
|
h5EnterLink();
|
1039
|
-
}, [isShowConsent]);
|
1069
|
+
}, [isShowConsent, h5EnterLink]);
|
1040
1070
|
React.useEffect(() => {
|
1041
1071
|
if (isShowConsent || isPreview)
|
1042
1072
|
return;
|
@@ -1180,7 +1210,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1180
1210
|
channel,
|
1181
1211
|
eventTimeList,
|
1182
1212
|
setEventTimeList,
|
1183
|
-
multiPostTimeRef
|
1213
|
+
multiPostTimeRef,
|
1214
|
+
refreshFeSession
|
1184
1215
|
} }, 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
1216
|
rtcList,
|
1186
1217
|
mutateLike: bffMutateLike,
|
@@ -12003,7 +12034,7 @@ const CommodityList = createMaterial(CommodityListComponent, {
|
|
12003
12034
|
* @Author: binruan@chatlabs.com
|
12004
12035
|
* @Date: 2023-10-27 14:06:35
|
12005
12036
|
* @LastEditors: binruan@chatlabs.com
|
12006
|
-
* @LastEditTime: 2024-
|
12037
|
+
* @LastEditTime: 2024-08-08 17:32:11
|
12007
12038
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\popup\Iframe\settingRender.tsx
|
12008
12039
|
*
|
12009
12040
|
*/
|
@@ -12017,32 +12048,16 @@ var settingRender$8 = [
|
|
12017
12048
|
name: ['style', 'backgroundColor']
|
12018
12049
|
}
|
12019
12050
|
]
|
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
12051
|
}
|
12036
12052
|
];
|
12037
12053
|
|
12038
12054
|
const Iframe$1 = (_a) => {
|
12039
12055
|
var _b, _c;
|
12040
|
-
var { content, btnText, style, icon, isPopup, isExternalLink, onClose, onClick, submitButtonStyle, contentStyle, isTel
|
12056
|
+
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
12057
|
const { popupDetailData } = useSxpDataSource();
|
12042
|
-
const
|
12043
|
-
|
12044
|
-
|
12045
|
-
React.createElement("iframe", { src: iframeUrl, allow: allow, scrolling: 'no', style: {
|
12058
|
+
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;
|
12059
|
+
return (React.createElement("div", Object.assign({ className: `${css.css(Object.assign({}, style))}` }, props),
|
12060
|
+
React.createElement("iframe", { src: iframeUrl, style: {
|
12046
12061
|
width: '100%',
|
12047
12062
|
height: 'calc(100% - 50px)',
|
12048
12063
|
marginTop: '50px',
|
@@ -16625,13 +16640,13 @@ var settingRender$1 = [
|
|
16625
16640
|
* @Author: binruan@chatlabs.com
|
16626
16641
|
* @Date: 2023-12-26 10:38:53
|
16627
16642
|
* @LastEditors: binruan@chatlabs.com
|
16628
|
-
* @LastEditTime: 2024-
|
16643
|
+
* @LastEditTime: 2024-12-11 18:24:31
|
16629
16644
|
* @FilePath: \pb-sxp-ui\src\core\context\EditorDataProvider.tsx
|
16630
16645
|
*
|
16631
16646
|
*/
|
16632
16647
|
const EditorDataContext = React.createContext({});
|
16633
16648
|
const EditorDataProvider = ({ children, data }) => {
|
16634
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
16649
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
16635
16650
|
const [openHashtag, setOpenHashtag] = React.useState(false);
|
16636
16651
|
const [openConsent, setOpenConsent] = React.useState(false);
|
16637
16652
|
const [consentPopupCate, setConsentPopupCate] = React.useState('');
|
@@ -16662,7 +16677,8 @@ const EditorDataProvider = ({ children, data }) => {
|
|
16662
16677
|
consentPopupCate,
|
16663
16678
|
setConsentPopupCate,
|
16664
16679
|
openMultiPosts,
|
16665
|
-
setOpenMultiPosts
|
16680
|
+
setOpenMultiPosts,
|
16681
|
+
pageTypeList: (_p = data === null || data === void 0 ? void 0 : data.pageTypeList) !== null && _p !== void 0 ? _p : []
|
16666
16682
|
} }, children));
|
16667
16683
|
};
|
16668
16684
|
function useEditorDataProvider() {
|
@@ -17986,6 +18002,14 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
|
17986
18002
|
};
|
17987
18003
|
var NavBack$1 = React.memo(NavBack);
|
17988
18004
|
|
18005
|
+
/*
|
18006
|
+
* @Author: binruan@chatlabs.com
|
18007
|
+
* @Date: 2024-03-20 10:27:31
|
18008
|
+
* @LastEditors: binruan@chatlabs.com
|
18009
|
+
* @LastEditTime: 2024-12-16 15:03:38
|
18010
|
+
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
18011
|
+
*
|
18012
|
+
*/
|
17989
18013
|
const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], licenseUrl }) => {
|
17990
18014
|
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
18015
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
@@ -18001,13 +18025,13 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
18001
18025
|
const [isReload, setIsReload] = React.useState(new Date().getTime());
|
18002
18026
|
const skipLinkRef = React.useRef(false);
|
18003
18027
|
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();
|
18028
|
+
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
18029
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
18006
18030
|
const isShowFingerTip = React.useMemo(() => {
|
18007
18031
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
18008
18032
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
18009
18033
|
React.useEffect(() => {
|
18010
|
-
|
18034
|
+
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(true);
|
18011
18035
|
}, []);
|
18012
18036
|
React.useEffect(() => {
|
18013
18037
|
if ((data === null || data === void 0 ? void 0 : data.length) > 0) {
|
@@ -18016,7 +18040,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
18016
18040
|
}
|
18017
18041
|
}, [data === null || data === void 0 ? void 0 : data.length]);
|
18018
18042
|
const handleH5EnterLink = React.useCallback(() => {
|
18019
|
-
refreshFeSessionId();
|
18020
18043
|
h5EnterLink === null || h5EnterLink === void 0 ? void 0 : h5EnterLink();
|
18021
18044
|
if (data.length > 0) {
|
18022
18045
|
const now = new Date();
|
@@ -18923,7 +18946,7 @@ var index$1 = React.memo(DiyPortalPreview);
|
|
18923
18946
|
* @Author: binruan@chatlabs.com
|
18924
18947
|
* @Date: 2023-10-31 10:56:01
|
18925
18948
|
* @LastEditors: binruan@chatlabs.com
|
18926
|
-
* @LastEditTime: 2024-
|
18949
|
+
* @LastEditTime: 2024-10-23 15:07:29
|
18927
18950
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Popup\index.tsx
|
18928
18951
|
*
|
18929
18952
|
*/
|