pb-sxp-ui 1.15.32 → 1.15.34
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 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -37
- 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 -37
- 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 -31
- package/lib/core/context/SxpDataSourceProvider.js +8 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -652,6 +652,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
652
652
|
const [playbookType, setPlaybookType] = useState();
|
653
653
|
const [chatlabsId, setChatlabsId] = useState();
|
654
654
|
const finalPageData = useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
|
655
|
+
const pixelPvStatusRef = useRef(false);
|
655
656
|
const isShowConsent = useMemo(() => {
|
656
657
|
var _a, _b, _c, _d;
|
657
658
|
return (((((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent) &&
|
@@ -714,7 +715,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
714
715
|
}, [bffDataSource]);
|
715
716
|
// bff API 请求方法
|
716
717
|
const bffFetch = useCallback((path, options) => {
|
717
|
-
var _a
|
718
|
+
var _a;
|
718
719
|
if (!bffDataSource)
|
719
720
|
return;
|
720
721
|
const url = bffDataSource.url;
|
@@ -722,49 +723,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
722
723
|
const queryString = qs.stringify(options.query);
|
723
724
|
path = `${path}?${queryString}`;
|
724
725
|
}
|
725
|
-
let isTikTokChannel = false;
|
726
|
-
const params = {};
|
727
726
|
const queryString = location.search.slice(1);
|
728
727
|
(_a = splitUrlParams(queryString)) === null || _a === void 0 ? void 0 : _a.forEach((val) => {
|
729
|
-
|
730
|
-
|
731
|
-
params[key] = value;
|
728
|
+
val.split('=')[0];
|
729
|
+
val.split('=')[1];
|
732
730
|
});
|
733
|
-
const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
|
734
|
-
if (cl_source &&
|
735
|
-
((_b = [
|
736
|
-
'40A-SPRK--DRESS_EYEWEAR-',
|
737
|
-
'41A-SPRK--MADRAGUE-',
|
738
|
-
'42A-SPRK--MOOD-',
|
739
|
-
'43A-SPRK--SUMMER-',
|
740
|
-
'44A-SPRK--DRESS_EYEWEAR-',
|
741
|
-
'45A-SPRK--MADRAGUE-',
|
742
|
-
'46A-SPRK--MOOD-',
|
743
|
-
'47A-SPRK--SUMMER-',
|
744
|
-
'48A-SPRK--DRESS_EYEWEAR-',
|
745
|
-
'49A-SPRK--MADRAGUE-',
|
746
|
-
'50A-SPRK--MOOD-',
|
747
|
-
'51A-SPRK--SUMMER-'
|
748
|
-
]) === null || _b === void 0 ? void 0 : _b.includes(cl_source))) {
|
749
|
-
isTikTokChannel = true;
|
750
|
-
}
|
751
|
-
// 事件上报优化
|
752
|
-
// Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
|
753
|
-
if (options.type === 'beacon' && navigator.sendBeacon && !isTikTokChannel) {
|
754
|
-
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
755
|
-
JSON.stringify({
|
756
|
-
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
757
|
-
})
|
758
|
-
], {
|
759
|
-
type: 'application/json;charset=UTF-8'
|
760
|
-
}));
|
761
|
-
}
|
762
731
|
return window
|
763
|
-
.fetch(`${url}/api/${path}`, Object.assign({ headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers), method: options.method, body:
|
732
|
+
.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'
|
764
733
|
? JSON.stringify({
|
765
734
|
body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
|
766
735
|
})
|
767
|
-
: JSON.stringify(options.body) }, (
|
736
|
+
: JSON.stringify(options.body) }, (options.type === 'beacon' && { keepalive: true })))
|
768
737
|
.then((res) => res.json())
|
769
738
|
.catch((err) => Promise.reject(err));
|
770
739
|
}, [bffDataSource, fakeUserId]);
|
@@ -1015,6 +984,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1015
984
|
}
|
1016
985
|
}
|
1017
986
|
if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
|
987
|
+
if (!pixelPvStatusRef.current) {
|
988
|
+
pixelPvStatusRef.current = true;
|
989
|
+
return;
|
990
|
+
}
|
1018
991
|
const currentUrl = window.location.href;
|
1019
992
|
const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
|
1020
993
|
history.pushState({ path: newUrl }, '', newUrl);
|