pb-sxp-ui 1.15.19 → 1.15.20-alpha.2

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,6 +4,7 @@ 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';
7
8
  import { css } from '@emotion/css';
8
9
  import * as ReactDOM from 'react-dom';
9
10
  import ReactDOM__default from 'react-dom';
@@ -22,7 +23,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
23
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
24
  PERFORMANCE OF THIS SOFTWARE.
24
25
  ***************************************************************************** */
25
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
26
+ /* global Reflect, Promise, SuppressedError, Symbol */
26
27
 
27
28
 
28
29
  function __rest(s, e) {
@@ -610,6 +611,25 @@ const Consent$3 = ({ width = window.innerWidth, height = window.innerHeight, pri
610
611
  };
611
612
  var Consent$4 = memo(Consent$3);
612
613
 
614
+ /*
615
+ * @Author: binruan@chatlabs.com
616
+ * @Date: 2025-03-24 17:20:35
617
+ * @LastEditors: binruan@chatlabs.com
618
+ * @LastEditTime: 2025-04-27 13:43:15
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
+
613
633
  const SxpDataSourceContext = createContext({
614
634
  rtcList: [],
615
635
  tagList: []
@@ -725,9 +745,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
725
745
  // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
726
746
  if (options.type === 'beacon' && navigator.sendBeacon) {
727
747
  return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
728
- JSON.stringify({
729
- body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
730
- })
748
+ encrypt(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId })), 'dcAR82I0b8sgwCku')
731
749
  ], {
732
750
  type: 'application/json;charset=UTF-8'
733
751
  }));