pb-sxp-ui 1.15.20-alpha.5 → 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 +43 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -6
- 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 +43 -6
- 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 +41 -6
- package/lib/core/context/SxpDataSourceProvider.js +41 -6
- 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,13 +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
|
+
}
|
766
|
+
// 事件上报优化
|
767
|
+
// Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
|
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'
|
775
|
+
}));
|
776
|
+
}
|
739
777
|
return window
|
740
|
-
.fetch(`${url}/api/${path}`, {
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
})
|
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 })))
|
746
783
|
.then((res) => res.json())
|
747
784
|
.catch((err) => Promise.reject(err));
|
748
785
|
}, [bffDataSource, fakeUserId]);
|