@jetthai/cuora 1.1.488 → 2.0.0-beta.0

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 (212) hide show
  1. package/.husky/pre-commit +3 -1
  2. package/BREAKING_CHANGES.md +9 -0
  3. package/CHANGELOG.md +3 -316
  4. package/README.md +15 -299
  5. package/package.json +5 -5
  6. package/resetGitBranch.sh +101 -0
  7. package/src/api/account.js +1 -0
  8. package/src/api/activity.js +39 -24
  9. package/src/api/auth.js +36 -5
  10. package/src/api/common.js +3 -5
  11. package/src/api/game.js +10 -0
  12. package/src/api/payment.js +55 -17
  13. package/src/api/user.js +16 -10
  14. package/src/index.js +2 -2
  15. package/src/lib/fingerprint_v3_11_12.js +11433 -0
  16. package/src/machine/activity/activity.js +213 -0
  17. package/src/machine/activity/activity_cash.js +36 -84
  18. package/src/machine/activity/cash_rain_activity.js +1 -0
  19. package/src/machine/activity/continue_deposit_activity.js +1 -0
  20. package/src/machine/activity/deposit_activity.js +1 -0
  21. package/src/machine/activity/diamond_shop_activity_cash.js +8 -0
  22. package/src/machine/activity/diamond_shop_activity_fc.js +197 -0
  23. package/src/machine/activity/diamond_shop_activity_vn.js +179 -0
  24. package/src/machine/activity/fafafa_activity.js +11 -0
  25. package/src/machine/activity/friend_invite_friends_activity.js +7 -8
  26. package/src/machine/activity/index.js +12 -0
  27. package/src/machine/activity/instant_rebate_activity.js +1 -0
  28. package/src/machine/activity/invite_friends_activity.js +115 -0
  29. package/src/machine/activity/jackpot.js +1 -0
  30. package/src/machine/activity/mini_game_activity.js +69 -0
  31. package/src/machine/activity/otp_verified_activity.js +1 -0
  32. package/src/machine/activity/ranking_activity.js +1 -0
  33. package/src/machine/activity/return_bonus_activity.js +155 -0
  34. package/src/machine/activity/roulette_activity_v2.js +1 -0
  35. package/src/machine/activity/sign_in_activity.js +1 -0
  36. package/src/machine/activity/sign_in_monthly_activity.js +2 -1
  37. package/src/machine/activity/specify_bets_activity.js +1 -0
  38. package/src/machine/activity/specify_turnover_activity.js +1 -0
  39. package/src/machine/activity/time_bomb_activity.js +1 -0
  40. package/src/machine/activity/vip_card_activity.js +1 -0
  41. package/src/machine/auth.js +112 -149
  42. package/src/machine/auth_otp_v2.js +178 -0
  43. package/src/machine/auth_otp_v3.js +22 -64
  44. package/src/machine/bank_binding.js +3 -2
  45. package/src/machine/bank_binding_amb.js +146 -0
  46. package/src/machine/bonus.js +76 -0
  47. package/src/machine/common.js +98 -14
  48. package/src/machine/deposit/amb.js +93 -0
  49. package/src/machine/deposit/crypto_bank.js +340 -0
  50. package/src/machine/deposit/crypto_bank_cash.js +35 -20
  51. package/src/machine/deposit/crypto_qrcode.js +158 -0
  52. package/src/machine/deposit/crypto_qrcode_cash.js +64 -26
  53. package/src/machine/deposit/crypto_way.js +253 -0
  54. package/src/machine/deposit/crypto_way_cash.js +37 -48
  55. package/src/machine/deposit/deposit_fc.js +272 -0
  56. package/src/machine/deposit/direct.js +311 -0
  57. package/src/machine/deposit/direct_cash.js +10 -8
  58. package/src/machine/deposit/float.js +375 -0
  59. package/src/machine/deposit/index.js +28 -0
  60. package/src/machine/deposit/krway.js +152 -0
  61. package/src/machine/deposit/loadcard_cash.js +32 -14
  62. package/src/machine/deposit/loadcard_vn.js +352 -0
  63. package/src/machine/deposit/manual_cash.js +11 -8
  64. package/src/machine/deposit/manual_vn.js +459 -0
  65. package/src/machine/deposit/qrcode_cash.js +32 -15
  66. package/src/machine/deposit/qrcode_v2.js +339 -0
  67. package/src/machine/deposit/usdt.js +163 -0
  68. package/src/machine/deposit/usdt_cash.js +15 -1
  69. package/src/machine/deposit/virtual_bank_cash.js +12 -13
  70. package/src/machine/deposit/virtual_bank_vn.js +270 -0
  71. package/src/machine/deposit/vpay.js +374 -0
  72. package/src/machine/error.js +1 -7
  73. package/src/machine/game_betslip.js +1 -0
  74. package/src/machine/game_favorite_v2.js +1 -0
  75. package/src/machine/game_hot_new.js +80 -0
  76. package/src/machine/game_info.js +13 -1
  77. package/src/machine/game_replay.js +47 -0
  78. package/src/machine/game_search_cash.js +1 -0
  79. package/src/machine/game_search_v2.js +402 -0
  80. package/src/machine/game_v2_1.js +126 -39
  81. package/src/machine/honor_board.js +133 -0
  82. package/src/machine/honor_board_cash.js +28 -22
  83. package/src/machine/inbox.js +105 -43
  84. package/src/machine/index.js +32 -0
  85. package/src/machine/leaderboard.js +12 -8
  86. package/src/machine/merge.js +58 -0
  87. package/src/machine/navbar.js +3 -1
  88. package/src/machine/payment_data.js +87 -0
  89. package/src/machine/promotions.js +163 -0
  90. package/src/machine/ranking.js +30 -45
  91. package/src/machine/reward.js +256 -0
  92. package/src/machine/reward_cash.js +42 -2
  93. package/src/machine/reward_fc.js +99 -0
  94. package/src/machine/roulette_v2.js +11 -14
  95. package/src/machine/setting.js +1 -0
  96. package/src/machine/side.js +160 -0
  97. package/src/machine/side_cash.js +3 -3
  98. package/src/machine/side_v2.js +223 -0
  99. package/src/machine/user_info.js +1 -0
  100. package/src/machine/user_photo.js +1 -0
  101. package/src/machine/user_reset_password.js +14 -0
  102. package/src/machine/user_sign_up.js +61 -46
  103. package/src/machine/vip_table.js +58 -0
  104. package/src/machine/websocket.js +349 -374
  105. package/src/machine/welcome.js +111 -0
  106. package/src/machine/withdraw/index.js +6 -0
  107. package/src/machine/withdraw/withdraw_crypto_cash.js +328 -0
  108. package/src/machine/withdraw/withdraw_krway.js +223 -0
  109. package/src/machine/withdraw/withdraw_manual.js +541 -0
  110. package/src/machine/withdraw/withdraw_manual_cash.js +39 -59
  111. package/src/request/config.js +0 -2
  112. package/src/request/request.js +60 -124
  113. package/src/util/constant.js +2 -6
  114. package/src/util/deviceToken.js +60 -0
  115. package/src/util/index.js +4 -2
  116. package/src/util/math.js +4 -0
  117. package/src/util/storage.js +4 -3
  118. package/test/api.behavior.test.js +69 -0
  119. package/test/api.contract.test.js +18 -0
  120. package/test/config.test.js +27 -0
  121. package/test/deviceToken.test.js +139 -0
  122. package/test/helpers.coverage.test.js +11 -0
  123. package/test/helpers.js +91 -0
  124. package/test/index.exports.test.js +14 -0
  125. package/test/machine.activity.core.coverage.test.js +337 -0
  126. package/test/machine.activity.gap.coverage.test.js +252 -0
  127. package/test/machine.activity.more.coverage.test.js +180 -0
  128. package/test/machine.activity_plus_and_binding_amb.coverage.test.js +201 -0
  129. package/test/machine.activity_timer_bonus.coverage.test.js +136 -0
  130. package/test/machine.activity_welcome.low.coverage.test.js +211 -0
  131. package/test/machine.amb_rewardfc_websocket.more.coverage.test.js +201 -0
  132. package/test/machine.auth.coverage.test.js +215 -0
  133. package/test/machine.bank_binding.test.js +143 -0
  134. package/test/machine.binding_otp_krway.coverage.test.js +223 -0
  135. package/test/machine.contract.test.js +50 -0
  136. package/test/machine.crypto_bank.coverage.test.js +270 -0
  137. package/test/machine.crypto_way.coverage.test.js +108 -0
  138. package/test/machine.crypto_way_cash.coverage.test.js +114 -0
  139. package/test/machine.definition.test.js +137 -0
  140. package/test/machine.deposit.manual.coverage.test.js +365 -0
  141. package/test/machine.deposit_fc.coverage.test.js +126 -0
  142. package/test/machine.direct.coverage.test.js +96 -0
  143. package/test/machine.direct_cash.coverage.test.js +108 -0
  144. package/test/machine.error.coverage.test.js +37 -0
  145. package/test/machine.events.test.js +126 -0
  146. package/test/machine.favorite_jackpot.coverage.test.js +82 -0
  147. package/test/machine.float.coverage.test.js +136 -0
  148. package/test/machine.flow.test.js +226 -0
  149. package/test/machine.game_hot_new_vip_table.coverage.test.js +105 -0
  150. package/test/machine.game_search_cash.coverage.test.js +155 -0
  151. package/test/machine.game_search_v2.test.js +199 -0
  152. package/test/machine.game_user_profile.coverage.test.js +100 -0
  153. package/test/machine.honor_board.test.js +133 -0
  154. package/test/machine.inbox.common.coverage.test.js +304 -0
  155. package/test/machine.loadcard_cash.coverage.test.js +101 -0
  156. package/test/machine.loadcard_vn.coverage.test.js +122 -0
  157. package/test/machine.misc.coverage.test.js +361 -0
  158. package/test/machine.more2.coverage.test.js +261 -0
  159. package/test/machine.options.execution.test.js +272 -0
  160. package/test/machine.priority.coverage.test.js +603 -0
  161. package/test/machine.qrcode_cash.coverage.test.js +107 -0
  162. package/test/machine.qrcode_v2.coverage.test.js +121 -0
  163. package/test/machine.regression.test.js +82 -0
  164. package/test/machine.roulette_v2.test.js +142 -0
  165. package/test/machine.side_reward_reset.coverage.test.js +220 -0
  166. package/test/machine.targeted.coverage.test.js +313 -0
  167. package/test/machine.usdt.coverage.test.js +95 -0
  168. package/test/machine.usdt_cash.coverage.test.js +73 -0
  169. package/test/machine.vip_card_activity.test.js +114 -0
  170. package/test/machine.virtual_bank_cash.coverage.test.js +105 -0
  171. package/test/machine.virtual_bank_vn.coverage.test.js +105 -0
  172. package/test/machine.vpay.coverage.test.js +142 -0
  173. package/test/machine.withdraw_crypto_cash.coverage.test.js +166 -0
  174. package/test/machine.withdraw_krway.coverage.test.js +123 -0
  175. package/test/machine.withdraw_manual.coverage.test.js +185 -0
  176. package/test/machine.withdraw_manual_cash.coverage.test.js +123 -0
  177. package/test/request.test.js +325 -0
  178. package/test/util.storage.errors.test.js +47 -0
  179. package/test/util.test.js +41 -0
  180. package/.claude/commands/sync-ai-prompts.md +0 -93
  181. package/.claude/settings.local.json +0 -23
  182. package/.github/copilot-instructions.md +0 -448
  183. package/.husky/post-checkout +0 -32
  184. package/.husky/pre-push +0 -36
  185. package/AGENTS.md +0 -448
  186. package/AI_PROMPT_SOURCE.md +0 -446
  187. package/CLAUDE.md +0 -448
  188. package/GEMINI.md +0 -448
  189. package/docs/kibana/crypto-way-deposit-amount-bug-analysis.md +0 -1003
  190. package/docs/kibana/play-providerId-error.md +0 -202
  191. package/docs/kibana/play-selectedWalletType.md +0 -1
  192. package/docs/kibana/play-selectedWalletType_2.md +0 -1
  193. package/docs/kibana/play-selectedWalletType_analysis.md +0 -565
  194. package/docs/my-claude/feat-sharon-JT-1790247240-socket/branch-transfer.md +0 -14
  195. package/docs/my-claude/feat-sharon-JT-1790247240-socket/cash-module-preparation.json +0 -40
  196. package/docs/my-claude/feat-sharon-JT-1790247240-socket/cash-module-verification.md +0 -41
  197. package/docs/my-claude/feat-sharon-JT-1790247240-socket/implementation-ledger.md +0 -87
  198. package/docs/my-claude/feat-sharon-JT-1790247240-socket/module-report.md +0 -73
  199. package/docs/my-claude/feat-sharon-JT-1790247240-socket/plan.md +0 -309
  200. package/docs/my-claude/feat-sharon-JT-1790247240-socket/test-cases.md +0 -245
  201. package/docs/my-claude/feat-sharon-JT-1791180540-onesignal/transfer.md +0 -9
  202. package/scripts/auto-version.js +0 -68
  203. package/scripts/auto-version.sh +0 -33
  204. package/scripts/branch-auto-npm-publish.js +0 -29
  205. package/scripts/check-version.sh +0 -36
  206. package/scripts/clean-tags.sh +0 -84
  207. package/src/util/amount.js +0 -8
  208. package/src/util/err998SentryExtra.js +0 -26
  209. package/src/util/paramStore.js +0 -139
  210. package/src/util/socketPolicy.js +0 -57
  211. package/test/auth_otp_v3.test.js +0 -323
  212. package/tests/websocket.test.mjs +0 -779
