pb-sxp-ui 1.10.1 → 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/pb-ui.js CHANGED
@@ -646,9 +646,8 @@
646
646
  DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
647
647
  })(DataSourceType || (DataSourceType = {}));
648
648
  const DEFAULT_TAG = 'FOR U';
649
- 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 }) => {
649
+ 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 }) => {
650
650
  var _a, _b, _c, _d, _e;
651
- const { channel } = useEditor();
652
651
  const [rtcList, setRtcList] = React.useState([]);
653
652
  const [tagList, setTagList] = React.useState([]);
654
653
  const [loading, setLoading] = React.useState(false);
@@ -674,11 +673,16 @@
674
673
  const [pageData, setPageData] = React.useState(data);
675
674
  const [showConsent, setShowConsent] = React.useState(false);
676
675
  const [layoutVariantId, setLayoutVariantId] = React.useState();
676
+ const [channel, setChannel] = React.useState();
677
677
  const isShowConsent = React.useMemo(() => {
678
678
  var _a, _b, _c, _d;
679
679
  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) &&
680
680
  showConsent);
681
681
  }, [isAgreePolicy, globalConfig, isOpenConsent, isEditor, showConsent]);
682
+ const updateChannel = React.useCallback((d) => {
683
+ onUpdateChannel === null || onUpdateChannel === void 0 ? void 0 : onUpdateChannel(d);
684
+ setChannel(d);
685
+ }, []);
682
686
  const getFilterRecList = React.useCallback((data) => {
683
687
  var _a;
684
688
  const recList = data === null || data === void 0 ? void 0 : data.recList;
@@ -1119,7 +1123,9 @@
1119
1123
  popupCurTimeRef,
1120
1124
  checkCommodityIndexRef,
1121
1125
  isEditor,
1122
- isNoMoreData
1126
+ isNoMoreData,
1127
+ updateChannel,
1128
+ channel
1123
1129
  } }, 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({
1124
1130
  rtcList,
1125
1131
  mutateLike: bffMutateLike,
@@ -1249,7 +1255,6 @@
1249
1255
  });
1250
1256
  const EditorCore = React.forwardRef(({ children, resolver, isSsr, schema, enableDataSource = true, utmVal }, ref) => {
1251
1257
  const [currentNode, setCurrentNode] = React.useState(null);
1252
- const [channel, setChannel] = React.useState();
1253
1258
  const [_schema, setSchema] = React.useState(schema || {
1254
1259
  pointData: [item],
1255
1260
  dataSource: [],
@@ -1270,9 +1275,6 @@
1270
1275
  const [undoStack, setUndoStack] = React.useState([[item]]);
1271
1276
  const [redoStack, setRedoStack] = React.useState([]);
1272
1277
  const [popup, setPopup] = React.useState(popupInit);
1273
- const channelParams = React.useMemo(() => {
1274
- return channel || utmVal;
1275
- }, [channel, utmVal]);
1276
1278
  typeof window !== 'undefined' &&
1277
1279
  (window.sxpPopup = (type, aniType) => {
1278
1280
  setPopup(Object.assign(Object.assign(Object.assign({}, popupInit), { id: type }), aniType));
@@ -1281,10 +1283,10 @@
1281
1283
  (window.getJointUtmLink = (url) => {
1282
1284
  setSlideSkipState();
1283
1285
  if ((url === null || url === void 0 ? void 0 : url.indexOf('?')) !== -1) {
1284
- return url + (channelParams ? '&' + channelParams : '');
1286
+ return url + (utmVal ? '&' + utmVal : '');
1285
1287
  }
1286
1288
  else {
1287
- return url + (channelParams ? '?' + channelParams : '');
1289
+ return url + (utmVal ? '?' + utmVal : '');
1288
1290
  }
1289
1291
  });
1290
1292
  // 切换页面类型,清空操作栈
@@ -1352,9 +1354,7 @@
1352
1354
  setUndoStack,
1353
1355
  getCurPageConf,
1354
1356
  popup,
1355
- setPopup,
1356
- channel,
1357
- setChannel
1357
+ setPopup
1358
1358
  } },
1359
1359
  React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
1360
1360
  });
@@ -16812,8 +16812,7 @@ Made in Italy` })));
16812
16812
  const MultiPosts$1 = (_a) => {
16813
16813
  var _b, _c;
16814
16814
  var { bgImgUrl, style, recData } = _a, props = __rest(_a, ["bgImgUrl", "style", "recData"]);
16815
- const { setChannel } = useEditor();
16816
- const { bffEventReport, curTime } = useSxpDataSource();
16815
+ const { bffEventReport, curTime, updateChannel } = useSxpDataSource();
16817
16816
  const { isActive } = useSwiperSlide() || {};
16818
16817
  const initRef = React.useRef(false);
16819
16818
  const viewTime = React.useRef();
@@ -16843,7 +16842,7 @@ Made in Italy` })));
16843
16842
  });
