@jetthai/cuora 1.0.65 → 1.0.66-sabai-2
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 +642 -0
- package/README.md +6 -0
- package/dist/bundle.mjs +27623 -0
- package/package.json +13 -11
- package/rollup.config.js +12 -0
- package/src/api/activity.js +10 -3
- package/src/api/auth.js +47 -5
- package/src/api/game.js +64 -2
- package/src/api/index.js +9 -9
- package/src/api/payment.js +91 -7
- package/src/api/user.js +18 -0
- package/src/index.js +7 -5
- package/src/lib/fingerprint.js +5779 -0
- package/src/machine/activity/activity.js +97 -10
- package/src/machine/activity/affiliate_invite_friends_activity.js +216 -0
- package/src/machine/activity/continue_deposit_activity.js +1 -1
- package/src/machine/activity/deposit_activity.js +1 -1
- package/src/machine/activity/{diamond_shop_activity.js → diamond_shop_activity_fc.js} +33 -5
- package/src/machine/activity/{diamond_shop_activity_single_exchange.js → diamond_shop_activity_vn.js} +66 -21
- package/src/machine/activity/fafafa_activity.js +4 -2
- package/src/machine/activity/index.js +24 -10
- package/src/machine/activity/invite_friends_activity.js +3 -8
- package/src/machine/activity/mini_game_activity.js +68 -0
- package/src/machine/activity/ranking_activity.js +40 -46
- package/src/machine/activity/return_bonus_activity.js +5 -3
- package/src/machine/activity/roulette_activity_v2.js +81 -0
- package/src/machine/activity/sign_in_activity.js +149 -0
- package/src/machine/activity/specify_bets_activity.js +1 -1
- package/src/machine/activity/specify_turnover_activity.js +113 -0
- package/src/machine/activity/time_bomb_activity.js +80 -0
- package/src/machine/auth.js +234 -79
- package/src/machine/auth_otp_v2.js +177 -0
- package/src/machine/{auth_otp.js → auth_otp_v3.js} +80 -17
- package/src/machine/bank_binding.js +120 -0
- package/src/machine/bank_binding_amb.js +140 -0
- package/src/machine/bonus.js +75 -0
- package/src/machine/common.js +80 -17
- package/src/machine/deposit/amb.js +90 -0
- package/src/machine/deposit/crypto.js +267 -0
- package/src/machine/deposit/crypto_button.js +449 -0
- package/src/machine/{deposit.js → deposit/deposit_fc.js} +27 -15
- package/src/machine/deposit/direct.js +246 -0
- package/src/machine/deposit/float.js +295 -0
- package/src/machine/deposit/index.js +25 -0
- package/src/machine/deposit/loadcard_vn.js +390 -0
- package/src/machine/deposit/manual_vn.js +382 -0
- package/src/machine/deposit/qrcode_v2.js +451 -0
- package/src/machine/deposit/usdt.js +144 -0
- package/src/machine/deposit/vpay.js +292 -0
- package/src/machine/error.js +1 -1
- package/src/machine/game.js +17 -10
- package/src/machine/game_favorite.js +2 -2
- package/src/machine/game_favorite_v2.js +119 -0
- package/src/machine/game_hot_new.js +1 -1
- package/src/machine/game_search.js +3 -7
- package/src/machine/game_search_v2.js +379 -0
- package/src/machine/game_v2.js +381 -0
- package/src/machine/game_v2_1.js +442 -0
- package/src/machine/inbox.js +5 -6
- package/src/machine/index.js +58 -23
- package/src/machine/leaderboard.js +108 -0
- package/src/machine/merge.js +2 -2
- package/src/machine/payment_data.js +6 -5
- package/src/machine/promotions.js +170 -0
- package/src/machine/reward.js +84 -3
- package/src/machine/reward_fc.js +97 -0
- package/src/machine/roulette_v2.js +271 -0
- package/src/machine/setting.js +5 -2
- package/src/machine/side.js +34 -27
- package/src/machine/side_v2.js +200 -0
- package/src/machine/user_info.js +1 -1
- package/src/machine/user_reset_password.js +2 -2
- package/src/machine/user_sign_up.js +111 -56
- package/src/machine/vip_table.js +50 -0
- package/src/machine/welcome.js +6 -8
- package/src/machine/withdraw_amb.js +373 -0
- package/src/machine/withdraw_crypto.js +560 -0
- package/src/machine/withdraw_fc.js +251 -0
- package/src/machine/withdraw_vn.js +495 -0
- package/src/request/config.js +7 -1
- package/src/request/request.js +11 -15
- package/src/util/constant.js +2 -0
- package/src/util/deviceToken.js +33 -0
- package/src/util/index.js +6 -0
- package/src/util/storage.js +28 -0
- package/dist/index.js +0 -2
- package/dist/index.js.LICENSE.txt +0 -30
- package/src/machine/withdraw.js +0 -380
- package/src/request/cookie.js +0 -52
- package/webpack.config.js +0 -33
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import api from '../api/game.js'
|
|
3
|
+
import UAParser from 'ua-parser-js'
|
|
4
|
+
import { GAME_SEARCH } from '../util/constant.js'
|
|
5
|
+
|
|
6
|
+
// 對應 intersectionObserver 版本
|
|
7
|
+
export default function (request) {
|
|
8
|
+
return createMachine(
|
|
9
|
+
{
|
|
10
|
+
id: 'game',
|
|
11
|
+
type: 'parallel',
|
|
12
|
+
context: {
|
|
13
|
+
loadable: false,
|
|
14
|
+
isLastPage: false,
|
|
15
|
+
room: null,
|
|
16
|
+
index: -1,
|
|
17
|
+
content: {
|
|
18
|
+
data: [],
|
|
19
|
+
timestamp: null,
|
|
20
|
+
parentCategoryId: null,
|
|
21
|
+
totalPage: 0,
|
|
22
|
+
},
|
|
23
|
+
additionEnable: false,
|
|
24
|
+
addition: {
|
|
25
|
+
data: [],
|
|
26
|
+
timestamp: null,
|
|
27
|
+
totalPage: 0,
|
|
28
|
+
},
|
|
29
|
+
// play params
|
|
30
|
+
game: {
|
|
31
|
+
providerId: null,
|
|
32
|
+
gameId: null,
|
|
33
|
+
gameTypeId: null,
|
|
34
|
+
mappingId: null,
|
|
35
|
+
portrait: null,
|
|
36
|
+
},
|
|
37
|
+
lang: 'en_US',
|
|
38
|
+
isMobile: new UAParser().getResult().device.type,
|
|
39
|
+
gameURL: null,
|
|
40
|
+
...oldContext,
|
|
41
|
+
},
|
|
42
|
+
states: {
|
|
43
|
+
flow: {
|
|
44
|
+
initial: 'idle',
|
|
45
|
+
states: {
|
|
46
|
+
idle: {
|
|
47
|
+
enter: 'clearGameInfo',
|
|
48
|
+
on: {
|
|
49
|
+
SET_ADDITION_ENABLE: {
|
|
50
|
+
actions: 'setAdditionEnable',
|
|
51
|
+
},
|
|
52
|
+
LOAD: {
|
|
53
|
+
target: 'routing',
|
|
54
|
+
actions: 'setLoadable',
|
|
55
|
+
},
|
|
56
|
+
SET_ROOM: {
|
|
57
|
+
cond: 'isDifferentRoom',
|
|
58
|
+
actions: ['setRoom', 'resetContent'],
|
|
59
|
+
},
|
|
60
|
+
ENTER_GAME: {
|
|
61
|
+
target: 'connecting',
|
|
62
|
+
actions: ['setGameInfo', 'setLang'],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
loading: {
|
|
67
|
+
entry: 'increaseIndex',
|
|
68
|
+
invoke: {
|
|
69
|
+
src: 'getPageContent',
|
|
70
|
+
onDone: {
|
|
71
|
+
target: 'routing',
|
|
72
|
+
actions: ['appendContent', 'setLastPage'],
|
|
73
|
+
},
|
|
74
|
+
onError: {
|
|
75
|
+
target: 'idle',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
on: {
|
|
79
|
+
LOAD: { actions: 'setLoadable' },
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
routing: {
|
|
83
|
+
always: [
|
|
84
|
+
{
|
|
85
|
+
target: 'loading',
|
|
86
|
+
cond: 'hasNext',
|
|
87
|
+
},
|
|
88
|
+
{ target: 'idle' },
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
connecting: {
|
|
92
|
+
invoke: {
|
|
93
|
+
src: 'connectGame',
|
|
94
|
+
onDone: {
|
|
95
|
+
target: 'playing',
|
|
96
|
+
actions: 'setGameURL',
|
|
97
|
+
},
|
|
98
|
+
onError: {
|
|
99
|
+
target: 'idle',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
playing: {
|
|
104
|
+
on: {
|
|
105
|
+
EXIT_GAME: {
|
|
106
|
+
target: 'disconnect',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
disconnect: {
|
|
111
|
+
invoke: {
|
|
112
|
+
src: 'disconnectGame',
|
|
113
|
+
onDone: {
|
|
114
|
+
target: 'idle',
|
|
115
|
+
},
|
|
116
|
+
onError: {
|
|
117
|
+
target: 'idle',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
timer: {
|
|
124
|
+
initial: 'pending',
|
|
125
|
+
states: {
|
|
126
|
+
pending: {
|
|
127
|
+
after: {
|
|
128
|
+
20000: [
|
|
129
|
+
{
|
|
130
|
+
target: 'updating',
|
|
131
|
+
cond: 'hasRoom',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
target: 'pending',
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
updating: {
|
|
140
|
+
invoke: {
|
|
141
|
+
src: 'updatePageContent',
|
|
142
|
+
onDone: {
|
|
143
|
+
target: 'pending',
|
|
144
|
+
actions: 'swapContent',
|
|
145
|
+
},
|
|
146
|
+
onError: {
|
|
147
|
+
target: 'pending',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
oldTimer: {
|
|
154
|
+
initial: 'fetchingGameSHA',
|
|
155
|
+
states: {
|
|
156
|
+
fetchingGameSHA: {
|
|
157
|
+
invoke: {
|
|
158
|
+
src: 'fetchGameSHA',
|
|
159
|
+
onDone: {
|
|
160
|
+
target: 'checking',
|
|
161
|
+
actions: 'setGameSHA',
|
|
162
|
+
},
|
|
163
|
+
onError: {
|
|
164
|
+
target: 'pending',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
checking: {
|
|
169
|
+
always: [{ target: 'updatingStatus', cond: 'isStatusChanged' }, { target: 'pending' }],
|
|
170
|
+
},
|
|
171
|
+
updatingStatus: {
|
|
172
|
+
invoke: {
|
|
173
|
+
src: 'fetchStatus',
|
|
174
|
+
onDone: {
|
|
175
|
+
target: 'updatingOption',
|
|
176
|
+
actions: ['setStatus'],
|
|
177
|
+
},
|
|
178
|
+
onError: {
|
|
179
|
+
target: 'pending',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
updatingOption: {
|
|
184
|
+
invoke: {
|
|
185
|
+
src: 'fetchOption',
|
|
186
|
+
onDone: {
|
|
187
|
+
target: 'pending',
|
|
188
|
+
actions: 'mergeOption',
|
|
189
|
+
},
|
|
190
|
+
onError: {
|
|
191
|
+
target: 'pending',
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
pending: {
|
|
196
|
+
after: {
|
|
197
|
+
20000: {
|
|
198
|
+
target: 'fetchingGameSHA',
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
actions: {
|
|
208
|
+
setAdditionEnable: assign((context, event) => {
|
|
209
|
+
return {
|
|
210
|
+
additionEnable: event.data,
|
|
211
|
+
}
|
|
212
|
+
}),
|
|
213
|
+
setLoadable: assign((context, event) => {
|
|
214
|
+
return {
|
|
215
|
+
loadable: event.data,
|
|
216
|
+
}
|
|
217
|
+
}),
|
|
218
|
+
setLastPage: assign((context, event) => {
|
|
219
|
+
const { index, content } = context
|
|
220
|
+
return {
|
|
221
|
+
isLastPage: index >= content?.totalPage - 1,
|
|
222
|
+
}
|
|
223
|
+
}),
|
|
224
|
+
setFavoriteList: assign((context, event) => {
|
|
225
|
+
return {
|
|
226
|
+
favoriteList: event.data.data || [],
|
|
227
|
+
}
|
|
228
|
+
}),
|
|
229
|
+
setRoom: assign((context, event) => {
|
|
230
|
+
return {
|
|
231
|
+
room: event.data,
|
|
232
|
+
}
|
|
233
|
+
}),
|
|
234
|
+
resetContent: assign((context, event) => {
|
|
235
|
+
return {
|
|
236
|
+
loadable: false,
|
|
237
|
+
isLastPage: false,
|
|
238
|
+
index: -1,
|
|
239
|
+
content: {
|
|
240
|
+
data: [],
|
|
241
|
+
timestamp: null,
|
|
242
|
+
parentCategoryId: null,
|
|
243
|
+
totalPage: 0,
|
|
244
|
+
},
|
|
245
|
+
addition: {
|
|
246
|
+
data: [],
|
|
247
|
+
timestamp: null,
|
|
248
|
+
totalPage: 0,
|
|
249
|
+
},
|
|
250
|
+
}
|
|
251
|
+
}),
|
|
252
|
+
appendContent: assign((context, event) => {
|
|
253
|
+
const { room, additionEnable } = context
|
|
254
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
255
|
+
return
|
|
256
|
+
} else if (additionEnable) {
|
|
257
|
+
const [content, addition] = event.data
|
|
258
|
+
return {
|
|
259
|
+
content: {
|
|
260
|
+
...context.content,
|
|
261
|
+
...content,
|
|
262
|
+
data: context.content.data.concat(content.data),
|
|
263
|
+
},
|
|
264
|
+
addition: {
|
|
265
|
+
...context.addition,
|
|
266
|
+
...addition,
|
|
267
|
+
data: context.addition.data.concat(addition.data),
|
|
268
|
+
},
|
|
269
|
+
}
|
|
270
|
+
} else {
|
|
271
|
+
const [content] = event.data
|
|
272
|
+
return {
|
|
273
|
+
content: {
|
|
274
|
+
...context.content,
|
|
275
|
+
...content,
|
|
276
|
+
data: context.content.data.concat(content.data),
|
|
277
|
+
},
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}),
|
|
281
|
+
swapContent: assign((context, event) => {
|
|
282
|
+
const [content, addition] = event.data
|
|
283
|
+
let result = {}
|
|
284
|
+
if (content?.data?.length) {
|
|
285
|
+
result.content = content
|
|
286
|
+
}
|
|
287
|
+
if (addition?.data?.length) {
|
|
288
|
+
result.addition = addition
|
|
289
|
+
}
|
|
290
|
+
return result
|
|
291
|
+
}),
|
|
292
|
+
increaseIndex: assign((context, event) => {
|
|
293
|
+
return {
|
|
294
|
+
index: context.index + 1,
|
|
295
|
+
}
|
|
296
|
+
}),
|
|
297
|
+
setGameURL: assign({
|
|
298
|
+
gameURL: (context, event) => {
|
|
299
|
+
return event.data.gameURL
|
|
300
|
+
},
|
|
301
|
+
}),
|
|
302
|
+
clearGameInfo: assign((context, event) => {
|
|
303
|
+
return { game: { providerId: null, gameId: null, gameTypeId: null, mappingId: null } }
|
|
304
|
+
}),
|
|
305
|
+
setGameInfo: assign((context, event) => {
|
|
306
|
+
const { providerId, gameId, gameTypeId, mappingId, portrait } = event.data.game
|
|
307
|
+
return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0 } }
|
|
308
|
+
}),
|
|
309
|
+
setLang: assign((context, event) => {
|
|
310
|
+
const lang = event.data.locale.replace('-', '_')
|
|
311
|
+
return { lang }
|
|
312
|
+
}),
|
|
313
|
+
...oldActions,
|
|
314
|
+
},
|
|
315
|
+
guards: {
|
|
316
|
+
isDifferentRoom: (context, event) => context.room?.categoryId !== event.data?.categoryId,
|
|
317
|
+
hasNext: (context, event) => {
|
|
318
|
+
const { loadable, isLastPage } = context
|
|
319
|
+
return loadable && !isLastPage
|
|
320
|
+
},
|
|
321
|
+
hasRoom: (context, event) => context.room?.categoryId,
|
|
322
|
+
...oldGuards,
|
|
323
|
+
},
|
|
324
|
+
services: {
|
|
325
|
+
getPageContent: async (context, event) => {
|
|
326
|
+
const { room, index, additionEnable } = context
|
|
327
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
328
|
+
return
|
|
329
|
+
} else if (additionEnable) {
|
|
330
|
+
const param = { categoryId: room.categoryId, index }
|
|
331
|
+
return await Promise.all([request.send(api.getListCategory(param)), request.send(api.getListAddition(param))])
|
|
332
|
+
} else {
|
|
333
|
+
const param = { categoryId: room.categoryId, index }
|
|
334
|
+
return await Promise.all([request.send(api.getListCategory(param))])
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
updatePageContent: async (context, event) => {
|
|
338
|
+
const { room, content, index, additionEnable } = context
|
|
339
|
+
if (room.categoryId === GAME_SEARCH) {
|
|
340
|
+
return
|
|
341
|
+
} else if (additionEnable) {
|
|
342
|
+
return await Promise.all([
|
|
343
|
+
request.send(
|
|
344
|
+
api.getListCategoryByRange({
|
|
345
|
+
categoryId: room.categoryId,
|
|
346
|
+
end: index,
|
|
347
|
+
timestamp: content.timestamp,
|
|
348
|
+
})
|
|
349
|
+
),
|
|
350
|
+
request.send(
|
|
351
|
+
api.getListAdditionByRange({
|
|
352
|
+
categoryId: room.categoryId,
|
|
353
|
+
end: index,
|
|
354
|
+
timestamp: content.timestamp,
|
|
355
|
+
})
|
|
356
|
+
),
|
|
357
|
+
])
|
|
358
|
+
} else {
|
|
359
|
+
return await Promise.all([
|
|
360
|
+
request.send(
|
|
361
|
+
api.getListCategoryByRange({
|
|
362
|
+
categoryId: room.categoryId,
|
|
363
|
+
end: index,
|
|
364
|
+
timestamp: content.timestamp,
|
|
365
|
+
})
|
|
366
|
+
),
|
|
367
|
+
])
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
connectGame: async (context, event) => {
|
|
371
|
+
const { lang, isMobile } = context
|
|
372
|
+
const { providerId, gameId, gameTypeId, mappingId } = context.game
|
|
373
|
+
const params = {
|
|
374
|
+
provider_id: providerId,
|
|
375
|
+
game_id: gameId,
|
|
376
|
+
gametype_id: gameTypeId,
|
|
377
|
+
mapping_id: mappingId,
|
|
378
|
+
is_demo: false,
|
|
379
|
+
is_mobile: isMobile,
|
|
380
|
+
lang,
|
|
381
|
+
return_url: window.location.href,
|
|
382
|
+
}
|
|
383
|
+
const { redirect_url } = await request.send(api.playGame(params))
|
|
384
|
+
return { gameURL: redirect_url }
|
|
385
|
+
},
|
|
386
|
+
disconnectGame: async (context, event) => {
|
|
387
|
+
const uid_site = event.data
|
|
388
|
+
const provider_id = context.game.providerId
|
|
389
|
+
return await request.send(api.logoutGame({ uid_site, provider_id }))
|
|
390
|
+
},
|
|
391
|
+
...oldServices(request),
|
|
392
|
+
},
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const oldContext = {
|
|
398
|
+
sha: {
|
|
399
|
+
status: null,
|
|
400
|
+
},
|
|
401
|
+
isStatusChanged: false,
|
|
402
|
+
statusMap: {},
|
|
403
|
+
optionMap: {},
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const oldActions = {
|
|
407
|
+
setGameSHA: assign((context, event) => {
|
|
408
|
+
const { sha } = context
|
|
409
|
+
const newSha = event.data
|
|
410
|
+
return {
|
|
411
|
+
sha: newSha,
|
|
412
|
+
isStatusChanged: !sha.status || sha.status !== newSha.status,
|
|
413
|
+
}
|
|
414
|
+
}),
|
|
415
|
+
setStatus: assign((context, event) => {
|
|
416
|
+
return {
|
|
417
|
+
statusMap: event.data,
|
|
418
|
+
}
|
|
419
|
+
}),
|
|
420
|
+
mergeOption: assign((context, event) => {
|
|
421
|
+
const { optionMap } = context
|
|
422
|
+
return {
|
|
423
|
+
optionMap: { ...optionMap, ...event.data },
|
|
424
|
+
}
|
|
425
|
+
}),
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
const oldGuards = {
|
|
429
|
+
isStatusChanged: (context, event) => context.isStatusChanged,
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
const oldServices = (request) => ({
|
|
433
|
+
fetchOption: async (context, event) => {
|
|
434
|
+
return await request.send(api.getOptionMap())
|
|
435
|
+
},
|
|
436
|
+
fetchGameSHA: async (context, event) => {
|
|
437
|
+
return await request.send(api.getGameSHA())
|
|
438
|
+
},
|
|
439
|
+
fetchStatus: async (context, event) => {
|
|
440
|
+
return await request.send(api.getGameStatus())
|
|
441
|
+
},
|
|
442
|
+
})
|
package/src/machine/inbox.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
|
-
import mailbox from '../api/mailbox'
|
|
3
|
-
import activity from '../api/activity'
|
|
2
|
+
import mailbox from '../api/mailbox.js'
|
|
3
|
+
import activity from '../api/activity.js'
|
|
4
4
|
|
|
5
|
-
// todo - 自動開啟系統信
|
|
6
|
-
// todo - 更新未讀數量
|
|
7
5
|
const messageState = {
|
|
8
6
|
// always: [{ actions: 'showUnread', cond: 'isShowUnread' }],
|
|
9
7
|
initial: 'idle',
|
|
@@ -224,11 +222,12 @@ export default function (request) {
|
|
|
224
222
|
},
|
|
225
223
|
fetchMessages: async (context, event) => {
|
|
226
224
|
const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context))
|
|
227
|
-
if (isRewardListEnable && currentTab === 'REWARD') {
|
|
225
|
+
if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND')) {
|
|
228
226
|
const { data } = await request.send(activity.getRewardList({ count: 30, appSecret }))
|
|
229
227
|
inbox[currentTab] = { data, page: 0, totalPage: 1 }
|
|
230
228
|
} else {
|
|
231
|
-
const
|
|
229
|
+
const { page = -1 } = inbox[currentTab] || {}
|
|
230
|
+
const nextPage = page + 1
|
|
232
231
|
const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: nextPage }))
|
|
233
232
|
const currentData = inbox[currentTab]?.data || []
|
|
234
233
|
inbox[currentTab] = { data: currentData.concat(data), ...rest }
|
package/src/machine/index.js
CHANGED
|
@@ -1,45 +1,80 @@
|
|
|
1
|
-
import activity from './activity'
|
|
2
|
-
import auth from './auth'
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import game_favorite from './game_favorite'
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
1
|
+
import activity from './activity/index.js'
|
|
2
|
+
import auth from './auth.js'
|
|
3
|
+
import welcome from './welcome.js'
|
|
4
|
+
import common from './common.js'
|
|
5
|
+
import error from './error.js'
|
|
6
|
+
import game from './game.js'
|
|
7
|
+
import game_v2 from './game_v2.js'
|
|
8
|
+
import game_v2_1 from './game_v2_1.js'
|
|
9
|
+
import game_favorite from './game_favorite.js'
|
|
10
|
+
import game_favorite_v2 from './game_favorite_v2.js'
|
|
11
|
+
import game_search from './game_search.js'
|
|
12
|
+
import game_search_v2 from './game_search_v2.js'
|
|
13
|
+
import game_hot_new from './game_hot_new.js'
|
|
14
|
+
import inbox from './inbox.js'
|
|
15
|
+
import merge from './merge.js'
|
|
16
|
+
import payment_data from './payment_data.js'
|
|
17
|
+
import reward_fc from './reward_fc.js'
|
|
18
|
+
import reward from './reward.js'
|
|
19
|
+
import setting from './setting.js'
|
|
20
|
+
import side from './side.js'
|
|
21
|
+
import side_v2 from './side_v2.js'
|
|
22
|
+
import user_info from './user_info.js'
|
|
23
|
+
import user_sign_up from './user_sign_up.js'
|
|
24
|
+
import user_reset_password from './user_reset_password.js'
|
|
25
|
+
import bank_binding from './bank_binding.js'
|
|
26
|
+
import bank_binding_amb from './bank_binding_amb.js'
|
|
27
|
+
import withdraw_fc from './withdraw_fc.js'
|
|
28
|
+
import withdraw_vn from './withdraw_vn.js'
|
|
29
|
+
import withdraw_crypto from './withdraw_crypto.js'
|
|
30
|
+
import withdraw_amb from './withdraw_amb.js'
|
|
31
|
+
import deposit from './deposit/index.js'
|
|
32
|
+
import bonus from './bonus.js'
|
|
33
|
+
import leaderboard from './leaderboard.js'
|
|
34
|
+
import auth_otp_v2 from './auth_otp_v2.js'
|
|
35
|
+
import auth_otp_v3 from './auth_otp_v3.js'
|
|
36
|
+
import vip_table from './vip_table.js'
|
|
37
|
+
import promotions from './promotions.js'
|
|
38
|
+
import roulette_v2 from './roulette_v2.js'
|
|
22
39
|
|
|
23
40
|
export default {
|
|
24
41
|
...activity,
|
|
25
42
|
auth,
|
|
26
|
-
auth_otp,
|
|
27
43
|
welcome,
|
|
28
44
|
common,
|
|
29
45
|
deposit,
|
|
30
46
|
error,
|
|
31
47
|
game,
|
|
48
|
+
game_v2,
|
|
32
49
|
game_favorite,
|
|
50
|
+
game_favorite_v2,
|
|
33
51
|
game_search,
|
|
52
|
+
game_search_v2,
|
|
34
53
|
game_hot_new,
|
|
35
54
|
inbox,
|
|
36
55
|
merge,
|
|
37
56
|
payment_data,
|
|
38
57
|
reward,
|
|
58
|
+
reward_fc,
|
|
39
59
|
setting,
|
|
40
60
|
side,
|
|
41
|
-
|
|
61
|
+
side_v2,
|
|
62
|
+
game_v2_1,
|
|
42
63
|
user_info,
|
|
43
64
|
user_sign_up,
|
|
44
65
|
user_reset_password,
|
|
66
|
+
bank_binding,
|
|
67
|
+
bank_binding_amb,
|
|
68
|
+
withdraw_fc,
|
|
69
|
+
withdraw_vn,
|
|
70
|
+
withdraw_crypto,
|
|
71
|
+
withdraw_amb,
|
|
72
|
+
...deposit,
|
|
73
|
+
bonus,
|
|
74
|
+
leaderboard,
|
|
75
|
+
auth_otp_v2,
|
|
76
|
+
auth_otp_v3,
|
|
77
|
+
vip_table,
|
|
78
|
+
promotions,
|
|
79
|
+
roulette_v2,
|
|
45
80
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import api from '../api/activity.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
const { appSecret } = request.config
|
|
6
|
+
return createMachine(
|
|
7
|
+
{
|
|
8
|
+
id: 'leaderboard',
|
|
9
|
+
context: {
|
|
10
|
+
rankActivities: null,
|
|
11
|
+
activityNo: null,
|
|
12
|
+
activityDetail: null,
|
|
13
|
+
activityMap: {},
|
|
14
|
+
},
|
|
15
|
+
initial: 'fetching',
|
|
16
|
+
states: {
|
|
17
|
+
fetching: {
|
|
18
|
+
invoke: {
|
|
19
|
+
src: 'fetchActivityList',
|
|
20
|
+
onDone: {
|
|
21
|
+
target: 'checking',
|
|
22
|
+
actions: 'setRankActivities',
|
|
23
|
+
},
|
|
24
|
+
onError: {
|
|
25
|
+
target: 'idle',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
idle: {
|
|
30
|
+
on: {
|
|
31
|
+
SET_ACTIVITY_NO: {
|
|
32
|
+
target: 'checking',
|
|
33
|
+
actions: 'setActivityNo',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
checking: {
|
|
38
|
+
always: [
|
|
39
|
+
{ target: 'idle', actions: 'setActivityDetail', cond: 'isExist' },
|
|
40
|
+
{ target: 'loading', cond: 'hasActivityNo' },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
loading: {
|
|
44
|
+
invoke: {
|
|
45
|
+
src: 'fetchActivityDetail',
|
|
46
|
+
onDone: {
|
|
47
|
+
target: 'idle',
|
|
48
|
+
actions: ['setActivityMap', 'setActivityDetail'],
|
|
49
|
+
},
|
|
50
|
+
onError: {
|
|
51
|
+
target: 'idle',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
actions: {
|
|
59
|
+
setRankActivities: assign((context, event) => {
|
|
60
|
+
const rankActivities = event.data.filter((item) => item.activityType === 2 || item.activityType === 200)
|
|
61
|
+
// 2: ranking_activity
|
|
62
|
+
// 200: cl_activity
|
|
63
|
+
return {
|
|
64
|
+
rankActivities,
|
|
65
|
+
activityNo: rankActivities?.[0]?.activityNo,
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
setActivityNo: assign((context, event) => {
|
|
69
|
+
return {
|
|
70
|
+
activityNo: event.data,
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
setActivityMap: assign((context, event) => {
|
|
74
|
+
const { activityMap, activityNo } = context
|
|
75
|
+
return {
|
|
76
|
+
activityMap: { ...activityMap, [activityNo]: event.data },
|
|
77
|
+
}
|
|
78
|
+
}),
|
|
79
|
+
setActivityDetail: assign((context, event) => {
|
|
80
|
+
const { activityMap, activityNo } = context
|
|
81
|
+
return {
|
|
82
|
+
activityDetail: activityMap[activityNo],
|
|
83
|
+
}
|
|
84
|
+
}),
|
|
85
|
+
},
|
|
86
|
+
guards: {
|
|
87
|
+
isExist: (context, event) => {
|
|
88
|
+
const { activityMap, activityNo } = context
|
|
89
|
+
return activityMap[activityNo]
|
|
90
|
+
},
|
|
91
|
+
hasActivityNo: (context, event) => {
|
|
92
|
+
return !!context.activityNo
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
services: {
|
|
96
|
+
fetchActivityList: async (context, event) => {
|
|
97
|
+
const { data } = await request.send(api.getActivityList({ appSecret }))
|
|
98
|
+
return data
|
|
99
|
+
},
|
|
100
|
+
fetchActivityDetail: async (context, event) => {
|
|
101
|
+
const { activityNo } = context
|
|
102
|
+
const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
|
|
103
|
+
return data
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
}
|
package/src/machine/merge.js
CHANGED