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 +21 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -17
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +21 -17
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/LikeButton/index.js +11 -11
- package/es/core/context/SxpDataSourceProvider.d.ts +4 -12
- package/es/core/context/SxpDataSourceProvider.js +11 -5
- package/lib/core/components/SxpPageRender/LikeButton/index.js +11 -11
- package/lib/core/context/SxpDataSourceProvider.d.ts +4 -12
- package/lib/core/context/SxpDataSourceProvider.js +11 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -729,8 +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), { productUserId: fakeUserId });
|
732
733
|
return window
|
733
|
-
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId,
|
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
|
734
735
|
? JSON.stringify({
|
735
736
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
736
737
|
})
|
@@ -1057,8 +1058,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1057
1058
|
// 用户信息都是公共的
|
1058
1059
|
if (!userInfo) {
|
1059
1060
|
userInfo = {
|
1060
|
-
|
1061
|
-
|
1061
|
+
productUserId: fakeUserId // 后端逻辑会从请求头获取,所以不需要传
|
1062
|
+
// tpChannelId: 'H5' // 后端处理
|
1062
1063
|
};
|
1063
1064
|
}
|
1064
1065
|
const sessionID = storeAndLoadFeSessionId();
|
@@ -1092,7 +1093,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1092
1093
|
layoutVariantId,
|
1093
1094
|
globalConfig,
|
1094
1095
|
playbookType,
|
1095
|
-
bffDataSource
|
1096
|
+
bffDataSource,
|
1097
|
+
fakeUserId
|
1096
1098
|
]);
|
1097
1099
|
const getEventParamsByJson = useCallback((json, product) => {
|
1098
1100
|
var _a, _b, _c;
|
@@ -1222,13 +1224,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1222
1224
|
}
|
1223
1225
|
}, [bffFetch, enableReportEvent, enabledMetaConversionApi, globalConfig, bffDataSource, getEventParamsByJson]);
|
1224
1226
|
const bffMutateLike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
1227
|
+
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
1225
1228
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/like', { method: 'POST', body }));
|
1226
1229
|
return res === null || res === void 0 ? void 0 : res.success;
|
1227
|
-
}), [bffFetch]);
|
1230
|
+
}), [bffFetch, fakeUserId]);
|
1228
1231
|
const bffMutateUnlike = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
1232
|
+
body = Object.assign(Object.assign({}, body), { productUserId: fakeUserId });
|
1229
1233
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/unlike', { method: 'POST', body }));
|
1230
1234
|
return res === null || res === void 0 ? void 0 : res.success;
|
1231
|
-
}), [bffFetch]);
|
1235
|
+
}), [bffFetch, fakeUserId]);
|
1232
1236
|
const bffSubmitForm = useCallback((body) => __awaiter(void 0, void 0, void 0, function* () {
|
1233
1237
|
const res = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/customform', { method: 'POST', body }));
|
1234
1238
|
return res === null || res === void 0 ? void 0 : res.success;
|
@@ -17962,11 +17966,11 @@ const LikeButton = (_a) => {
|
|
17962
17966
|
const likeIcon = useIconLink(defaultLikeIconPath$2);
|
17963
17967
|
const unlikeIcon = useIconLink(defaultUnLikeIconPath$2);
|
17964
17968
|
const handleClick = debounce(() => __awaiter(void 0, void 0, void 0, function* () {
|
17965
|
-
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;
|
17966
17970
|
if (state) {
|
17967
17971
|
// 先设置状态
|
17968
17972
|
setState(false);
|
17969
|
-
const result = (_e = (yield (mutateUnlike === null || mutateUnlike === void 0 ? void 0 : mutateUnlike({
|
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;
|
17970
17974
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
17971
17975
|
eventInfo: {
|
17972
17976
|
eventSubject: 'favoriteContentCanceled',
|
@@ -17996,30 +18000,30 @@ const LikeButton = (_a) => {
|
|
17996
18000
|
}
|
17997
18001
|
else {
|
17998
18002
|
setState(true);
|
17999
|
-
const result = (
|
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;
|
18000
18004
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
18001
18005
|
eventInfo: {
|
18002
18006
|
eventSubject: 'favoriteContent',
|
18003
18007
|
eventDescription: 'This content was favorite by the user',
|
18004
|
-
contentId: (
|
18005
|
-
sceneId: (
|
18006
|
-
contentName: (
|
18007
|
-
contentTags: JSON.stringify((
|
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 : []),
|
18008
18012
|
position: position + '',
|
18009
|
-
contentFormat: ((
|
18010
|
-
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
|
18011
18015
|
}
|
18012
18016
|
});
|
18013
18017
|
if (!result) {
|
18014
18018
|
setState(false);
|
18015
18019
|
}
|
18016
18020
|
else {
|
18017
|
-
const nRtcList = (
|
18021
|
+
const nRtcList = (_7 = cacheRtcList === null || cacheRtcList === void 0 ? void 0 : cacheRtcList.map((item, index) => {
|
18018
18022
|
if (index === position) {
|
18019
18023
|
item.isCollected = true;
|
18020
18024
|
}
|
18021
18025
|
return item;
|
18022
|
-
})) !== null &&
|
18026
|
+
})) !== null && _7 !== void 0 ? _7 : [];
|
18023
18027
|
setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList(nRtcList);
|
18024
18028
|
}
|
18025
18029
|
}
|