16844
16843
  if ((v === null || v === void 0 ? void 0 : v.linkType) === 'recommendFlow') {
16845
16844
  endMultiPost('multipostClick');
16846
- setChannel === null || setChannel === void 0 ? void 0 : setChannel(value);
16845
+ updateChannel === null || updateChannel === void 0 ? void 0 : updateChannel(value);
16847
16846
  curTime.current = new Date();
16848
16847
  }
16849
16848
  else {
@@ -17929,7 +17928,7 @@ Made in Italy` })));
17929
17928
  * @Author: binruan@chatlabs.com
17930
17929
  * @Date: 2024-03-20 10:27:31
17931
17930
  * @LastEditors: binruan@chatlabs.com
17932
- * @LastEditTime: 2024-11-27 15:55:34
17931
+ * @LastEditTime: 2024-11-27 17:08:59
17933
17932
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
17934
17933
  *
17935
17934
  */
@@ -17937,7 +17936,7 @@ Made in Italy` })));
17937
17936
  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;
17938
17937
  const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
17939
17938
  const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
17940
- const { schema, channel } = useEditor();
17939
+ const { schema } = useEditor();
17941
17940
  const { openMultiPosts } = useEditorDataProvider();
17942
17941
  const [activeIndex, setActiveIndex] = React.useState(0);
17943
17942
  const viewImageStartTime = React.useRef(0);
@@ -17948,7 +17947,7 @@ Made in Italy` })));
17948
17947
  const [isReload, setIsReload] = React.useState(new Date().getTime());
17949
17948
  const skipLinkRef = React.useRef(false);
17950
17949
  const [pageNum, setPageNum] = React.useState(2);
17951
- 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();
17950
+ 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();
17952
17951
  const { backMainFeed, productView, jumpToWeb } = useEventReport();
17953
17952
  const isShowFingerTip = React.useMemo(() => {
17954
17953
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
@@ -18953,7 +18952,7 @@ Made in Italy` })));
18953
18952
  * @Author: binruan@chatlabs.com
18954
18953
  * @Date: 2024-01-15 19:03:09
18955
18954
  * @LastEditors: binruan@chatlabs.com
18956
- * @LastEditTime: 2024-09-30 14:37:13
18955
+ * @LastEditTime: 2024-11-27 16:58:32
18957
18956
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageCore\index.tsx
18958
18957
  *
18959
18958
  */
@@ -18977,8 +18976,9 @@ Made in Italy` })));
18977
18976
  return searchParams;
18978
18977
  }, []);
18979
18978
  const [_schema, setSchema] = React.useState(data === null || data === void 0 ? void 0 : data.data);
18980
- return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: _schema, utmVal: utmVal },
18981
- 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), render: ({ rtcList, tagList, pageData }) => {
18979
+ const [channel, setChannel] = React.useState();
18980
+ return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: _schema, utmVal: channel || utmVal },
18981
+ 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 }) => {
18982
18982
  var _a;
18983
18983
  return (React.createElement(React.Fragment, null,
18984
18984
  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 })),