pb-sxp-ui 1.15.12-alpha.6 → 1.15.12-alpha.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
@@ -4,7 +4,6 @@ import pako from 'pako';
4
4
  import React, { useContext, useMemo, memo, useEffect, createContext, useState, useRef, useCallback, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
5
5
  import qs from 'qs';
6
6
  import EventEmitter from 'eventemitter3';
7
- import CryptoJS from 'crypto-js';
8
7
  import { css } from '@emotion/css';
9
8
  import * as ReactDOM from 'react-dom';
10
9
  import ReactDOM__default from 'react-dom';
@@ -611,25 +610,6 @@ const Consent$3 = ({ width = window.innerWidth, height = window.innerHeight, pri
611
610
  };
612
611
  var Consent$4 = memo(Consent$3);
613
612
 
614
- /*
615
- * @Author: binruan@chatlabs.com
616
- * @Date: 2025-03-24 17:20:35
617
- * @LastEditors: binruan@chatlabs.com
618
- * @LastEditTime: 2025-03-24 17:42:04
619
- * @FilePath: \pb-sxp-ui\src\core\utils\cryptojs.ts
620
- *
621
- */
622
- // 使用CryptoJS实现
623
- function encrypt(text, key) {
624
- const encrypted = CryptoJS.AES.encrypt(text, CryptoJS.enc.Utf8.parse(key), // 密钥
625
- {
626
- iv: CryptoJS.enc.Utf8.parse(key), // IV是密钥的字节
627
- mode: CryptoJS.mode.CBC,
628
- padding: CryptoJS.pad.Pkcs7
629
- });
630
- return encrypted.ciphertext.toString(CryptoJS.enc.Base64);
631
- }
632
-
633
613
  const SxpDataSourceContext = createContext({
634
614
  rtcList: [],
635
615
  tagList: []
@@ -745,7 +725,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
745
725
  // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
746
726
  if (options.type === 'beacon' && navigator.sendBeacon) {
747
727
  return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
748
- encrypt(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId })), 'dcAR82I0b8sgwCku')
728
+ JSON.stringify({
729
+ body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
730
+ })
749
731
  ], {
750
732
  type: 'application/json;charset=UTF-8'
751
733
  }));
@@ -925,7 +907,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
925
907
  bffDataSource
926
908
  ]);
927
909
  const bffFbReport = useCallback(({ eventName, product }) => {
928
- var _a, _b, _c, _d, _e, _f;
910
+ var _a, _b, _c, _d, _e, _f, _g;
929
911
  if (!enableReportEvent ||
930
912
  !enabledMetaConversionApi ||
931
913
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) ||
@@ -989,7 +971,15 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
989
971
  }
990
972
  };
991
973
  getEventParams(jsonParams);
992
- return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/event/report/FB/${(_f = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _f === void 0 ? void 0 : _f['x-app-id']}/${eventName}`, {
974
+ const params = {};
975
+ const queryString = location.search.slice(1);
976
+ (_f = splitUrlParams(queryString)) === null || _f === void 0 ? void 0 : _f.map((val) => {
977
+ const key = val.split('=')[0];
978
+ const value = val.split('=')[1];
979
+ params[key] = value;
980
+ });
981
+ const cl_source = params === null || params === void 0 ? void 0 : params.cl_source;
982
+ return bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch(`v2/fb/${(_g = bffDataSource === null || bffDataSource === void 0 ? void 0 : bffDataSource.headers) === null || _g === void 0 ? void 0 : _g['x-app-id']}/${eventName}${cl_source ? `/${decodeURIComponent(cl_source)}` : ''}`, {
993
983
  method: 'POST',
994
984
  body: jsonParams,
995
985
  type: 'beacon'