@jetthai/cuora 1.1.335 → 1.1.336-dev-1
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 +18 -0
- package/package.json +1 -1
- package/src/api/auth.js +2 -2
- package/src/api/common.js +1 -0
- package/src/api/game.js +2 -0
- package/src/machine/auth.js +18 -2
- package/src/machine/common.js +1 -1
- package/src/machine/deposit/crypto_button.js +2 -2
- package/src/machine/deposit/float.js +2 -2
- package/src/machine/deposit/index.js +4 -0
- package/src/machine/deposit/loadcard_vn.js +6 -6
- package/src/machine/deposit/qrcode_v2.js +6 -6
- package/src/machine/deposit/virtual_bank_cash.js +201 -0
- package/src/machine/deposit/virtual_bank_vn.js +289 -0
- package/src/machine/deposit/vpay.js +2 -2
- package/src/machine/error.js +10 -0
- package/src/request/request.js +0 -1
- package/src/util/deviceToken.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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.1.336-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.333-dev-8...v1.1.336-dev-1) (2025-01-15)
|
|
6
|
+
|
|
7
|
+
### [1.1.335](https://github.com/jetthai/cuora-module/compare/v1.1.334...v1.1.335) (2025-01-13)
|
|
8
|
+
|
|
9
|
+
### [1.1.334](https://github.com/jetthai/cuora-module/compare/v1.1.333-dev-6...v1.1.334) (2025-01-13)
|
|
10
|
+
|
|
11
|
+
### [1.1.333-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.333-dev-7...v1.1.333-dev-8) (2025-01-13)
|
|
12
|
+
|
|
13
|
+
### [1.1.333-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.333-dev-6...v1.1.333-dev-7) (2025-01-13)
|
|
14
|
+
|
|
15
|
+
### [1.1.333-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.333-dev-5...v1.1.333-dev-6) (2025-01-13)
|
|
16
|
+
|
|
17
|
+
### [1.1.333-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.333-dev-4...v1.1.333-dev-5) (2025-01-10)
|
|
18
|
+
|
|
19
|
+
### [1.1.333-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.333-dev-3...v1.1.333-dev-4) (2025-01-10)
|
|
20
|
+
|
|
21
|
+
### [1.1.333-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.333...v1.1.333-dev-3) (2025-01-10)
|
|
22
|
+
|
|
5
23
|
### [1.1.335](https://github.com/jetthai/cuora-module/compare/v1.1.334...v1.1.335) (2025-01-13)
|
|
6
24
|
|
|
7
25
|
### [1.1.334](https://github.com/jetthai/cuora-module/compare/v1.1.333...v1.1.334) (2025-01-13)
|
package/package.json
CHANGED
package/src/api/auth.js
CHANGED
|
@@ -5,10 +5,10 @@ export default {
|
|
|
5
5
|
method: 'post',
|
|
6
6
|
isPublic: true,
|
|
7
7
|
}),
|
|
8
|
-
login: ({ username, password, provider, countryCode, phone, email, dt, reCaptchaToken }) => ({
|
|
8
|
+
login: ({ username, password, provider, countryCode, phone, email, dt, reCaptchaToken, additionalUserInfo, loginType, isSignature }) => ({
|
|
9
9
|
url: 'login',
|
|
10
10
|
method: 'post',
|
|
11
|
-
params: { username, password, provider, countryCode, phone, email, dt },
|
|
11
|
+
params: { username, password, provider, countryCode, phone, email, dt, additionalUserInfo, loginType, isSignature },
|
|
12
12
|
isPublic: true,
|
|
13
13
|
headers: { 'x-access-captcha': reCaptchaToken },
|
|
14
14
|
}),
|
package/src/api/common.js
CHANGED
|
@@ -6,4 +6,5 @@ export default {
|
|
|
6
6
|
getAnnouncements: ({ appSecret }) => ({ url: 'getAnnouncements', params: { appSecret }, method: 'get', isPublic: true }),
|
|
7
7
|
getNavbar: ({ appSecret } = {}) => ({ url: 'getNavbarSetting', params: { appSecret }, method: 'get', isPublic: true }),
|
|
8
8
|
getDefaultAffiliateCode: ({ appSecret }) => ({ url: 'getAffiliateCode', params: { appSecret }, method: 'get', isPublic: true }),
|
|
9
|
+
getSiteInfoConfig: ({ appSecret, config }) => ({ url: 'get-site-config', method: 'get', params: { appSecret, config }, isPublic: true }),
|
|
9
10
|
}
|
package/src/api/game.js
CHANGED
|
@@ -98,4 +98,6 @@ export default {
|
|
|
98
98
|
params: { providerId, seqNo, lang },
|
|
99
99
|
isPublic: true,
|
|
100
100
|
}),
|
|
101
|
+
getFreeGameList: () => ({ method: 'get', url: 'activities/getFreeGameRewardList' }),
|
|
102
|
+
getFreeGameReward: ({ activityNo, receiveNo }) => ({ method: 'post', url: 'activities/getFreeGameReward', params: { activityNo, receiveNo } }),
|
|
101
103
|
}
|
package/src/machine/auth.js
CHANGED
|
@@ -33,6 +33,7 @@ export default function (request) {
|
|
|
33
33
|
email: null,
|
|
34
34
|
username: null,
|
|
35
35
|
password: null,
|
|
36
|
+
additionalUserInfo: null,
|
|
36
37
|
},
|
|
37
38
|
countryAbbr: null,
|
|
38
39
|
userInfo: {},
|
|
@@ -271,6 +272,10 @@ export default function (request) {
|
|
|
271
272
|
LOGIN_APP: {
|
|
272
273
|
target: '.authenticationApp',
|
|
273
274
|
},
|
|
275
|
+
LOGIN_TELEGRAM: {
|
|
276
|
+
target: '.authentication',
|
|
277
|
+
actions: 'setLoginTelegram',
|
|
278
|
+
},
|
|
274
279
|
SET_PLAY: {
|
|
275
280
|
actions: 'setPlay',
|
|
276
281
|
},
|
|
@@ -353,6 +358,17 @@ export default function (request) {
|
|
|
353
358
|
},
|
|
354
359
|
}
|
|
355
360
|
}),
|
|
361
|
+
setLoginTelegram: assign((context, event) => {
|
|
362
|
+
const { loginType, additionalUserInfo, isSignature } = event.data
|
|
363
|
+
return {
|
|
364
|
+
loginData: {
|
|
365
|
+
provider: 'telegram',
|
|
366
|
+
loginType,
|
|
367
|
+
additionalUserInfo,
|
|
368
|
+
isSignature,
|
|
369
|
+
},
|
|
370
|
+
}
|
|
371
|
+
}),
|
|
356
372
|
fetchToken: assign((context, event) => {
|
|
357
373
|
const token = storage.get(tokenKey)
|
|
358
374
|
return {
|
|
@@ -414,7 +430,7 @@ export default function (request) {
|
|
|
414
430
|
}),
|
|
415
431
|
redirectTo3Party: async (context, event) => {
|
|
416
432
|
const { provider, channel, subchannel, fc } = event.data
|
|
417
|
-
const deviceTokenEnable = context.siteConfig?.dtVerify
|
|
433
|
+
const deviceTokenEnable = context.siteConfig?.dtVerify
|
|
418
434
|
|
|
419
435
|
const dt = await getDeviceToken({
|
|
420
436
|
fpToken,
|
|
@@ -497,7 +513,7 @@ export default function (request) {
|
|
|
497
513
|
return await request.send(user.getUserInfo())
|
|
498
514
|
},
|
|
499
515
|
checkDeviceToken: async (context, event) => {
|
|
500
|
-
const deviceTokenEnable = context.siteConfig?.dtVerify
|
|
516
|
+
const deviceTokenEnable = context.siteConfig?.dtVerify
|
|
501
517
|
if (deviceTokenEnable) {
|
|
502
518
|
const { exist } = await request.send(user.checkDt())
|
|
503
519
|
if (!exist) {
|
package/src/machine/common.js
CHANGED
|
@@ -55,8 +55,8 @@ export default function (request) {
|
|
|
55
55
|
target: 'fetching',
|
|
56
56
|
cond: (context, event) => {
|
|
57
57
|
const { siteConfig = {}, promotion = {}, selectedCrypto } = context
|
|
58
|
-
const { walletMode = '', bonusPreviewEnable
|
|
59
|
-
return !!selectedCrypto && walletMode === '4' && bonusPreviewEnable
|
|
58
|
+
const { walletMode = '', bonusPreviewEnable } = siteConfig
|
|
59
|
+
return !!selectedCrypto && walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
{ target: 'loaded' },
|
|
@@ -72,8 +72,8 @@ export default function (request) {
|
|
|
72
72
|
target: 'fetching',
|
|
73
73
|
cond: (context, event) => {
|
|
74
74
|
const { siteConfig = {}, promotion = {} } = context
|
|
75
|
-
const { walletMode = '', bonusPreviewEnable
|
|
76
|
-
return walletMode === '4' && bonusPreviewEnable
|
|
75
|
+
const { walletMode = '', bonusPreviewEnable } = siteConfig
|
|
76
|
+
return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
79
|
{ target: 'loaded' },
|
|
@@ -22,6 +22,8 @@ import crypto_way from './crypto_way.js'
|
|
|
22
22
|
import crypto_bank_cash from './crypto_bank_cash.js'
|
|
23
23
|
import crypto_qrcode_cash from './crypto_qrcode_cash.js'
|
|
24
24
|
import crypto_way_cash from './crypto_way_cash.js'
|
|
25
|
+
import virtual_bank_vn from './virtual_bank_vn.js'
|
|
26
|
+
import virtual_bank_cash from './virtual_bank_cash.js'
|
|
25
27
|
|
|
26
28
|
export default {
|
|
27
29
|
manual_vn,
|
|
@@ -48,4 +50,6 @@ export default {
|
|
|
48
50
|
crypto_bank_cash,
|
|
49
51
|
crypto_qrcode_cash,
|
|
50
52
|
crypto_way_cash,
|
|
53
|
+
virtual_bank_vn,
|
|
54
|
+
virtual_bank_cash,
|
|
51
55
|
}
|
|
@@ -49,8 +49,8 @@ export default function (request) {
|
|
|
49
49
|
target: 'fetching',
|
|
50
50
|
cond: (context, event) => {
|
|
51
51
|
const { siteConfig = {}, promotion = {}, selectedCard } = context
|
|
52
|
-
const { walletMode = '', bonusPreviewEnable
|
|
53
|
-
return !!selectedCard && walletMode === '4' && bonusPreviewEnable
|
|
52
|
+
const { walletMode = '', bonusPreviewEnable } = siteConfig
|
|
53
|
+
return !!selectedCard && walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
56
|
{ target: 'loaded' },
|
|
@@ -78,8 +78,8 @@ export default function (request) {
|
|
|
78
78
|
actions: 'setCard',
|
|
79
79
|
cond: (context, event) => {
|
|
80
80
|
const { siteConfig = {}, promotion = {} } = context
|
|
81
|
-
const { walletMode = '', bonusPreviewEnable
|
|
82
|
-
return walletMode === '4' && bonusPreviewEnable
|
|
81
|
+
const { walletMode = '', bonusPreviewEnable } = siteConfig
|
|
82
|
+
return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
{
|
|
@@ -216,8 +216,8 @@ export default function (request) {
|
|
|
216
216
|
actions: 'setCard',
|
|
217
217
|
cond: (context, event) => {
|
|
218
218
|
const { siteConfig = {}, promotion = {} } = context
|
|
219
|
-
const { walletMode = '', bonusPreviewEnable
|
|
220
|
-
return walletMode === '4' && bonusPreviewEnable
|
|
219
|
+
const { walletMode = '', bonusPreviewEnable } = siteConfig
|
|
220
|
+
return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
|
|
221
221
|
},
|
|
222
222
|
},
|
|
223
223
|
{
|
|
@@ -49,8 +49,8 @@ export default function (request) {
|
|
|
49
49
|
target: 'fetching',
|
|
50
50
|
cond: (context, event) => {
|
|
51
51
|
const { siteConfig = {}, promotion = {}, selectedQrcode } = context
|
|
52
|
-
const { walletMode = '', bonusPreviewEnable
|
|
53
|
-
return !!selectedQrcode && walletMode === '4' && bonusPreviewEnable
|
|
52
|
+
const { walletMode = '', bonusPreviewEnable } = siteConfig
|
|
53
|
+
return !!selectedQrcode && walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
56
|
{
|
|
@@ -86,8 +86,8 @@ export default function (request) {
|
|
|
86
86
|
actions: 'setQrcode',
|
|
87
87
|
cond: (context, event) => {
|
|
88
88
|
const { siteConfig = {}, promotion = {} } = context
|
|
89
|
-
const { walletMode = '', bonusPreviewEnable
|
|
90
|
-
return walletMode === '4' && bonusPreviewEnable
|
|
89
|
+
const { walletMode = '', bonusPreviewEnable } = siteConfig
|
|
90
|
+
return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
93
|
{
|
|
@@ -314,8 +314,8 @@ export default function (request) {
|
|
|
314
314
|
actions: 'setQrcode',
|
|
315
315
|
cond: (context, event) => {
|
|
316
316
|
const { siteConfig = {}, promotion = {} } = context
|
|
317
|
-
const { walletMode = '', bonusPreviewEnable
|
|
318
|
-
return walletMode === '4' && bonusPreviewEnable
|
|
317
|
+
const { walletMode = '', bonusPreviewEnable } = siteConfig
|
|
318
|
+
return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
|
|
319
319
|
},
|
|
320
320
|
},
|
|
321
321
|
{
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '@jetthai/cuora/src/api/payment.js'
|
|
3
|
+
import { max } from '@jetthai/cuora/src/util/index.js'
|
|
4
|
+
|
|
5
|
+
export default function (request, context) {
|
|
6
|
+
const { appSecret } = request.config
|
|
7
|
+
const { paymentDetail = [], promotion, selectedAmount, siteConfig = {} } = context || {}
|
|
8
|
+
|
|
9
|
+
return createMachine(
|
|
10
|
+
{
|
|
11
|
+
id: 'virtual_bank_cash',
|
|
12
|
+
initial: 'loading',
|
|
13
|
+
context: {
|
|
14
|
+
siteConfig,
|
|
15
|
+
paymentDetail,
|
|
16
|
+
promotion,
|
|
17
|
+
selectedAmount,
|
|
18
|
+
|
|
19
|
+
bindingPaymentList: {},
|
|
20
|
+
bindingPaymentInfo: {},
|
|
21
|
+
virtualBanks: {},
|
|
22
|
+
|
|
23
|
+
depositTime: null,
|
|
24
|
+
|
|
25
|
+
currentCategory: 'virtualBank',
|
|
26
|
+
method: null,
|
|
27
|
+
currentPayment: null,
|
|
28
|
+
currentApplyerBank: null,
|
|
29
|
+
|
|
30
|
+
calculation: null,
|
|
31
|
+
processing: null,
|
|
32
|
+
},
|
|
33
|
+
states: {
|
|
34
|
+
loading: {
|
|
35
|
+
invoke: {
|
|
36
|
+
src: 'fetchInitData',
|
|
37
|
+
onDone: {
|
|
38
|
+
target: 'checking',
|
|
39
|
+
actions: 'setInitData',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
checking: {
|
|
44
|
+
always: [
|
|
45
|
+
{
|
|
46
|
+
target: 'submitted',
|
|
47
|
+
cond: 'isProcessing',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
target: 'debouncing',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
loaded: {},
|
|
55
|
+
debouncing: {
|
|
56
|
+
entry: 'clearCalculation',
|
|
57
|
+
after: {
|
|
58
|
+
1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'loaded' }],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
calculating: {
|
|
62
|
+
invoke: {
|
|
63
|
+
src: 'fetchCalculation',
|
|
64
|
+
onDone: {
|
|
65
|
+
target: 'calculated',
|
|
66
|
+
actions: 'setCalculation',
|
|
67
|
+
},
|
|
68
|
+
onError: {
|
|
69
|
+
target: 'loaded',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
calculated: {
|
|
74
|
+
on: {
|
|
75
|
+
SET_DEPOSIT_TIME: {
|
|
76
|
+
actions: 'setDepositTime',
|
|
77
|
+
},
|
|
78
|
+
SUBMIT: {
|
|
79
|
+
target: 'submitting',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
submitting: {
|
|
84
|
+
invoke: {
|
|
85
|
+
src: 'submitDeposit',
|
|
86
|
+
onDone: {
|
|
87
|
+
target: 'submitted',
|
|
88
|
+
actions: 'setProcessing',
|
|
89
|
+
},
|
|
90
|
+
onError: {
|
|
91
|
+
target: 'loaded',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
submitted: {},
|
|
96
|
+
},
|
|
97
|
+
on: {
|
|
98
|
+
SET_PROMOTION: {
|
|
99
|
+
target: 'debouncing',
|
|
100
|
+
actions: 'setPromotion',
|
|
101
|
+
internal: false,
|
|
102
|
+
},
|
|
103
|
+
INPUT_AMOUNT: {
|
|
104
|
+
target: 'debouncing',
|
|
105
|
+
actions: 'inputAmount',
|
|
106
|
+
internal: false,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
actions: {
|
|
112
|
+
setInitData: assign((context, event) => {
|
|
113
|
+
const { currentPayment } = event.data
|
|
114
|
+
|
|
115
|
+
const processing = currentPayment?.processing?.[0]
|
|
116
|
+
|
|
117
|
+
const virtualBanks = currentPayment?.virtualBanks?.[0]
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
currentPayment,
|
|
121
|
+
method: currentPayment.method,
|
|
122
|
+
processing,
|
|
123
|
+
selectedAmount: max(promotion?.minimumAmount, currentPayment?.minimum, selectedAmount, 0),
|
|
124
|
+
virtualBanks,
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
inputAmount: assign((context, event) => {
|
|
128
|
+
return { selectedAmount: event.data }
|
|
129
|
+
}),
|
|
130
|
+
setCalculation: assign((context, event) => {
|
|
131
|
+
return {
|
|
132
|
+
calculation: event.data,
|
|
133
|
+
}
|
|
134
|
+
}),
|
|
135
|
+
setProcessing: assign((context, event) => {
|
|
136
|
+
return {
|
|
137
|
+
processing: event.data,
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
clearCalculation: assign((context, event) => {
|
|
141
|
+
return {
|
|
142
|
+
calculation: null,
|
|
143
|
+
}
|
|
144
|
+
}),
|
|
145
|
+
setDepositTime: assign((context, event) => {
|
|
146
|
+
return {
|
|
147
|
+
depositTime: event.data,
|
|
148
|
+
}
|
|
149
|
+
}),
|
|
150
|
+
setPromotion: assign((context, event) => {
|
|
151
|
+
return {
|
|
152
|
+
promotion: event.data,
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
155
|
+
},
|
|
156
|
+
guards: {
|
|
157
|
+
isCalculable: (context, event) => {
|
|
158
|
+
const {
|
|
159
|
+
selectedAmount,
|
|
160
|
+
currentPayment: { maximum, minimum },
|
|
161
|
+
} = context
|
|
162
|
+
return selectedAmount && minimum <= +selectedAmount && +selectedAmount <= maximum
|
|
163
|
+
},
|
|
164
|
+
isProcessing: (context, event) => {
|
|
165
|
+
return context.processing
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
services: {
|
|
169
|
+
fetchInitData: async (context, event) => {
|
|
170
|
+
const { paymentDetail = [] } = context
|
|
171
|
+
const currentPayment = paymentDetail.find((element) => element.category === context.currentCategory && element.transferType === 'deposit')
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
currentPayment,
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
fetchCalculation: async (context, event) => {
|
|
178
|
+
const { method, selectedAmount, promotion } = context
|
|
179
|
+
return await request.send(
|
|
180
|
+
payment.getDepositExpectedResult({
|
|
181
|
+
method,
|
|
182
|
+
amount: selectedAmount,
|
|
183
|
+
promotionsNo: promotion?.promotionsNo,
|
|
184
|
+
})
|
|
185
|
+
)
|
|
186
|
+
},
|
|
187
|
+
submitDeposit: async (context, event) => {
|
|
188
|
+
const { method, selectedAmount, depositTime, promotion } = context
|
|
189
|
+
return await request.send(
|
|
190
|
+
payment.submitDepositTransactionBank({
|
|
191
|
+
method,
|
|
192
|
+
amount: selectedAmount,
|
|
193
|
+
depositTime,
|
|
194
|
+
promotionsNo: promotion?.promotionsNo,
|
|
195
|
+
})
|
|
196
|
+
)
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../../api/payment.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
const { appSecret } = request.config
|
|
6
|
+
|
|
7
|
+
return createMachine(
|
|
8
|
+
{
|
|
9
|
+
id: 'virtual_bank',
|
|
10
|
+
initial: 'loading',
|
|
11
|
+
context: {
|
|
12
|
+
siteConfig: null,
|
|
13
|
+
paymentDetail: [],
|
|
14
|
+
virtualBanks: {},
|
|
15
|
+
|
|
16
|
+
amount: null,
|
|
17
|
+
depositTime: null,
|
|
18
|
+
|
|
19
|
+
currentCategory: 'virtualBank',
|
|
20
|
+
method: null,
|
|
21
|
+
currentPayment: null,
|
|
22
|
+
|
|
23
|
+
calculation: null,
|
|
24
|
+
processing: null,
|
|
25
|
+
|
|
26
|
+
// use for wallet mode 3
|
|
27
|
+
promotion: null,
|
|
28
|
+
},
|
|
29
|
+
states: {
|
|
30
|
+
loading: {
|
|
31
|
+
initial: 'init',
|
|
32
|
+
states: {
|
|
33
|
+
init: {
|
|
34
|
+
invoke: {
|
|
35
|
+
src: 'fetchPaymentDetail',
|
|
36
|
+
onDone: {
|
|
37
|
+
target: '#virtual_bank.step1',
|
|
38
|
+
actions: 'setInitData',
|
|
39
|
+
},
|
|
40
|
+
onError: {
|
|
41
|
+
target: '#virtual_bank.fail',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
step1: {
|
|
48
|
+
initial: 'promotion',
|
|
49
|
+
states: {
|
|
50
|
+
promotion: {
|
|
51
|
+
always: [
|
|
52
|
+
{
|
|
53
|
+
target: 'idle',
|
|
54
|
+
cond: 'isDoubleWalletMode',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
target: 'calculating',
|
|
58
|
+
actions: 'setPromotionDefaultAmount',
|
|
59
|
+
cond: 'hasMinPromotionDeposit',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
target: 'idle',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
idle: {},
|
|
67
|
+
calculating: {
|
|
68
|
+
invoke: {
|
|
69
|
+
src: 'fetchCalculation',
|
|
70
|
+
onDone: {
|
|
71
|
+
target: 'idle',
|
|
72
|
+
actions: 'setCalculation',
|
|
73
|
+
},
|
|
74
|
+
onError: {
|
|
75
|
+
target: 'idle',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
debouncing: {
|
|
80
|
+
after: {
|
|
81
|
+
1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'idle' }],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
on: {
|
|
86
|
+
SET_AMOUNT: {
|
|
87
|
+
actions: ['setAmount', 'clearCalculation'],
|
|
88
|
+
},
|
|
89
|
+
CALCULATE: {
|
|
90
|
+
target: '.debouncing',
|
|
91
|
+
},
|
|
92
|
+
CLEAR_CALCULATION: {
|
|
93
|
+
target: '.debouncing',
|
|
94
|
+
actions: 'clearCalculation',
|
|
95
|
+
},
|
|
96
|
+
TRANSACT: {
|
|
97
|
+
target: 'checking',
|
|
98
|
+
cond: 'isCalculated',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
checking: {
|
|
103
|
+
always: [
|
|
104
|
+
{
|
|
105
|
+
target: 'pending',
|
|
106
|
+
cond: (context, event) => {
|
|
107
|
+
const { siteConfig = {}, calculation, promotion } = context
|
|
108
|
+
const { walletMode } = siteConfig
|
|
109
|
+
const { promotionsNo, activityNo } = promotion
|
|
110
|
+
const isNoBonus = promotionsNo === 'none' || activityNo === 'none'
|
|
111
|
+
return walletMode === '4' && !!calculation && !isNoBonus
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
target: '#virtual_bank.step2',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
pending: {
|
|
120
|
+
on: {
|
|
121
|
+
CONFIRM: {
|
|
122
|
+
target: '#virtual_bank.step2',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
step2: {
|
|
127
|
+
initial: 'idle',
|
|
128
|
+
states: {
|
|
129
|
+
idle: {},
|
|
130
|
+
calculating: {
|
|
131
|
+
invoke: {
|
|
132
|
+
src: 'fetchCalculation',
|
|
133
|
+
onDone: {
|
|
134
|
+
target: 'idle',
|
|
135
|
+
actions: 'setCalculation',
|
|
136
|
+
},
|
|
137
|
+
onError: {
|
|
138
|
+
target: 'idle',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
debouncing: {
|
|
143
|
+
after: {
|
|
144
|
+
1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'idle' }],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
submitting: {
|
|
148
|
+
invoke: {
|
|
149
|
+
src: 'submitDeposit',
|
|
150
|
+
onDone: {
|
|
151
|
+
target: '#virtual_bank.submitted',
|
|
152
|
+
actions: 'setProcessing',
|
|
153
|
+
},
|
|
154
|
+
onError: {
|
|
155
|
+
target: 'idle',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
on: {
|
|
161
|
+
SET_AMOUNT: {
|
|
162
|
+
actions: ['setAmount', 'clearCalculation'],
|
|
163
|
+
},
|
|
164
|
+
CALCULATE: {
|
|
165
|
+
target: '.debouncing',
|
|
166
|
+
},
|
|
167
|
+
SET_DEPOSIT_TIME: {
|
|
168
|
+
actions: 'setDepositTime',
|
|
169
|
+
},
|
|
170
|
+
CLEAR_CALCULATION: {
|
|
171
|
+
target: '.debouncing',
|
|
172
|
+
actions: 'clearCalculation',
|
|
173
|
+
},
|
|
174
|
+
SUBMIT: {
|
|
175
|
+
target: '.submitting',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
processing: {},
|
|
180
|
+
submitted: {},
|
|
181
|
+
fail: {},
|
|
182
|
+
},
|
|
183
|
+
on: {
|
|
184
|
+
SET_PROMOTION: {
|
|
185
|
+
actions: 'setPromotion',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
actions: {
|
|
191
|
+
setInitData: assign((context, event) => {
|
|
192
|
+
const paymentDetail = event.data || []
|
|
193
|
+
const currentPayment = paymentDetail.find((element) => element.category === context.currentCategory)
|
|
194
|
+
const { method, processing, virtualBanks } = currentPayment || {}
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
paymentDetail,
|
|
198
|
+
currentPayment,
|
|
199
|
+
method,
|
|
200
|
+
processing: processing?.[0],
|
|
201
|
+
virtualBanks: virtualBanks?.[0],
|
|
202
|
+
}
|
|
203
|
+
}),
|
|
204
|
+
setAmount: assign((context, event) => {
|
|
205
|
+
return {
|
|
206
|
+
amount: event.data,
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
209
|
+
setCalculation: assign((context, event) => {
|
|
210
|
+
return {
|
|
211
|
+
calculation: event.data,
|
|
212
|
+
}
|
|
213
|
+
}),
|
|
214
|
+
setProcessing: assign((context, event) => {
|
|
215
|
+
return {
|
|
216
|
+
processing: event.data,
|
|
217
|
+
}
|
|
218
|
+
}),
|
|
219
|
+
clearCalculation: assign((context, event) => {
|
|
220
|
+
return {
|
|
221
|
+
calculation: null,
|
|
222
|
+
}
|
|
223
|
+
}),
|
|
224
|
+
setDepositTime: assign((context, event) => {
|
|
225
|
+
return {
|
|
226
|
+
depositTime: event.data,
|
|
227
|
+
}
|
|
228
|
+
}),
|
|
229
|
+
setPromotion: assign((context, event) => {
|
|
230
|
+
return {
|
|
231
|
+
promotion: event.data,
|
|
232
|
+
}
|
|
233
|
+
}),
|
|
234
|
+
setPromotionDefaultAmount: assign((context, event) => {
|
|
235
|
+
return {
|
|
236
|
+
amount: context.promotion.minimumAmount,
|
|
237
|
+
}
|
|
238
|
+
}),
|
|
239
|
+
},
|
|
240
|
+
guards: {
|
|
241
|
+
isDoubleWalletMode: (context, event) => {
|
|
242
|
+
return context.siteConfig?.walletMode === '4'
|
|
243
|
+
},
|
|
244
|
+
isCalculable: (context, event) => {
|
|
245
|
+
const {
|
|
246
|
+
amount,
|
|
247
|
+
currentPayment: { maximum, minimum },
|
|
248
|
+
} = context
|
|
249
|
+
return amount && minimum <= +amount && +amount <= maximum
|
|
250
|
+
},
|
|
251
|
+
isCalculated: (context, event) => {
|
|
252
|
+
return context.calculation
|
|
253
|
+
},
|
|
254
|
+
isProcessing: (context, event) => {
|
|
255
|
+
return context.processing
|
|
256
|
+
},
|
|
257
|
+
hasMinPromotionDeposit: (context, event) => {
|
|
258
|
+
return context.promotion?.minimumAmount
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
services: {
|
|
262
|
+
fetchPaymentDetail: async (context, event) => {
|
|
263
|
+
return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
264
|
+
},
|
|
265
|
+
fetchCalculation: async (context, event) => {
|
|
266
|
+
const { method, amount, promotion } = context
|
|
267
|
+
return await request.send(
|
|
268
|
+
payment.getDepositExpectedResult({
|
|
269
|
+
method,
|
|
270
|
+
amount,
|
|
271
|
+
promotionsNo: promotion?.activityNo,
|
|
272
|
+
})
|
|
273
|
+
)
|
|
274
|
+
},
|
|
275
|
+
submitDeposit: async (context, event) => {
|
|
276
|
+
const { method, amount, depositTime, promotion } = context
|
|
277
|
+
return await request.send(
|
|
278
|
+
payment.submitDepositTransactionBank({
|
|
279
|
+
method,
|
|
280
|
+
amount,
|
|
281
|
+
depositTime,
|
|
282
|
+
promotionsNo: promotion?.activityNo,
|
|
283
|
+
})
|
|
284
|
+
)
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
}
|
|
@@ -74,8 +74,8 @@ export default function (request) {
|
|
|
74
74
|
target: 'fetching',
|
|
75
75
|
cond: (context, event) => {
|
|
76
76
|
const { siteConfig = {}, promotion = {} } = context
|
|
77
|
-
const { walletMode = '', bonusPreviewEnable
|
|
78
|
-
return walletMode === '4' && bonusPreviewEnable
|
|
77
|
+
const { walletMode = '', bonusPreviewEnable } = siteConfig
|
|
78
|
+
return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
{ target: 'loaded' },
|
package/src/machine/error.js
CHANGED
|
@@ -26,12 +26,16 @@ export default function () {
|
|
|
26
26
|
{ target: 'logout', cond: 'isLogout' },
|
|
27
27
|
{ target: 'deposit', cond: 'isNoBalance' },
|
|
28
28
|
{ target: 'unfinishedGame', cond: 'isUnfinishedGame', actions: 'setUnfinishedGame' },
|
|
29
|
+
{ target: 'freeGameSettle', cond: 'isFreeGameSettle' },
|
|
30
|
+
{ target: 'freeGameGiveUp', cond: 'isFreeGameGiveUp' },
|
|
29
31
|
// { target: 'hall' },
|
|
30
32
|
],
|
|
31
33
|
},
|
|
32
34
|
logout: {},
|
|
33
35
|
deposit: {},
|
|
34
36
|
unfinishedGame: {},
|
|
37
|
+
freeGameSettle: {},
|
|
38
|
+
freeGameGiveUp: {},
|
|
35
39
|
// hall: {},
|
|
36
40
|
},
|
|
37
41
|
},
|
|
@@ -65,6 +69,12 @@ export default function () {
|
|
|
65
69
|
isUnfinishedGame: (context, event) => {
|
|
66
70
|
return context.error.extend?.includes?.('unfinished_')
|
|
67
71
|
},
|
|
72
|
+
isFreeGameSettle: (context, event) => {
|
|
73
|
+
return context.error.code === 'ERR_G124'
|
|
74
|
+
},
|
|
75
|
+
isFreeGameGiveUp: (context, event) => {
|
|
76
|
+
return context.error.code === 'ERR_G125'
|
|
77
|
+
},
|
|
68
78
|
},
|
|
69
79
|
services: {},
|
|
70
80
|
}
|
package/src/request/request.js
CHANGED
package/src/util/deviceToken.js
CHANGED
|
@@ -23,7 +23,6 @@ const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
|
|
|
23
23
|
throw new Error('[Device Token] No token from FingerprintJS.')
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
console.log('[Device Token]', `${dt} from ${endpoints}`)
|
|
27
26
|
sentry?.setTag('dt', dt)
|
|
28
27
|
} catch (error) {
|
|
29
28
|
console.error('[Device Token]', `${dt} from ${endpoints}`, error)
|