pb-sxp-ui 1.10.0 → 1.10.2
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 +25 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -25
- 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 +25 -25
- 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/SxpPageCore/index.js +3 -2
- package/es/core/components/SxpPageRender/index.js +4 -4
- package/es/core/context/EditorContext.d.ts +0 -2
- package/es/core/context/EditorContext.js +3 -9
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -0
- package/es/core/context/SxpDataSourceProvider.js +10 -5
- package/es/materials/sxp/MultiPosts/index.js +4 -5
- package/lib/core/components/SxpPageCore/index.js +3 -2
- package/lib/core/components/SxpPageRender/index.js +4 -4
- package/lib/core/context/EditorContext.d.ts +0 -2
- package/lib/core/context/EditorContext.js +3 -9
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -0
- package/lib/core/context/SxpDataSourceProvider.js +10 -5
- package/lib/materials/sxp/MultiPosts/index.js +3 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -653,9 +653,8 @@ var DataSourceType;
|
|
653
653
|
DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
|
654
654
|
})(DataSourceType || (DataSourceType = {}));
|
655
655
|
const DEFAULT_TAG = 'FOR U';
|
656
|
-
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, onUpdateSchema }) => {
|
656
|
+
const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, onUpdateSchema, onUpdateChannel }) => {
|
657
657
|
var _a, _b, _c, _d, _e;
|
658
|
-
const { channel } = useEditor();
|
659
658
|
const [rtcList, setRtcList] = React.useState([]);
|
660
659
|
const [tagList, setTagList] = React.useState([]);
|
661
660
|
const [loading, setLoading] = React.useState(false);
|
@@ -681,11 +680,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
681
680
|
const [pageData, setPageData] = React.useState(data);
|
682
681
|
const [showConsent, setShowConsent] = React.useState(false);
|
683
682
|
const [layoutVariantId, setLayoutVariantId] = React.useState();
|
683
|
+
const [channel, setChannel] = React.useState();
|
684
684
|
const isShowConsent = React.useMemo(() => {
|
685
685
|
var _a, _b, _c, _d;
|
686
686
|
return (((((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent) &&
|
687
687
|
showConsent);
|
688
688
|
}, [isAgreePolicy, globalConfig, isOpenConsent, isEditor, showConsent]);
|
689
|
+
const updateChannel = React.useCallback((d) => {
|
690
|
+
onUpdateChannel === null || onUpdateChannel === void 0 ? void 0 : onUpdateChannel(d);
|
691
|
+
setChannel(d);
|
692
|
+
}, []);
|
689
693
|
const getFilterRecList = React.useCallback((data) => {
|
690
694
|
var _a;
|
691
695
|
const recList = data === null || data === void 0 ? void 0 : data.recList;
|
@@ -1016,7 +1020,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1016
1020
|
h5EnterLink();
|
1017
1021
|
}, [isShowConsent]);
|
1018
1022
|
React.useEffect(() => {
|
1019
|
-
if (isShowConsent)
|
1023
|
+
if (isShowConsent || isPreview)
|
1020
1024
|
return;
|
1021
1025
|
setLoading(true);
|
1022
1026
|
let layId;
|
@@ -1126,7 +1130,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1126
1130
|
popupCurTimeRef,
|
1127
1131
|
checkCommodityIndexRef,
|
1128
1132
|
isEditor,
|
1129
|
-
isNoMoreData
|
1133
|
+
isNoMoreData,
|
1134
|
+
updateChannel,
|
1135
|
+
channel
|
1130
1136
|
} }, 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({
|
1131
1137
|
rtcList,
|
1132
1138
|
mutateLike: bffMutateLike,
|
@@ -1256,7 +1262,6 @@ const EditorContext = React.createContext({
|
|
1256
1262
|
});
|
1257
1263
|
const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enableDataSource = true, utmVal }, ref) => {
|
1258
1264
|
const [currentNode, setCurrentNode] = React.useState(null);
|
1259
|
-
const [channel, setChannel] = React.useState();
|
1260
1265
|
const [_schema, setSchema] = React.useState(schema || {
|
1261
1266
|
pointData: [item],
|
1262
1267
|
dataSource: [],
|
@@ -1277,9 +1282,6 @@ const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enable
|
|
1277
1282
|
const [undoStack, setUndoStack] = React.useState([[item]]);
|
1278
1283
|
const [redoStack, setRedoStack] = React.useState([]);
|
1279
1284
|
const [popup, setPopup] = React.useState(popupInit);
|
1280
|
-
const channelParams = React.useMemo(() => {
|
1281
|
-
return channel || utmVal;
|
1282
|
-
}, [channel, utmVal]);
|
1283
1285
|
typeof window !== 'undefined' &&
|
1284
1286
|
(window.sxpPopup = (type, aniType) => {
|
1285
1287
|
setPopup(Object.assign(Object.assign(Object.assign({}, popupInit), { id: type }), aniType));
|
@@ -1288,10 +1290,10 @@ const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enable
|
|
1288
1290
|
(window.getJointUtmLink = (url) => {
|
1289
1291
|
setSlideSkipState();
|
1290
1292
|
if ((url === null || url === void 0 ? void 0 : url.indexOf('?')) !== -1) {
|
1291
|
-
return url + (
|
1293
|
+
return url + (utmVal ? '&' + utmVal : '');
|
1292
1294
|
}
|
1293
1295
|
else {
|
1294
|
-
return url + (
|
1296
|
+
return url + (utmVal ? '?' + utmVal : '');
|
1295
1297
|
}
|
1296
1298
|
});
|
1297
1299
|
// 切换页面类型,清空操作栈
|
@@ -1359,9 +1361,7 @@ const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enable
|
|
1359
1361
|
setUndoStack,
|
1360
1362
|
getCurPageConf,
|
1361
1363
|
popup,
|
1362
|
-
setPopup
|
1363
|
-
channel,
|
1364
|
-
setChannel
|
1364
|
+
setPopup
|
1365
1365
|
} },
|
1366
1366
|
React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
|
1367
1367
|
});
|
@@ -16819,9 +16819,8 @@ var settingRender = [
|
|
16819
16819
|
const MultiPosts$1 = (_a) => {
|
16820
16820
|
var _b, _c;
|
16821
16821
|
var { bgImgUrl, style, recData } = _a, props = __rest(_a, ["bgImgUrl", "style", "recData"]);
|
16822
|
-
const {
|
16823
|
-
const {
|
16824
|
-
const { isActive } = useSwiperSlide();
|
16822
|
+
const { bffEventReport, curTime, updateChannel } = useSxpDataSource();
|
16823
|
+
const { isActive } = useSwiperSlide() || {};
|
16825
16824
|
const initRef = React.useRef(false);
|
16826
16825
|
const viewTime = React.useRef();
|
16827
16826
|
const traceinfo = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.traceInfo) !== null && _c !== void 0 ? _c : '';
|
@@ -16850,7 +16849,7 @@ const MultiPosts$1 = (_a) => {
|
|
16850
16849
|
});
|
16851
16850
|
if ((v === null || v === void 0 ? void 0 : v.linkType) === 'recommendFlow') {
|
16852
16851
|
endMultiPost('multipostClick');
|
16853
|
-
|
16852
|
+
updateChannel === null || updateChannel === void 0 ? void 0 : updateChannel(value);
|
16854
16853
|
curTime.current = new Date();
|
16855
16854
|
}
|
16856
16855
|
else {
|
@@ -17936,7 +17935,7 @@ var NavBack$1 = React.memo(NavBack);
|
|
17936
17935
|
* @Author: binruan@chatlabs.com
|
17937
17936
|
* @Date: 2024-03-20 10:27:31
|
17938
17937
|
* @LastEditors: binruan@chatlabs.com
|
17939
|
-
* @LastEditTime: 2024-11-27
|
17938
|
+
* @LastEditTime: 2024-11-27 17:08:59
|
17940
17939
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
17941
17940
|
*
|
17942
17941
|
*/
|
@@ -17944,7 +17943,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
17944
17943
|
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;
|
17945
17944
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
17946
17945
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
17947
|
-
const { schema
|
17946
|
+
const { schema } = useEditor();
|
17948
17947
|
const { openMultiPosts } = useEditorDataProvider();
|
17949
17948
|
const [activeIndex, setActiveIndex] = React.useState(0);
|
17950
17949
|
const viewImageStartTime = React.useRef(0);
|
@@ -17955,7 +17954,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
17955
17954
|
const [isReload, setIsReload] = React.useState(new Date().getTime());
|
17956
17955
|
const skipLinkRef = React.useRef(false);
|
17957
17956
|
const [pageNum, setPageNum] = React.useState(2);
|
17958
|
-
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 } = useSxpDataSource();
|
17957
|
+
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();
|
17959
17958
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
17960
17959
|
const isShowFingerTip = React.useMemo(() => {
|
17961
17960
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
@@ -18449,8 +18448,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
18449
18448
|
React.createElement(Tagbar$1, { tagList: tagList, setActiveIndex: setActiveIndex, style: {
|
18450
18449
|
top: minusHeight
|
18451
18450
|
} }),
|
18452
|
-
((_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.backButton) === null || _f === void 0 ? void 0 : _f.enable) && !channel && (React.createElement(NavBack$1, { data: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.backButton, minusHeight: minusHeight, tagHeight: tagHeight, onClick: () => history === null || history === void 0 ? void 0 : history.back() })),
|
18453
|
-
((_l = (_k = (_j = (_h = (_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.item) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.backButton) === null || _l === void 0 ? void 0 : _l.enable) && channel && (React.createElement(NavBack$1, { data: (_q = (_p = (_o = (_m = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.item) === null || _p === void 0 ? void 0 : _p.props) === null || _q === void 0 ? void 0 : _q.backButton, minusHeight: minusHeight, tagHeight: tagHeight, onClick: () => {
|
18451
|
+
((_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.backButton) === null || _f === void 0 ? void 0 : _f.enable) && !channel && !openMultiPosts && (React.createElement(NavBack$1, { data: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.backButton, minusHeight: minusHeight, tagHeight: tagHeight, onClick: () => history === null || history === void 0 ? void 0 : history.back() })),
|
18452
|
+
((((_l = (_k = (_j = (_h = (_g = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.item) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.backButton) === null || _l === void 0 ? void 0 : _l.enable) && channel) || openMultiPosts) && (React.createElement(NavBack$1, { data: (_q = (_p = (_o = (_m = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.item) === null || _p === void 0 ? void 0 : _p.props) === null || _q === void 0 ? void 0 : _q.backButton, minusHeight: minusHeight, tagHeight: tagHeight, onClick: () => {
|
18454
18453
|
var _a, _b, _c;
|
18455
18454
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
18456
18455
|
eventInfo: {
|
@@ -18960,7 +18959,7 @@ const Popup = () => {
|
|
18960
18959
|
* @Author: binruan@chatlabs.com
|
18961
18960
|
* @Date: 2024-01-15 19:03:09
|
18962
18961
|
* @LastEditors: binruan@chatlabs.com
|
18963
|
-
* @LastEditTime: 2024-
|
18962
|
+
* @LastEditTime: 2024-11-27 16:58:32
|
18964
18963
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageCore\index.tsx
|
18965
18964
|
*
|
18966
18965
|
*/
|
@@ -18984,8 +18983,9 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
|
|
18984
18983
|
return searchParams;
|
18985
18984
|
}, []);
|
18986
18985
|
const [_schema, setSchema] = React.useState(data === null || data === void 0 ? void 0 : data.data);
|
18987
|
-
|
18988
|
-
|
18986
|
+
const [channel, setChannel] = React.useState();
|
18987
|
+
return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: _schema, utmVal: channel || utmVal },
|
18988
|
+
React.createElement(SxpDataSourceProvider$1, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_b = (_a = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _a === void 0 ? void 0 : _a.personalized_recommend) !== null && _b !== void 0 ? _b : maxSize, defaultSize: (_d = (_c = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _c === void 0 ? void 0 : _c.default_recommend) !== null && _d !== void 0 ? _d : defaultSize, hashTagSize: (_f = (_e = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _e === void 0 ? void 0 : _e.hash_tag_size) !== null && _f !== void 0 ? _f : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: data, dataList: dataList, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
|
18989
18989
|
var _a;
|
18990
18990
|
return (React.createElement(React.Fragment, null,
|
18991
18991
|
React.createElement(SxpPageRender, Object.assign({}, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
|