byt-ui 0.1.3 → 0.1.4

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.
@@ -94274,7 +94274,7 @@ var index = (function () {
94274
94274
 
94275
94275
  /***/ }),
94276
94276
 
94277
- /***/ 20434:
94277
+ /***/ 71099:
94278
94278
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
94279
94279
 
94280
94280
  "use strict";
@@ -94283,7 +94283,188 @@ __webpack_require__.r(__webpack_exports__);
94283
94283
 
94284
94284
  // EXPORTS
94285
94285
  __webpack_require__.d(__webpack_exports__, {
94286
- "default": function() { return /* binding */ modules_Sentry; }
94286
+ getCookie: function() { return /* binding */ getCookie; },
94287
+ removeCookie: function() { return /* binding */ removeCookie; },
94288
+ setCookie: function() { return /* binding */ setCookie; }
94289
+ });
94290
+
94291
+ ;// CONCATENATED MODULE: ./node_modules/js-cookie/dist/js.cookie.mjs
94292
+ /*! js-cookie v3.0.5 | MIT */
94293
+ /* eslint-disable no-var */
94294
+ function js_cookie_assign (target) {
94295
+ for (var i = 1; i < arguments.length; i++) {
94296
+ var source = arguments[i];
94297
+ for (var key in source) {
94298
+ target[key] = source[key];
94299
+ }
94300
+ }
94301
+ return target
94302
+ }
94303
+ /* eslint-enable no-var */
94304
+
94305
+ /* eslint-disable no-var */
94306
+ var defaultConverter = {
94307
+ read: function (value) {
94308
+ if (value[0] === '"') {
94309
+ value = value.slice(1, -1);
94310
+ }
94311
+ return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
94312
+ },
94313
+ write: function (value) {
94314
+ return encodeURIComponent(value).replace(
94315
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
94316
+ decodeURIComponent
94317
+ )
94318
+ }
94319
+ };
94320
+ /* eslint-enable no-var */
94321
+
94322
+ /* eslint-disable no-var */
94323
+
94324
+ function init (converter, defaultAttributes) {
94325
+ function set (name, value, attributes) {
94326
+ if (typeof document === 'undefined') {
94327
+ return
94328
+ }
94329
+
94330
+ attributes = js_cookie_assign({}, defaultAttributes, attributes);
94331
+
94332
+ if (typeof attributes.expires === 'number') {
94333
+ attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
94334
+ }
94335
+ if (attributes.expires) {
94336
+ attributes.expires = attributes.expires.toUTCString();
94337
+ }
94338
+
94339
+ name = encodeURIComponent(name)
94340
+ .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
94341
+ .replace(/[()]/g, escape);
94342
+
94343
+ var stringifiedAttributes = '';
94344
+ for (var attributeName in attributes) {
94345
+ if (!attributes[attributeName]) {
94346
+ continue
94347
+ }
94348
+
94349
+ stringifiedAttributes += '; ' + attributeName;
94350
+
94351
+ if (attributes[attributeName] === true) {
94352
+ continue
94353
+ }
94354
+
94355
+ // Considers RFC 6265 section 5.2:
94356
+ // ...
94357
+ // 3. If the remaining unparsed-attributes contains a %x3B (";")
94358
+ // character:
94359
+ // Consume the characters of the unparsed-attributes up to,
94360
+ // not including, the first %x3B (";") character.
94361
+ // ...
94362
+ stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
94363
+ }
94364
+
94365
+ return (document.cookie =
94366
+ name + '=' + converter.write(value, name) + stringifiedAttributes)
94367
+ }
94368
+
94369
+ function get (name) {
94370
+ if (typeof document === 'undefined' || (arguments.length && !name)) {
94371
+ return
94372
+ }
94373
+
94374
+ // To prevent the for loop in the first place assign an empty array
94375
+ // in case there are no cookies at all.
94376
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
94377
+ var jar = {};
94378
+ for (var i = 0; i < cookies.length; i++) {
94379
+ var parts = cookies[i].split('=');
94380
+ var value = parts.slice(1).join('=');
94381
+
94382
+ try {
94383
+ var found = decodeURIComponent(parts[0]);
94384
+ jar[found] = converter.read(value, found);
94385
+
94386
+ if (name === found) {
94387
+ break
94388
+ }
94389
+ } catch (e) {}
94390
+ }
94391
+
94392
+ return name ? jar[name] : jar
94393
+ }
94394
+
94395
+ return Object.create(
94396
+ {
94397
+ set,
94398
+ get,
94399
+ remove: function (name, attributes) {
94400
+ set(
94401
+ name,
94402
+ '',
94403
+ js_cookie_assign({}, attributes, {
94404
+ expires: -1
94405
+ })
94406
+ );
94407
+ },
94408
+ withAttributes: function (attributes) {
94409
+ return init(this.converter, js_cookie_assign({}, this.attributes, attributes))
94410
+ },
94411
+ withConverter: function (converter) {
94412
+ return init(js_cookie_assign({}, this.converter, converter), this.attributes)
94413
+ }
94414
+ },
94415
+ {
94416
+ attributes: { value: Object.freeze(defaultAttributes) },
94417
+ converter: { value: Object.freeze(converter) }
94418
+ }
94419
+ )
94420
+ }
94421
+
94422
+ var api = init(defaultConverter, { path: '/' });
94423
+ /* eslint-enable no-var */
94424
+
94425
+
94426
+
94427
+ // EXTERNAL MODULE: ./packages/common/modules/website.js
94428
+ var website = __webpack_require__(17021);
94429
+ ;// CONCATENATED MODULE: ./packages/common/modules/cookie.js
94430
+ /*
94431
+ * @Description:
94432
+ * @Author: 王国火
94433
+ * @Date: 2022-10-18 12:37:03
94434
+ * @LastEditTime: 2024-04-19 13:27:26
94435
+ * @LastEditors: 王国火
94436
+ */
94437
+
94438
+
94439
+ const getCookie = key => {
94440
+ const searchKey = `${website["default"].key}-${key}`;
94441
+ return api.get(searchKey) || '';
94442
+ };
94443
+ const setCookie = (key, value, expires = 7, path = '/') => {
94444
+ return api.set(`${website["default"].key}-${key}`, value, {
94445
+ expires,
94446
+ path
94447
+ });
94448
+ };
94449
+ const removeCookie = (key, path = '/') => {
94450
+ return api.remove(`${website["default"].key}-${key}`, {
94451
+ path,
94452
+ domain: window.location.hostname
94453
+ });
94454
+ };
94455
+
94456
+ /***/ }),
94457
+
94458
+ /***/ 17182:
94459
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
94460
+
94461
+ "use strict";
94462
+ // ESM COMPAT FLAG
94463
+ __webpack_require__.r(__webpack_exports__);
94464
+
94465
+ // EXPORTS
94466
+ __webpack_require__.d(__webpack_exports__, {
94467
+ "default": function() { return /* binding */ sentry; }
94287
94468
  });
