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/pb-ui.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('uuid'), require('pako'), require('react'), require('qs'), require('eventemitter3'), require('@emotion/css'), require('react-dom')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'uuid', 'pako', 'react', 'qs', 'eventemitter3', '@emotion/css', 'react-dom'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PUI = {}, global.lodash, global.uuid$1, global.pako, global.React, global.qs, global.EventEmitter, global.css, global.ReactDOM));
5
- })(this, (function (exports, lodash, uuid$1, pako, React, qs, EventEmitter, css, ReactDOM) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('uuid'), require('pako'), require('react'), require('qs'), require('eventemitter3'), require('crypto-js'), require('@emotion/css'), require('react-dom')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'lodash', 'uuid', 'pako', 'react', 'qs', 'eventemitter3', 'crypto-js', '@emotion/css', 'react-dom'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PUI = {}, global.lodash, global.uuid$1, global.pako, global.React, global.qs, global.EventEmitter, global.CryptoJS, global.css, global.ReactDOM));
5
+ })(this, (function (exports, lodash, uuid$1, pako, React, qs, EventEmitter, CryptoJS, css, ReactDOM) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -37,7 +37,7 @@
37
37
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
38
38
  PERFORMANCE OF THIS SOFTWARE.
39
39
  ***************************************************************************** */
40
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
40
+ /* global Reflect, Promise, SuppressedError, Symbol */
41
41
 
42
42
 
43
43
  function __rest(s, e) {
@@ -625,6 +625,25 @@
625
625
  };
626
626
  var Consent$4 = React.memo(Consent$3);
627
627
 
628
+ /*
629
+ * @Author: binruan@chatlabs.com
630
+ * @Date: 2025-03-24 17:20:35
631
+ * @LastEditors: binruan@chatlabs.com
632
+ * @LastEditTime: 2025-04-27 13:43:15
633
+ * @FilePath: \pb-sxp-ui\src\core\utils\cryptojs.ts
634
+ *
635
+ */
636
+ // 使用CryptoJS实现
637
+ function encrypt(text, key) {
638
+ const encrypted = CryptoJS.AES.encrypt(text, CryptoJS.enc.Utf8.parse(key), // 密钥
639
+ {
640
+ iv: CryptoJS.enc.Utf8.parse(key), // IV是密钥的字节
641
+ mode: CryptoJS.mode.CBC,
642
+ padding: CryptoJS.pad.Pkcs7
643
+ });
644
+ return encrypted.ciphertext.toString(CryptoJS.enc.Base64);
645
+ }
646
+
628
647
  const SxpDataSourceContext = React.createContext({
629
648
  rtcList: [],
630
649
  tagList: []
@@ -738,25 +757,13 @@
738
757
  }
739
758
  // 事件上报优化
740
759
  // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
741
- // if (options.type === 'beacon' && navigator.sendBeacon) {
742
- // return navigator.sendBeacon(
743
- // `${url}/api/${path}`,
744
- // new Blob(
745
- // [
746
- // JSON.stringify({
747
- // body: btoa(
748
- // encodeURIComponent(
749
- // JSON.stringify({ ...options.body, ...bffDataSource.headers, 'x-user-id': fakeUserId })
750
- // )
751
- // )
752
- // })
753
- // ],
754
- // {
755
- // type: 'application/json;charset=UTF-8'
756
- // }
757
- // )
758
- // );
759
- // }
760
+ if (options.type === 'beacon' && navigator.sendBeacon) {
761
+ return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
762
+ encrypt(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId })), 'dcAR82I0b8sgwCku')
763
+ ], {
764
+ type: 'application/json;charset=UTF-8'
765
+ }));
766
+ }
760
767
  return window
761
768
  .fetch(`${url}/api/${path}`, {
762
769
  headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),