pb-sxp-ui 1.15.20-alpha.1 → 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 +28 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -20
- 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 +31 -24
- 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 +8 -0
- package/es/core/utils/cryptojs.d.ts +3 -0
- package/es/core/utils/cryptojs.js +18 -0
- package/lib/core/context/SxpDataSourceProvider.js +8 -0
- 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.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
|
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: []
|
@@ -745,25 +765,13 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
745
765
|
}
|
746
766
|
// 事件上报优化
|
747
767
|
// Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
// encodeURIComponent(
|
756
|
-
// JSON.stringify({ ...options.body, ...bffDataSource.headers, 'x-user-id': fakeUserId })
|
757
|
-
// )
|
758
|
-
// )
|
759
|
-
// })
|
760
|
-
// ],
|
761
|
-
// {
|
762
|
-
// type: 'application/json;charset=UTF-8'
|
763
|
-
// }
|
764
|
-
// )
|
765
|
-
// );
|
766
|
-
// }
|
768
|
+
if (options.type === 'beacon' && navigator.sendBeacon) {
|
769
|
+
return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
|
770
|
+
encrypt(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId })), 'dcAR82I0b8sgwCku')
|
771
|
+
], {
|
772
|
+
type: 'application/json;charset=UTF-8'
|
773
|
+
}));
|
774
|
+
}
|
767
775
|
return window
|
768
776
|
.fetch(`${url}/api/${path}`, {
|
769
777
|
headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
|