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