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