pb-sxp-ui 1.15.20-alpha.4 → 1.15.20
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 +39 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -8
- 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 +39 -8
- 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/context/SxpDataSourceProvider.js +39 -8
- package/lib/core/context/SxpDataSourceProvider.js +39 -8
- package/package.json +1 -2
- package/es/core/utils/cryptojs.d.ts +0 -3
- package/es/core/utils/cryptojs.js +0 -18
- package/lib/core/utils/cryptojs.d.ts +0 -3
- package/lib/core/utils/cryptojs.js +0 -23
package/dist/pb-ui.js
CHANGED
@@ -729,6 +729,7 @@
|
|
729
729
|
}, [bffDataSource]);
|
730
730
|
// bff API 请求方法
|
731
731
|
const bffFetch = React.useCallback((path, options) => {
|
732
|
+
var _a, _b;
|
732
733
|
if (!bffDataSource)
|
733
734
|
return;
|
734
735
|
const url = bffDataSource.url;
|
@@ -736,19 +737,49 @@
|
|
736
737
|
const queryString = qs.stringify(options.query);
|
737
738
|
path = `${path}?${queryString}`;
|
738
739
|
}
|
740
|
+
let isTikTokChannel = false;
|
741
|
+
const params = {};
|
742
|
+
const queryString = location.search.slice(1);
|
743
|
+
(_a = splitUrlParams(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
|
744
|
+
const key = val.split('=')[0];
|
745
|
+
const value = val.split('=')[1];
|
746
|
+
params[key] = value;
|
747
|
+
});
|
748
|
+
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
749
|
+
if (cl_source &&
|
750
|
+
((_b = [
|
751
|
+
'40A-SPRK--DRESS_EYEWEAR-',
|
752
|
+
'41A-SPRK--MADRAGUE-',
|
753
|
+
'42A-SPRK--MOOD-',
|
754
|
+
'43A-SPRK--SUMMER-',
|
755
|
+
'44A-SPRK--DRESS_EYEWEAR-',
|
756
|
+
'45A-SPRK--MADRAGUE-',
|
757
|
+
'46A-SPRK--MOOD-',
|
758
|
+
'47A-SPRK--SUMMER-',
|
759
|
+
'48A-SPRK--DRESS_EYEWEAR-',
|
760
|
+
'49A-SPRK--MADRAGUE-',
|
761
|
+
'50A-SPRK--MOOD-',
|
762
|
+
'51A-SPRK--SUMMER-'
|
763
|
+
]) === null || _b === void 0 ? void 0 : _b.includes(cl_source))) {
|
764
|
+
isTikTokChannel = true;
|
765
|
+
}
|
739
766
|
// 事件上报优化
|
740
767
|
// Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
|
741
|
-
if (options.type === 'beacon' && navigator.sendBeacon) {
|
742
|
-
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
743
|
-
|
768
|
+
if (options.type === 'beacon' && navigator.sendBeacon && !isTikTokChannel) {
|
769
|
+
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
770
|
+
JSON.stringify({
|
771
|
+
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
772
|
+
})
|
773
|
+
], {
|
774
|
+
type: 'application/json;charset=UTF-8'
|
744
775
|
}));
|
745
776
|
}
|
746
777
|
return window
|
747
|
-
.fetch(`${url}/api/${path}`, {
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
778
|
+
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body: isTikTokChannel
|
779
|
+
? JSON.stringify({
|
780
|
+
body: btoa(encodeURIComponent(JSON.stringify(options.body)))
|
781
|
+
})
|
782
|
+
: JSON.stringify(options.body) }, (isTikTokChannel && { keepalive: true })))
|
752
783
|
.then((res) => res.json())
|
753
784
|
.catch((err) => Promise.reject(err));
|
754
785
|
}, [bffDataSource, fakeUserId]);
|