pb-sxp-ui 1.15.33 → 1.15.35
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 +10 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -41
- 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 +10 -41
- 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 +8 -35
- package/lib/core/context/SxpDataSourceProvider.js +8 -35
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -737,7 +737,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
737
737
|
}, [bffDataSource]);
|
738
738
|
// bff API 请求方法
|
739
739
|
const bffFetch = React.useCallback((path, options) => {
|
740
|
-
var _a
|
740
|
+
var _a;
|
741
741
|
if (!bffDataSource)
|
742
742
|
return;
|
743
743
|
const url = bffDataSource.url;
|
@@ -745,49 +745,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
745
745
|
const queryString = qs.stringify(options.query);
|
746
746
|
path = `${path}?${queryString}`;
|
747
747
|
}
|
748
|
-
let isTikTokChannel = false;
|
749
|
-
const params = {};
|
750
748
|
const queryString = location.search.slice(1);
|
751
749
|
(_a = splitUrlParams(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
|
752
|
-
|
753
|
-
|
754
|
-
params[key] = value;
|
750
|
+
val.split('=')[0];
|
751
|
+
val.split('=')[1];
|
755
752
|
});
|
756
|
-
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
757
|
-
if (cl_source &&
|
758
|
-
((_b = [
|
759
|
-
'40A-SPRK--DRESS_EYEWEAR-',
|
760
|
-
'41A-SPRK--MADRAGUE-',
|
761
|
-
'42A-SPRK--MOOD-',
|
762
|
-
'43A-SPRK--SUMMER-',
|
763
|
-
'44A-SPRK--DRESS_EYEWEAR-',
|
764
|
-
'45A-SPRK--MADRAGUE-',
|
765
|
-
'46A-SPRK--MOOD-',
|
766
|
-
'47A-SPRK--SUMMER-',
|
767
|
-
'48A-SPRK--DRESS_EYEWEAR-',
|
768
|
-
'49A-SPRK--MADRAGUE-',
|
769
|
-
'50A-SPRK--MOOD-',
|
770
|
-
'51A-SPRK--SUMMER-'
|
771
|
-
]) === null || _b === void 0 ? void 0 : _b.includes(cl_source))) {
|
772
|
-
isTikTokChannel = true;
|
773
|
-
}
|
774
|
-
// 事件上报优化
|
775
|
-
// Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
|
776
|
-
if (options.type === 'beacon' && navigator.sendBeacon && !isTikTokChannel) {
|
777
|
-
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
778
|
-
JSON.stringify({
|
779
|
-
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
780
|
-
})
|
781
|
-
], {
|
782
|
-
type: 'application/json;charset=UTF-8'
|
783
|
-
}));
|
784
|
-
}
|
785
753
|
return window
|
786
|
-
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body:
|
754
|
+
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body: options.type === 'beacon'
|
787
755
|
? JSON.stringify({
|
788
756
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
789
757
|
})
|
790
|
-
: JSON.stringify(options.body) }, (
|
758
|
+
: JSON.stringify(options.body) }, (options.type === 'beacon' && { keepalive: true })))
|
791
759
|
.then((res) => res.json())
|
792
760
|
.catch((err) => Promise.reject(err));
|
793
761
|
}, [bffDataSource, fakeUserId]);
|
@@ -1040,11 +1008,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1040
1008
|
if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
|
1041
1009
|
if (!pixelPvStatusRef.current) {
|
1042
1010
|
pixelPvStatusRef.current = true;
|
1043
|
-
return;
|
1044
1011
|
}
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1012
|
+
else {
|
1013
|
+
const currentUrl = window.location.href;
|
1014
|
+
const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
|
1015
|
+
history.pushState({ path: newUrl }, '', newUrl);
|
1016
|
+
}
|
1048
1017
|
}
|
1049
1018
|
else {
|
1050
1019
|
const body = getEventParamsByJson(pixelEventParamsJson);
|