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/index.js CHANGED
@@ -631,9 +631,8 @@ var DataSourceType;
631
631
  DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
632
632
  })(DataSourceType || (DataSourceType = {}));
633
633
  const DEFAULT_TAG = 'FOR U';
634
- 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 }) => {
634
+ 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 }) => {
635
635
  var _a, _b, _c, _d, _e;
636
- const { channel } = useEditor();
637
636
  const [rtcList, setRtcList] = useState([]);
638
637
  const [tagList, setTagList] = useState([]);
639
638
  const [loading, setLoading] = useState(false);
@@ -659,11 +658,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
659
658
  const [pageData, setPageData] = useState(data);
660
659
  const [showConsent, setShowConsent] = useState(false);
661
660
  const [layoutVariantId, setLayoutVariantId] = useState();
661
+ const [channel, setChannel] = useState();
662
662
  const isShowConsent = useMemo(() => {
663
663
  var _a, _b, _c, _d;
664
664
  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) &&
665
665
  showConsent);
666
666
  }, [isAgreePolicy, globalConfig, isOpenConsent, isEditor, showConsent]);
667
+ const updateChannel = useCallback((d) => {
668
+ onUpdateChannel === null || onUpdateChannel === void 0 ? void 0 : onUpdateChannel(d);
669
+ setChannel(d);
670
+ }, []);
667
671
  const getFilterRecList = useCallback((data) => {
668
672
  var _a;
669
673
  const recList = data === null || data === void 0 ? void 0 : data.recList;
@@ -1104,7 +1108,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1104
1108
  popupCurTimeRef,
1105
1109
  checkCommodityIndexRef,
1106
1110
  isEditor,
1107
- isNoMoreData
1111
+ isNoMoreData,
1112
+ updateChannel,
1113
+ channel
1108
1114
  } }, 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({
1109
1115
  rtcList,
1110
1116
  mutateLike: bffMutateLike,
@@ -1234,7 +1240,6 @@ const EditorContext = React.createContext({
1234
1240
  });
1235
1241
  const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSource = true, utmVal }, ref) => {
1236
1242
  const [currentNode, setCurrentNode] = useState(null);
1237
- const [channel, setChannel] = useState();
1238
1243
  const [_schema, setSchema] = useState(schema || {
1239
1244
  pointData: [item],
1240
1245
  dataSource: [],
@@ -1255,9 +1260,6 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
1255
1260
  const [undoStack, setUndoStack] = useState([[item]]);
1256
1261
  const [redoStack, setRedoStack] = useState([]);
1257
1262
  const [popup, setPopup] = useState(popupInit);
1258
- const channelParams = useMemo(() => {
1259
- return channel || utmVal;
1260
- }, [channel, utmVal]);
1261
1263
  typeof window !== 'undefined' &&
1262
1264
  (window.sxpPopup = (type, aniType) => {
1263
1265
  setPopup(Object.assign(Object.assign(Object.assign({}, popupInit), { id: type }), aniType));
@@ -1266,10 +1268,10 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
1266
1268
  (window.getJointUtmLink = (url) => {
1267
1269
  setSlideSkipState();
1268
1270
  if ((url === null || url === void 0 ? void 0 : url.indexOf('?')) !== -1) {
1269
- return url + (channelParams ? '&' + channelParams : '');
1271
+ return url + (utmVal ? '&' + utmVal : '');
1270
1272
  }
1271
1273
  else {
1272
- return url + (channelParams ? '?' + channelParams : '');
1274
+ return url + (utmVal ? '?' + utmVal : '');
1273
1275
  }
1274
1276
  });
1275
1277
  // 切换页面类型,清空操作栈
@@ -1337,9 +1339,7 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
1337
1339
  setUndoStack,
1338
1340
  getCurPageConf,
1339
1341
  popup,
1340
- setPopup,
1341
- channel,
1342
- setChannel
1342
+ setPopup
1343
1343
  } },
1344
1344
  React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
1345
1345
  });
@@ -16797,8 +16797,7 @@ var settingRender = [
16797
16797
  const MultiPosts$1 = (_a) => {
16798
16798
  var _b, _c;
16799
16799
  var { bgImgUrl, style, recData } = _a, props = __rest(_a, ["bgImgUrl", "style", "recData"]);
16800
- const { setChannel } = useEditor();
16801
- const { bffEventReport, curTime } = useSxpDataSource();
16800
+ const { bffEventReport, curTime, updateChannel } = useSxpDataSource();
16802
16801
  const { isActive } = useSwiperSlide() || {};
16803
16802
  const initRef = useRef(false);
16804
16803
  const viewTime = useRef();
@@ -16828,7 +16827,7 @@ const MultiPosts$1 = (_a) => {
16828
16827
  });
16829
16828
  if ((v === null || v === void 0 ? void 0 : v.linkType) === 'recommendFlow') {
16830
16829
  endMultiPost('multipostClick');
16831
- setChannel === null || setChannel === void 0 ? void 0 : setChannel(value);
16830
+ updateChannel === null || updateChannel === void 0 ? void 0 : updateChannel(value);
16832
16831
  curTime.current = new Date();
16833
16832
  }
16834
16833
  else {
@@ -17914,7 +17913,7 @@ var NavBack$1 = memo(NavBack);
17914
17913
  * @Author: binruan@chatlabs.com
17915
17914
  * @Date: 2024-03-20 10:27:31
17916
17915
  * @LastEditors: binruan@chatlabs.com
17917
- * @LastEditTime: 2024-11-27 15:55:34
17916
+ * @LastEditTime: 2024-11-27 17:08:59
17918
17917
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
17919
17918
  *
17920
17919
  */
@@ -17922,7 +17921,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
17922
17921
  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;
17923
17922
  const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
17924
17923
  const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
17925
- const { schema, channel } = useEditor();
17924
+ const { schema } = useEditor();
17926
17925
  const { openMultiPosts } = useEditorDataProvider();
17927
17926
  const [activeIndex, setActiveIndex] = useState(0);
17928
17927
  const viewImageStartTime = useRef(0);
@@ -17933,7 +17932,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
17933
17932
  const [isReload, setIsReload] = useState(new Date().getTime());
17934
17933
  const skipLinkRef = useRef(false);
17935
17934
  const [pageNum, setPageNum] = useState(2);
17936
- 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();
17935
+ 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();
17937
17936
  const { backMainFeed, productView, jumpToWeb } = useEventReport();
17938
17937
  const isShowFingerTip = useMemo(() => {
17939
17938
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
@@ -18938,7 +18937,7 @@ const Popup = () => {
18938
18937
  * @Author: binruan@chatlabs.com
18939
18938
  * @Date: 2024-01-15 19:03:09
18940
18939
  * @LastEditors: binruan@chatlabs.com
18941
- * @LastEditTime: 2024-09-30 14:37:13
18940
+ * @LastEditTime: 2024-11-27 16:58:32
18942
18941
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageCore\index.tsx
18943
18942
  *
18944
18943
  */
@@ -18962,8 +18961,9 @@ const SxpPageCore = ({ data, maxSize = 10, defaultSize = 10, hashTagSize = 20, l
18962
18961
  return searchParams;
18963
18962
  }, []);
18964
18963
  const [_schema, setSchema] = useState(data === null || data === void 0 ? void 0 : data.data);
18965
- return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: _schema, utmVal: utmVal },
18966
- 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 }) => {
18964
+ const [channel, setChannel] = useState();
18965
+ return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: _schema, utmVal: channel || utmVal },
18966
+ 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 }) => {
18967
18967
  var _a;
18968
18968
  return (React.createElement(React.Fragment, null,
18969
18969
  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 })),