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.cjs CHANGED
@@ -738,7 +738,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
738
738
  }, [bffDataSource]);
739
739
  // bff API 请求方法
740
740
  const bffFetch = React.useCallback((path, options, isBota = true) => {
741
- var _a;
741
+ var _a, _b;
742
742
  if (!bffDataSource)
743
743
  return;
744
744
  const url = bffDataSource.url;
@@ -751,9 +751,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
751
751
  val.split('=')[0];
752
752
  val.split('=')[1];
753
753
  });
754
- options.body = Object.assign(Object.assign({}, options.body), { tenant_id: fakeUserId });
754
+ options.body = Object.assign(Object.assign({}, options.body), { productUserId: fakeUserId });
755
755
  return window
756
- .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
756
+ .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
757
757
  ? JSON.stringify({
758
758
  body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
759
759
  })
@@ -1080,8 +1080,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1080
1080
  // 用户信息都是公共的
1081
1081
  if (!userInfo) {
1082
1082
  userInfo = {
1083
- // productUserId: fakeUserId, // 后端逻辑会从请求头获取,所以不需要传
1084
- // tpChannelId: 'H5' // 后端处理
1083
+ productUserId: fakeUserId // 后端逻辑会从请求头获取,所以不需要传
1084
+ // tpChannelId: 'H5' // 后端处理
1085
1085
  };
1086
1086
  }
1087
1087
  const sessionID = storeAndLoadFeSessionId();
@@ -1115,7 +1115,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1115
1115
  layoutVariantId,
1116
1116
  globalConfig,
1117
1117
  playbookType,
1118
- bffDataSource
1118
+ bffDataSource,
1119
+ fakeUserId
1119
1120
  ]);
1120
1121
  const getEventParamsByJson = React.useCallback((json, product) => {
1121
1122
  var _a, _b, _c;
@@ -1245,13 +1246,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1245
1246
  }
1246
1247
  }, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
1247
1248
  const bffMutateLike = React.useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
1249
+ body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
1248
1250
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
1249
1251
  return res === null || res === void 0 ? void 0 : res.success;
1250
- }), [bffFetch]);
1252
+ }), [bffFetch, fakeUserId]);
1251
1253
  const bffMutateUnlike = React.useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
1254
+ body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
1252
1255
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
1253
1256
  return res === null || res === void 0 ? void 0 : res.success;
1254
- }), [bffFetch]);
1257
+ }), [bffFetch, fakeUserId]);
1255
1258
  const bffSubmitForm = React.useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
1256
1259
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
1257
1260
  return res === null || res === void 0 ? void 0 : res.success;
@@ -17985,11 +17988,11 @@ const LikeButton = (_a) => {
17985
17988
  const likeIcon = useIconLink(defaultLikeIconPath$2);
17986
17989
  const unlikeIcon = useIconLink(defaultUnLikeIconPath$2);
17987
17990
  const handleClick = lodash.debounce(() => __awaiter(void 0, void 0, void 0, function* () {
17988
- 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;
17991
+ 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;
17989
17992
  if (state) {
17990
17993
  // 先设置状态
17991
17994
  setState(false);
17992
- 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;
17995
+ 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;
17993
17996
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
17994
17997
  eventInfo: {
17995
17998
  eventSubject: 'favoriteContentCanceled',
@@ -18019,30 +18022,30 @@ const LikeButton = (_a) => {
18019
18022
  }
18020
18023
  else {
18021
18024
  setState(true);
18022
- const result = (_t = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _t !== void 0 ? _t : false;
18025
+ 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;
18023
18026
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
18024
18027
  eventInfo: {
18025
18028
  eventSubject: 'favoriteContent',
18026
18029
  eventDescription: 'This content was favorite by the user',
18027
- 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 : '',
18028
- 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 : '',
18029
- 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 : '',
18030
- 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 : []),
18030
+ 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 : '',
18031
+ 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 : '',
18032
+ 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 : '',
18033
+ 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 : []),
18031
18034
  position: position + '',
18032
- contentFormat: ((_3 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _3 === void 0 ? void 0 : _3.url) ? 'video' : 'image',
18033
- traceInfo: (_4 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _4 === void 0 ? void 0 : _4.traceInfo
18035
+ contentFormat: ((_5 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _5 === void 0 ? void 0 : _5.url) ? 'video' : 'image',
18036
+ traceInfo: (_6 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _6 === void 0 ? void 0 : _6.traceInfo
18034
18037
  }
18035
18038
  });
18036
18039
  if (!result) {
18037
18040
  setState(false);
18038
18041
  }
18039
18042
  else {
18040
- const nRtcList = (_5 = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
18043
+ const nRtcList = (_7 = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
18041
18044
  if (index === position) {
18042
18045
  item.isCollected = true;
18043
18046
  }
18044
18047
  return item;
18045
- })) !== null && _5 !== void 0 ? _5 : [];
18048
+ })) !== null && _7 !== void 0 ? _7 : [];
18046
18049
  setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
18047
18050
  }
18048
18051
  }