ls-pro-common 3.0.96 → 3.0.97

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.
@@ -1,3 +1,4 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
1
2
  import "antd/es/spin/style";
2
3
  import _Spin from "antd/es/spin";
3
4
  import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
@@ -7,10 +8,12 @@ import _Modal from "antd/es/modal";
7
8
  import "antd/es/message/style";
8
9
  import _message from "antd/es/message";
9
10
  import _typeof from "@babel/runtime/helpers/esm/typeof";
11
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
12
  import ReactDOM from 'react-dom';
11
13
  import { QuestionCircleOutlined } from '@ant-design/icons';
12
14
  import { httpPost } from '../http';
13
15
  import React from 'react';
16
+ import FingerprintJS from '@fingerprintjs/fingerprintjs';
14
17
  export { throttle, debounce } from 'lodash';
15
18
  /**
16
19
  * 获取 url 参数
@@ -865,6 +868,7 @@ export var openPageInMain = function openPageInMain(option) {
865
868
  param: option
866
869
  });
867
870
  };
871
+ /** 显示加载 */
868
872
  export var showLoading = function showLoading() {
869
873
  var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '处理中...';
870
874
  var loading = document.getElementById('myloading');
@@ -877,6 +881,7 @@ export var showLoading = function showLoading() {
877
881
  var pNode = getFullScreenElement() || document.body;
878
882
  pNode.appendChild(loadWrapper);
879
883
  };
884
+ /** 退出加载 */
880
885
  export var exitLoading = function exitLoading() {
881
886
  var loading = document.getElementById('myloading');
882
887
  if (loading) {
@@ -884,12 +889,19 @@ export var exitLoading = function exitLoading() {
884
889
  (_loading$parentNode = loading.parentNode) === null || _loading$parentNode === void 0 ? void 0 : _loading$parentNode.removeChild(loading);
885
890
  }
886
891
  };
892
+ /** 处理主题 */
887
893
  export var handleTheme = function handleTheme() {
888
894
  var theme = getCache('theme');
889
895
  if (theme) {
890
896
  document.body.classList.add('theme-' + theme);
891
897
  }
892
898
  };
899
+ /**
900
+ * 睡眠
901
+ *
902
+ * @param secord 秒
903
+ * @returns
904
+ */
893
905
  export var sleep = function sleep(secord) {
894
906
  return new Promise(function (resolve) {
895
907
  setTimeout(function () {
@@ -897,6 +909,12 @@ export var sleep = function sleep(secord) {
897
909
  }, secord * 1000);
898
910
  });
899
911
  };
912
+ /**
913
+ * 通用下载文件方法
914
+ *
915
+ * @param url 文件地址
916
+ * @param fileName 文件名
917
+ */
900
918
  export var downloadFile = function downloadFile(url, fileName) {
901
919
  var a = document.createElement('a');
902
920
  a.href = url;
@@ -916,6 +934,33 @@ export var downloadFile = function downloadFile(url, fileName) {
916
934
  a.click();
917
935
  document.body.removeChild(a);
918
936
  };
919
- export var isSaasVersion = function isSaasVersion() {
920
- return (getCache('TENANT') || '') === '1';
921
- };
937
+ /**
938
+ * 获取浏览器指纹 基于fingerprintjs
939
+ *
940
+ * @returns 浏览器指纹
941
+ */
942
+ export var getBrowserId = /*#__PURE__*/function () {
943
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
944
+ var fp, fingerprint;
945
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
946
+ while (1) switch (_context.prev = _context.next) {
947
+ case 0:
948
+ _context.next = 2;
949
+ return FingerprintJS.load();
950
+ case 2:
951
+ fp = _context.sent;
952
+ _context.next = 5;
953
+ return fp.get();
954
+ case 5:
955
+ fingerprint = _context.sent;
956
+ return _context.abrupt("return", fingerprint.visitorId);
957
+ case 7:
958
+ case "end":
959
+ return _context.stop();
960
+ }
961
+ }, _callee);
962
+ }));
963
+ return function getBrowserId() {
964
+ return _ref.apply(this, arguments);
965
+ };
966
+ }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.0.96",
3
+ "version": "3.0.97",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
@@ -32,7 +32,8 @@
32
32
  "moment": "^2.27.0",
33
33
  "rc-util": "^5.0.6",
34
34
  "react-sortable-hoc": "^2.0.0",
35
- "swr": "1.1.0"
35
+ "swr": "1.1.0",
36
+ "@fingerprintjs/fingerprintjs": "^4.6.1"
36
37
  },
37
38
  "peerDependencies": {
38
39
  "antd": "4.x",