@@ -99,6 +99,7 @@ export default function (request) {
99
99
  return createMachine(
100
100
  {
101
101
  id: 'inbox',
102
+ predictableActionArguments: true,
102
103
  initial: 'loading',
103
104
  context: {
104
105
  isRewardListEnable: true,
@@ -223,6 +224,10 @@ export default function (request) {
223
224
  PRESET_TAB: {
224
225
  actions: ['setCurrentTab', 'hideMessage'],
225
226
  },
227
+ RESET: {
228
+ target: '.loading',
229
+ actions: 'reset',
230
+ },
226
231
  INQUIRY_ACCOUNT: {
227
232
  target: '.inquiring',
228
233
  actions: 'resetPage',
@@ -279,11 +284,32 @@ export default function (request) {
279
284
  const lang = event.data.locale || context.lang || 'en-US'
280
285
  return { lang }
281
286
  }),
287
+ reset: assign((context, event) => {
288
+ return {
289
+ currentTab: null,
290
+ inbox: {},
291
+ messageDetail: null,
292
+ currentMessage: null,
293
+ }
294
+ }),
282
295
  resetPage: assign((context, event) => {
283
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
284
- inbox[currentTab].page = -1
296
+ const { inbox, currentTab } = context
297
+ if (!inbox[currentTab]) {
298
+ return {
299
+ inbox,
300
+ messageDetail: null,
301
+ currentMessage: null,
302
+ }
303
+ }
304
+ const nextInbox = {
305
+ ...inbox,
306
+ [currentTab]: {
307
+ ...inbox[currentTab],
308
+ page: -1,
309
+ },
310
+ }
285
311
  return {
286
- inbox,
312
+ inbox: nextInbox,
287
313
  messageDetail: null,
288
314
  currentMessage: null,
289
315
  }
@@ -309,27 +335,44 @@ export default function (request) {
309
335
  }
310
336
  }),
311
337
  selectMessages: assign((context, event) => {
312
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
313
- const data = inbox[currentTab].data.map((item) => {
314
- if (item.groupId === event.data.groupId) {
315
- item.isSelected = !item.isSelected
316
- }
317
- return item
318
- })
319
- inbox[currentTab].data = data
320
- return { inbox }
338
+ const { inbox, currentTab } = context
339
+ const data = inbox[currentTab].data.map((item) =>
340
+ item.groupId === event.data.groupId
341
+ ? {
342
+ ...item,
343
+ isSelected: !item.isSelected,
344
+ }
345
+ : item
346
+ )
347
+ return {
348
+ inbox: {
349
+ ...inbox,
350
+ [currentTab]: {
351
+ ...inbox[currentTab],
352
+ data,
353
+ },
354
+ },
355
+ }
321
356
  }),
322
357
  cancelSelectMessages: assign((context, event) => {
323
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
324
- const data = inbox[currentTab].data.map((item) => {
325
- item.isSelected = false
326
- return item
327
- })
328
- inbox[currentTab].data = data
329
- return { inbox, selectedDeleteMessages: null }
358
+ const { inbox, currentTab } = context
359
+ if (!inbox[currentTab]?.data) {
360
+ return { inbox, selectedDeleteMessages: null }
361
+ }
362
+ const data = inbox[currentTab].data.map((item) => ({ ...item, isSelected: false }))
363
+ return {
364
+ inbox: {
365
+ ...inbox,
366
+ [currentTab]: {
367
+ ...inbox[currentTab],
368
+ data,
369
+ },
370
+ },
371
+ selectedDeleteMessages: null,
372
+ }
330
373
  }),
331
374
  setDelectMessages: assign((context, event) => {
332
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
375
+ const { inbox, currentTab } = context
333
376
  const selectedMessages = inbox[currentTab].data?.filter((item) => item.isSelected)
334
377
  const groupIdsArray = selectedMessages?.map((item) => item.groupId)
335
378
  const groupIds = groupIdsArray?.join(',')
@@ -370,10 +413,18 @@ export default function (request) {
370
413
  }),
371
414
  removeMessage: assign((context, event) => {
372
415
  const groupIds = event.data
373
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
374
- const data = inbox[currentTab].data.filter((item) => !groupIds.find((groupId) => groupId === item.groupId))
375
- inbox[currentTab].data = data
376
- return { inbox }
416
+ const { inbox, currentTab } = context
417
+ const groupIdSet = new Set(groupIds)
418
+ const data = inbox[currentTab].data.filter((item) => !groupIdSet.has(item.groupId))
419
+ return {
420
+ inbox: {
421
+ ...inbox,
422
+ [currentTab]: {
423
+ ...inbox[currentTab],
424
+ data,
425
+ },
426
+ },
427
+ }
377
428
  }),
378
429
  setInbox: assign((context, event) => {
379
430
  return {
@@ -381,15 +432,24 @@ export default function (request) {
381
432
  }
382
433
  }),
383
434
  setMessageIsRead: assign((context, event) => {
384
- const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
385
- const data = inbox[currentTab].data.map((item) => {
386
- if (item.groupId === event.data.groupId) {
387
- item.isRead = true
388
- }
389
- return item
390
- })
391
- inbox[currentTab].data = data
392
- return { inbox }
435
+ const { inbox, currentTab } = context
436
+ const data = inbox[currentTab].data.map((item) =>
437
+ item.groupId === event.data.groupId
438
+ ? {
439
+ ...item,
440
+ isRead: true,
441
+ }
442
+ : item
443
+ )
444
+ return {
445
+ inbox: {
446
+ ...inbox,
447
+ [currentTab]: {
448
+ ...inbox[currentTab],
449
+ data,
450
+ },
451
+ },
452
+ }
393
453
  }),
394
454
  setMessageTitle: assign((context, event) => {
395
455
  return {
@@ -410,33 +470,35 @@ export default function (request) {
410
470
  },
411
471
  fetchMessages: async (context, event) => {
412
472
  const lang = context.lang
413
- const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context))
473
+ const { isRewardListEnable, currentTab, inbox } = context
474
+ const nextInbox = { ...inbox }
414
475
  if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND' || currentTab === 'FREE_GAME')) {
415
476
  const { data } = await request.send(activity.getRewardList({ count: 30, appSecret, lang }))
416
- inbox[currentTab] = { data, page: 0, totalPage: 1 }
477
+ nextInbox[currentTab] = { data, page: 0, totalPage: 1 }
417
478
  } else {
418
- const { page = -1 } = inbox[currentTab] || {}
479
+ const { page = -1 } = nextInbox[currentTab] || {}
419
480
  const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: page + 1 }))
420
481
  const formattedData = data?.map((item) => ({ ...item, isSelected: false }))
421
- const currentData = inbox[currentTab]?.data || []
422
- inbox[currentTab] = { data: currentData.concat(formattedData), ...rest }
482
+ const currentData = nextInbox[currentTab]?.data || []
483
+ nextInbox[currentTab] = { data: currentData.concat(formattedData), ...rest }
423
484
  }
424
- return inbox
485
+ return nextInbox
425
486
  },
426
487
  reFetchMessages: async (context, event) => {
427
488
  const lang = context.lang
428
- const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context))
489
+ const { isRewardListEnable, currentTab, inbox } = context
490
+ const nextInbox = { ...inbox }
429
491
 
430
492
  if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND' || currentTab === 'FREE_GAME')) {
431
493
  const { data } = await request.send(activity.getRewardList({ count: 30, appSecret, lang }))
432
- inbox[currentTab] = { data, page: 0, totalPage: 1 }
494
+ nextInbox[currentTab] = { data, page: 0, totalPage: 1 }
433
495
  } else {
434
496
  const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: 0 }))
