@jetthai/cuora 1.0.149 → 1.0.150
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/auth.js +7 -0
- package/src/machine/auth.js +8 -11
- package/src/machine/auth_otp_v3.js +10 -8
- package/src/machine/deposit/direct.js +4 -4
- package/src/machine/user_sign_up.js +3 -3
- package/src/machine/vip_table.js +14 -14
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.150](https://github.com/jetthai/cuora-module/compare/v1.0.149...v1.0.150) (2022-07-27)
|
|
6
|
+
|
|
5
7
|
### [1.0.149](https://github.com/jetthai/cuora-module/compare/v1.0.148...v1.0.149) (2022-07-26)
|
|
6
8
|
|
|
7
9
|
### [1.0.148](https://github.com/jetthai/cuora-module/compare/v1.0.147...v1.0.148) (2022-07-26)
|
package/package.json
CHANGED
package/src/api/auth.js
CHANGED
|
@@ -19,4 +19,11 @@ export default {
|
|
|
19
19
|
headers: { 'x-access-captcha': reCaptchaToken },
|
|
20
20
|
}),
|
|
21
21
|
logout: () => ({ url: 'logout', method: 'post' }),
|
|
22
|
+
// bindGet for 'google' | 'zalo' | 'facebook'
|
|
23
|
+
bindGet: ({ x, provider, redirectURI }) => ({ url: 'bind', method: 'get', params: { x, provider, redirectURI } }),
|
|
24
|
+
bindPost: ({ provider, countryCode, phone, email }) => ({
|
|
25
|
+
url: 'bind',
|
|
26
|
+
method: 'post',
|
|
27
|
+
params: { provider, countryCode, phone, email },
|
|
28
|
+
}),
|
|
22
29
|
}
|
package/src/machine/auth.js
CHANGED
|
@@ -291,14 +291,14 @@ export default function (request) {
|
|
|
291
291
|
const redirectURL = urljoin(
|
|
292
292
|
request.config.fullURL,
|
|
293
293
|
'login?' +
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
294
|
+
qs.stringify({
|
|
295
|
+
provider,
|
|
296
|
+
redirectURI: `${window.location.protocol}//${window.location.host}`,
|
|
297
|
+
channel: cookies.get('channel') || channel || defaultChannel || 'official',
|
|
298
|
+
subchannel: cookies.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
|
|
299
|
+
// dt,
|
|
300
|
+
platform: 'pwa',
|
|
301
|
+
})
|
|
302
302
|
)
|
|
303
303
|
window.location.href = redirectURL
|
|
304
304
|
},
|
|
@@ -330,9 +330,6 @@ export default function (request) {
|
|
|
330
330
|
fetchUserInfo: async (context, event) => {
|
|
331
331
|
return await request.send(user.getUserInfo())
|
|
332
332
|
},
|
|
333
|
-
updateUserInfo: async (context, event) => {
|
|
334
|
-
return await request.send(user.updateUserInfo(event.data))
|
|
335
|
-
},
|
|
336
333
|
},
|
|
337
334
|
}
|
|
338
335
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createMachine, assign } from 'xstate'
|
|
2
|
-
import api from '../api/user'
|
|
3
2
|
import user from '../api/user'
|
|
3
|
+
import auth from '../api/auth'
|
|
4
4
|
|
|
5
5
|
export default function (request) {
|
|
6
6
|
return createMachine(
|
|
@@ -86,7 +86,8 @@ export default function (request) {
|
|
|
86
86
|
invoke: {
|
|
87
87
|
src: 'sendPhone',
|
|
88
88
|
onDone: {
|
|
89
|
-
target: '
|
|
89
|
+
target: 'otp',
|
|
90
|
+
actions: 'setVerificationData',
|
|
90
91
|
},
|
|
91
92
|
onError: { target: 'phone' },
|
|
92
93
|
},
|
|
@@ -95,7 +96,8 @@ export default function (request) {
|
|
|
95
96
|
invoke: {
|
|
96
97
|
src: 'sendEmail',
|
|
97
98
|
onDone: {
|
|
98
|
-
target: '
|
|
99
|
+
target: 'otp',
|
|
100
|
+
actions: 'setVerificationData',
|
|
99
101
|
},
|
|
100
102
|
onError: { target: 'email' },
|
|
101
103
|
},
|
|
@@ -226,22 +228,22 @@ export default function (request) {
|
|
|
226
228
|
},
|
|
227
229
|
services: {
|
|
228
230
|
fetchUserInfo: async (context, event) => {
|
|
229
|
-
return await request.send(
|
|
231
|
+
return await request.send(user.getUserInfo())
|
|
230
232
|
},
|
|
231
233
|
verify: async (context, event) => {
|
|
232
|
-
return await request.send(
|
|
234
|
+
return await request.send(user.verifyV2Initiate({ strategy: context.strategy }))
|
|
233
235
|
},
|
|
234
236
|
sendPhone: async (context, event) => {
|
|
235
237
|
const { countryCode, phone } = context
|
|
236
|
-
return await request.send(
|
|
238
|
+
return await request.send(auth.bindPost({ provider: 'phone', countryCode, phone }))
|
|
237
239
|
},
|
|
238
240
|
sendEmail: async (context, event) => {
|
|
239
241
|
const { email } = context
|
|
240
|
-
return await request.send(
|
|
242
|
+
return await request.send(auth.bindPost({ provider: 'email', email }))
|
|
241
243
|
},
|
|
242
244
|
resetOtp: async (context, event) => {
|
|
243
245
|
const { requestId, target } = context
|
|
244
|
-
return await request.send(
|
|
246
|
+
return await request.send(user.otpReset({ requestId, target }))
|
|
245
247
|
},
|
|
246
248
|
acknowledge: async (context, event) => {
|
|
247
249
|
const { requestId, target } = context
|
|
@@ -16,7 +16,7 @@ export default function (request) {
|
|
|
16
16
|
currentCategory: 'direct',
|
|
17
17
|
currentMethod: null,
|
|
18
18
|
amount: null,
|
|
19
|
-
result: null
|
|
19
|
+
result: null,
|
|
20
20
|
},
|
|
21
21
|
states: {
|
|
22
22
|
loading: {
|
|
@@ -51,7 +51,7 @@ export default function (request) {
|
|
|
51
51
|
loaded: {
|
|
52
52
|
on: {
|
|
53
53
|
SELECT_DIRECT: {
|
|
54
|
-
actions: ['setDirect', 'reset']
|
|
54
|
+
actions: ['setDirect', 'reset'],
|
|
55
55
|
},
|
|
56
56
|
SELECT_BANK: {
|
|
57
57
|
actions: 'setSelectedBank',
|
|
@@ -142,7 +142,7 @@ export default function (request) {
|
|
|
142
142
|
}),
|
|
143
143
|
setAmount: assign((context, event) => {
|
|
144
144
|
return {
|
|
145
|
-
amount: event.data
|
|
145
|
+
amount: event.data,
|
|
146
146
|
}
|
|
147
147
|
}),
|
|
148
148
|
setCalculation: assign((context, event) => {
|
|
@@ -200,7 +200,7 @@ export default function (request) {
|
|
|
200
200
|
payment.submitDepositTransactionBank({
|
|
201
201
|
method: currentMethod,
|
|
202
202
|
amount,
|
|
203
|
-
applyerBankCode: selectedBank.bankCode
|
|
203
|
+
applyerBankCode: selectedBank.bankCode,
|
|
204
204
|
})
|
|
205
205
|
)
|
|
206
206
|
},
|
|
@@ -15,7 +15,7 @@ export default function (request) {
|
|
|
15
15
|
channel: null,
|
|
16
16
|
subchannel: null,
|
|
17
17
|
signUpData: {},
|
|
18
|
-
reCaptchaToken: null
|
|
18
|
+
reCaptchaToken: null,
|
|
19
19
|
},
|
|
20
20
|
states: {
|
|
21
21
|
idle: {
|
|
@@ -49,7 +49,7 @@ export default function (request) {
|
|
|
49
49
|
setReCaptchaToken: assign((context, event) => {
|
|
50
50
|
const { reCaptchaToken } = event.data
|
|
51
51
|
return {
|
|
52
|
-
reCaptchaToken
|
|
52
|
+
reCaptchaToken,
|
|
53
53
|
}
|
|
54
54
|
}),
|
|
55
55
|
setSignUpPhone: assign((context, event) => {
|
|
@@ -89,7 +89,7 @@ export default function (request) {
|
|
|
89
89
|
channel: cookies.get('channel') || defaultChannel || channel,
|
|
90
90
|
subchannel: cookies.get('subchannel') || defaultSubchannel || subchannel,
|
|
91
91
|
dt,
|
|
92
|
-
reCaptchaToken: context.reCaptchaToken
|
|
92
|
+
reCaptchaToken: context.reCaptchaToken,
|
|
93
93
|
})
|
|
94
94
|
)
|
|
95
95
|
},
|
package/src/machine/vip_table.js
CHANGED
|
@@ -13,7 +13,7 @@ export default function (request) {
|
|
|
13
13
|
cashbackOthers: [],
|
|
14
14
|
cashbackSlot: [],
|
|
15
15
|
cashbackFishing: [],
|
|
16
|
-
upgradeReward: []
|
|
16
|
+
upgradeReward: [],
|
|
17
17
|
},
|
|
18
18
|
states: {
|
|
19
19
|
fetching: {
|
|
@@ -26,23 +26,23 @@ export default function (request) {
|
|
|
26
26
|
onError: {
|
|
27
27
|
target: 'fail',
|
|
28
28
|
},
|
|
29
|
-
}
|
|
29
|
+
},
|
|
30
30
|
},
|
|
31
31
|
completed: {},
|
|
32
|
-
fail: {}
|
|
33
|
-
}
|
|
32
|
+
fail: {},
|
|
33
|
+
},
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
actions: {
|
|
37
37
|
setVipTable: assign((context, event) => {
|
|
38
38
|
const vipTable = event.data
|
|
39
39
|
const filterVipTable = vipTable.filter((item) => item.title !== 'rookie' && item.title !== 'guest')
|
|
40
|
-
const fasterWithdraw = filterVipTable.map(item => item.fasterWithdraw)
|
|
41
|
-
const fasterReward = filterVipTable.map(item => item.fasterReward)
|
|
42
|
-
const cashbackOthers = filterVipTable.map(item => item.cashbackOther)
|
|
43
|
-
const cashbackSlot = filterVipTable.map(item => item.cashbackSlot)
|
|
44
|
-
const cashbackFishing = filterVipTable.map(item => item.cashbackFishing)
|
|
45
|
-
const upgradeReward = filterVipTable.map(item => {
|
|
40
|
+
const fasterWithdraw = filterVipTable.map((item) => item.fasterWithdraw)
|
|
41
|
+
const fasterReward = filterVipTable.map((item) => item.fasterReward)
|
|
42
|
+
const cashbackOthers = filterVipTable.map((item) => item.cashbackOther)
|
|
43
|
+
const cashbackSlot = filterVipTable.map((item) => item.cashbackSlot)
|
|
44
|
+
const cashbackFishing = filterVipTable.map((item) => item.cashbackFishing)
|
|
45
|
+
const upgradeReward = filterVipTable.map((item) => {
|
|
46
46
|
return {
|
|
47
47
|
reward: item.upgradeReward,
|
|
48
48
|
type: item.rewardType,
|
|
@@ -57,7 +57,7 @@ export default function (request) {
|
|
|
57
57
|
cashbackOthers,
|
|
58
58
|
cashbackSlot,
|
|
59
59
|
cashbackFishing,
|
|
60
|
-
upgradeReward
|
|
60
|
+
upgradeReward,
|
|
61
61
|
}
|
|
62
62
|
}),
|
|
63
63
|
},
|
|
@@ -65,14 +65,14 @@ export default function (request) {
|
|
|
65
65
|
fetchVipTable: async (context, event) => {
|
|
66
66
|
const { viptable = {} } = await request.send(user.getVipTable())
|
|
67
67
|
const { data = [] } = viptable
|
|
68
|
-
data.map(item => {
|
|
68
|
+
data.map((item) => {
|
|
69
69
|
item.title = item.title.toLowerCase()
|
|
70
70
|
return item
|
|
71
71
|
})
|
|
72
72
|
|
|
73
73
|
return data
|
|
74
74
|
},
|
|
75
|
-
}
|
|
75
|
+
},
|
|
76
76
|
}
|
|
77
77
|
)
|
|
78
|
-
}
|
|
78
|
+
}
|