@jetthai/cuora 1.1.94-cash-5 → 1.1.94
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 +0 -20
- package/dist/bundle.mjs +827 -79
- package/package.json +1 -1
- package/src/api/activity.js +1 -13
- package/src/api/payment.js +4 -12
- package/src/machine/activity/deposit_activity.js +4 -13
- package/src/machine/activity/fafafa_activity.js +15 -26
- package/src/machine/activity/index.js +0 -2
- package/src/machine/activity/ranking_activity.js +2 -11
- package/src/machine/activity/specify_bets_activity.js +3 -25
- package/src/machine/activity/specify_turnover_activity.js +3 -25
- package/src/machine/activity/time_bomb_activity.js +2 -11
- package/src/machine/deposit/index.js +0 -12
- package/src/machine/game.js +285 -0
- package/src/machine/game_favorite.js +123 -0
- package/src/machine/game_favorite_v2.js +2 -6
- package/src/machine/game_v2.js +381 -0
- package/src/machine/game_v2_1.js +9 -35
- package/src/machine/index.js +6 -6
- package/src/request/request.js +5 -9
- package/src/util/index.js +1 -2
- package/src/machine/activity/diamond_shop_activity_cash.js +0 -214
- package/src/machine/deposit/crypto_cash.js +0 -243
- package/src/machine/deposit/direct_cash.js +0 -236
- package/src/machine/deposit/loadcard_cash.js +0 -227
- package/src/machine/deposit/manual_cash.js +0 -321
- package/src/machine/deposit/qrcode_cash.js +0 -227
- package/src/machine/deposit/usdt_cash.js +0 -140
- package/src/machine/reward_cash.js +0 -220
- package/src/machine/side_cash.js +0 -110
- package/src/machine/withdraw/crypto_cash.js +0 -313
- package/src/machine/withdraw/index.js +0 -4
- package/src/machine/withdraw/manual_cash.js +0 -267
- package/src/util/math.js +0 -4
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import api from '../api/game.js'
|
|
3
|
+
import UAParser from 'ua-parser-js'
|
|
4
|
+
|
|
5
|
+
// const UAParser = require('ua-parser-js')
|
|
6
|
+
|
|
7
|
+
export default function (request) {
|
|
8
|
+
return createMachine(
|
|
9
|
+
{
|
|
10
|
+
id: 'game',
|
|
11
|
+
type: 'parallel',
|
|
12
|
+
context: {
|
|
13
|
+
roomId: null,
|
|
14
|
+
room: null,
|
|
15
|
+
list: [],
|
|
16
|
+
gameList: [],
|
|
17
|
+
// play params
|
|
18
|
+
game: {
|
|
19
|
+
provider: null,
|
|
20
|
+
game_id: null,
|
|
21
|
+
game_type: null,
|
|
22
|
+
mapping_id: null,
|
|
23
|
+
portrait: null,
|
|
24
|
+
},
|
|
25
|
+
lang: 'en_US',
|
|
26
|
+
isMobile: new UAParser().getResult().device.type,
|
|
27
|
+
gameURL: null,
|
|
28
|
+
// game database
|
|
29
|
+
sha: {
|
|
30
|
+
category: null,
|
|
31
|
+
status: null,
|
|
32
|
+
},
|
|
33
|
+
isCategoryChanged: false,
|
|
34
|
+
isStatusChanged: false,
|
|
35
|
+
statusMap: {},
|
|
36
|
+
optionMap: {},
|
|
37
|
+
},
|
|
38
|
+
states: {
|
|
39
|
+
flow: {
|
|
40
|
+
initial: 'idle',
|
|
41
|
+
states: {
|
|
42
|
+
idle: {
|
|
43
|
+
enter: 'clearGameInfo',
|
|
44
|
+
on: {
|
|
45
|
+
SET_ROOM: {
|
|
46
|
+
target: 'loading',
|
|
47
|
+
actions: 'setRoom',
|
|
48
|
+
cond: (context, event) => {
|
|
49
|
+
return context.room?.id !== event.data?.id
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
ENTER_GAME: {
|
|
53
|
+
target: 'connecting',
|
|
54
|
+
actions: ['setGameInfo', 'setLang'],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
loading: {
|
|
59
|
+
invoke: {
|
|
60
|
+
src: 'getRoomItems',
|
|
61
|
+
onDone: {
|
|
62
|
+
target: 'idle',
|
|
63
|
+
actions: 'setList',
|
|
64
|
+
},
|
|
65
|
+
onError: {
|
|
66
|
+
target: 'idle',
|
|
67
|
+
actions: assign({ list: [] }),
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
connecting: {
|
|
72
|
+
invoke: {
|
|
73
|
+
src: 'connectGame',
|
|
74
|
+
onDone: {
|
|
75
|
+
target: 'playing',
|
|
76
|
+
actions: 'setGameURL',
|
|
77
|
+
},
|
|
78
|
+
onError: {
|
|
79
|
+
target: 'idle',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
playing: {
|
|
84
|
+
on: {
|
|
85
|
+
EXIT_GAME: {
|
|
86
|
+
target: 'disconnect',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
disconnect: {
|
|
91
|
+
invoke: {
|
|
92
|
+
src: 'disconnectGame',
|
|
93
|
+
onDone: {
|
|
94
|
+
target: 'idle',
|
|
95
|
+
},
|
|
96
|
+
onError: {
|
|
97
|
+
target: 'idle',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
timer: {
|
|
104
|
+
initial: 'fetchingGameSHA',
|
|
105
|
+
states: {
|
|
106
|
+
fetchingGameSHA: {
|
|
107
|
+
invoke: {
|
|
108
|
+
src: 'fetchGameSHA',
|
|
109
|
+
onDone: {
|
|
110
|
+
target: 'checking',
|
|
111
|
+
actions: 'setGameSHA',
|
|
112
|
+
},
|
|
113
|
+
onError: {
|
|
114
|
+
target: 'pending',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
checking: {
|
|
119
|
+
always: [
|
|
120
|
+
{ target: 'updatingStatus', cond: 'isStatusChanged' },
|
|
121
|
+
{ target: 'updatingCategory', cond: 'isCategoryChanged' },
|
|
122
|
+
{ target: 'pending' },
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
updatingStatus: {
|
|
126
|
+
invoke: {
|
|
127
|
+
src: 'fetchStatus',
|
|
128
|
+
onDone: {
|
|
129
|
+
target: 'updatingOption',
|
|
130
|
+
actions: ['setStatus'],
|
|
131
|
+
},
|
|
132
|
+
onError: {
|
|
133
|
+
target: 'pending',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
updatingOption: {
|
|
138
|
+
invoke: {
|
|
139
|
+
src: 'fetchOption',
|
|
140
|
+
onDone: {
|
|
141
|
+
target: 'updatingCategory',
|
|
142
|
+
actions: 'mergeOption',
|
|
143
|
+
},
|
|
144
|
+
onError: {
|
|
145
|
+
target: 'pending',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
updatingCategory: {
|
|
150
|
+
invoke: {
|
|
151
|
+
src: 'getRoomItems',
|
|
152
|
+
onDone: {
|
|
153
|
+
target: 'pending',
|
|
154
|
+
actions: 'setList',
|
|
155
|
+
},
|
|
156
|
+
onError: {
|
|
157
|
+
target: 'pending',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
pending: {
|
|
162
|
+
after: {
|
|
163
|
+
20000: {
|
|
164
|
+
target: 'fetchingGameSHA',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
actions: {
|
|
174
|
+
setRoomId: assign((context, event) => {
|
|
175
|
+
return { roomId: event.roomId }
|
|
176
|
+
}),
|
|
177
|
+
setRoom: assign((context, event) => {
|
|
178
|
+
return {
|
|
179
|
+
room: event.data,
|
|
180
|
+
roomId: event.data.id,
|
|
181
|
+
}
|
|
182
|
+
}),
|
|
183
|
+
setList: assign((context, event) => {
|
|
184
|
+
const { statusMap, optionMap } = context
|
|
185
|
+
const { list = [] } = event.data
|
|
186
|
+
const gameList = list
|
|
187
|
+
.map((item) => {
|
|
188
|
+
if (item.id) {
|
|
189
|
+
item.room = true
|
|
190
|
+
return item
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const code = item.g
|
|
194
|
+
if (!code || !optionMap[code]) {
|
|
195
|
+
return
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
...optionMap[code],
|
|
200
|
+
code,
|
|
201
|
+
system_enable: statusMap[code][0],
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
.filter((item) => item && !item.header)
|
|
205
|
+
.sort((a, b) => a.system_enable - b.system_enable)
|
|
206
|
+
return { list, gameList }
|
|
207
|
+
}),
|
|
208
|
+
setGameURL: assign({
|
|
209
|
+
gameURL: (context, event) => {
|
|
210
|
+
return event.data.gameURL
|
|
211
|
+
},
|
|
212
|
+
}),
|
|
213
|
+
clearGameInfo: assign((context, event) => {
|
|
214
|
+
return { game: { provider: null, game_id: null, game_type: null, mapping_id: null } }
|
|
215
|
+
}),
|
|
216
|
+
setGameInfo: assign((context, event) => {
|
|
217
|
+
const { provider, game_id, game_type, mapping_id, portrait } = event.data.game
|
|
218
|
+
return { game: { provider, game_id, game_type, mapping_id, portrait } }
|
|
219
|
+
}),
|
|
220
|
+
setLang: assign((context, event) => {
|
|
221
|
+
const lang = event.data.locale.replace('-', '_')
|
|
222
|
+
return { lang }
|
|
223
|
+
}),
|
|
224
|
+
setGameSHA: assign((context, event) => {
|
|
225
|
+
const { sha } = context
|
|
226
|
+
const newSha = event.data
|
|
227
|
+
return {
|
|
228
|
+
sha: newSha,
|
|
229
|
+
isCategoryChanged: !sha.category || sha.category !== newSha.category,
|
|
230
|
+
isStatusChanged: !sha.status || sha.status !== newSha.status,
|
|
231
|
+
}
|
|
232
|
+
}),
|
|
233
|
+
setStatus: assign((context, event) => {
|
|
234
|
+
return {
|
|
235
|
+
statusMap: event.data,
|
|
236
|
+
}
|
|
237
|
+
}),
|
|
238
|
+
mergeOption: assign((context, event) => {
|
|
239
|
+
const { optionMap } = context
|
|
240
|
+
return {
|
|
241
|
+
optionMap: { ...optionMap, ...event.data },
|
|
242
|
+
}
|
|
243
|
+
}),
|
|
244
|
+
},
|
|
245
|
+
guards: {
|
|
246
|
+
isCategoryChanged: (context, event) => context.isCategoryChanged,
|
|
247
|
+
isStatusChanged: (context, event) => context.isStatusChanged,
|
|
248
|
+
},
|
|
249
|
+
services: {
|
|
250
|
+
getRoomItems: async (context, event) => {
|
|
251
|
+
return await request.send(api.getGameCategory({ id: context.roomId }))
|
|
252
|
+
},
|
|
253
|
+
connectGame: async (context, event) => {
|
|
254
|
+
const { lang, isMobile } = context
|
|
255
|
+
const { provider, game_id, game_type, mapping_id } = context.game
|
|
256
|
+
const params = {
|
|
257
|
+
provider_id: provider,
|
|
258
|
+
game_id: game_id,
|
|
259
|
+
gametype_id: game_type,
|
|
260
|
+
mapping_id: mapping_id,
|
|
261
|
+
is_demo: false,
|
|
262
|
+
is_mobile: isMobile,
|
|
263
|
+
lang,
|
|
264
|
+
return_url: window.location.href,
|
|
265
|
+
}
|
|
266
|
+
const { redirect_url } = await request.send(api.playGame(params))
|
|
267
|
+
return { gameURL: redirect_url }
|
|
268
|
+
},
|
|
269
|
+
disconnectGame: async (context, event) => {
|
|
270
|
+
const uid_site = event.data
|
|
271
|
+
return await request.send(api.logoutGame({ uid_site, provider_id: context.game.provider }))
|
|
272
|
+
},
|
|
273
|
+
fetchOption: async (context, event) => {
|
|
274
|
+
return await request.send(api.getOptionMap())
|
|
275
|
+
},
|
|
276
|
+
fetchGameSHA: async (context, event) => {
|
|
277
|
+
return await request.send(api.getGameSHA())
|
|
278
|
+
},
|
|
279
|
+
fetchStatus: async (context, event) => {
|
|
280
|
+
return await request.send(api.getGameStatus())
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import api from '../api/game.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
return createMachine(
|
|
6
|
+
{
|
|
7
|
+
id: 'favorite',
|
|
8
|
+
type: 'parallel',
|
|
9
|
+
context: {
|
|
10
|
+
list: [],
|
|
11
|
+
},
|
|
12
|
+
states: {
|
|
13
|
+
fetching: {
|
|
14
|
+
initial: 'disable',
|
|
15
|
+
states: {
|
|
16
|
+
disable: {},
|
|
17
|
+
enable: {
|
|
18
|
+
invoke: {
|
|
19
|
+
src: 'fetchList',
|
|
20
|
+
onDone: {
|
|
21
|
+
actions: 'setList',
|
|
22
|
+
},
|
|
23
|
+
onError: {
|
|
24
|
+
actions: assign({ list: [] }),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
adding: {
|
|
31
|
+
initial: 'disable',
|
|
32
|
+
states: {
|
|
33
|
+
disable: {},
|
|
34
|
+
enable: {
|
|
35
|
+
invoke: {
|
|
36
|
+
src: 'add',
|
|
37
|
+
onDone: {},
|
|
38
|
+
onError: {
|
|
39
|
+
actions: 'removeFromList',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
removing: {
|
|
46
|
+
initial: 'disable',
|
|
47
|
+
states: {
|
|
48
|
+
disable: {},
|
|
49
|
+
enable: {
|
|
50
|
+
invoke: {
|
|
51
|
+
src: 'remove',
|
|
52
|
+
onDone: {},
|
|
53
|
+
onError: {
|
|
54
|
+
actions: 'addToList',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
on: {
|
|
62
|
+
FETCH_LIST: {
|
|
63
|
+
target: 'fetching.enable',
|
|
64
|
+
},
|
|
65
|
+
ADD: {
|
|
66
|
+
target: 'adding.enable',
|
|
67
|
+
actions: 'addToList',
|
|
68
|
+
cond: 'isNotExist',
|
|
69
|
+
},
|
|
70
|
+
REMOVE: {
|
|
71
|
+
target: 'removing.enable',
|
|
72
|
+
actions: 'removeFromList',
|
|
73
|
+
cond: 'isExist',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
actions: {
|
|
79
|
+
setList: assign((context, event) => {
|
|
80
|
+
return {
|
|
81
|
+
list: event.data,
|
|
82
|
+
}
|
|
83
|
+
}),
|
|
84
|
+
addToList: assign((context, event) => {
|
|
85
|
+
return {
|
|
86
|
+
list: [...context.list, event.data],
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
removeFromList: assign((context, event) => {
|
|
90
|
+
return {
|
|
91
|
+
list: context.list.filter((item) => item !== event.data),
|
|
92
|
+
}
|
|
93
|
+
}),
|
|
94
|
+
},
|
|
95
|
+
guards: {
|
|
96
|
+
isExist: (context, event) => context.list.includes(event.data),
|
|
97
|
+
isNotExist: (context, event) => !context.list.includes(event.data),
|
|
98
|
+
},
|
|
99
|
+
services: {
|
|
100
|
+
add: async (context, event) => {
|
|
101
|
+
try {
|
|
102
|
+
return await request.send(api.addFavoriteGame(event.data))
|
|
103
|
+
} catch (error) {
|
|
104
|
+
throw event.data
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
remove: async (context, event) => {
|
|
108
|
+
try {
|
|
109
|
+
return await request.send(api.removeFavoriteGame(event.data))
|
|
110
|
+
} catch (error) {
|
|
111
|
+
throw event.data
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
fetchList: async (context, event) => {
|
|
115
|
+
const main = await request.send(api.getGameCategory({}))
|
|
116
|
+
const room = main.list.find((item) => item.category === 'SYSTEM_MY_FAVORITE')
|
|
117
|
+
const favorite = await request.send(api.getGameCategory({ id: room.id }))
|
|
118
|
+
return favorite.list.map((item) => item.g)
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
}
|
|
@@ -110,12 +110,8 @@ export default function (request) {
|
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
fetchList: async (context, event) => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return data
|
|
116
|
-
} else {
|
|
117
|
-
return []
|
|
118
|
-
}
|
|
113
|
+
const { data } = await request.send(api.getListMyFavorite())
|
|
114
|
+
return data
|
|
119
115
|
},
|
|
120
116
|
},
|
|
121
117
|
}
|