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/pb-ui.js CHANGED
@@ -667,6 +667,7 @@
667
667
  const [playbookType, setPlaybookType] = React.useState();
668
668
  const [chatlabsId, setChatlabsId] = React.useState();
669
669
  const finalPageData = React.useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
670
+ const pixelPvStatusRef = React.useRef(false);
670
671
  const isShowConsent = React.useMemo(() => {
671
672
  var _a, _b, _c, _d;
672
673
  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) &&
@@ -729,7 +730,7 @@
729
730
  }, [bffDataSource]);
730
731
  // bff API 请求方法
731
732
  const bffFetch = React.useCallback((path, options) => {
732
- var _a, _b;
733
+ var _a;
733
734
  if (!bffDataSource)
734
735
  return;
735
736
  const url = bffDataSource.url;
@@ -737,49 +738,17 @@
737
738
  const queryString = qs.stringify(options.query);
738
739
  path = `${path}?${queryString}`;
739
740
  }
740
- let isTikTokChannel = false;
741
- const params = {};
742
741
  const queryString = location.search.slice(1);
743
742
  (_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;
743
+ val.split('=')[0];
744
+ val.split('=')[1];
747
745
  });
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
- }
777
746
  return window
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
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'
779
748
  ? JSON.stringify({
780
749
  body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
781
750
  })
782
- : JSON.stringify(options.body) }, (isTikTokChannel && { keepalive: true })))
751
+ : JSON.stringify(options.body) }, (options.type === 'beacon' && { keepalive: true })))
783
752
  .then((res) => res.json())
784
753
  .catch((err) => Promise.reject(err));
785
754
  }, [bffDataSource, fakeUserId]);
@@ -1030,6 +999,10 @@
1030
999
  }
1031
1000
  }
1032
1001
  if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
1002
+ if (!pixelPvStatusRef.current) {
1003
+ pixelPvStatusRef.current = true;
1004
+ return;
1005
+ }
1033
1006
  const currentUrl = window.location.href;
1034
1007
  const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
1035
1008
  history.pushState({ path: newUrl }, '', newUrl);