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/pb-ui.js CHANGED
@@ -731,7 +731,7 @@
731
731
  }, [bffDataSource]);
732
732
  // bff API 请求方法
733
733
  const bffFetch = React.useCallback((path, options, isBota = true) => {
734
- var _a;
734
+ var _a, _b;
735
735
  if (!bffDataSource)
736
736
  return;
737
737
  const url = bffDataSource.url;
@@ -744,9 +744,9 @@
744
744
  val.split('=')[0];
745
745
  val.split('=')[1];
746
746
  });
747
- options.body = Object.assign(Object.assign({}, options.body), { tenant_id: fakeUserId });
747
+ options.body = Object.assign(Object.assign({}, options.body), { productUserId: fakeUserId });
748
748
  return window
749
- .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
749
+ .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
750
750
  ? JSON.stringify({
751
751
  body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
752
752
  })
@@ -1073,8 +1073,8 @@
1073
1073
  // 用户信息都是公共的
1074
1074
  if (!userInfo) {
1075
1075
  userInfo = {
1076
- // productUserId: fakeUserId, // 后端逻辑会从请求头获取,所以不需要传
1077
- // tpChannelId: 'H5' // 后端处理
1076
+ productUserId: fakeUserId // 后端逻辑会从请求头获取,所以不需要传
1077
+ // tpChannelId: 'H5' // 后端处理
1078
1078
  };
1079
1079
  }
1080
1080
  const sessionID = storeAndLoadFeSessionId();
@@ -1108,7 +1108,8 @@
1108
1108
  layoutVariantId,
1109
1109
  globalConfig,
1110
1110
  playbookType,
1111
- bffDataSource
1111
+ bffDataSource,
1112
+ fakeUserId
1112
1113
  ]);
1113
1114
  const getEventParamsByJson = React.useCallback((json, product) => {
1114
1115
  var _a, _b, _c;
@@ -1238,13 +1239,15 @@
1238
1239
  }
1239
1240
  }, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
1240
1241
  const bffMutateLike = React.useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
1242
+ body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
1241
1243
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
1242
1244
  return res === null || res === void 0 ? void 0 : res.success;
1243
- }), [bffFetch]);
1245
+ }), [bffFetch, fakeUserId]);
1244
1246
  const bffMutateUnlike = React.useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
1247
+ body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
1245
1248
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
1246
1249
  return res === null || res === void 0 ? void 0 : res.success;
1247
- }), [bffFetch]);
1250
+ }), [bffFetch, fakeUserId]);
1248
1251
  const bffSubmitForm = React.useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
1249
1252
  const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
1250
1253
  return res === null || res === void 0 ? void 0 : res.success;
@@ -17978,11 +17981,11 @@ Made in Italy` })));
17978
17981
  const likeIcon = useIconLink(defaultLikeIconPath$2);
17979
17982
  const unlikeIcon = useIconLink(defaultUnLikeIconPath$2);
17980
17983
  const handleClick = lodash.debounce(() => __awaiter(void 0, void 0, void 0, function* () {
17981
- 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;
17984
+ 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;
17982
17985
  if (state) {
17983
17986
  // 先设置状态
17984
17987
  setState(false);
17985
- 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;
17988
+ 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;
17986
17989
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
17987
17990
  eventInfo: {
17988
17991
  eventSubject: 'favoriteContentCanceled',
@@ -18012,30 +18015,30 @@ Made in Italy` })));
18012
18015
  }
18013
18016
  else {
18014
18017
  setState(true);
18015
- const result = (_t = (yield (mutateLike === null || mutateLike === void 0 ? void 0 : mutateLike({ content: JSON.stringify(recData) })))) !== null && _t !== void 0 ? _t : false;
18018
+ 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;
18016
18019
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
18017
18020
  eventInfo: {
18018
18021
  eventSubject: 'favoriteContent',
18019
18022
  eventDescription: 'This content was favorite by the user',
18020
- 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 : '',
18021
- 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 : '',
18022
- 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 : '',
18023
- 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 : []),
18023
+ 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 : '',
18024
+ 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 : '',
18025
+ 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 : '',
18026
+ 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 : []),
18024
18027
  position: position + '',
18025
- contentFormat: ((_3 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _3 === void 0 ? void 0 : _3.url) ? 'video' : 'image',
18026
- traceInfo: (_4 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _4 === void 0 ? void 0 : _4.traceInfo
18028
+ contentFormat: ((_5 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _5 === void 0 ? void 0 : _5.url) ? 'video' : 'image',
18029
+ traceInfo: (_6 = recData === null || recData === void 0 ? void 0 : recData.video) === null || _6 === void 0 ? void 0 : _6.traceInfo
18027
18030
  }
18028
18031
  });
18029
18032
  if (!result) {
18030
18033
  setState(false);
18031
18034
  }
18032
18035
  else {
18033
- const nRtcList = (_5 = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
18036
+ const nRtcList = (_7 = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
18034
18037
  if (index === position) {
18035
18038
  item.isCollected = true;
18036
18039
  }
18037
18040
  return item;
18038
- })) !== null && _5 !== void 0 ? _5 : [];
18041
+ })) !== null && _7 !== void 0 ? _7 : [];
18039
18042
  setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
18040
18043
  }
18041
18044
  }