@jetthai/cuora 1.0.45 → 1.0.46
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 +1 -1
- package/src/api/user.js +1 -0
- package/src/machine/user_reset_password.js +43 -18
- package/src/machine/user_sign_up.js +2 -2
- package/src/machine/withdraw.js +2 -0
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.46](https://github.com/jetthai/cuora-module/compare/v1.0.45...v1.0.46) (2021-11-23)
|
|
6
|
+
|
|
5
7
|
### [1.0.45](https://github.com/jetthai/cuora-module/compare/v1.0.44...v1.0.45) (2021-11-23)
|
|
6
8
|
|
|
7
9
|
### [1.0.44](https://github.com/jetthai/cuora-module/compare/v1.0.43...v1.0.44) (2021-11-22)
|
package/package.json
CHANGED
package/src/api/user.js
CHANGED
|
@@ -27,6 +27,7 @@ export default {
|
|
|
27
27
|
isPublic: true,
|
|
28
28
|
}),
|
|
29
29
|
passwordV2Abandon: ({ requestId, target }) => ({ url: 'recovery/v2/abandon', method: 'post', params: { requestId, target }, isPublic: true }),
|
|
30
|
+
passwordV2ResetOtp: ({ requestId, target }) => ({ url: 'recovery/v2/reset', method: 'post', params: { requestId, target }, isPublic: true }),
|
|
30
31
|
passwordV2Change: ({ requestId, target, newPassword }) => ({
|
|
31
32
|
url: 'recovery/v2/changePassword',
|
|
32
33
|
method: 'post',
|
|
@@ -17,30 +17,31 @@ export default function (request) {
|
|
|
17
17
|
requestId: null,
|
|
18
18
|
ttl: null,
|
|
19
19
|
target: {},
|
|
20
|
+
newPassword: null,
|
|
20
21
|
},
|
|
21
22
|
states: {
|
|
22
23
|
idle: {
|
|
23
24
|
on: {
|
|
24
25
|
SEND_OTP_EMAIL: {
|
|
25
|
-
target: '
|
|
26
|
+
target: 'otpFetching',
|
|
26
27
|
actions: 'setOtpParamsEmail',
|
|
27
28
|
},
|
|
28
29
|
SEND_OTP_LOCAL: {
|
|
29
|
-
target: '
|
|
30
|
+
target: 'otpFetching',
|
|
30
31
|
actions: 'setOtpParamsLocal',
|
|
31
32
|
},
|
|
32
33
|
SEND_OTP_PHONE: {
|
|
33
|
-
target: '
|
|
34
|
+
target: 'otpFetching',
|
|
34
35
|
actions: 'setOtpParamsPhone',
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
38
|
},
|
|
38
|
-
|
|
39
|
+
otpFetching: {
|
|
39
40
|
invoke: {
|
|
40
41
|
src: 'sendOtp',
|
|
41
42
|
onDone: {
|
|
42
43
|
target: 'otp',
|
|
43
|
-
actions: '
|
|
44
|
+
actions: 'setOtpResult',
|
|
44
45
|
},
|
|
45
46
|
onError: {
|
|
46
47
|
target: 'idle',
|
|
@@ -62,22 +63,40 @@ export default function (request) {
|
|
|
62
63
|
BACK: {
|
|
63
64
|
target: 'idle',
|
|
64
65
|
},
|
|
65
|
-
|
|
66
|
-
target: '
|
|
66
|
+
RESET_OTP: {
|
|
67
|
+
target: 'otpResetting',
|
|
67
68
|
},
|
|
68
69
|
},
|
|
69
70
|
},
|
|
70
|
-
|
|
71
|
+
otpResetting: {
|
|
71
72
|
invoke: {
|
|
72
|
-
src: '
|
|
73
|
+
src: 'resetOtp',
|
|
73
74
|
onDone: {
|
|
74
|
-
target: '
|
|
75
|
+
target: 'otp',
|
|
76
|
+
actions: 'setOtpResult',
|
|
75
77
|
},
|
|
76
78
|
onError: {
|
|
77
79
|
target: 'otp',
|
|
78
80
|
},
|
|
79
81
|
},
|
|
80
82
|
},
|
|
83
|
+
acknowledging: {
|
|
84
|
+
invoke: {
|
|
85
|
+
src: 'acknowledge',
|
|
86
|
+
onDone: {
|
|
87
|
+
target: 'acknowledged',
|
|
88
|
+
},
|
|
89
|
+
onError: [
|
|
90
|
+
{
|
|
91
|
+
target: 'idle',
|
|
92
|
+
cond: (context, event) => event.data.code === 'ERR_A108',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
target: 'otp',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
81
100
|
acknowledged: {
|
|
82
101
|
on: {
|
|
83
102
|
CHANGE: {
|
|
@@ -92,9 +111,15 @@ export default function (request) {
|
|
|
92
111
|
onDone: {
|
|
93
112
|
target: 'changed',
|
|
94
113
|
},
|
|
95
|
-
onError:
|
|
96
|
-
|
|
97
|
-
|
|
114
|
+
onError: [
|
|
115
|
+
{
|
|
116
|
+
target: 'idle',
|
|
117
|
+
cond: (context, event) => event.data.code === 'ERR_A108',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
target: 'acknowledged',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
98
123
|
},
|
|
99
124
|
},
|
|
100
125
|
changed: {},
|
|
@@ -130,7 +155,7 @@ export default function (request) {
|
|
|
130
155
|
},
|
|
131
156
|
}
|
|
132
157
|
}),
|
|
133
|
-
|
|
158
|
+
setOtpResult: assign((context, event) => {
|
|
134
159
|
const { requestId, ttl, target } = event.data
|
|
135
160
|
return {
|
|
136
161
|
requestId,
|
|
@@ -151,13 +176,13 @@ export default function (request) {
|
|
|
151
176
|
},
|
|
152
177
|
services: {
|
|
153
178
|
sendOtp: async (context, event) => {
|
|
154
|
-
const { requestId, target } = context
|
|
155
|
-
if (requestId) {
|
|
156
|
-
await request.send(user.passwordV2Abandon({ requestId, target }))
|
|
157
|
-
}
|
|
158
179
|
const { provider, username, countryCode, phone, email } = context.otpParams
|
|
159
180
|
return await request.send(user.passwordV2RecoveryInit({ provider, username, countryCode, phone, email }))
|
|
160
181
|
},
|
|
182
|
+
resetOtp: async (context, event) => {
|
|
183
|
+
const { requestId, target } = context
|
|
184
|
+
return await request.send(user.passwordV2ResetOtp({ requestId, target }))
|
|
185
|
+
},
|
|
161
186
|
acknowledge: async (context, event) => {
|
|
162
187
|
const { requestId, target } = context
|
|
163
188
|
const code = event.data
|
|
@@ -76,10 +76,10 @@ export default function (request) {
|
|
|
76
76
|
},
|
|
77
77
|
guards: {
|
|
78
78
|
isInvalidFormat: (context, event) => {
|
|
79
|
-
return !context.email || /[+-]/.test(context.email)
|
|
79
|
+
// return !context.email || /[+-]/.test(context.email)
|
|
80
80
|
},
|
|
81
81
|
isLessThan6Characters: (context, event) => {
|
|
82
|
-
return context.password.length < 6
|
|
82
|
+
// return context.password.length < 6
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
services: {
|
package/src/machine/withdraw.js
CHANGED
|
@@ -223,6 +223,7 @@ export default function (request) {
|
|
|
223
223
|
let distance = 0,
|
|
224
224
|
limit = 0,
|
|
225
225
|
amount = 0
|
|
226
|
+
|
|
226
227
|
if (lastMatchedIndex > -1) {
|
|
227
228
|
rules[lastMatchedIndex].match = true
|
|
228
229
|
amount = rules[lastMatchedIndex].maxWithdrawAmount
|
|
@@ -241,6 +242,7 @@ export default function (request) {
|
|
|
241
242
|
} else {
|
|
242
243
|
amount = balance
|
|
243
244
|
}
|
|
245
|
+
|
|
244
246
|
return {
|
|
245
247
|
withdrawDistance: distance,
|
|
246
248
|
withdrawAmount: amount,
|