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