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