pb-sxp-ui 1.7.6 → 1.7.8

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isEmpty, isEqual, cloneDeep, debounce, throttle, get } from 'lodash';
1
+ import { isEmpty, cloneDeep, isEqual, debounce, throttle, get } from 'lodash';
2
2
  import { v4 } from 'uuid';
3
3
  import pako from 'pako';
4
4
  import React, { useContext, useMemo, memo, useEffect, createContext, useState, useRef, useCallback, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
@@ -682,8 +682,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
682
682
  // 事件上报优化
683
683
  // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
684
684
  if (options.type === 'beacon' && navigator.sendBeacon) {
685
+ const query = qs.stringify(Object.assign(Object.assign({}, bffDataSource.headers), { 'x-user-id': fakeUserId }));
686
+ if (query) {
687
+ path = (options === null || options === void 0 ? void 0 : options.query) ? `${path}&${query}` : `${path}?${query}`;
688
+ }
685
689
  return navigator.sendBeacon(`${url}/api/v1${path}`, new Blob([
686
- JSON.stringify(Object.assign(Object.assign(Object.assign({}, bffDataSource.headers), { 'x-user-id': fakeUserId }), options.body))
690
+ JSON.stringify(Object.assign({}, options.body))
687
691
  ], { type: 'application/json;charset=UTF-8' }));
688
692
  }
689
693
  return window
@@ -805,7 +809,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
805
809
  !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
806
810
  return;
807
811
  }
808
- let jsonParams = JSON.parse(JSON.stringify((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]));
812
+ let jsonParams = cloneDeep((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
809
813
  const urlParams = new URLSearchParams(window.location.search);
810
814
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
811
815
  const fix_par = {
@@ -834,10 +838,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
834
838
  const matches = value === null || value === void 0 ? void 0 : value.match(regex);
835
839
  if (matches) {
836
840
  matches.forEach((match) => {
841
+ var _a;
837
842
  const prop = match.substring(2, match.length - 2);
838
843
  try {
839
844
  let replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
840
845
  if (replaceValue) {
846
+ if (prop.indexOf('currency') &&
847
+ (replaceValue === null || replaceValue === void 0 ? void 0 : replaceValue.indexOf('-')) !== -1 &&
848
+ typeof replaceValue === 'string') {
849
+ replaceValue = (_a = replaceValue === null || replaceValue === void 0 ? void 0 : replaceValue.split('-')) === null || _a === void 0 ? void 0 : _a[0];
850
+ }
841
851
  obj[key] = replaceValue;
842
852
  }
843
853
  else {
@@ -15724,7 +15734,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
15724
15734
  position: index + '',
15725
15735
  contentFormat: 'video',
15726
15736
  traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo,
15727
- loadTime: ((loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current)).toFixed(2) + ''
15737
+ loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + ''
15728
15738
  }
15729
15739
  });
15730
15740
  setIsFirstPlay(false);
@@ -16111,7 +16121,7 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
16111
16121
  const showFirstImageFn = useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
16112
16122
  if (!isLoad) {
16113
16123
  setImgInfo({
16114
- loadTime: (new Date() - initTime).toFixed(2) + ''
16124
+ loadTime: new Date() - initTime + ''
16115
16125
  });
16116
16126
  setIsLoad(true);
16117
16127
  }