@jetthai/cuora 1.1.126 → 1.1.128-dev-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.
Files changed (71) hide show
  1. package/CHANGELOG.md +428 -0
  2. package/package.json +1 -1
  3. package/src/api/activity.js +28 -0
  4. package/src/api/auth.js +6 -0
  5. package/src/api/common.js +2 -1
  6. package/src/api/game.js +5 -4
  7. package/src/api/mailbox.js +9 -5
  8. package/src/api/payment.js +103 -8
  9. package/src/api/user.js +2 -0
  10. package/src/machine/activity/activity.js +56 -16
  11. package/src/machine/activity/activity_cash.js +78 -14
  12. package/src/machine/activity/cash_rain_activity.js +153 -0
  13. package/src/machine/activity/diamond_shop_activity_cash.js +57 -92
  14. package/src/machine/activity/diamond_shop_activity_vn.js +54 -89
  15. package/src/machine/activity/fafafa_activity.js +8 -1
  16. package/src/machine/activity/friend_invite_friends_activity.js +3 -1
  17. package/src/machine/activity/index.js +6 -0
  18. package/src/machine/activity/instant_rebate_activity.js +214 -0
  19. package/src/machine/activity/roulette_activity_v2.js +11 -2
  20. package/src/machine/activity/sign_in_activity.js +20 -13
  21. package/src/machine/activity/vip_card_activity.js +140 -0
  22. package/src/machine/auth.js +54 -5
  23. package/src/machine/bank_binding.js +112 -12
  24. package/src/machine/bank_binding_amb.js +6 -1
  25. package/src/machine/common.js +92 -24
  26. package/src/machine/deposit/amb.js +5 -3
  27. package/src/machine/deposit/crypto.js +14 -10
  28. package/src/machine/deposit/crypto_bank.js +317 -0
  29. package/src/machine/deposit/crypto_bank_cash.js +280 -0
  30. package/src/machine/deposit/crypto_button.js +9 -5
  31. package/src/machine/deposit/crypto_cash.js +2 -5
  32. package/src/machine/deposit/crypto_qrcode.js +147 -0
  33. package/src/machine/deposit/crypto_qrcode_cash.js +131 -0
  34. package/src/machine/deposit/crypto_way.js +220 -0
  35. package/src/machine/deposit/crypto_way_cash.js +242 -0
  36. package/src/machine/deposit/direct.js +2 -11
  37. package/src/machine/deposit/direct_cash.js +6 -26
  38. package/src/machine/deposit/float.js +5 -3
  39. package/src/machine/deposit/index.js +14 -0
  40. package/src/machine/deposit/krway.js +151 -0
  41. package/src/machine/deposit/loadcard_cash.js +6 -27
  42. package/src/machine/deposit/loadcard_vn.js +2 -10
  43. package/src/machine/deposit/manual_cash.js +89 -38
  44. package/src/machine/deposit/manual_vn.js +104 -48
  45. package/src/machine/deposit/qrcode_cash.js +12 -23
  46. package/src/machine/deposit/qrcode_v2.js +3 -8
  47. package/src/machine/deposit/usdt_cash.js +0 -2
  48. package/src/machine/deposit/vpay.js +5 -3
  49. package/src/machine/game_info.js +57 -0
  50. package/src/machine/game_search_cash.js +390 -0
  51. package/src/machine/game_search_v2.js +4 -4
  52. package/src/machine/game_v2_1.js +131 -7
  53. package/src/machine/honor_board_cash.js +63 -0
  54. package/src/machine/inbox.js +259 -34
  55. package/src/machine/index.js +8 -2
  56. package/src/machine/leaderboard.js +31 -8
  57. package/src/machine/reward_cash.js +1 -1
  58. package/src/machine/side_v2.js +1 -1
  59. package/src/machine/user_photo.js +65 -0
  60. package/src/machine/user_sign_up.js +71 -7
  61. package/src/machine/withdraw/index.js +6 -0
  62. package/src/machine/withdraw/withdraw_crypto.js +1 -66
  63. package/src/machine/withdraw/withdraw_crypto2.js +540 -0
  64. package/src/machine/withdraw/withdraw_krway.js +207 -0
  65. package/src/machine/withdraw/withdraw_manual.js +595 -0
  66. package/src/machine/withdraw/withdraw_manual_cash.js +44 -14
  67. package/src/machine/withdraw/withdraw_vn.js +42 -7
  68. package/src/machine/withdraw/withdraw_vn2.js +64 -37
  69. package/src/util/constant.js +18 -0
  70. package/src/util/deviceToken.js +2 -2
  71. package/src/machine/game_search.js +0 -244
