message-verify 1.0.1-beta.34 → 1.0.1-beta.36

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.js CHANGED
@@ -5,10 +5,12 @@ import Fingerprint2 from 'fingerprintjs2';
5
5
  import ReLoginModal from './relogin-modal.js';
6
6
  let fingerprintPromise = null; // 用 Promise 本身作为缓存
7
7
  export const initFingerprint = async () => {
8
+ console.log('fingerprintPromise:', fingerprintPromise);
8
9
  if (!fingerprintPromise) {
9
10
  fingerprintPromise = new Promise((resolve) => {
10
11
  Fingerprint2.get(components => {
11
12
  const includeKeys = ['userAgent', 'deviceMemory', 'cpuClass', 'hardwareConcurrency', 'platform'];
13
+ console.log('components:', components);
12
14
  const values = components
13
15
  .filter(c => includeKeys.includes(c.key))
14
16
  .map(c => c.value)
package/dist/main.js CHANGED
@@ -44,6 +44,8 @@ createRoot(document.getElementById('root')).render(_jsxs(_Fragment, { children:
44
44
  apiReject: () => {
45
45
  },
46
46
  apiResolve: () => {
47
+ },
48
+ apiPromiseToEmpty: () => {
47
49
  }
48
50
  }), children: "Show verify Modal" }), _jsx("button", { onClick: () => createReLoginModal({
49
51
  goLogin: () => {
@@ -21,6 +21,7 @@ export type ModalConfig = {
21
21
  api?: string;
22
22
  apiReject: any;
23
23
  apiResolve: any;
24
+ apiPromiseToEmpty: () => void;
24
25
  };
25
26
  export type LoginModalConfig = {
26
27
  goLogin: () => void;
@@ -11,7 +11,7 @@ const CreateMessageVerifyModal = ({ props }) => {
11
11
  const [captchaImage, setCaptchaImage] = useState('');
12
12
  const [captchCode, setCaptchCode] = useState('');
13
13
  const [captchaKey, setCaptchaKey] = useState('');
14
- const { data, http, lang, api = '/admin/sms/send', config, apiResolve, apiReject } = props || {};
14
+ const { data, http, lang, api = '/admin/sms/send', config, apiResolve, apiPromiseToEmpty } = props || {};
15
15
  const dataObj = JSON.parse(data || '{}');
16
16
  const { mobile, verifyCodeKey } = dataObj || {};
17
17
  const getKey = async () => {
@@ -64,7 +64,7 @@ const CreateMessageVerifyModal = ({ props }) => {
64
64
  };
65
65
  return (_jsxs(Modal, { width: 420, visible: visible, onClose: () => {
66
66
  setVisible(false);
67
- apiReject();
67
+ apiPromiseToEmpty();
68
68
  props.onClose?.();
69
69
  }, children: [_jsx("div", { style: { fontSize: 14, color: '#666' }, children: t('alreadySend', lang, { phone: mobile }) }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8, marginTop: 12 }, children: [_jsx(Input.OTP, { length: 6, value: otp, onChange: async (val) => {
70
70
  setOtp(val);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "1.0.1-beta.34",
3
+ "version": "1.0.1-beta.36",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
package/src/index.tsx CHANGED
@@ -7,10 +7,12 @@ import { ModalConfig, LoginModalConfig } from './utils/type.js';
7
7
  let fingerprintPromise: Promise<string> | null = null; // 用 Promise 本身作为缓存
8
8
 
9
9
  export const initFingerprint = async (): Promise<string> => {
10
+ console.log('fingerprintPromise:', fingerprintPromise);
10
11
  if (!fingerprintPromise) {
11
12
  fingerprintPromise = new Promise((resolve) => {
12
13
  Fingerprint2.get(components => {
13
14
  const includeKeys = ['userAgent', 'deviceMemory', 'cpuClass', 'hardwareConcurrency', 'platform'];
15
+ console.log('components:', components);
14
16
  const values = components
15
17
  .filter(c => includeKeys.includes(c.key))
16
18
  .map(c => c.value)
package/src/main.tsx CHANGED
@@ -48,6 +48,8 @@ createRoot(document.getElementById('root')!).render(
48
48
  apiReject: () => {
49
49
  },
50
50
  apiResolve: () => {
51
+ },
52
+ apiPromiseToEmpty: () => {
51
53
  }
52
54
  })}>
53
55
  Show verify Modal
package/src/utils/type.ts CHANGED
@@ -22,6 +22,7 @@ export type ModalConfig = {
22
22
  api?: string;
23
23
  apiReject: any;
24
24
  apiResolve: any;
25
+ apiPromiseToEmpty: () => void;
25
26
  }
26
27
 
27
28
  export type LoginModalConfig = {
@@ -12,7 +12,7 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
12
12
  const [captchaImage, setCaptchaImage] = useState<string>('');
13
13
  const [captchCode, setCaptchCode] = useState<string>('');
14
14
  const [captchaKey, setCaptchaKey] = useState<string>('');
15
- const { data, http, lang, api = '/admin/sms/send', config, apiResolve, apiReject } = props || {};
15
+ const { data, http, lang, api = '/admin/sms/send', config, apiResolve, apiPromiseToEmpty } = props || {};
16
16
  const dataObj = JSON.parse(data || '{}');
17
17
  const { mobile, verifyCodeKey } = dataObj || {};
18
18
 
@@ -72,7 +72,7 @@ const CreateMessageVerifyModal = ({ props }: { props: ModalConfig }) => {
72
72
  visible={visible}
73
73
  onClose={() => {
74
74
  setVisible(false);
75
- apiReject();
75
+ apiPromiseToEmpty();
76
76
  props.onClose?.();
77
77
  }}
78
78
  >