pb-sxp-ui 1.16.17 → 1.16.19

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
@@ -716,7 +716,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
716
716
  }, [bffDataSource]);
717
717
  // bff API 请求方法
718
718
  const bffFetch = useCallback((path, options, isBota = true) => {
719
- var _a;
719
+ var _a, _b;
720
720
  if (!bffDataSource)
721
721
  return;
722
722
  const url = bffDataSource.url;
@@ -729,9 +729,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
729
729
  val.split('=')[0];
730
730
  val.split('=')[1];
731
731
  });
732
- options.body = Object.assign(Object.assign({}, options.body), { tenant_id: fakeUserId });
732
+ options.body = Object.assign(Object.assign({}, options.body), { productUserId: fakeUserId });
733
733
  return window
734
- .fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body: options.type === 'beacon' && isBota
734
+ .fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId, 'tenant-id': (_b = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _b === void 0 ? void 0 : _b['x-app-id'] }, bffDataSource.headers), method: options.method, body: options.type === 'beacon' && isBota
735
735
  ? JSON.stringify({
736
736
  body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
737
737
  })
@@ -1058,8 +1058,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1058
1058
  // 用户信息都是公共的
1059
1059
  if (!userInfo) {
1060
1060
  userInfo = {
1061
- // productUserId: fakeUserId, // 后端逻辑会从请求头获取,所以不需要传
1062
- // tpChannelId: 'H5' // 后端处理
1061
+ productUserId: fakeUserId // 后端逻辑会从请求头获取,所以不需要传
1062
+ // tpChannelId: 'H5' // 后端处理
1063
1063
  };
1064
1064
  }
1065
1065
  const sessionID = storeAndLoadFeSessionId();
@@ -1093,7 +1093,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1093
1093
  layoutVariantId,
1094
1094
  globalConfig,
1095
1095
  playbookType,
1096
- bffDataSource
1096
+ bffDataSource,
1097
+ fakeUserId
1097
1098
  ]);
1098
1099
  const getEventParamsByJson = useCallback((json, product) => {
1099
1100
  var _a, _b, _c;
@@ -1223,13 +1224,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1223
1224
  }
1224
1225
  }, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
1225
1226
  const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
1227
+ body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
1226
1228
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
1227
1229
  return res === null || res === void 0 ? void 0 : res.success;
1228
- }), [bffFetch]);
1230
+ }), [bffFetch, fakeUserId]);
1229
1231
  const bffMutateUnlike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
1232
+ body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
1230
1233
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
1231
1234
  return res === null || res === void 0 ? void 0 : res.success;
1232
- }), [bffFetch]);
1235
+ }), [bffFetch, fakeUserId]);
1233
1236
  const bffSubmitForm = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
1234
1237
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
1235
1238
  return res === null || res === void 0 ? void 0 : res.success;
@@ -17963,11 +17966,11 @@ const LikeButton = (_a) => {
17963
17966
  const likeIcon = useIconLink(defaultLikeIconPath$2);
17964
17967
  const unlikeIcon = useIconLink(defaultUnLikeIconPath$2);
17965
17968
  const handleClick = debounce(() => __awaiter(void 0, void 0, void 0, function* () {
17966
- var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
17969
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
17967
17970
  if (state) {
17968
17971
  // 先设置状态
17969
17972
  setState(false);
17970
- const result = (_e = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({ videoItemId: (_d = (_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '' })))) !== null && _e !== void 0 ? _e : false;
17973
+ const result = (_e = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({ itemId: (_d = (_c = recData === null || recData === void 0 ? void 0 : recData.video) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : '' })))) !== null && _e !== void 0 ? _e : false;
17971
17974
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
17972
17975
  eventInfo: {
17973
17976
  eventSubject: 'favoriteContentCanceled',
@@ -17997,30 +18000,30 @@ const LikeButton = (_a) => {
17997
18000
  }
17998
18001
  else {
17999
18002
  setState(true);
18000
- const result = (_t = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _t !== void 0 ? _t : false;
18003
+ const result = (_v = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData), itemId: (_u = (_t = recData === null || recData === void 0 ? void 0 : recData.video) === null || _t === void 0 ? void 0 : _t.itemId) !== null && _u !== void 0 ? _u : '' })))) !== null && _v !== void 0 ? _v : false;
18001
18004
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
18002
18005
  eventInfo: {
18003
18006
  eventSubject: 'favoriteContent',
18004
18007
  eventDescription: 'This content was favorite by the user',
18005
- contentId: (_v = (_u = recData === null || recData === void 0 ? void 0 : recData.video) === null || _u === void 0 ? void 0 : _u.itemId) !== null && _v !== void 0 ? _v : '',
18006
- sceneId: (_y = (_x = (_w = recData === null || recData === void 0 ? void 0 : recData.video) === null || _w === void 0 ? void 0 : _w.scene) === null || _x === void 0 ? void 0 : _x.sceneId) !== null && _y !== void 0 ? _y : '',
18007
- contentName: (_0 = (_z = recData === null || recData === void 0 ? void 0 : recData.video) === null || _z === void 0 ? void 0 : _z.title) !== null && _0 !== void 0 ? _0 : '',
18008
- contentTags: JSON.stringify((_2 = (_1 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _1 === void 0 ? void 0 : _1.tags) !== null && _2 !== void 0 ? _2 : []),
18008
+ contentId: (_x = (_w = recData === null || recData === void 0 ? void 0 : recData.video) === null || _w === void 0 ? void 0 : _w.itemId) !== null && _x !== void 0 ? _x : '',
18009
+ sceneId: (_0 = (_z = (_y = recData === null || recData === void 0 ? void 0 : recData.video) === null || _y === void 0 ? void 0 : _y.scene) === null || _z === void 0 ? void 0 : _z.sceneId) !== null && _0 !== void 0 ? _0 : '',
18010
+ contentName: (_2 = (_1 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _1 === void 0 ? void 0 : _1.title) !== null && _2 !== void 0 ? _2 : '',
18011
+ contentTags: JSON.stringify((_4 = (_3 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _3 === void 0 ? void 0 : _3.tags) !== null && _4 !== void 0 ? _4 : []),
18009
18012
  position: position + '',
18010
- contentFormat: ((_3 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _3 === void 0 ? void 0 : _3.url) ? 'video' : 'image',
18011
- traceInfo: (_4 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _4 === void 0 ? void 0 : _4.traceInfo
18013
+ contentFormat: ((_5 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _5 === void 0 ? void 0 : _5.url) ? 'video' : 'image',
18014
+ traceInfo: (_6 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _6 === void 0 ? void 0 : _6.traceInfo
18012
18015
  }
18013
18016
  });
18014
18017
  if (!result) {
18015
18018
  setState(false);
18016
18019
  }
18017
18020
  else {
18018
- const nRtcList = (_5 = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
18021
+ const nRtcList = (_7 = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
18019
18022
  if (index === position) {
18020
18023
  item.isCollected = true;
18021
18024
  }
18022
18025
  return item;
18023
- })) !== null && _5 !== void 0 ? _5 : [];
18026
+ })) !== null && _7 !== void 0 ? _7 : [];
18024
18027
  setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
18025
18028
  }
18026
18029
  }