@@ -11,6 +11,7 @@ export default function (request) {
11
11
  type: 'parallel',
12
12
  context: {
13
13
  base: '/',
14
+ batch: null,
14
15
  loadable: false,
15
16
  isLastPage: false,
16
17
  room: null,
@@ -36,10 +37,13 @@ export default function (request) {
36
37
  mappingId: null,
37
38
  portrait: null,
38
39
  gameCode: null,
40
+ name: null,
39
41
  },
40
42
  lang: 'en_US',
41
43
  isMobile: new UAParser().getResult().device.type,
42
44
  gameURL: null,
45
+ gameToken: null,
46
+ gameHtml: null,
43
47
  ...oldContext,
44
48
  },
45
49
  states: {
@@ -63,10 +67,28 @@ export default function (request) {
63
67
  cond: 'isDifferentRoom',
64
68
  actions: ['setRoom', 'resetContent'],
65
69
  },
70
+ BATCH: {
71
+ target: 'batchFetching',
72
+ },
66
73
  ENTER_GAME: {
67
74
  target: 'connecting',
68
75
  actions: ['setGameInfo', 'setLang'],
69
76
  },
77
+ UPDATE: {
78
+ target: 'updating',
79
+ },
80
+ },
81
+ },
82
+ batchFetching: {
83
+ invoke: {
84
+ src: 'batchFetch',
85
+ onDone: {
86
+ target: 'idle',
87
+ actions: 'setBatch',
88
+ },
89
+ onError: {
90
+ target: 'idle',
91
+ },
70
92
  },
71
93
  },
72
94
  loading: {
@@ -94,6 +116,18 @@ export default function (request) {
94
116
  { target: 'idle' },
95
117
  ],
96
118
  },
119
+ updating: {
120
+ invoke: {
121
+ src: 'updatePageContent',
122
+ onDone: {
123
+ target: 'idle',
124
+ actions: 'swapContent',
125
+ },
126
+ onError: {
127
+ target: 'idle',
128
+ },
129
+ },
130
+ },
97
131
  connecting: {
98
132
  invoke: {
99
133
  src: 'connectGame',
@@ -103,6 +137,12 @@ export default function (request) {
103
137
  },
104
138
  onError: {
105
139
  target: 'idle',
140
+ actions: 'setGameURL',
141
+ },
142
+ },
143
+ on: {
144
+ EXIT_GAME: {
145
+ target: 'disconnect',
106
146
  },
107
147
  },
108
148
  },
@@ -111,6 +151,29 @@ export default function (request) {
111
151
  EXIT_GAME: {
112
152
  target: 'disconnect',
113
153
  },
154
+ REFRESH: {
155
+ target: 'refreshing',
156
+ },
157
+ },
158
+ },
159
+ refreshing: {
160
+ invoke: {
161
+ src: 'disconnectGame',
162
+ onDone: {
163
+ target: 'refreshPending',
164
+ actions: 'setGameURL',
165
+ },
166
+ onError: {
167
+ target: 'idle',
168
+ actions: 'setGameURL',
169
+ },
170
+ },
171
+ },
172
+ refreshPending: {
173
+ after: {
174
+ 500: {
175
+ target: 'connecting',
176
+ },
114
177
  },
115
178
  },
116
179
  disconnect: {
@@ -118,9 +181,11 @@ export default function (request) {
118
181
  src: 'disconnectGame',
119
182
  onDone: {
120
183
  target: 'idle',
184
+ actions: 'setGameURL',
121
185
  },
122
186
  onError: {
123
187
  target: 'idle',
188
+ actions: 'setGameURL',
124
189
  },
125
190
  },
126
191
  },
@@ -237,6 +302,11 @@ export default function (request) {
237
302
  room: event.data,
238
303
  }
239
304
  }),
