@jetthai/cuora 1.0.103 → 1.0.104
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/CHANGELOG.md +2 -0
- package/package.json +2 -8
- package/src/api/user.js +3 -4
- package/src/machine/auth_otp_v2.js +6 -2
- package/src/machine/withdraw_fc.js +11 -0
- package/webpack.config.js +0 -33
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.0.104](https://github.com/jetthai/cuora-module/compare/v1.0.103...v1.0.104) (2022-03-21)
|
|
6
|
+
|
|
5
7
|
### [1.0.103](https://github.com/jetthai/cuora-module/compare/v1.0.102...v1.0.103) (2022-03-17)
|
|
6
8
|
|
|
7
9
|
### [1.0.102](https://github.com/jetthai/cuora-module/compare/v1.0.101...v1.0.102) (2022-03-17)
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetthai/cuora",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.104",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "webpack",
|
|
8
7
|
"release": "standard-version && git push --follow-tags origin master && npm publish"
|
|
9
8
|
},
|
|
10
9
|
"repository": {
|
|
@@ -14,13 +13,8 @@
|
|
|
14
13
|
"author": "Neil",
|
|
15
14
|
"license": "ISC",
|
|
16
15
|
"devDependencies": {
|
|
17
|
-
"@babel/core": "^7.15.8",
|
|
18
|
-
"@babel/preset-env": "^7.15.8",
|
|
19
|
-
"babel-loader": "^8.2.2",
|
|
20
16
|
"prettier": "^2.3.0",
|
|
21
|
-
"standard-version": "^9.3.1"
|
|
22
|
-
"webpack": "^5.58.2",
|
|
23
|
-
"webpack-cli": "^4.9.0"
|
|
17
|
+
"standard-version": "^9.3.1"
|
|
24
18
|
},
|
|
25
19
|
"dependencies": {
|
|
26
20
|
"@fingerprintjs/fingerprintjs-pro": "^3.5.5",
|
package/src/api/user.js
CHANGED
|
@@ -34,18 +34,17 @@ export default {
|
|
|
34
34
|
params: { requestId, target, newPassword },
|
|
35
35
|
isPublic: true,
|
|
36
36
|
}),
|
|
37
|
-
// /verify/v2/* 為已登入時的otp驗證
|
|
38
37
|
verifyV2Initiate: ({ strategy }) => ({
|
|
39
38
|
// strategy: 'phone' | 'email'
|
|
40
39
|
url: '/verify/v2/initiate',
|
|
41
40
|
method: 'post',
|
|
42
41
|
params: { strategy },
|
|
43
42
|
}),
|
|
44
|
-
|
|
45
|
-
url: '/
|
|
43
|
+
otpAcknowledge: ({ requestId, target, code }) => ({
|
|
44
|
+
url: '/otpsso/acknowledge',
|
|
46
45
|
method: 'post',
|
|
47
46
|
params: { requestId, target, code },
|
|
48
47
|
isPublic: true,
|
|
49
48
|
}),
|
|
50
|
-
|
|
49
|
+
otpReset: ({ requestId, target }) => ({ url: '/otpsso/reset', method: 'post', params: { requestId, target }, isPublic: true }),
|
|
51
50
|
}
|
|
@@ -17,6 +17,10 @@ export default function (request) {
|
|
|
17
17
|
states: {
|
|
18
18
|
idle: {
|
|
19
19
|
on: {
|
|
20
|
+
SET_OTP_INITIALIZATION: {
|
|
21
|
+
target: 'otp',
|
|
22
|
+
actions: 'setOtpResult',
|
|
23
|
+
},
|
|
20
24
|
SEND_OTP_EMAIL: {
|
|
21
25
|
target: 'otpFetching',
|
|
22
26
|
actions: 'setStrategyEmail',
|
|
@@ -154,12 +158,12 @@ export default function (request) {
|
|
|
154
158
|
},
|
|
155
159
|
resetOtp: async (context, event) => {
|
|
156
160
|
const { requestId, target } = context
|
|
157
|
-
return await request.send(user.
|
|
161
|
+
return await request.send(user.otpReset({ requestId, target }))
|
|
158
162
|
},
|
|
159
163
|
acknowledge: async (context, event) => {
|
|
160
164
|
const { requestId, target } = context
|
|
161
165
|
const code = event.data
|
|
162
|
-
return await request.send(user.
|
|
166
|
+
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
163
167
|
},
|
|
164
168
|
},
|
|
165
169
|
}
|
|
@@ -92,6 +92,7 @@ export default function (request) {
|
|
|
92
92
|
src: 'submitWithdrawFree',
|
|
93
93
|
onDone: {
|
|
94
94
|
target: 'transferred',
|
|
95
|
+
actions: 'setOtp',
|
|
95
96
|
},
|
|
96
97
|
onError: {
|
|
97
98
|
target: 'transferable.operation',
|
|
@@ -103,6 +104,7 @@ export default function (request) {
|
|
|
103
104
|
src: 'submitWithdraw',
|
|
104
105
|
onDone: {
|
|
105
106
|
target: 'transferred',
|
|
107
|
+
actions: 'setOtp',
|
|
106
108
|
},
|
|
107
109
|
onError: {
|
|
108
110
|
target: 'transferable.operation',
|
|
@@ -179,6 +181,15 @@ export default function (request) {
|
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
}),
|
|
184
|
+
setOtp: assign((context, event) => {
|
|
185
|
+
const { requestId, status, target, ttl } = event.data
|
|
186
|
+
return {
|
|
187
|
+
requestId,
|
|
188
|
+
status,
|
|
189
|
+
target,
|
|
190
|
+
ttl,
|
|
191
|
+
}
|
|
192
|
+
}),
|
|
182
193
|
},
|
|
183
194
|
guards: {
|
|
184
195
|
isFree: (context, event) => {
|
package/webpack.config.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
mode: 'production',
|
|
5
|
-
entry: {
|
|
6
|
-
main: './src/index.js',
|
|
7
|
-
},
|
|
8
|
-
output: {
|
|
9
|
-
filename: 'index.js',
|
|
10
|
-
path: path.resolve(__dirname, 'dist'),
|
|
11
|
-
clean: true,
|
|
12
|
-
library: {
|
|
13
|
-
type: 'module',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
experiments: {
|
|
17
|
-
outputModule: true,
|
|
18
|
-
},
|
|
19
|
-
module: {
|
|
20
|
-
rules: [
|
|
21
|
-
{
|
|
22
|
-
test: /\.m?js$/,
|
|
23
|
-
exclude: /node_modules/,
|
|
24
|
-
use: {
|
|
25
|
-
loader: 'babel-loader',
|
|
26
|
-
options: {
|
|
27
|
-
presets: [['@babel/preset-env', { targets: 'defaults' }]],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
}
|