435
497
  let formattedData = []
436
498
  formattedData = data?.map((item) => ({ ...item, isSelected: false }))
437
- inbox[currentTab] = { data: formattedData, ...rest }
499
+ nextInbox[currentTab] = { data: formattedData, ...rest }
438
500
  }
439
- return inbox
501
+ return nextInbox
440
502
  },
441
503
  updateMessageIsRead: async (context, event) => {
442
504
  const { currentMessage } = context
@@ -1,26 +1,42 @@
1
1
  import activity from './activity/index.js'
2
2
  import auth from './auth.js'
3
+ import welcome from './welcome.js'
3
4
  import common from './common.js'
4
5
  import error from './error.js'
5
6
  import game_v2_1 from './game_v2_1.js'
6
7
  import game_favorite_v2 from './game_favorite_v2.js'
7
8
  import game_search_cash from './game_search_cash.js'
9
+ import game_search_v2 from './game_search_v2.js'
10
+ import game_hot_new from './game_hot_new.js'
8
11
  import game_info from './game_info.js'
12
+ import game_replay from './game_replay.js'
9
13
  import game_betslip from './game_betslip.js'
10
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'
11
19
  import reward_cash from './reward_cash.js'
12
20
  import setting from './setting.js'
21
+ import side from './side.js'
22
+ import side_v2 from './side_v2.js'
13
23
  import side_cash from './side_cash.js'
14
24
  import user_info from './user_info.js'
15
25
  import user_sign_up from './user_sign_up.js'
16
26
  import user_reset_password from './user_reset_password.js'
17
27
  import bank_binding from './bank_binding.js'
28
+ import bank_binding_amb from './bank_binding_amb.js'
18
29
  import withdraw from './withdraw/index.js'
19
30
  import deposit from './deposit/index.js'
31
+ import bonus from './bonus.js'
20
32
  import leaderboard from './leaderboard.js'
33
+ import auth_otp_v2 from './auth_otp_v2.js'
21
34
  import auth_otp_v3 from './auth_otp_v3.js'
35
+ import vip_table from './vip_table.js'
36
+ import promotions from './promotions.js'
22
37
  import roulette_v2 from './roulette_v2.js'
23
38
  import honor_board_cash from './honor_board_cash.js'
39
+ import honor_board from './honor_board.js'
24
40
  import user_photo from './user_photo.js'
25
41
  import navbar from './navbar.js'
26
42
  import websocket from './websocket.js'
@@ -29,26 +45,42 @@ import ranking from './ranking.js'
29
45
  export default {
30
46
  ...activity,
31
47
  auth,
48
+ welcome,
32
49
  common,
33
50
  error,
34
51
  game_favorite_v2,
35
52
  game_search_cash,
53
+ game_search_v2,
54
+ game_hot_new,
36
55
  game_info,
56
+ game_replay,
37
57
  game_betslip,
38
58
  inbox,
59
+ merge,
60
+ payment_data,
61
+ reward,
39
62
  reward_cash,
63
+ reward_fc,
40
64
  setting,
65
+ side,
66
+ side_v2,
41
67
  side_cash,
42
68
  game_v2_1,
43
69
  user_info,
44
70
  user_sign_up,
45
71
  user_reset_password,
46
72
  bank_binding,
73
+ bank_binding_amb,
47
74
  ...deposit,
75
+ bonus,
48
76
  leaderboard,
77
+ auth_otp_v2,
49
78
  auth_otp_v3,
79
+ vip_table,
80
+ promotions,
50
81
  roulette_v2,
51
82
  honor_board_cash,
83
+ honor_board,
52
84
  user_photo,
53
85
  navbar,
54
86
  ...withdraw,
@@ -6,6 +6,7 @@ export default function (request) {
6
6
  return createMachine(
7
7
  {
8
8
  id: 'leaderboard',
9
+ predictableActionArguments: true,
9
10
  context: {
10
11
  rankActivities: null,
11
12
  activityNo: null,
@@ -37,13 +38,12 @@ export default function (request) {
37
38
  checking: {
38
39
  always: [
39
40
  { target: 'idle', actions: 'setActivityDetail', cond: 'isExist' },
40
- { target: 'loading', cond: 'hasActivityNoAndToken' },
41
- { target: 'idle' },
41
+ { target: 'loading', cond: 'hasActivityNo' },
42
42
  ],
43
43
  },
44
44
  loading: {
45
45
  invoke: {
46
- src: 'fetchActivityDetail',
46
+ src: 'fetchPublicActivityDetail',
47
47
  onDone: {
48
48
  target: 'idle',
49
49
  actions: ['setActivityMap', 'setActivityDetail'],
@@ -101,9 +101,8 @@ export default function (request) {
101
101
  const { activityMap, activityNo } = context
102
102
  return activityMap[activityNo]
103
103
  },
104
- hasActivityNoAndToken: (context, event) => {
105
- const hasToken = request.getToken()
106
- return !!context.activityNo && hasToken
104
+ hasActivityNo: (context, event) => {
105
+ return !!context.activityNo
107
106
  },
108
107
  },
109
108
  services: {
@@ -118,10 +117,15 @@ export default function (request) {
118
117
  const { data } = await request.send(hasToken ? api.getActivityList({ appSecret }) : api.getAllActivityList({ appSecret }))
119
118
  return data
120
119
  },
121
- fetchActivityDetail: async (context, event) => {
120
+ fetchPublicActivityDetail: async (context, event) => {
121
+ const hasToken = request.getToken()
122
122
  const { activityNo } = context
123
123
  let result = {}
124
- result = await request.send(api.getActivityDetail({ activityNo, appSecret }))
124
+ if (hasToken) {
125
+ result = await request.send(api.getActivityDetail({ activityNo, appSecret }))
126
+ } else {
127
+ result = await request.send(api.getTournamentDetail({ activityNo, appSecret }))
128
+ }
125
129
  return result.data
126
130
  },
127
131
  },
@@ -0,0 +1,58 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import api from '../api/payment.js'
3
+ export default function (request) {
4
+ return createMachine(
5
+ {
6
+ id: 'merge',
7
+ predictableActionArguments: true,
8
+ initial: 'idle',
9
+ context: {
10
+ userInfo: null,
11
+ },
12
+ states: {
13
+ idle: {
14
+ always: [{ target: 'mergeable', cond: 'isMergeable' }],
15
+ },
16
+ mergeable: {
17
+ on: {
18
+ MERGE: {
19
+ target: 'merging',
20
+ },
21
+ },
22
+ },
23
+ merging: {
24
+ invoke: {
25
+ src: 'mergeWallet',
26
+ onDone: { target: 'idle' },
27
+ onError: { target: 'idle' },
28
+ },
29
+ },
30
+ },
31
+ on: {
32
+ SET_USER_INFO: {
33
+ actions: 'setUserInfo',
34
+ },
35
+ },
36
+ },
37
+ {
38
+ actions: {
39
+ setUserInfo: assign((context, event) => {
40
+ return {
41
+ userInfo: event.data,
42
+ }
43
+ }),
44
+ },
45
+ guards: {
46
+ isMergeable: (context, event) => {
47
+ const { retain, balance, withdraw_policy } = context.userInfo || {}
48
+ return retain > 0 && (parseFloat(balance) <= 5 || withdraw_policy === 'FREE')
49
+ },
50
+ },
51
+ services: {
52
+ mergeWallet: async (context, event) => {
53
+ return await request.send(api.mergeWallet())
54
+ },
55
+ },
56
+ }
57
+ )
58
+ }
@@ -7,6 +7,7 @@ export default function (request) {
7
7
  return createMachine(
8
8
  {
9
9
  id: 'navbar',
10
+ predictableActionArguments: true,
10
11
  initial: 'fetching',
11
12
  context: {
12
13
  navbar: [],
@@ -72,9 +73,10 @@ export default function (request) {
72
73
  combindGames: assign((context, event) => {
73
74
  const gameInfo = event.data?.data || []
74
75
  const { navbar = [] } = context
76
+ const gameInfoMap = new Map(gameInfo.map((game) => [game.gameCode, game]))
75
77
  const combindNavBar = navbar.map((item) => {
76
78
  if (item.type.toLowerCase() === 'game') {
77
- const currentGame = gameInfo.find((game) => game.gameCode === item.gameCode)
79
+ const currentGame = gameInfoMap.get(item.gameCode)
78
80
  return {
79
81
  ...item,
80
82
  ...currentGame,
@@ -0,0 +1,87 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import payment from '../api/payment.js'
3
+
4
+ export default function (request) {
5
+ return createMachine(
6
+ {
7
+ id: 'payment_data',
8
+ predictableActionArguments: true,
9
+ initial: 'idle',
10
+ context: {
11
+ transactionList: [],
12
+ spotMarketTime: null,
13
+ spotMarketList: [],
14
+ },
15
+ states: {
16
+ idle: {},
17
+ fetchingTransactionList: {
18
+ invoke: {
19
+ src: 'fetchTransactionList',
20
+ onDone: {
21
+ target: 'idle',
22
+ actions: 'setTransactionList',
23
+ },
24
+ onError: {
25
+ target: 'idle',
26
+ },
27
+ },
28
+ },
29
+ fetchingSpotMarket: {
30
+ invoke: {
31
+ src: 'fetchSpotMarket',
32
+ onDone: {
33
+ target: 'idle',
34
+ actions: 'setSpotMarket',
35
+ },
36
+ onError: {
37
+ target: 'idle',
38
+ },
39
+ },
40
+ },
41
+ },
42
+ on: {
43
+ GET_TRANSACTION_LIST: {
44
+ target: 'fetchingTransactionList',
45
+ },
46
+ GET_SPOT_MARKET: {
47
+ target: 'fetchingSpotMarket',
48
+ },
49
+ },
50
+ },
51
+ {
52
+ actions: {
53
+ setTransactionList: assign((context, event) => {
54
+ const statusMap = {
55
+ 2: 'pending',
56
+ 3: 'success',
57
+ 4: 'reject',
58
+ 8: 'expired',
59
+ }
60
+ const transactionList = event.data.map((item) => {
61
+ item.statusName = statusMap[item.status]
62
+ return item
63
+ })
64
+ return {
65
+ transactionList,
66
+ }
67
+ }),
68
+ setSpotMarket: assign((context, event) => {
69
+ const { timestamp, data } = event.data
70
+ return {
71
+ spotMarketTime: timestamp,
72
+ spotMarketList: data.slice(0, 100),
73
+ }
74
+ }),
75
+ },
76
+ services: {
77
+ fetchTransactionList: async (context, event) => {
78
+ const returnDays = event.data
79
+ return await request.send(payment.getPaymentHistory(returnDays))
80
+ },
81
+ fetchSpotMarket: async (context, event) => {
82
+ return await request.send(payment.getSpotMarket())
83
+ },
84
+ },
85
+ }
86
+ )
87
+ }
@@ -0,0 +1,163 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import payment from '../api/payment.js'
3
+
4
+ export default function (request) {
5
+ return createMachine(
6
+ {
7
+ id: 'promotions',
8
+ predictableActionArguments: true,
9
+ initial: 'loading',
10
+ context: {
11
+ userInfo: {},
12
+ siteConfig: {},
13
+ withdrawRule: {},
14
+ promotionsList: [],
15
+ selectedPromo: {},
16
+ amount: null,
17
+ callback: () => {},
18
+ },
19
+ states: {
20
+ loading: {
21
+ invoke: {
22
+ src: 'fetchPromotionsList',
23
+ onDone: {
24
+ target: 'loaded',
25
+ actions: 'setPromotionsList',
26
+ },
27
+ onError: {
28
+ target: 'fail',
29
+ },
30
+ },
31
+ },
32
+ loaded: {
33
+ on: {
34
+ SELECT_PROMO: {
35
+ actions: ['reset', 'setSelectedPromo'],
36
+ },
37
+ SET_AMOUNT: {
38
+ actions: 'setAmount',
39
+ },
40
+ JOIN: {
41
+ target: 'fetching',
42
+ cond: 'isValidAmount',
43
+ },
44
+ },
45
+ },
46
+ fetching: {
47
+ invoke: {
48
+ src: 'fetchWithdrawRulePreview',
49
+ onDone: {
50
+ target: 'pending',
51
+ actions: 'setWithdrawRulePreview',
52
+ },
53
+ onError: {
54
+ target: 'loaded',
55
+ },
56
+ },
57
+ },
58
+ pending: {
59
+ on: {
60
+ CONFIRM: {
61
+ target: 'applying',
62
+ actions: 'setCallback',
63
+ },
64
+ BACK: {
65
+ target: 'loaded',
66
+ },
67
+ },
68
+ },
69
+ applying: {
70
+ invoke: {
71
+ src: 'applyPromotion',
72
+ onDone: {
73
+ target: 'applied',
74
+ },
75
+ onError: {
76
+ target: 'loaded',
77
+ },
78
+ },
79
+ },
80
+ applied: {
81
+ entry: 'doCallback',
82
+ },
83
+ fail: {},
84
+ },
85
+ },
86
+ {
87
+ actions: {
88
+ setPromotionsList: assign((context, event) => {
89
+ const sourcePromotions = Array.isArray(event.data) ? event.data : []
90
+ const { userInfo, siteConfig } = context
91
+ const { withdraw_rule, balance, bank_amount } = userInfo
92
+ const { currencyConversionLimit } = siteConfig
93
+ const balanceAvailable = parseFloat(bank_amount) < parseFloat(`${currencyConversionLimit}`)
94
+ const isFreeLimitRule = withdraw_rule.includes('FREE_LIMIT')
95
+ const includesDefaultRule = withdraw_rule === 'DEFAULT' || withdraw_rule.includes('FREE_DEFAULT')
96
+ const promotionsList = sourcePromotions.map((item) => ({
97
+ ...item,
98
+ attendEnable:
99
+ !balanceAvailable && includesDefaultRule
100
+ ? !item.withdrawRule.includes('FREE_LIMIT')
101
+ : !balanceAvailable && isFreeLimitRule
102
+ ? false
103
+ : true,
104
+ }))
105
+ return {
106
+ promotionsList,
107
+ selectedPromo: promotionsList[0],
108
+ }
109
+ }),
110
+ setSelectedPromo: assign((context, event) => {
111
+ return {
112
+ selectedPromo: event.data,
113
+ }
114
+ }),
115
+ setAmount: assign((context, event) => {
116
+ return {
117
+ amount: event.data,
118
+ }
119
+ }),
120
+ setWithdrawRulePreview: assign((context, event) => {
121
+ return {
122
+ withdrawRule: event.data,
123
+ }
124
+ }),
125
+ setCallback: assign((context, event) => {
126
+ return {
127
+ callback: event.data?.callback || (() => {}),
128
+ }
129
+ }),
130
+ doCallback: (context, event) => {
131
+ context.callback()
132
+ },
133
+ reset: assign((context, event) => {
134
+ return {
135
+ amount: null,
136
+ }
137
+ }),
138
+ },
139
+ guards: {
140
+ isValidAmount: (context, event) => {
141
+ const { selectedPromo, amount } = context
142
+ return selectedPromo.minimumAmount <= amount
143
+ },
144
+ },
145
+ services: {
146
+ fetchPromotionsList: async (context, event) => {
147
+ return await request.send(payment.getPromotionsList())
148
+ },
149
+ fetchWithdrawRulePreview: async (context, event) => {
150
+ const { selectedPromo, amount } = context
151
+ const data = await request.send(
152
+ payment.getWithdrawRulePreview({ applyType: 'promotions', applyNo: selectedPromo.promotionsNo, amount: parseFloat(amount) })
153
+ )
154
+ return data
155
+ },
156
+ applyPromotion: async (context, event) => {
157
+ const { selectedPromo, amount } = context
158
+ return await request.send(payment.applyPromotions({ promotionsNo: selectedPromo.promotionsNo, amount: parseFloat(amount) }))
159
+ },
160
+ },
161
+ }
162
+ )
163
+ }