305
+ setBatch: assign((context, event) => {
306
+ return {
307
+ batch: event.data,
308
+ }
309
+ }),
240
310
  resetContent: assign((context, event) => {
241
311
  return {
242
312
  loadable: false,
@@ -260,7 +330,7 @@ export default function (request) {
260
330
  if (room.categoryId === GAME_SEARCH) {
261
331
  return
262
332
  } else if (additionEnable) {
263
- const [content, addition] = event.data
333
+ const [content, addition = {}] = event.data
264
334
  return {
265
335
  content: {
266
336
  ...context.content,
@@ -301,6 +371,15 @@ export default function (request) {
301
371
  }
302
372
  }),
303
373
  setGameURL: assign({
374
+ type: (context, event) => {
375
+ return event.data.type
376
+ },
377
+ gameToken: (context, event) => {
378
+ return event.data.gameToken
379
+ },
380
+ gameHtml: (context, event) => {
381
+ return event.data.gameHtml
382
+ },
304
383
  gameURL: (context, event) => {
305
384
  return event.data.gameURL
306
385
  },
@@ -309,8 +388,8 @@ export default function (request) {
309
388
  return { game: { providerId: null, gameId: null, gameTypeId: null, mappingId: null } }
310
389
  }),
311
390
  setGameInfo: assign((context, event) => {
312
- const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode } = event.data.game
313
- return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode } }
391
+ const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = event.data.game
392
+ return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
314
393
  }),
315
394
  setLang: assign((context, event) => {
316
395
  const lang = event.data.locale.replace('-', '_')
@@ -328,6 +407,51 @@ export default function (request) {
328
407
  ...oldGuards,
329
408
  },
330
409
  services: {
410
+ batchFetch: async (context, event) => {
411
+ const { room, index, additionEnable, staticData } = context
412
+ let requestChain = null
413
+ if (!request.getToken()) {
414
+ // 如果沒 token ,id 列表去 static 找
415
+ const list = event.data.list.map((targetCategory, b) => {
416
+ return {
417
+ id: targetCategory.id,
418
+ i18n: targetCategory.i18n,
419
+ downLine: staticData
420
+ .find((item) => item.category === targetCategory.id)
421
+ .info.filter((item) => item.isGame === true)
422
+ .slice(0, 20),
423
+ }
424
+ })
425
+ return list.filter((item) => item.downLine.length > 0).slice(0, 6)
426
+ } else if (additionEnable) {
427
+ const param = { categoryId: room.categoryId, index }
428
+ requestChain = event.data.list.map((category, b) => {
429
+ return request
430
+ .send(
431
+ api.getListCategory({
432
+ categoryId: category.id,
433
+ index: 0,
434
+ })
435
+ )
436
+ .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame === true).slice(0, 20) }, category))
437
+ })
438
+ const result = await Promise.all([...requestChain, request.send(api.getListAddition(param))])
439
+ return result.filter((item) => item.downLine.length > 0).slice(0, 6)
440
+ } else {
441
+ requestChain = event.data.list.map((category, b) => {
442
+ return request
443
+ .send(
444
+ api.getListCategory({
445
+ categoryId: category.id,
446
+ index: 0,
447
+ })
448
+ )
449
+ .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame === true).slice(0, 20) }, category))
450
+ })
451
+ const result = await Promise.all([...requestChain])
452
+ return result.filter((item) => item.downLine.length > 0).slice(0, 6)
453
+ }
454
+ },
331
455
  getPageContent: async (context, event) => {
332
456
  const { room, index, additionEnable, staticData } = context
333
457
  if (room.categoryId === GAME_SEARCH) {
@@ -353,7 +477,7 @@ export default function (request) {
353
477
  updatePageContent: async (context, event) => {
354
478
  const { room, content, index, additionEnable } = context
355
479
  if (room.categoryId === GAME_SEARCH) {
356
- return
480
+ return []
357
481
  } else if (!request.getToken()) {
358
482
  return []
359
483
  } else if (additionEnable) {
@@ -386,7 +510,7 @@ export default function (request) {
386
510
  }
387
511
  },
388
512
  connectGame: async (context, event) => {
389
- const returnProviders = ['RSG', 'KP', 'EPICWIN', 'KA', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
513
+ const returnProviders = ['RSG', 'KP', 'EPICWIN', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
390
514
  const { lang, isMobile } = context
391
515
  const { providerId, gameId, gameTypeId, mappingId } = context.game
392
516
  const params = {
@@ -399,8 +523,8 @@ export default function (request) {
399
523
  lang,
400
524
  return_url: returnProviders.includes(providerId) ? `${window.location.origin}${context.base}return` : window.location.href, // For providers to return.
401
525
  }
402
- const { redirect_url } = await request.send(api.playGame(params))
403
- return { gameURL: redirect_url }
526
+ const { type, redirect_url, gameToken, gameHtml } = await request.send(api.playGame(params))
527
+ return { type, gameToken, gameHtml, gameURL: redirect_url }
404
528
  },
405
529
  disconnectGame: async (context, event) => {
406
530
  const uid_site = event.data
@@ -0,0 +1,63 @@
1
+ import { createMachine, assign } from 'xstate'
2
+ import activity from '../api/activity.js'
3
+
4
+ export default function (request) {
5
+ const { appSecret } = request.config
6
+ return createMachine(
7
+ {
8
+ id: 'honor_board',
9
+ initial: 'fetching',
10
+ context: {
11
+ tick: 6000,
12
+ bigWinList: [],
13
+ maxBetList: [],
14
+ withdrawList: [],
15
+ },
16
+ states: {
17
+ fetching: {
18
+ invoke: {
19
+ src: 'fetchHonorBoardList',
20
+ onDone: {
21
+ target: 'pending',
22
+ actions: 'setHonorBoardList',
23
+ },
24
+ onError: {
25
+ target: 'pending',
26
+ },
27
+ },
28
+ },
29
+ pending: {
30
+ after: {
31
+ TIMEOUT: {
32
+ target: 'fetching',
33
+ },
34
+ },
35
+ },
36
+ },
37
+ },
38
+ {
39
+ actions: {
40
+ setHonorBoardList: assign((context, event) => {
41
+ const { bigWinList = [], maxBetList = [], withdrawList = [] } = event.data
42
+ return {
43
+ bigWinList,
44
+ maxBetList,
45
+ withdrawList,
46
+ }
47
+ }),
48
+ },
49
+ delays: {
50
+ TIMEOUT: (context, event) => {
51
+ const { tick } = context
52
+ return tick * 10
53
+ },
54
+ },
55
+ services: {
56
+ fetchHonorBoardList: async (context, event) => {
57
+ const { data } = await request.send(activity.getHonorBoard(appSecret))
58
+ return data
59
+ },
60
+ },
61
+ }
62
+ )
63
+ }