message-verify 1.0.1-beta.54 → 1.0.1-beta.57

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/.arcconfig CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "project.name": "message-verify",
2
3
  "phabricator.uri": "https://code.yangqianguan.com/",
3
4
  "lint.engine": "YqgWebDiffLintEngine"
4
5
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { VerifyModalConfig, LoginModalConfig } from './utils/type.js';
2
2
  export declare const initFingerprint: () => Promise<string>;
3
3
  export declare const createReLoginModal: (modalProps: LoginModalConfig) => void;
4
- export declare const VerifyHandler: ({ data, config, http, verifyPromise, sendApi }: VerifyModalConfig) => Promise<any>;
4
+ export declare const VerifyHandler: ({ data, config, http, verifyPromise, sendApi, response }: VerifyModalConfig) => Promise<any>;
package/dist/index.js CHANGED
@@ -54,7 +54,8 @@ export const createReLoginModal = (modalProps) => {
54
54
  const reLoginModalId = 'relogin-modal-container';
55
55
  creatModal(modalProps, reLoginModalId, ReLoginModal);
56
56
  };
57
- export const VerifyHandler = ({ data, config, http, verifyPromise, sendApi }) => {
57
+ export const VerifyHandler = ({ data, config, http, verifyPromise, sendApi, response }) => {
58
+ console.log('VerifyHandler =>', response);
58
59
  const toEmpty = () => {
59
60
  verifyPromise.current = null;
60
61
  };
@@ -11,5 +11,6 @@ declare const _default: {
11
11
  alertContent: string;
12
12
  ok: string;
13
13
  chidoriOpenPro: string;
14
+ verifyFail: string;
14
15
  };
15
16
  export default _default;
@@ -10,5 +10,6 @@ export default {
10
10
  accountAlert: 'Account Security Alert',
11
11
  alertContent: 'Changes have been detected in your login environment or network information.To ensure account security, please log in again to verify your identity.',
12
12
  ok: 'OK',
13
- chidoriOpenPro: 'Chidori has activated security protection for you'
13
+ chidoriOpenPro: 'Chidori has activated security protection for you',
14
+ verifyFail: 'Validation failed'
14
15
  };
@@ -11,5 +11,6 @@ declare const _default: {
11
11
  alertContent: string;
12
12
  ok: string;
13
13
  chidoriOpenPro: string;
14
+ verifyFail: string;
14
15
  };
15
16
  export default _default;
@@ -10,5 +10,6 @@ export default {
10
10
  accountAlert: 'Peringatan Keamanan Akun',
11
11
  alertContent: 'Terdeteksi perubahan pada lingkungan login atau informasi jaringan Anda.Untuk menjaga keamanan akun, silakan login kembali untuk memverifikasi identitas Anda.',
12
12
  ok: 'Baiklah',
13
- chidoriOpenPro: 'chidori telah mengaktifkan keamanan untuk Anda'
13
+ chidoriOpenPro: 'chidori telah mengaktifkan keamanan untuk Anda',
14
+ verifyFail: 'Autentikasi gagal'
14
15
  };
@@ -11,5 +11,6 @@ declare const _default: {
11
11
  alertContent: string;
12
12
  ok: string;
13
13
  chidoriOpenPro: string;
14
+ verifyFail: string;
14
15
  };
15
16
  export default _default;
@@ -10,5 +10,6 @@ export default {
10
10
  accountAlert: '账号安全提醒',
11
11
  alertContent: '检测到您的登录环境或网络信息有变动,为保障账户安全,请重新登录验证身份',
12
12
  ok: '好的',
13
- chidoriOpenPro: 'chidori已为您开启安全防护'
13
+ chidoriOpenPro: 'chidori已为您开启安全防护',
14
+ verifyFail: '验证失败'
14
15
  };
package/dist/main.js CHANGED
@@ -38,7 +38,7 @@ const config = {
38
38
  };
39
39
  const promise = { current: null };
40
40
  createRoot(document.getElementById('root')).render(_jsxs(_Fragment, { children: [_jsx("button", { onClick: () => {
41
- return VerifyHandler({ data, config, http: axios, verifyPromise: promise });
41
+ return VerifyHandler({ data, config, http: axios, verifyPromise: promise, response: {} });
42
42
  }, children: "Show verify Modal" }), _jsx("button", { onClick: () => createReLoginModal({
43
43
  goLogin: () => {
44
44
  console.log('goLogin');
@@ -68,15 +68,13 @@ const CreateMessageVerifyModal = ({ props }) => {
68
68
  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);
71
- console.log('val', val);
72
71
  if (val.length === 6) {
73
- console.log('val2===>');
74
72
  try {
75
73
  const res = await Promise.race([
76
74
  new Promise((resolve, reject) => {
77
75
  setTimeout(() => {
78
76
  reject(new Error('Timeout'));
79
- }, 10000);
77
+ }, 1000);
80
78
  }),
81
79
  new Promise((resolve, reject) => {
82
80
  http({
@@ -88,29 +86,24 @@ const CreateMessageVerifyModal = ({ props }) => {
88
86
  'Content-Type': config.headers['Content-Type'],
89
87
  }
90
88
  }).then(res => {
91
- console.log('res', res);
92
89
  resolve(res);
93
90
  }).catch(err => {
94
- console.log('err', err);
95
91
  reject(err);
96
92
  });
97
93
  })
98
94
  ]);
99
- console.log('res', res);
100
95
  if (res?.data?.status?.code === 0) {
101
- console.log('code', res?.data?.status?.code);
102
- apiResolve(res);
96
+ // apiResolve(res);
103
97
  setVisible(false);
104
98
  }
105
99
  else {
106
- console.log('验证失败');
107
- message.error('验证失败');
100
+ message.error(t('verifyFail', lang));
108
101
  setOtp('');
109
102
  }
110
103
  }
111
104
  catch (error) {
112
105
  console.warn('catch=>error', error);
113
- message.error('验证失败');
106
+ message.error(t('verifyFail', lang));
114
107
  setOtp('');
115
108
  }
116
109
  }
@@ -25,6 +25,7 @@ export type VerifyModalConfig = {
25
25
  verifyPromise: {
26
26
  current: Promise<any> | null;
27
27
  };
28
+ response: any;
28
29
  };
29
30
  export type LoginModalConfig = {
30
31
  goLogin: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "message-verify",
3
- "version": "1.0.1-beta.54",
3
+ "version": "1.0.1-beta.57",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "dependencies": {
package/src/index.tsx CHANGED
@@ -64,7 +64,8 @@ export const createReLoginModal = (modalProps: LoginModalConfig) => {
64
64
  creatModal(modalProps, reLoginModalId, ReLoginModal);
65
65
  }
66
66
 
67
- export const VerifyHandler = ({data, config, http, verifyPromise, sendApi}: VerifyModalConfig): Promise<any> => {
67
+ export const VerifyHandler = ({data, config, http, verifyPromise, sendApi, response}: VerifyModalConfig): Promise<any> => {
68
+ console.log('VerifyHandler =>', response);
68
69
  const toEmpty = () => {
69
70
  verifyPromise.current = null;
70
71
  };
package/src/locales/en.ts CHANGED
@@ -10,5 +10,6 @@ export default {
10
10
  accountAlert: 'Account Security Alert',
11
11
  alertContent: 'Changes have been detected in your login environment or network information.To ensure account security, please log in again to verify your identity.',
12
12
  ok: 'OK',
13
- chidoriOpenPro: 'Chidori has activated security protection for you'
13
+ chidoriOpenPro: 'Chidori has activated security protection for you',
14
+ verifyFail: 'Validation failed'
14
15
  };
package/src/locales/id.ts CHANGED
@@ -10,5 +10,6 @@ export default {
10
10
  accountAlert: 'Peringatan Keamanan Akun',
11
11
  alertContent: 'Terdeteksi perubahan pada lingkungan login atau informasi jaringan Anda.Untuk menjaga keamanan akun, silakan login kembali untuk memverifikasi identitas Anda.',
12
12
  ok: 'Baiklah',
13
- chidoriOpenPro: 'chidori telah mengaktifkan keamanan untuk Anda'
13
+ chidoriOpenPro: 'chidori telah mengaktifkan keamanan untuk Anda',
14
+ verifyFail: 'Autentikasi gagal'
14
15
  };
package/src/locales/zh.ts CHANGED
@@ -10,5 +10,6 @@ export default {
10
10
  accountAlert: '账号安全提醒',
11
11
  alertContent: '检测到您的登录环境或网络信息有变动,为保障账户安全,请重新登录验证身份',
12
12
  ok: '好的',
13
- chidoriOpenPro: 'chidori已为您开启安全防护'
13
+ chidoriOpenPro: 'chidori已为您开启安全防护',
14
+ verifyFail: '验证失败'
14
15
  };
package/src/main.tsx CHANGED
@@ -43,7 +43,7 @@ const promise = {current: null};
43
43
  createRoot(document.getElementById('root')!).render(
44
44
  <>
45
45
  <button onClick={() => {
46
- return VerifyHandler({data, config, http: axios, verifyPromise: promise});
46
+ return VerifyHandler({data, config, http: axios, verifyPromise: promise, response: {}});
47
47
  }}>
48
48
  Show verify Modal
49
49
  </button>
@@ -84,15 +84,13 @@ const CreateMessageVerifyModal = ({ props }: { props: VerifyModalConfig }) => {
84
84
  value={otp}
85
85
  onChange={async (val) => {
86
86
  setOtp(val);
87
- console.log('val', val);
88
87
  if (val.length === 6) {
89
- console.log('val2===>');
90
88
  try {
91
89
  const res = await Promise.race([
92
90
  new Promise((resolve, reject) => {
93
91
  setTimeout(() => {
94
92
  reject(new Error('Timeout'));
95
- }, 10000);
93
+ }, 1000);
96
94
  }),
97
95
  new Promise((resolve, reject) => {
98
96
  http({
@@ -104,27 +102,22 @@ const CreateMessageVerifyModal = ({ props }: { props: VerifyModalConfig }) => {
104
102
  'Content-Type': config.headers['Content-Type'],
105
103
  }
106
104
  }).then(res => {
107
- console.log('res', res);
108
105
  resolve(res);
109
106
  }).catch(err => {
110
- console.log('err', err);
111
107
  reject(err);
112
108
  })
113
109
  })
114
110
  ]) as any;
115
- console.log('res', res);
116
111
  if (res?.data?.status?.code === 0) {
117
- console.log('code', res?.data?.status?.code);
118
- apiResolve(res);
112
+ // apiResolve(res);
119
113
  setVisible(false);
120
114
  } else {
121
- console.log('验证失败');
122
- message.error('验证失败');
115
+ message.error(t('verifyFail', lang));
123
116
  setOtp('');
124
117
  }
125
118
  } catch (error) {
126
119
  console.warn('catch=>error', error);
127
- message.error('验证失败');
120
+ message.error(t('verifyFail', lang));
128
121
  setOtp('');
129
122
  }
130
123
  }
package/src/utils/type.ts CHANGED
@@ -24,6 +24,7 @@ export type VerifyModalConfig = {
24
24
  apiResolve?: any;
25
25
  apiPromiseToEmpty?: () => void;
26
26
  verifyPromise: {current: Promise<any> | null}
27
+ response: any;
27
28
  }
28
29
 
29
30
  export type LoginModalConfig = {