94288
94469
 
94289
94470
  ;// CONCATENATED MODULE: ./node_modules/@sentry/utils/esm/worldwide.js
@@ -121566,12 +121747,12 @@ function sdk_init(
121566
121747
  var cookie = __webpack_require__(71099);
121567
121748
  // EXTERNAL MODULE: ./packages/common/modules/store.js
121568
121749
  var store = __webpack_require__(67745);
121569
- ;// CONCATENATED MODULE: ./packages/common/modules/Sentry.js
121750
+ ;// CONCATENATED MODULE: ./packages/common/modules/sentry.js
121570
121751
  /*
121571
121752
  * @Description:
121572
121753
  * @Author: 王国火
121573
121754
  * @Date: 2024-04-18 15:37:44
121574
- * @LastEditTime: 2024-04-19 13:50:16
121755
+ * @LastEditTime: 2024-04-22 08:56:36
121575
121756
  * @LastEditors: 王国火
121576
121757
  */
121577
121758
 
@@ -121595,9 +121776,38 @@ class Sentry {
121595
121776
  // 注册调用获取dsn;
121596
121777
  this.register();
121597
121778
  }
121779
+ getUserInfo() {
121780
+ // 处理要提交的用户信息
121781
+ const {
121782
+ fullPath
121783
+ } = this.router.currentRoute;
121784
+ const userInfo = (0,cookie.getCookie)('userInfo') || (0,store.getStore)('userInfo');
121785
+ const tenantId = (0,cookie.getCookie)('tenantId') || '';
121786
+ const params = {
121787
+ path: fullPath,
121788
+ title: document.title,
121789
+ ip: window.location.host
121790
+ };
121791
+ let opts = {};
121792
+ if (userInfo) {
121793
+ const info = JSON.parse(userInfo);
121794
+ const {
121795
+ username,
121796
+ email
121797
+ } = info;
121798
+ opts = Object.assign(params, info, {
121799
+ id: tenantId,
121800
+ username,
121801
+ email
121802
+ });
121803
+ } else {
121804
+ opts = params;
121805
+ }
121806
+ return opts;
121807
+ }
121598
121808
  captureEvent({
121599
121809
  message = '',
121600
- level = 'error',
121810
+ level = 'info',
121601
121811
  tags = {
121602
121812
  type: 'xhr-error',
121603
121813
  category: 'xhr-category'
@@ -121605,6 +121815,7 @@ class Sentry {
121605
121815
  extra = {},
121606
121816
  breadcrumbs = []
121607
121817
  }) {
121818
+ // 错误上报
121608
121819
  captureEvent({
121609
121820
  message,
121610
121821
  level,
@@ -121614,6 +121825,7 @@ class Sentry {
121614
121825
  });
121615
121826
  }
121616
121827
  init(dsn) {
121828
+ // init调用
121617
121829
  const params = {
121618
121830
  Vue: this.Vue,
121619
121831
  dsn,
@@ -121630,37 +121842,16 @@ class Sentry {
121630
121842
  },
121631
121843
  beforeSend: e => {
121632
121844
  // 请求发送前添加用户信息
121633
- const {
121634
- fullPath
121635
- } = this.router.currentRoute;
121636
- const userInfo = (0,cookie.getCookie)('userInfo') || (0,store.getStore)('userInfo');
121637
- const tenantId = (0,cookie.getCookie)('tenantId') || '';
121638
- const params = {
121639
- path: fullPath,
121640
- title: document.title,
121641
- ip: window.location.host
121642
- };
121643
- if (userInfo) {
121644
- const info = JSON.parse(userInfo);
121645
- const {
121646
- username,
121647
- email
121648
- } = info;
121649
- e.user = Object.assign(params, info, {
121650
- id: tenantId,
121651
- username,
121652
- email
121653
- });
121654
- } else {
121655
- e.user = params;
121656
- }
121845
+ e.user = this.getUserInfo();
121657
121846
  return e;
121658
121847
  },
121659
121848
  beforeSendTransaction: e => {
121849
+ // 请求发送前添加用户信息,修改transaction为title
121660
121850
  e.transaction = document.title;
121851
+ e.user = this.getUserInfo();
121661
121852
  return e;
121662
121853
  },
121663
- // 任何请求都会调用的函数,处理请求status_code不是200时,自定义上报错误信息
121854
+ // 任何请求都会调用的函数,处理请求status_code不是200时,或者code=1,自定义上报错误信息
121664
121855
  beforeBreadcrumb: (scope, hint) => {
121665
121856
  if (scope.category == 'xhr') {
121666
121857
  const statusCode = scope.data.status_code;
@@ -121717,205 +121908,30 @@ class Sentry {
121717
121908
  // 允许自定义配置覆盖、合并默认配置
121718
121909
  sdk_init(Object.assign({}, params, this.options));
121719
121910
  }
121720
- register() {
121721
- this.axios({
121911
+ async register() {
121912
+ const res = await this.axios({
121722
121913
  url: '/leo-tech-bridge/sysParam/getSentryDsn',
121723
121914
  method: 'GET'
121724
- }).then(res => {
121725
- // 需要兼容商城和业务中台
121726
- const val = res instanceof Object ? res.data : res;
121727
- if (val) {
121728
- // 重新处理拼接dsn地址
121729
- const localhost = window.location;
121730
- const result = val.split('@');
121731
- const dsn = `${localhost.protocol}//${result[0]}@${localhost.host}${result[1]}`;
121732
- this.init(dsn);
121733
- }
121734
121915
  });
121735
- }
121736
- }
121737
- /* harmony default export */ var modules_Sentry = (Sentry);
121738
-
121739
- /***/ }),
121740
-
121741
- /***/ 71099:
121742
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
121743
-
121744
- "use strict";
121745
- // ESM COMPAT FLAG
121746
- __webpack_require__.r(__webpack_exports__);
121747
-
121748
- // EXPORTS
121749
- __webpack_require__.d(__webpack_exports__, {
121750
- getCookie: function() { return /* binding */ getCookie; },
121751
- removeCookie: function() { return /* binding */ removeCookie; },
121752
- setCookie: function() { return /* binding */ setCookie; }
121753
- });
121754
-
121755
- ;// CONCATENATED MODULE: ./node_modules/js-cookie/dist/js.cookie.mjs
121756
- /*! js-cookie v3.0.5 | MIT */
121757
- /* eslint-disable no-var */
121758
- function js_cookie_assign (target) {
121759
- for (var i = 1; i < arguments.length; i++) {
121760
- var source = arguments[i];
121761
- for (var key in source) {
121762
- target[key] = source[key];
121916
+ // 需要兼容商城和业务中台
121917
+ const val = res instanceof Object ? res.data : res;
121918
+ if (val) {
121919
+ // 重新处理拼接dsn地址
121920
+ const localhost = window.location;
121921
+ const result = val.split('@');
121922
+ const dsn = `${localhost.protocol}//${result[0]}@${localhost.host}${result[1]}`;
121923
+ this.init(dsn);
121763
121924
  }
121764
121925
  }
121765
- return target
121766
121926
  }
121767
- /* eslint-enable no-var */
121768
-
121769
- /* eslint-disable no-var */
121770
- var defaultConverter = {
121771
- read: function (value) {
121772
- if (value[0] === '"') {
121773
- value = value.slice(1, -1);
121774
- }
121775
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
121776
- },
121777
- write: function (value) {
121778
- return encodeURIComponent(value).replace(
121779
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
121780
- decodeURIComponent
121781
- )
121927
+ /* harmony default export */ var sentry = ({
121928
+ install(Vue, options) {
121929
+ const sentry = new Sentry(Object.assign({
121930
+ Vue
121931
+ }, options));
121932
+ Vue.prototype.$sentry = sentry;
121782
121933
  }
121783
- };
121784
- /* eslint-enable no-var */
121785
-
121786
- /* eslint-disable no-var */
121787
-
121788
- function init (converter, defaultAttributes) {
121789
- function set (name, value, attributes) {
121790
- if (typeof document === 'undefined') {
121791
- return
121792
- }
121793
-
121794
- attributes = js_cookie_assign({}, defaultAttributes, attributes);
121795
-
121796
- if (typeof attributes.expires === 'number') {
121797
- attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
121798
- }
121799
- if (attributes.expires) {
121800
- attributes.expires = attributes.expires.toUTCString();
121801
- }
121802
-
121803
- name = encodeURIComponent(name)
121804
- .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
121805
- .replace(/[()]/g, escape);
121806
-
121807
- var stringifiedAttributes = '';
121808
- for (var attributeName in attributes) {
121809
- if (!attributes[attributeName]) {
121810
- continue
121811
- }
121812
-
121813
- stringifiedAttributes += '; ' + attributeName;
121814
-
121815
- if (attributes[attributeName] === true) {
121816
- continue
121817
- }
121818
-
121819
- // Considers RFC 6265 section 5.2:
121820
- // ...
121821
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
121822
- // character:
121823
- // Consume the characters of the unparsed-attributes up to,
121824
- // not including, the first %x3B (";") character.
121825
- // ...
121826
- stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
121827
- }
121828
-
121829
- return (document.cookie =
121830
- name + '=' + converter.write(value, name) + stringifiedAttributes)
121831
- }
121832
-
121833
- function get (name) {
121834
- if (typeof document === 'undefined' || (arguments.length && !name)) {
121835
- return
121836
- }
121837
-
121838
- // To prevent the for loop in the first place assign an empty array
121839
- // in case there are no cookies at all.
121840
- var cookies = document.cookie ? document.cookie.split('; ') : [];
121841
- var jar = {};
121842
- for (var i = 0; i < cookies.length; i++) {
121843
- var parts = cookies[i].split('=');
121844
- var value = parts.slice(1).join('=');
121845
-
121846
- try {
121847
- var found = decodeURIComponent(parts[0]);
121848
- jar[found] = converter.read(value, found);
121849
-
121850
- if (name === found) {
121851
- break
121852
- }
121853
- } catch (e) {}
121854
- }
121855
-
121856
- return name ? jar[name] : jar
121857
- }
121858
-
121859
- return Object.create(
121860
- {
121861
- set,
121862
- get,
121863
- remove: function (name, attributes) {
121864
- set(
121865
- name,
121866
- '',
121867
- js_cookie_assign({}, attributes, {
121868
- expires: -1
121869
- })
121870
- );
121871
- },
121872
- withAttributes: function (attributes) {
121873
- return init(this.converter, js_cookie_assign({}, this.attributes, attributes))
121874
- },
121875
- withConverter: function (converter) {
121876
- return init(js_cookie_assign({}, this.converter, converter), this.attributes)
121877
- }
121878
- },
121879
- {
121880
- attributes: { value: Object.freeze(defaultAttributes) },
121881
- converter: { value: Object.freeze(converter) }
121882
- }
121883
- )
121884
- }
121885
-
121886
- var api = init(defaultConverter, { path: '/' });
121887
- /* eslint-enable no-var */
121888
-
121889
-
121890
-
121891
- // EXTERNAL MODULE: ./packages/common/modules/website.js
121892
- var website = __webpack_require__(17021);
121893
- ;// CONCATENATED MODULE: ./packages/common/modules/cookie.js
121894
- /*
121895
- * @Description:
121896
- * @Author: 王国火
121897
- * @Date: 2022-10-18 12:37:03
121898
- * @LastEditTime: 2024-04-19 13:27:26
121899
- * @LastEditors: 王国火
121900
- */
121901
-
121902
-
121903
- const getCookie = key => {
121904
- const searchKey = `${website["default"].key}-${key}`;
121905
- return api.get(searchKey) || '';
121906
- };
121907
- const setCookie = (key, value, expires = 7, path = '/') => {
121908
- return api.set(`${website["default"].key}-${key}`, value, {
121909
- expires,
121910
- path
121911
- });
121912
- };
121913
- const removeCookie = (key, path = '/') => {
121914
- return api.remove(`${website["default"].key}-${key}`, {
121915
- path,
121916
- domain: window.location.hostname
121917
- });
121918
- };
121934
+ });
121919
121935
 
121920
121936
  /***/ }),
121921
121937
 
@@ -161064,8 +161080,8 @@ module.exports = zipObject
161064
161080
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
161065
161081
 
161066
161082
  var map = {
161067
- "./Sentry.js": 20434,
161068
161083
  "./cookie.js": 71099,
161084
+ "./sentry.js": 17182,
161069
161085
  "./store.js": 67745,
161070
161086
  "./validate.js": 32368,
161071
161087
  "./website.js": 17021