pb-sxp-ui 1.15.12-alpha.5 → 1.15.12-alpha.6
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 +21 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +24 -7
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/context/SxpDataSourceProvider.js +2 -3
- package/es/core/utils/cryptojs.d.ts +3 -0
- package/es/core/utils/cryptojs.js +18 -0
- package/lib/core/context/SxpDataSourceProvider.js +2 -3
- package/lib/core/utils/cryptojs.d.ts +3 -0
- package/lib/core/utils/cryptojs.js +23 -0
- package/package.json +2 -1
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';
|
@@ -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-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
|
+
|
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: 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
|
}));
|