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.
@@ -31,7 +31,7 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent,
31
31
  const showFirstImageFn = useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
32
32
  if (!isLoad) {
33
33
  setImgInfo({
34
- loadTime: (new Date() - initTime).toFixed(2) + ''
34
+ loadTime: new Date() - initTime + ''
35
35
  });
36
36
  setIsLoad(true);
37
37
  }
@@ -92,7 +92,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
92
92
  position: index + '',
93
93
  contentFormat: 'video',
94
94
  traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo,
95
- loadTime: ((loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current)).toFixed(2) + ''
95
+ loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + ''
96
96
  }
97
97
  });
98
98
  setIsFirstPlay(false);
@@ -7,6 +7,7 @@ import { useIconLink } from '../components/SxpPageRender/useIconLink';
7
7
  import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../utils/event';
8
8
  import Consent from '../components/Consent';
9
9
  import { getBrowserInfo, getCookie, getDevice, getSystem } from '../utils/tool';
10
+ import { cloneDeep } from 'lodash';
10
11
  export const SxpDataSourceContext = createContext({
11
12
  rtcList: [],
12
13
  tagList: []
@@ -80,8 +81,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
80
81
  path = `${path}?${queryString}`;
81
82
  }
82
83
  if (options.type === 'beacon' && navigator.sendBeacon) {
84
+ const query = qs.stringify(Object.assign(Object.assign({}, bffDataSource.headers), { 'x-user-id': fakeUserId }));
85
+ if (query) {
86
+ path = (options === null || options === void 0 ? void 0 : options.query) ? `${path}&${query}` : `${path}?${query}`;
87
+ }
83
88
  return navigator.sendBeacon(`${url}/api/v1${path}`, new Blob([
84
- JSON.stringify(Object.assign(Object.assign(Object.assign({}, bffDataSource.headers), { 'x-user-id': fakeUserId }), options.body))
89
+ JSON.stringify(Object.assign({}, options.body))
85
90
  ], { type: 'application/json;charset=UTF-8' }));
86
91
  }
87
92
  return window
@@ -197,7 +202,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
197
202
  !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
198
203
  return;
199
204
  }
200
- let jsonParams = JSON.parse(JSON.stringify((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]));
205
+ let jsonParams = cloneDeep((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
201
206
  const urlParams = new URLSearchParams(window.location.search);
202
207
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
203
208
  const fix_par = {
@@ -226,10 +231,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
226
231
  const matches = value === null || value === void 0 ? void 0 : value.match(regex);
227
232
  if (matches) {
228
233
  matches.forEach((match) => {
234
+ var _a;
229
235
  const prop = match.substring(2, match.length - 2);
230
236
  try {
231
237
  let replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
232
238
  if (replaceValue) {
239
+ if (prop.indexOf('currency') &&
240
+ (replaceValue === null || replaceValue === void 0 ? void 0 : replaceValue.indexOf('-')) !== -1 &&
241
+ typeof replaceValue === 'string') {
242
+ replaceValue = (_a = replaceValue === null || replaceValue === void 0 ? void 0 : replaceValue.split('-')) === null || _a === void 0 ? void 0 : _a[0];
243
+ }
233
244
  obj[key] = replaceValue;
234
245
  }
235
246
  else {
@@ -33,7 +33,7 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onViewImageEndEvent,
33
33
  const showFirstImageFn = (0, react_1.useCallback)((e) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
34
34
  if (!isLoad) {
35
35
  setImgInfo({
36
- loadTime: (new Date() - initTime).toFixed(2) + ''
36
+ loadTime: new Date() - initTime + ''
37
37
  });
38
38
  setIsLoad(true);
39
39
  }
@@ -94,7 +94,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
94
94
  position: index + '',
95
95
  contentFormat: 'video',
96
96
  traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo,
97
- loadTime: ((loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current)).toFixed(2) + ''
97
+ loadTime: (loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current) + ''
98
98
  }
99
99
  });
100
100
  setIsFirstPlay(false);
@@ -10,6 +10,7 @@ const useIconLink_1 = require("../components/SxpPageRender/useIconLink");
10
10
  const event_1 = tslib_1.__importStar(require("../utils/event"));
11
11
  const Consent_1 = tslib_1.__importDefault(require("../components/Consent"));
12
12
  const tool_1 = require("../utils/tool");
13
+ const lodash_1 = require("lodash");
13
14
  exports.SxpDataSourceContext = (0, react_1.createContext)({
14
15
  rtcList: [],
15
16
  tagList: []
@@ -83,8 +84,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
83
84
  path = `${path}?${queryString}`;
84
85
  }
85
86
  if (options.type === 'beacon' && navigator.sendBeacon) {
87
+ const query = qs_1.default.stringify(Object.assign(Object.assign({}, bffDataSource.headers), { 'x-user-id': fakeUserId }));
88
+ if (query) {
89
+ path = (options === null || options === void 0 ? void 0 : options.query) ? `${path}&${query}` : `${path}?${query}`;
90
+ }
86
91
  return navigator.sendBeacon(`${url}/api/v1${path}`, new Blob([
87
- JSON.stringify(Object.assign(Object.assign(Object.assign({}, bffDataSource.headers), { 'x-user-id': fakeUserId }), options.body))
92
+ JSON.stringify(Object.assign({}, options.body))
88
93
  ], { type: 'application/json;charset=UTF-8' }));
89
94
  }
90
95
  return window
@@ -200,7 +205,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
200
205
  !((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _a === void 0 ? void 0 : _a[eventName])) {
201
206
  return;
202
207
  }
203
- let jsonParams = JSON.parse(JSON.stringify((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]));
208
+ let jsonParams = (0, lodash_1.cloneDeep)((_b = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _b === void 0 ? void 0 : _b[eventName]);
204
209
  const urlParams = new URLSearchParams(window.location.search);
205
210
  const fbclid = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('fbclid');
206
211
  const fix_par = {
@@ -229,10 +234,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
229
234
  const matches = value === null || value === void 0 ? void 0 : value.match(regex);
230
235
  if (matches) {
231
236
  matches.forEach((match) => {
237
+ var _a;
232
238
  const prop = match.substring(2, match.length - 2);
233
239
  try {
234
240
  let replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product);
235
241
  if (replaceValue) {
242
+ if (prop.indexOf('currency') &&
243
+ (replaceValue === null || replaceValue === void 0 ? void 0 : replaceValue.indexOf('-')) !== -1 &&
244
+ typeof replaceValue === 'string') {
245
+ replaceValue = (_a = replaceValue === null || replaceValue === void 0 ? void 0 : replaceValue.split('-')) === null || _a === void 0 ? void 0 : _a[0];
246
+ }
236
247
  obj[key] = replaceValue;
237
248
  }
238
249
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.7.6",
3
+ "version": "1.7.8",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",