@jetthai/cuora 1.0.205 → 1.0.302-sl-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/.husky/pre-commit +4 -0
- package/.prettierignore +1 -0
- package/CHANGELOG.md +846 -0
- package/README.md +6 -0
- package/package.json +6 -9
- package/src/api/activity.js +43 -2
- package/src/api/auth.js +22 -7
- package/src/api/common.js +2 -1
- package/src/api/game.js +20 -7
- package/src/api/mailbox.js +9 -5
- package/src/api/payment.js +167 -19
- package/src/api/user.js +7 -0
- package/src/lib/fingerprint.js +9779 -0
- package/src/machine/activity/activity.js +111 -26
- package/src/machine/activity/activity_cash.js +159 -0
- package/src/machine/activity/cash_rain_activity.js +153 -0
- package/src/machine/activity/continue_deposit_activity.js +11 -2
- package/src/machine/activity/deposit_activity.js +13 -4
- package/src/machine/activity/diamond_shop_activity_cash.js +179 -0
- package/src/machine/activity/diamond_shop_activity_vn.js +54 -89
- package/src/machine/activity/fafafa_activity.js +34 -19
- package/src/machine/activity/{affiliate_invite_friends_activity.js → friend_invite_friends_activity.js} +70 -41
- package/src/machine/activity/index.js +22 -4
- package/src/machine/activity/instant_rebate_activity.js +217 -0
- package/src/machine/activity/invite_friends_activity.js +14 -14
- package/src/machine/activity/jackpot.js +74 -0
- package/src/machine/activity/otp_verified_activity.js +74 -0
- package/src/machine/activity/ranking_activity.js +11 -2
- package/src/machine/activity/roulette_activity_v2.js +90 -0
- package/src/machine/activity/sign_in_activity.js +21 -14
- package/src/machine/activity/sign_in_monthly_activity.js +65 -0
- package/src/machine/activity/specify_bets_activity.js +25 -3
- package/src/machine/activity/specify_turnover_activity.js +25 -3
- package/src/machine/activity/time_bomb_activity.js +11 -2
- package/src/machine/activity/vip_card_activity.js +140 -0
- package/src/machine/auth.js +141 -27
- package/src/machine/auth_otp_v2.js +10 -4
- package/src/machine/auth_otp_v3.js +11 -3
- package/src/machine/bank_binding.js +112 -12
- package/src/machine/bank_binding_amb.js +145 -0
- package/src/machine/common.js +113 -25
- package/src/machine/deposit/amb.js +92 -0
- package/src/machine/deposit/crypto.js +50 -29
- package/src/machine/deposit/crypto_bank.js +317 -0
- package/src/machine/deposit/crypto_bank_cash.js +287 -0
- package/src/machine/deposit/crypto_button.js +174 -39
- package/src/machine/deposit/crypto_cash.js +255 -0
- package/src/machine/deposit/crypto_qrcode.js +148 -0
- package/src/machine/deposit/crypto_qrcode_cash.js +131 -0
- package/src/machine/deposit/crypto_way.js +239 -0
- package/src/machine/deposit/crypto_way_cash.js +256 -0
- package/src/machine/deposit/deposit_fc.js +8 -5
- package/src/machine/deposit/direct.js +111 -16
- package/src/machine/deposit/direct_cash.js +217 -0
- package/src/machine/deposit/float.js +366 -0
- package/src/machine/deposit/index.js +43 -2
- package/src/machine/deposit/krway.js +151 -0
- package/src/machine/deposit/loadcard_cash.js +207 -0
- package/src/machine/deposit/loadcard_vn.js +191 -43
- package/src/machine/deposit/manual_cash.js +356 -0
- package/src/machine/deposit/manual_vn.js +182 -60
- package/src/machine/deposit/qrcode_cash.js +217 -0
- package/src/machine/deposit/qrcode_v2.js +285 -52
- package/src/machine/deposit/usdt.js +144 -0
- package/src/machine/deposit/usdt_cash.js +138 -0
- package/src/machine/deposit/vpay.js +359 -0
- package/src/machine/game_favorite_v2.js +74 -28
- package/src/machine/game_info.js +57 -0
- package/src/machine/game_search_cash.js +390 -0
- package/src/machine/game_search_v2.js +64 -24
- package/src/machine/game_v2_1.js +662 -0
- package/src/machine/honor_board_cash.js +63 -0
- package/src/machine/inbox.js +259 -34
- package/src/machine/index.js +22 -17
- package/src/machine/leaderboard.js +31 -8
- package/src/machine/promotions.js +171 -0
- package/src/machine/reward.js +74 -7
- package/src/machine/reward_cash.js +219 -0
- package/src/machine/roulette_v2.js +276 -0
- package/src/machine/setting.js +5 -2
- package/src/machine/side_cash.js +110 -0
- package/src/machine/side_v2.js +33 -28
- package/src/machine/user_photo.js +65 -0
- package/src/machine/user_sign_up.js +101 -17
- package/src/machine/withdraw/index.js +23 -0
- package/src/machine/{withdraw_vn.js → withdraw/withdraw_amb.js} +146 -78
- package/src/machine/{withdraw_crypto.js → withdraw/withdraw_crypto.js} +220 -69
- package/src/machine/withdraw/withdraw_crypto2.js +540 -0
- package/src/machine/withdraw/withdraw_crypto_cash.js +319 -0
- package/src/machine/{withdraw_fc.js → withdraw/withdraw_fc.js} +2 -2
- package/src/machine/withdraw/withdraw_krway.js +207 -0
- package/src/machine/withdraw/withdraw_manual.js +595 -0
- package/src/machine/withdraw/withdraw_manual_cash.js +303 -0
- package/src/machine/withdraw/withdraw_vn.js +533 -0
- package/src/machine/withdraw/withdraw_vn2.js +548 -0
- package/src/request/request.js +10 -5
- package/src/util/constant.js +19 -1
- package/src/util/deviceToken.js +18 -8
- package/src/util/index.js +2 -1
- package/src/util/math.js +4 -0
- package/src/util/storage.js +22 -22
- package/dist/bundle.mjs +0 -18462
- package/rollup.config.js +0 -16
- package/src/machine/auth_otp.js +0 -201
- package/src/machine/deposit/qrcode_vn.js +0 -206
- package/src/machine/game.js +0 -285
- package/src/machine/game_favorite.js +0 -123
- package/src/machine/game_search.js +0 -244
- package/src/machine/game_v2.js +0 -356
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../../api/payment.js'
|
|
3
|
+
import mailbox from '../../api/mailbox.js'
|
|
4
|
+
|
|
5
|
+
export default function (request) {
|
|
6
|
+
return createMachine(
|
|
7
|
+
{
|
|
8
|
+
id: 'krway',
|
|
9
|
+
initial: 'loading',
|
|
10
|
+
context: {
|
|
11
|
+
currentCategory: 'krway',
|
|
12
|
+
paymentDetail: [],
|
|
13
|
+
currentPayment: null,
|
|
14
|
+
options: [],
|
|
15
|
+
amount: null,
|
|
16
|
+
processing: null,
|
|
17
|
+
},
|
|
18
|
+
states: {
|
|
19
|
+
loading: {
|
|
20
|
+
invoke: {
|
|
21
|
+
src: 'fetchPaymentDetail',
|
|
22
|
+
onDone: {
|
|
23
|
+
target: 'checking',
|
|
24
|
+
actions: 'setPaymentDetail',
|
|
25
|
+
},
|
|
26
|
+
onError: {
|
|
27
|
+
target: 'fail',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
checking: {
|
|
32
|
+
always: [
|
|
33
|
+
{
|
|
34
|
+
target: 'processing',
|
|
35
|
+
cond: 'isProcessing',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
target: 'idle',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
processing: {},
|
|
43
|
+
idle: {},
|
|
44
|
+
inquiring: {
|
|
45
|
+
invoke: {
|
|
46
|
+
src: 'accountInquiry',
|
|
47
|
+
onDone: {
|
|
48
|
+
target: 'inquired',
|
|
49
|
+
},
|
|
50
|
+
onError: {
|
|
51
|
+
target: 'idle',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
inquired: {
|
|
56
|
+
after: {
|
|
57
|
+
0: {
|
|
58
|
+
target: 'idle',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
submitting: {
|
|
63
|
+
invoke: {
|
|
64
|
+
src: 'submitDeposit',
|
|
65
|
+
onDone: {
|
|
66
|
+
target: 'submitted',
|
|
67
|
+
actions: 'setProcessing',
|
|
68
|
+
},
|
|
69
|
+
onError: {
|
|
70
|
+
target: 'fail',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
submitted: {},
|
|
75
|
+
fail: {},
|
|
76
|
+
},
|
|
77
|
+
on: {
|
|
78
|
+
INQUIRY_ACCOUNT: {
|
|
79
|
+
target: 'inquiring',
|
|
80
|
+
},
|
|
81
|
+
ADD_AMOUNT: {
|
|
82
|
+
actions: 'addAmount',
|
|
83
|
+
},
|
|
84
|
+
SET_AMOUNT: {
|
|
85
|
+
actions: 'setAmount',
|
|
86
|
+
},
|
|
87
|
+
CLEAR_AMOUNT: {
|
|
88
|
+
actions: 'clearAmount',
|
|
89
|
+
},
|
|
90
|
+
SUBMIT: {
|
|
91
|
+
target: 'submitting',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
actions: {
|
|
97
|
+
setPaymentDetail: assign((context, event) => {
|
|
98
|
+
const paymentDetail = event.data
|
|
99
|
+
const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
|
|
100
|
+
const currentPayment = payments[0]
|
|
101
|
+
const options = currentPayment.optional || []
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
currentPayment,
|
|
105
|
+
options,
|
|
106
|
+
processing: currentPayment.processing?.[0],
|
|
107
|
+
}
|
|
108
|
+
}),
|
|
109
|
+
addAmount: assign((context, event) => {
|
|
110
|
+
return {
|
|
111
|
+
amount: parseFloat(`${context.amount || 0}`) + parseFloat(`${event.data}`),
|
|
112
|
+
}
|
|
113
|
+
}),
|
|
114
|
+
setAmount: assign((context, event) => {
|
|
115
|
+
return { amount: parseFloat(`${event.data}`) }
|
|
116
|
+
}),
|
|
117
|
+
clearAmount: assign((context, event) => {
|
|
118
|
+
return { amount: null }
|
|
119
|
+
}),
|
|
120
|
+
setProcessing: assign((context, event) => {
|
|
121
|
+
return {
|
|
122
|
+
processing: event.data,
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
guards: {
|
|
127
|
+
isProcessing: (context, event) => {
|
|
128
|
+
return context.processing
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
services: {
|
|
132
|
+
fetchPaymentDetail: async (context, event) => {
|
|
133
|
+
return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
134
|
+
},
|
|
135
|
+
accountInquiry: async (context, event) => {
|
|
136
|
+
const { from, title, content } = event.data
|
|
137
|
+
return await request.send(mailbox.sendMessage({ type: 'CUSTOMER', category: 'DEPOSIT', from, to: 'SYSTEM', title, content }))
|
|
138
|
+
},
|
|
139
|
+
submitDeposit: async (context, event) => {
|
|
140
|
+
const { currentPayment, amount } = context
|
|
141
|
+
return await request.send(
|
|
142
|
+
payment.submitDepositTransaction({
|
|
143
|
+
method: currentPayment.method,
|
|
144
|
+
amount,
|
|
145
|
+
})
|
|
146
|
+
)
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../../api/payment.js'
|
|
3
|
+
import { max } from '../../util'
|
|
4
|
+
|
|
5
|
+
export default function (request, context) {
|
|
6
|
+
const { paymentDetail = [], promotion, selectedAmount } = context || {}
|
|
7
|
+
return createMachine(
|
|
8
|
+
{
|
|
9
|
+
id: 'qrcode_cash',
|
|
10
|
+
initial: 'loading',
|
|
11
|
+
context: {
|
|
12
|
+
currentCategory: 'loadcard',
|
|
13
|
+
paymentDetail,
|
|
14
|
+
promotion,
|
|
15
|
+
selectedAmount,
|
|
16
|
+
loadcards: [],
|
|
17
|
+
options: null,
|
|
18
|
+
selectedLoadcard: null,
|
|
19
|
+
calculation: null,
|
|
20
|
+
cardNumber: null,
|
|
21
|
+
serialNumber: null,
|
|
22
|
+
result: null,
|
|
23
|
+
},
|
|
24
|
+
states: {
|
|
25
|
+
loading: {
|
|
26
|
+
always: [
|
|
27
|
+
{
|
|
28
|
+
target: 'debouncing',
|
|
29
|
+
actions: 'setInitData',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
loaded: {},
|
|
34
|
+
debouncing: {
|
|
35
|
+
entry: 'clearCalculation',
|
|
36
|
+
after: {
|
|
37
|
+
1000: [
|
|
38
|
+
{
|
|
39
|
+
target: 'calculating',
|
|
40
|
+
cond: (context, event) => {
|
|
41
|
+
const { selectedLoadcard, selectedAmount } = context
|
|
42
|
+
if (selectedLoadcard && selectedAmount) {
|
|
43
|
+
return selectedLoadcard.minimum <= selectedAmount && selectedAmount <= selectedLoadcard.maximum
|
|
44
|
+
} else {
|
|
45
|
+
return false
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
target: 'loaded',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
calculating: {
|
|
56
|
+
invoke: {
|
|
57
|
+
src: 'fetchCalculation',
|
|
58
|
+
onDone: {
|
|
59
|
+
target: 'calculated',
|
|
60
|
+
actions: 'setCalculation',
|
|
61
|
+
},
|
|
62
|
+
onError: {
|
|
63
|
+
target: 'calculated',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
calculated: {
|
|
68
|
+
on: {
|
|
69
|
+
INPUT_CARD_NUMBER: {
|
|
70
|
+
actions: 'setCardNumber',
|
|
71
|
+
},
|
|
72
|
+
INPUT_SERIAL_NUMBER: {
|
|
73
|
+
actions: 'setSerialNumber',
|
|
74
|
+
},
|
|
75
|
+
SUBMIT: {
|
|
76
|
+
target: 'submitting',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
submitting: {
|
|
81
|
+
invoke: {
|
|
82
|
+
src: 'submitDeposit',
|
|
83
|
+
onDone: {
|
|
84
|
+
target: 'submitted',
|
|
85
|
+
actions: 'setResult',
|
|
86
|
+
},
|
|
87
|
+
onError: {
|
|
88
|
+
target: 'loaded',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
submitted: {},
|
|
93
|
+
},
|
|
94
|
+
on: {
|
|
95
|
+
SET_PROMOTION: {
|
|
96
|
+
target: '.debouncing',
|
|
97
|
+
actions: 'setPromotion',
|
|
98
|
+
internal: false,
|
|
99
|
+
},
|
|
100
|
+
SELECT_LOADCARD: {
|
|
101
|
+
target: '.debouncing',
|
|
102
|
+
actions: 'setLoadcard',
|
|
103
|
+
internal: false,
|
|
104
|
+
},
|
|
105
|
+
SELECT_AMOUNT: {
|
|
106
|
+
target: '.debouncing',
|
|
107
|
+
actions: 'setAmount',
|
|
108
|
+
internal: false,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
actions: {
|
|
114
|
+
setInitData: assign((context, event) => {
|
|
115
|
+
const { paymentDetail, selectedAmount, promotion } = context
|
|
116
|
+
const loadcards = paymentDetail.filter((element) => element.category === context.currentCategory && element.transferType === 'deposit')
|
|
117
|
+
const selectedLoadcard = loadcards[0]
|
|
118
|
+
return {
|
|
119
|
+
paymentDetail,
|
|
120
|
+
loadcards,
|
|
121
|
+
selectedLoadcard,
|
|
122
|
+
options: selectedLoadcard?.optional,
|
|
123
|
+
selectedAmount: max(promotion?.minimumAmount, selectedLoadcard?.minimum, selectedAmount, 0),
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
setPromotion: assign((context, event) => {
|
|
127
|
+
const { selectedAmount } = context
|
|
128
|
+
const promotion = event.data
|
|
129
|
+
const loadcards = context.loadcards
|
|
130
|
+
const selectedLoadcard = loadcards[0]
|
|
131
|
+
return {
|
|
132
|
+
promotion,
|
|
133
|
+
loadcards,
|
|
134
|
+
selectedLoadcard,
|
|
135
|
+
options: selectedLoadcard?.optional,
|
|
136
|
+
selectedAmount: max(promotion.minimumAmount, selectedLoadcard?.minimum, selectedAmount, 0),
|
|
137
|
+
calculation: null,
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
setLoadcard: assign((context, event) => {
|
|
141
|
+
const { promotion, selectedAmount } = context
|
|
142
|
+
const selectedLoadcard = event.data
|
|
143
|
+
return {
|
|
144
|
+
selectedLoadcard,
|
|
145
|
+
options: selectedLoadcard.optional,
|
|
146
|
+
selectedAmount: max(promotion.minimumAmount, selectedAmount, 0),
|
|
147
|
+
calculation: null,
|
|
148
|
+
}
|
|
149
|
+
}),
|
|
150
|
+
setAmount: assign((context, event) => {
|
|
151
|
+
return { selectedAmount: event.data }
|
|
152
|
+
}),
|
|
153
|
+
setCalculation: assign((context, event) => {
|
|
154
|
+
return {
|
|
155
|
+
calculation: event.data,
|
|
156
|
+
}
|
|
157
|
+
}),
|
|
158
|
+
clearCalculation: assign((context, event) => {
|
|
159
|
+
return {
|
|
160
|
+
calculation: null,
|
|
161
|
+
}
|
|
162
|
+
}),
|
|
163
|
+
setResult: assign((context, event) => {
|
|
164
|
+
return {
|
|
165
|
+
result: event.data,
|
|
166
|
+
}
|
|
167
|
+
}),
|
|
168
|
+
setCardNumber: assign((context, event) => {
|
|
169
|
+
return {
|
|
170
|
+
cardNumber: event.data,
|
|
171
|
+
}
|
|
172
|
+
}),
|
|
173
|
+
setSerialNumber: assign((context, event) => {
|
|
174
|
+
return {
|
|
175
|
+
serialNumber: event.data,
|
|
176
|
+
}
|
|
177
|
+
}),
|
|
178
|
+
},
|
|
179
|
+
guards: {},
|
|
180
|
+
services: {
|
|
181
|
+
fetchCalculation: async (context, event) => {
|
|
182
|
+
const { selectedLoadcard, selectedAmount, promotion } = context
|
|
183
|
+
return await request.send(
|
|
184
|
+
payment.getDepositExpectedResult({
|
|
185
|
+
method: selectedLoadcard.method,
|
|
186
|
+
amount: selectedAmount,
|
|
187
|
+
promotionsNo: promotion?.promotionsNo,
|
|
188
|
+
})
|
|
189
|
+
)
|
|
190
|
+
},
|
|
191
|
+
submitDeposit: async (context, event) => {
|
|
192
|
+
const { selectedLoadcard, selectedAmount, promotion, cardNumber, serialNumber } = context
|
|
193
|
+
return await request.send(
|
|
194
|
+
payment.submitDepositTransactionLoadcard({
|
|
195
|
+
method: selectedLoadcard.method,
|
|
196
|
+
amount: selectedAmount,
|
|
197
|
+
card_type: selectedLoadcard.channel_id,
|
|
198
|
+
card_code: cardNumber,
|
|
199
|
+
card_seri: serialNumber,
|
|
200
|
+
promotionsNo: promotion?.promotionsNo,
|
|
201
|
+
})
|
|
202
|
+
)
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
}
|