@jetthai/cuora 1.0.204 → 1.0.302-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/.husky/pre-commit +4 -0
- package/.prettierignore +1 -0
- package/CHANGELOG.md +848 -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 +3 -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} +72 -45
- 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 +70 -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 +24 -17
- package/src/machine/leaderboard.js +31 -8
- package/src/machine/navbar.js +57 -0
- 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 +117 -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,303 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../../api/payment.js'
|
|
3
|
+
import user from '../../api/user.js'
|
|
4
|
+
|
|
5
|
+
export default function (request, context) {
|
|
6
|
+
const { paymentDetail = [] } = context || {}
|
|
7
|
+
return createMachine(
|
|
8
|
+
{
|
|
9
|
+
id: 'withdraw_manual_cash',
|
|
10
|
+
initial: 'loading',
|
|
11
|
+
context: {
|
|
12
|
+
paymentDetail,
|
|
13
|
+
currentPayment: null,
|
|
14
|
+
banks: [],
|
|
15
|
+
paymentInfo: null,
|
|
16
|
+
withdrawRule: null,
|
|
17
|
+
userBanks: [],
|
|
18
|
+
selectedUserBank: null,
|
|
19
|
+
selectedAmount: null,
|
|
20
|
+
processing: null,
|
|
21
|
+
|
|
22
|
+
// otp
|
|
23
|
+
requestId: null,
|
|
24
|
+
status: null,
|
|
25
|
+
target: null,
|
|
26
|
+
ttl: null,
|
|
27
|
+
},
|
|
28
|
+
states: {
|
|
29
|
+
loading: {
|
|
30
|
+
invoke: {
|
|
31
|
+
src: 'fetchInitData',
|
|
32
|
+
onDone: {
|
|
33
|
+
target: 'checking',
|
|
34
|
+
actions: 'setInitData',
|
|
35
|
+
},
|
|
36
|
+
onError: {
|
|
37
|
+
target: 'loaded',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
checking: {
|
|
42
|
+
always: [{ target: 'submitted', cond: 'isProcessing' }, { target: 'loaded' }],
|
|
43
|
+
},
|
|
44
|
+
loaded: {},
|
|
45
|
+
debouncing: {
|
|
46
|
+
always: [{ target: 'calculated', cond: 'isSubmittable' }, { target: 'loaded' }],
|
|
47
|
+
},
|
|
48
|
+
calculated: {
|
|
49
|
+
on: {
|
|
50
|
+
SUBMIT: {
|
|
51
|
+
target: 'submitting',
|
|
52
|
+
},
|
|
53
|
+
SUBMIT_CRYPTO: {
|
|
54
|
+
target: 'submitting_crypto',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
submitting: {
|
|
59
|
+
invoke: {
|
|
60
|
+
src: 'submitWithdraw',
|
|
61
|
+
onDone: [
|
|
62
|
+
{
|
|
63
|
+
target: 'otp',
|
|
64
|
+
actions: 'setOtp',
|
|
65
|
+
cond: 'isOtpRequired',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
target: 'submitted',
|
|
69
|
+
actions: 'setProcessing',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
onError: {
|
|
73
|
+
target: 'calculated',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
submitting_crypto: {
|
|
78
|
+
invoke: {
|
|
79
|
+
src: 'submitWithdrawCrypto',
|
|
80
|
+
onDone: [
|
|
81
|
+
{
|
|
82
|
+
target: 'otp',
|
|
83
|
+
actions: 'setOtp',
|
|
84
|
+
cond: 'isOtpRequired',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
target: 'submitted',
|
|
88
|
+
actions: 'setProcessing',
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
onError: {
|
|
92
|
+
target: 'calculated',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
submitted: {},
|
|
97
|
+
otp: {
|
|
98
|
+
type: 'parallel',
|
|
99
|
+
states: {
|
|
100
|
+
countdown: {
|
|
101
|
+
after: {
|
|
102
|
+
1000: {
|
|
103
|
+
target: 'countdown',
|
|
104
|
+
actions: 'decreaseTtl',
|
|
105
|
+
cond: (context) => context.ttl > 0,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
verification: {
|
|
110
|
+
initial: 'idle',
|
|
111
|
+
states: {
|
|
112
|
+
idle: {
|
|
113
|
+
on: {
|
|
114
|
+
ACKNOWLEDGE: {
|
|
115
|
+
target: 'acknowledging',
|
|
116
|
+
},
|
|
117
|
+
RESET_OTP: {
|
|
118
|
+
target: 'reset',
|
|
119
|
+
},
|
|
120
|
+
BACK: [
|
|
121
|
+
// {
|
|
122
|
+
// target: '#withdraw_vn2.activity.convertible',
|
|
123
|
+
// cond: 'isActivity',
|
|
124
|
+
// },
|
|
125
|
+
// {
|
|
126
|
+
// target: '#withdraw_vn2.cash.withdrawable',
|
|
127
|
+
// },
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
acknowledging: {
|
|
132
|
+
invoke: {
|
|
133
|
+
src: 'acknowledge',
|
|
134
|
+
onDone: [
|
|
135
|
+
// {
|
|
136
|
+
// target: '#withdraw_vn2.activity.converted',
|
|
137
|
+
// cond: 'isActivity',
|
|
138
|
+
// },
|
|
139
|
+
// {
|
|
140
|
+
// target: '#withdraw_vn2.cash.submitted',
|
|
141
|
+
// },
|
|
142
|
+
],
|
|
143
|
+
onError: {
|
|
144
|
+
target: 'idle',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
reset: {
|
|
149
|
+
invoke: {
|
|
150
|
+
src: 'resetOtp',
|
|
151
|
+
onDone: {
|
|
152
|
+
target: 'idle',
|
|
153
|
+
actions: 'setVerificationData',
|
|
154
|
+
},
|
|
155
|
+
onError: { target: 'idle' },
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
on: {
|
|
164
|
+
REFRESH: { target: 'loading', internal: false, cond: 'hasNoBank' },
|
|
165
|
+
SET_AMOUNT: {
|
|
166
|
+
target: 'debouncing',
|
|
167
|
+
actions: 'setAmount',
|
|
168
|
+
internal: false,
|
|
169
|
+
},
|
|
170
|
+
SELECT_USER_BANK: {
|
|
171
|
+
actions: 'setUserBank',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
actions: {
|
|
177
|
+
setInitData: assign((context, event) => {
|
|
178
|
+
const { currentPayment, paymentInfo, withdrawRule, processing } = event.data
|
|
179
|
+
const userBanks = [...paymentInfo.bankList, ...paymentInfo.cryptoList, ...paymentInfo.ewalletList]
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
currentPayment,
|
|
183
|
+
processing,
|
|
184
|
+
paymentInfo,
|
|
185
|
+
withdrawRule,
|
|
186
|
+
userBanks,
|
|
187
|
+
selectedUserBank: userBanks[0],
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
190
|
+
setAmount: assign((context, event) => {
|
|
191
|
+
return {
|
|
192
|
+
selectedAmount: event.data,
|
|
193
|
+
}
|
|
194
|
+
}),
|
|
195
|
+
setUserBank: assign((context, event) => {
|
|
196
|
+
return {
|
|
197
|
+
selectedUserBank: event.data,
|
|
198
|
+
}
|
|
199
|
+
}),
|
|
200
|
+
setProcessing: assign((context, event) => {
|
|
201
|
+
return {
|
|
202
|
+
processing: event.data,
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
setOtp: assign((context, event) => {
|
|
206
|
+
const { requestId, status, target, ttl } = event.data
|
|
207
|
+
return {
|
|
208
|
+
requestId,
|
|
209
|
+
status,
|
|
210
|
+
target,
|
|
211
|
+
ttl,
|
|
212
|
+
}
|
|
213
|
+
}),
|
|
214
|
+
decreaseTtl: assign((context, evnet) => {
|
|
215
|
+
const second = context.ttl
|
|
216
|
+
return {
|
|
217
|
+
ttl: Math.max(second - 1, 0),
|
|
218
|
+
}
|
|
219
|
+
}),
|
|
220
|
+
setVerificationData: assign((context, event) => {
|
|
221
|
+
const { requestId, ttl, target } = event.data
|
|
222
|
+
return {
|
|
223
|
+
requestId,
|
|
224
|
+
ttl,
|
|
225
|
+
target,
|
|
226
|
+
}
|
|
227
|
+
}),
|
|
228
|
+
},
|
|
229
|
+
guards: {
|
|
230
|
+
hasNoBank: (context, event) => {
|
|
231
|
+
return !context.userBanks.length
|
|
232
|
+
},
|
|
233
|
+
isProcessing: (context, event) => {
|
|
234
|
+
return context.processing
|
|
235
|
+
},
|
|
236
|
+
isSubmittable: (context, event) => {
|
|
237
|
+
const { currentPayment, selectedUserBank, selectedAmount } = context
|
|
238
|
+
return selectedUserBank && selectedAmount > 0 && currentPayment.minimum <= selectedAmount && selectedAmount <= currentPayment.maximum
|
|
239
|
+
},
|
|
240
|
+
isOtpRequired: (context, event) => {
|
|
241
|
+
return event.data?.status === 'otp-verifying'
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
services: {
|
|
245
|
+
fetchInitData: async (context, event) => {
|
|
246
|
+
const { paymentDetail = [] } = context
|
|
247
|
+
const currentPayment = paymentDetail.find((element) => element.category === 'manual' && element.transferType === 'withdraw')
|
|
248
|
+
|
|
249
|
+
const [paymentInfo, withdrawRule, orders] = await Promise.all([
|
|
250
|
+
request.send(payment.getBindingPaymentInfo()),
|
|
251
|
+
request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' })),
|
|
252
|
+
request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
|
|
253
|
+
])
|
|
254
|
+
|
|
255
|
+
return {
|
|
256
|
+
currentPayment,
|
|
257
|
+
paymentInfo,
|
|
258
|
+
withdrawRule,
|
|
259
|
+
processing: orders[0],
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
submitWithdraw: async (context, event) => {
|
|
263
|
+
const { currentPayment, selectedUserBank, selectedAmount } = context
|
|
264
|
+
const branchTemp = ['GCASH', 'PAYM', 'PIX'].includes(selectedUserBank.bankCode) ? '' : selectedUserBank.branch
|
|
265
|
+
return await request.send(
|
|
266
|
+
payment.submitWithdrawTransactionVN({
|
|
267
|
+
method: currentPayment.method,
|
|
268
|
+
amount: selectedAmount,
|
|
269
|
+
applyerBankCode: selectedUserBank.bankCode,
|
|
270
|
+
applyerAccountNumber: selectedUserBank.accountNumber,
|
|
271
|
+
applyerIfscCode: selectedUserBank.ifscCode,
|
|
272
|
+
branch: branchTemp,
|
|
273
|
+
applyerHolderName: selectedUserBank.holderName,
|
|
274
|
+
})
|
|
275
|
+
)
|
|
276
|
+
},
|
|
277
|
+
submitWithdrawCrypto: async (context, event) => {
|
|
278
|
+
const { currentPayment, selectedUserBank, selectedAmount } = context
|
|
279
|
+
const branchTemp = ['GCASH', 'PAYM', 'PIX'].includes(selectedUserBank.bankCode) ? '' : selectedUserBank.branch
|
|
280
|
+
return await request.send(
|
|
281
|
+
payment.submitWithdrawTransactionCrypto({
|
|
282
|
+
method: currentPayment.method,
|
|
283
|
+
amount: selectedAmount,
|
|
284
|
+
cryptoCurrency: selectedUserBank.cryptoCurrency,
|
|
285
|
+
cryptoNetwork: selectedUserBank.cryptoNetwork,
|
|
286
|
+
targetAddress: selectedUserBank.cryptoAddress,
|
|
287
|
+
applyerHolderName: selectedUserBank.holderName,
|
|
288
|
+
})
|
|
289
|
+
)
|
|
290
|
+
},
|
|
291
|
+
resetOtp: async (context, event) => {
|
|
292
|
+
const { requestId, target } = context
|
|
293
|
+
return await request.send(user.otpReset({ requestId, target }))
|
|
294
|
+
},
|
|
295
|
+
acknowledge: async (context, event) => {
|
|
296
|
+
const { requestId, target } = context
|
|
297
|
+
const code = event.data
|
|
298
|
+
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
}
|
|
302
|
+
)
|
|
303
|
+
}
|