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.cjs CHANGED
@@ -8,6 +8,7 @@ var pako = require('pako');
8
8
  var React = require('react');
9
9
  var qs = require('qs');
10
10
  var EventEmitter = require('eventemitter3');
11
+ var CryptoJS = require('crypto-js');
11
12
  var css = require('@emotion/css');
12
13
  var ReactDOM = require('react-dom');
13
14
 
@@ -44,7 +45,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
44
45
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45
46
  PERFORMANCE OF THIS SOFTWARE.
46
47
  ***************************************************************************** */
47
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
48
+ /* global Reflect, Promise, SuppressedError, Symbol */
48
49
 
49
50
 
50
51
  function __rest(s, e) {
@@ -632,6 +633,25 @@ const Consent$3 = ({ width = window.innerWidth, height = window.innerHeight, pri
632
633
  };
633
634
  var Consent$4 = React.memo(Consent$3);
634
635
 
636
+ /*
637
+ * @Author: binruan@chatlabs.com
638
+ * @Date: 2025-03-24 17:20:35
639
+ * @LastEditors: binruan@chatlabs.com
640
+ * @LastEditTime: 2025-04-27 13:43:15
641
+ * @FilePath: \pb-sxp-ui\src\core\utils\cryptojs.ts
642
+ *
643
+ */
644
+ // 使用CryptoJS实现
645
+ function encrypt(text, key) {
646
+ const encrypted = CryptoJS.AES.encrypt(text, CryptoJS.enc.Utf8.parse(key), // 密钥
647
+ {
648
+ iv: CryptoJS.enc.Utf8.parse(key), // IV是密钥的字节
649
+ mode: CryptoJS.mode.CBC,
650
+ padding: CryptoJS.pad.Pkcs7
651
+ });
652
+ return encrypted.ciphertext.toString(CryptoJS.enc.Base64);
653
+ }
654
+
635
655
  const SxpDataSourceContext = React.createContext({
636
656
  rtcList: [],
637
657
  tagList: []
@@ -747,9 +767,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
747
767
  // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
748
768
  if (options.type === 'beacon' && navigator.sendBeacon) {
749
769
  return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
750
- JSON.stringify({
751
- body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
752
- })
770
+ encrypt(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId })), 'dcAR82I0b8sgwCku')
753
771
  ], {
754
772
  type: 'application/json;charset=UTF-8'
755
773
  }));