@jetthai/cuora 1.1.66 → 1.1.68-cash
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 +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/bundle.mjs +1348 -1931
- package/package.json +1 -1
- package/src/api/payment.js +2 -0
- package/src/machine/activity/activity.js +1 -1
- package/src/machine/deposit/crypto.js +36 -19
- package/src/machine/deposit/crypto_button.js +103 -126
- package/src/machine/deposit/direct.js +78 -9
- package/src/machine/deposit/float.js +94 -27
- package/src/machine/deposit/loadcard_vn.js +124 -149
- package/src/machine/deposit/manual_vn.js +39 -7
- package/src/machine/deposit/qrcode_v2.js +165 -175
- package/src/machine/deposit/vpay.js +89 -26
- package/src/machine/game_favorite_v2.js +6 -2
- package/src/machine/game_v2_1.js +36 -9
- package/src/machine/index.js +0 -6
- package/src/machine/promotions.js +1 -1
- package/src/request/request.js +9 -5
- package/src/machine/game.js +0 -285
- package/src/machine/game_favorite.js +0 -123
- package/src/machine/game_v2.js +0 -381
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
|
+
import common from '../../api/common.js'
|
|
3
4
|
|
|
4
5
|
export default function (request) {
|
|
6
|
+
const { appSecret } = request.config
|
|
5
7
|
return createMachine(
|
|
6
8
|
{
|
|
7
9
|
id: 'vpay',
|
|
@@ -9,6 +11,7 @@ export default function (request) {
|
|
|
9
11
|
context: {
|
|
10
12
|
method: 'vpay',
|
|
11
13
|
userAccount: {},
|
|
14
|
+
siteConfig: null,
|
|
12
15
|
amount: 0,
|
|
13
16
|
|
|
14
17
|
bankList: [],
|
|
@@ -23,6 +26,9 @@ export default function (request) {
|
|
|
23
26
|
calculatedAmount: 0,
|
|
24
27
|
|
|
25
28
|
grandTotalEnable: 1,
|
|
29
|
+
|
|
30
|
+
promotion: null,
|
|
31
|
+
bonusPreviewData: [],
|
|
26
32
|
},
|
|
27
33
|
states: {
|
|
28
34
|
loading: {
|
|
@@ -53,7 +59,7 @@ export default function (request) {
|
|
|
53
59
|
actions: ['setInitialization', 'setPreviousOrder'],
|
|
54
60
|
cond: 'hasPreviousOrder',
|
|
55
61
|
},
|
|
56
|
-
{ target: '#vpay.
|
|
62
|
+
{ target: '#vpay.checking', actions: 'setInitialization' },
|
|
57
63
|
],
|
|
58
64
|
onError: {
|
|
59
65
|
target: '#vpay.unavailable',
|
|
@@ -62,6 +68,31 @@ export default function (request) {
|
|
|
62
68
|
},
|
|
63
69
|
},
|
|
64
70
|
},
|
|
71
|
+
checking: {
|
|
72
|
+
always: [
|
|
73
|
+
{
|
|
74
|
+
target: 'fetching',
|
|
75
|
+
cond: (context, event) => {
|
|
76
|
+
const { siteConfig = {}, promotion = {} } = context
|
|
77
|
+
const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
|
|
78
|
+
return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{ target: 'loaded' },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
fetching: {
|
|
85
|
+
invoke: {
|
|
86
|
+
src: 'fetchBonusPreview',
|
|
87
|
+
onDone: {
|
|
88
|
+
target: 'loaded',
|
|
89
|
+
actions: 'setBonusPreview',
|
|
90
|
+
},
|
|
91
|
+
onError: {
|
|
92
|
+
target: 'loaded',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
65
96
|
loaded: {
|
|
66
97
|
entry: 'reset',
|
|
67
98
|
on: {
|
|
@@ -69,7 +100,7 @@ export default function (request) {
|
|
|
69
100
|
{
|
|
70
101
|
target: 'debouncing',
|
|
71
102
|
actions: 'addAmount',
|
|
72
|
-
cond:
|
|
103
|
+
cond: 'isGrandTotalEnable',
|
|
73
104
|
},
|
|
74
105
|
{
|
|
75
106
|
target: 'debouncing',
|
|
@@ -80,6 +111,10 @@ export default function (request) {
|
|
|
80
111
|
target: 'calculating',
|
|
81
112
|
actions: 'setAmount',
|
|
82
113
|
},
|
|
114
|
+
CLEAR_CALCULATION: {
|
|
115
|
+
target: 'debouncing',
|
|
116
|
+
actions: 'clearCalculation',
|
|
117
|
+
},
|
|
83
118
|
},
|
|
84
119
|
},
|
|
85
120
|
debouncing: {
|
|
@@ -88,7 +123,7 @@ export default function (request) {
|
|
|
88
123
|
{
|
|
89
124
|
target: 'debouncing',
|
|
90
125
|
actions: 'addAmount',
|
|
91
|
-
cond:
|
|
126
|
+
cond: 'isGrandTotalEnable',
|
|
92
127
|
},
|
|
93
128
|
{
|
|
94
129
|
target: 'debouncing',
|
|
@@ -99,9 +134,6 @@ export default function (request) {
|
|
|
99
134
|
target: 'debouncing',
|
|
100
135
|
actions: 'setAmount',
|
|
101
136
|
},
|
|
102
|
-
BACK: {
|
|
103
|
-
target: 'loaded',
|
|
104
|
-
},
|
|
105
137
|
},
|
|
106
138
|
after: {
|
|
107
139
|
1000: {
|
|
@@ -116,7 +148,7 @@ export default function (request) {
|
|
|
116
148
|
{
|
|
117
149
|
target: 'debouncing',
|
|
118
150
|
actions: 'addAmount',
|
|
119
|
-
cond:
|
|
151
|
+
cond: 'isGrandTotalEnable',
|
|
120
152
|
},
|
|
121
153
|
{
|
|
122
154
|
target: 'debouncing',
|
|
@@ -127,11 +159,12 @@ export default function (request) {
|
|
|
127
159
|
target: 'debouncing',
|
|
128
160
|
actions: 'setAmount',
|
|
129
161
|
},
|
|
130
|
-
|
|
162
|
+
CLEAR_CALCULATION: {
|
|
131
163
|
target: 'debouncing',
|
|
164
|
+
actions: 'clearCalculation',
|
|
132
165
|
},
|
|
133
|
-
|
|
134
|
-
|
|
166
|
+
CLEAR: {
|
|
167
|
+
actions: 'setAmount',
|
|
135
168
|
},
|
|
136
169
|
},
|
|
137
170
|
},
|
|
@@ -153,7 +186,7 @@ export default function (request) {
|
|
|
153
186
|
{
|
|
154
187
|
target: 'debouncing',
|
|
155
188
|
actions: 'addAmount',
|
|
156
|
-
cond:
|
|
189
|
+
cond: 'isGrandTotalEnable',
|
|
157
190
|
},
|
|
158
191
|
{
|
|
159
192
|
target: 'debouncing',
|
|
@@ -167,19 +200,22 @@ export default function (request) {
|
|
|
167
200
|
CONFIRM: {
|
|
168
201
|
target: 'submitting',
|
|
169
202
|
},
|
|
170
|
-
BACK: {
|
|
171
|
-
target: 'loaded',
|
|
172
|
-
},
|
|
173
203
|
CLEAR_CALCULATION: {
|
|
174
204
|
target: 'debouncing',
|
|
175
205
|
actions: 'clearCalculation',
|
|
176
206
|
},
|
|
207
|
+
CLEAR: {
|
|
208
|
+
actions: 'setAmount',
|
|
209
|
+
},
|
|
177
210
|
},
|
|
178
211
|
},
|
|
179
212
|
submitting: {
|
|
180
213
|
invoke: {
|
|
181
214
|
src: 'submitDeposit',
|
|
182
|
-
onDone: {
|
|
215
|
+
onDone: {
|
|
216
|
+
target: 'submitted',
|
|
217
|
+
actions: 'setOrder',
|
|
218
|
+
},
|
|
183
219
|
onError: {
|
|
184
220
|
target: 'calculated',
|
|
185
221
|
},
|
|
@@ -189,6 +225,11 @@ export default function (request) {
|
|
|
189
225
|
accountUnbound: {},
|
|
190
226
|
unavailable: {},
|
|
191
227
|
},
|
|
228
|
+
on: {
|
|
229
|
+
SET_PROMOTION: {
|
|
230
|
+
actions: 'setPromotion',
|
|
231
|
+
},
|
|
232
|
+
},
|
|
192
233
|
},
|
|
193
234
|
{
|
|
194
235
|
actions: {
|
|
@@ -197,6 +238,11 @@ export default function (request) {
|
|
|
197
238
|
userAccount: event.data.bankInfo?.[0],
|
|
198
239
|
}
|
|
199
240
|
}),
|
|
241
|
+
setBonusPreview: assign((context, event) => {
|
|
242
|
+
return {
|
|
243
|
+
bonusPreviewData: event.data.bonus,
|
|
244
|
+
}
|
|
245
|
+
}),
|
|
200
246
|
setOrder: assign((context, event) => {
|
|
201
247
|
const { amount, qrcode, vpayId } = event.data
|
|
202
248
|
return {
|
|
@@ -214,9 +260,10 @@ export default function (request) {
|
|
|
214
260
|
}
|
|
215
261
|
}),
|
|
216
262
|
setInitialization: assign((context, event) => {
|
|
217
|
-
const { housePayment, bankList } = event.data
|
|
263
|
+
const { siteConfig, housePayment, bankList } = event.data
|
|
218
264
|
const { optional, minimum, maximum, grandTotalEnable } = housePayment
|
|
219
265
|
return {
|
|
266
|
+
siteConfig,
|
|
220
267
|
options: optional,
|
|
221
268
|
minimum,
|
|
222
269
|
maximum,
|
|
@@ -224,6 +271,12 @@ export default function (request) {
|
|
|
224
271
|
grandTotalEnable,
|
|
225
272
|
}
|
|
226
273
|
}),
|
|
274
|
+
setPromotion: assign((context, event) => {
|
|
275
|
+
const promotion = event.data
|
|
276
|
+
return {
|
|
277
|
+
promotion,
|
|
278
|
+
}
|
|
279
|
+
}),
|
|
227
280
|
addAmount: assign((context, event) => {
|
|
228
281
|
const { amount, maximum } = context
|
|
229
282
|
return {
|
|
@@ -233,11 +286,6 @@ export default function (request) {
|
|
|
233
286
|
setAmount: assign((context, event) => {
|
|
234
287
|
return { amount: event.data }
|
|
235
288
|
}),
|
|
236
|
-
clear: assign((context, event) => {
|
|
237
|
-
return {
|
|
238
|
-
amount: 0,
|
|
239
|
-
}
|
|
240
|
-
}),
|
|
241
289
|
setCalculation: assign((context, event) => {
|
|
242
290
|
return {
|
|
243
291
|
calculation: event.data,
|
|
@@ -256,33 +304,48 @@ export default function (request) {
|
|
|
256
304
|
hasPreviousOrder: (context, event) => {
|
|
257
305
|
return event.data.order?.qrcode
|
|
258
306
|
},
|
|
307
|
+
isGrandTotalEnable: (context, event) => {
|
|
308
|
+
return context.grandTotalEnable === 1
|
|
309
|
+
},
|
|
259
310
|
},
|
|
260
311
|
services: {
|
|
261
312
|
fetchPaymentInfo: async (context, event) => {
|
|
262
313
|
return await request.send(payment.getPaymentInfo())
|
|
263
314
|
},
|
|
264
315
|
initialize: async (context, event) => {
|
|
265
|
-
const [payments, bankList, order] = await Promise.all([
|
|
316
|
+
const [{ config }, payments, bankList, order] = await Promise.all([
|
|
317
|
+
request.send(common.getConfig({ appSecret })),
|
|
266
318
|
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
267
319
|
request.send(payment.getBankList('amb')),
|
|
268
320
|
request.send(payment.checkTransaction(context.method)),
|
|
269
321
|
])
|
|
270
|
-
|
|
322
|
+
const siteConfig = JSON.parse(window.atob(config))
|
|
323
|
+
return { siteConfig, housePayment: payments.find((payment) => payment.method === context.method), bankList, order }
|
|
324
|
+
},
|
|
325
|
+
fetchBonusPreview: async (context, event) => {
|
|
326
|
+
const { method, promotion } = context
|
|
327
|
+
return await request.send({
|
|
328
|
+
paymentMethod: method,
|
|
329
|
+
promotionsNo: promotion?.activityNo,
|
|
330
|
+
})
|
|
271
331
|
},
|
|
272
332
|
submitDeposit: async (context, event) => {
|
|
273
|
-
const { method, amount } = context
|
|
333
|
+
const { method, amount, promotion } = context
|
|
274
334
|
return await request.send(
|
|
275
335
|
payment.submitDepositTransaction({
|
|
276
336
|
method,
|
|
277
337
|
amount,
|
|
338
|
+
promotionsNo: promotion?.activityNo,
|
|
278
339
|
})
|
|
279
340
|
)
|
|
280
341
|
},
|
|
281
342
|
fetchCalculation: async (context, event) => {
|
|
343
|
+
const { method, amount, promotion } = context
|
|
282
344
|
return await request.send(
|
|
283
345
|
payment.getDepositExpectedResult({
|
|
284
|
-
method
|
|
285
|
-
amount
|
|
346
|
+
method,
|
|
347
|
+
amount,
|
|
348
|
+
promotionsNo: promotion?.activityNo,
|
|
286
349
|
})
|
|
287
350
|
)
|
|
288
351
|
},
|
|
@@ -110,8 +110,12 @@ export default function (request) {
|
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
fetchList: async (context, event) => {
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
if (request.getToken()) {
|
|
114
|
+
const { data } = await request.send(api.getListMyFavorite())
|
|
115
|
+
return data
|
|
116
|
+
} else {
|
|
117
|
+
return []
|
|
118
|
+
}
|
|
115
119
|
},
|
|
116
120
|
},
|
|
117
121
|
}
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -26,6 +26,7 @@ export default function (request) {
|
|
|
26
26
|
timestamp: null,
|
|
27
27
|
totalPage: 0,
|
|
28
28
|
},
|
|
29
|
+
staticData: [],
|
|
29
30
|
// play params
|
|
30
31
|
game: {
|
|
31
32
|
providerId: null,
|
|
@@ -46,6 +47,9 @@ export default function (request) {
|
|
|
46
47
|
idle: {
|
|
47
48
|
enter: 'clearGameInfo',
|
|
48
49
|
on: {
|
|
50
|
+
SET_STATIC_DATA: {
|
|
51
|
+
actions: 'setStaticData',
|
|
52
|
+
},
|
|
49
53
|
SET_ADDITION_ENABLE: {
|
|
50
54
|
actions: 'setAdditionEnable',
|
|
51
55
|
},
|
|
@@ -205,6 +209,11 @@ export default function (request) {
|
|
|
205
209
|
},
|
|
206
210
|
{
|
|
207
211
|
actions: {
|
|
212
|
+
setStaticData: assign((context, event) => {
|
|
213
|
+
return {
|
|
214
|
+
staticData: event.data,
|
|
215
|
+
}
|
|
216
|
+
}),
|
|
208
217
|
setAdditionEnable: assign((context, event) => {
|
|
209
218
|
return {
|
|
210
219
|
additionEnable: event.data,
|
|
@@ -222,17 +231,13 @@ export default function (request) {
|
|
|
222
231
|
isLastPage: index >= content?.totalPage - 1,
|
|
223
232
|
}
|
|
224
233
|
}),
|
|
225
|
-
setFavoriteList: assign((context, event) => {
|
|
226
|
-
return {
|
|
227
|
-
favoriteList: event.data.data || [],
|
|
228
|
-
}
|
|
229
|
-
}),
|
|
230
234
|
setRoom: assign((context, event) => {
|
|
231
235
|
return {
|
|
232
236
|
room: event.data,
|
|
233
237
|
}
|
|
234
238
|
}),
|
|
235
239
|
resetContent: assign((context, event) => {
|
|
240
|
+
console.log('resetContent')
|
|
236
241
|
return {
|
|
237
242
|
loadable: false,
|
|
238
243
|
isLastPage: false,
|
|
@@ -324,9 +329,19 @@ export default function (request) {
|
|
|
324
329
|
},
|
|
325
330
|
services: {
|
|
326
331
|
getPageContent: async (context, event) => {
|
|
327
|
-
const { room, index, additionEnable } = context
|
|
332
|
+
const { room, index, additionEnable, staticData } = context
|
|
328
333
|
if (room.categoryId === GAME_SEARCH) {
|
|
329
334
|
return
|
|
335
|
+
} else if (!request.getToken()) {
|
|
336
|
+
const list = staticData.find((data) => data.category == room.categoryId)?.info || []
|
|
337
|
+
|
|
338
|
+
return [
|
|
339
|
+
{
|
|
340
|
+
data: list.slice(index * 20, (index + 1) * 20),
|
|
341
|
+
totalPage: Math.ceil(list.length / 20),
|
|
342
|
+
timestamp: Math.floor(Date.now() / 1000),
|
|
343
|
+
},
|
|
344
|
+
]
|
|
330
345
|
} else if (additionEnable) {
|
|
331
346
|
const param = { categoryId: room.categoryId, index }
|
|
332
347
|
return await Promise.all([request.send(api.getListCategory(param)), request.send(api.getListAddition(param))])
|
|
@@ -339,6 +354,8 @@ export default function (request) {
|
|
|
339
354
|
const { room, content, index, additionEnable } = context
|
|
340
355
|
if (room.categoryId === GAME_SEARCH) {
|
|
341
356
|
return
|
|
357
|
+
} else if (!request.getToken()) {
|
|
358
|
+
return []
|
|
342
359
|
} else if (additionEnable) {
|
|
343
360
|
return await Promise.all([
|
|
344
361
|
request.send(
|
|
@@ -432,12 +449,22 @@ const oldGuards = {
|
|
|
432
449
|
|
|
433
450
|
const oldServices = (request) => ({
|
|
434
451
|
fetchOption: async (context, event) => {
|
|
435
|
-
|
|
452
|
+
if (request.getToken()) {
|
|
453
|
+
return await request.send(api.getOptionMap())
|
|
454
|
+
}
|
|
436
455
|
},
|
|
437
456
|
fetchGameSHA: async (context, event) => {
|
|
438
|
-
|
|
457
|
+
if (request.getToken()) {
|
|
458
|
+
return await request.send(api.getGameSHA())
|
|
459
|
+
} else {
|
|
460
|
+
return {
|
|
461
|
+
status: null,
|
|
462
|
+
}
|
|
463
|
+
}
|
|
439
464
|
},
|
|
440
465
|
fetchStatus: async (context, event) => {
|
|
441
|
-
|
|
466
|
+
if (request.getToken()) {
|
|
467
|
+
return await request.send(api.getGameStatus())
|
|
468
|
+
}
|
|
442
469
|
},
|
|
443
470
|
})
|
package/src/machine/index.js
CHANGED
|
@@ -3,10 +3,7 @@ import auth from './auth.js'
|
|
|
3
3
|
import welcome from './welcome.js'
|
|
4
4
|
import common from './common.js'
|
|
5
5
|
import error from './error.js'
|
|
6
|
-
import game from './game.js'
|
|
7
|
-
import game_v2 from './game_v2.js'
|
|
8
6
|
import game_v2_1 from './game_v2_1.js'
|
|
9
|
-
import game_favorite from './game_favorite.js'
|
|
10
7
|
import game_favorite_v2 from './game_favorite_v2.js'
|
|
11
8
|
import game_search from './game_search.js'
|
|
12
9
|
import game_search_v2 from './game_search_v2.js'
|
|
@@ -44,9 +41,6 @@ export default {
|
|
|
44
41
|
common,
|
|
45
42
|
deposit,
|
|
46
43
|
error,
|
|
47
|
-
game,
|
|
48
|
-
game_v2,
|
|
49
|
-
game_favorite,
|
|
50
44
|
game_favorite_v2,
|
|
51
45
|
game_search,
|
|
52
46
|
game_search_v2,
|
package/src/request/request.js
CHANGED
|
@@ -22,8 +22,8 @@ export default class Request {
|
|
|
22
22
|
this.axios.interceptors.request.use((axiosConfig) => {
|
|
23
23
|
axiosConfig.headers['X-TH1GAMES-VERSION'] = this.config.version
|
|
24
24
|
axiosConfig.headers['X-TH1GAMES-PLATFORM'] = this.config.platform
|
|
25
|
-
if (
|
|
26
|
-
axiosConfig.headers.Authorization =
|
|
25
|
+
if (this.getToken()) {
|
|
26
|
+
axiosConfig.headers.Authorization = this.getToken()
|
|
27
27
|
}
|
|
28
28
|
return axiosConfig
|
|
29
29
|
})
|
|
@@ -51,7 +51,7 @@ export default class Request {
|
|
|
51
51
|
async send(req, customToken) {
|
|
52
52
|
try {
|
|
53
53
|
const cancelToken = customToken || this.source.token
|
|
54
|
-
this._checkToken(req
|
|
54
|
+
this._checkToken(req)
|
|
55
55
|
const requestConfig = this._createConfig(req, cancelToken)
|
|
56
56
|
const { data } = await this.axios.request(requestConfig)
|
|
57
57
|
return data
|
|
@@ -97,10 +97,14 @@ export default class Request {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
_checkToken(req
|
|
101
|
-
if (!req.isPublic && !
|
|
100
|
+
_checkToken(req) {
|
|
101
|
+
if (!req.isPublic && !this.getToken()) {
|
|
102
102
|
console.error(req)
|
|
103
103
|
throw { code: 'ERR_A103', url: req.url }
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
getToken() {
|
|
108
|
+
return storage.get(this.key)
|
|
109
|
+
}
|
|
106
110
|
}
|