@jetthai/cuora 1.1.488-dev.1 → 1.2.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 (221) hide show
  1. package/.husky/pre-commit +3 -1
  2. package/.prettierignore +1 -2
  3. package/CHANGELOG.md +0 -746
  4. package/README.md +15 -299
  5. package/package.json +3 -6
  6. package/resetGitBranch.sh +101 -0
  7. package/src/api/activity.js +39 -24
  8. package/src/api/auth.js +35 -4
  9. package/src/api/common.js +1 -8
  10. package/src/api/game.js +10 -0
  11. package/src/api/index.js +1 -3
  12. package/src/api/payment.js +55 -18
  13. package/src/api/user.js +16 -11
  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 +209 -0
  17. package/src/machine/activity/activity_cash.js +18 -71
  18. package/src/machine/activity/diamond_shop_activity_cash.js +1 -0
  19. package/src/machine/activity/diamond_shop_activity_fc.js +196 -0
  20. package/src/machine/activity/diamond_shop_activity_vn.js +178 -0
  21. package/src/machine/activity/fafafa_activity.js +10 -0
  22. package/src/machine/activity/index.js +12 -0
  23. package/src/machine/activity/invite_friends_activity.js +114 -0
  24. package/src/machine/activity/mini_game_activity.js +68 -0
  25. package/src/machine/activity/return_bonus_activity.js +153 -0
  26. package/src/machine/activity/roulette_activity_v2.js +0 -5
  27. package/src/machine/auth.js +140 -192
  28. package/src/machine/auth_otp_v2.js +177 -0
  29. package/src/machine/auth_otp_v3.js +32 -111
  30. package/src/machine/bank_binding.js +2 -2
  31. package/src/machine/bank_binding_amb.js +145 -0
  32. package/src/machine/bonus.js +75 -0
  33. package/src/machine/common.js +91 -27
  34. package/src/machine/deposit/amb.js +92 -0
  35. package/src/machine/deposit/crypto_bank.js +325 -0
  36. package/src/machine/deposit/crypto_bank_cash.js +8 -19
  37. package/src/machine/deposit/crypto_qrcode.js +148 -0
  38. package/src/machine/deposit/crypto_qrcode_cash.js +41 -26
  39. package/src/machine/deposit/crypto_way.js +247 -0
  40. package/src/machine/deposit/crypto_way_cash.js +32 -52
  41. package/src/machine/deposit/deposit_fc.js +271 -0
  42. package/src/machine/deposit/direct.js +310 -0
  43. package/src/machine/deposit/direct_cash.js +9 -8
  44. package/src/machine/deposit/float.js +374 -0
  45. package/src/machine/deposit/index.js +28 -0
  46. package/src/machine/deposit/krway.js +151 -0
  47. package/src/machine/deposit/loadcard_cash.js +31 -14
  48. package/src/machine/deposit/loadcard_vn.js +351 -0
  49. package/src/machine/deposit/manual_cash.js +10 -8
  50. package/src/machine/deposit/manual_vn.js +458 -0
  51. package/src/machine/deposit/qrcode_cash.js +30 -14
  52. package/src/machine/deposit/qrcode_v2.js +338 -0
  53. package/src/machine/deposit/usdt.js +144 -0
  54. package/src/machine/deposit/virtual_bank_cash.js +2 -5
  55. package/src/machine/deposit/virtual_bank_vn.js +269 -0
  56. package/src/machine/deposit/vpay.js +367 -0
  57. package/src/machine/error.js +0 -7
  58. package/src/machine/game_hot_new.js +79 -0
  59. package/src/machine/game_info.js +12 -5
  60. package/src/machine/game_replay.js +46 -0
  61. package/src/machine/game_search_v2.js +401 -0
  62. package/src/machine/game_v2_1.js +88 -58
  63. package/src/machine/honor_board.js +132 -0
  64. package/src/machine/honor_board_cash.js +18 -15
  65. package/src/machine/inbox.js +12 -0
  66. package/src/machine/index.js +32 -0
  67. package/src/machine/leaderboard.js +11 -8
  68. package/src/machine/merge.js +57 -0
  69. package/src/machine/payment_data.js +86 -0
  70. package/src/machine/promotions.js +170 -0
  71. package/src/machine/ranking.js +25 -43
  72. package/src/machine/reward.js +255 -0
  73. package/src/machine/reward_cash.js +41 -2
  74. package/src/machine/reward_fc.js +98 -0
  75. package/src/machine/roulette_v2.js +25 -20
  76. package/src/machine/side.js +154 -0
  77. package/src/machine/side_cash.js +2 -3
  78. package/src/machine/side_v2.js +209 -0
  79. package/src/machine/user_reset_password.js +15 -4
  80. package/src/machine/user_sign_up.js +60 -49
  81. package/src/machine/vip_table.js +57 -0
  82. package/src/machine/websocket.js +325 -378
  83. package/src/machine/welcome.js +110 -0
  84. package/src/machine/withdraw/index.js +6 -0
  85. package/src/machine/withdraw/withdraw_crypto_cash.js +327 -0
  86. package/src/machine/withdraw/withdraw_krway.js +222 -0
  87. package/src/machine/withdraw/withdraw_manual.js +533 -0
  88. package/src/machine/withdraw/withdraw_manual_cash.js +43 -74
  89. package/src/request/config.js +0 -2
  90. package/src/request/request.js +64 -231
  91. package/src/util/constant.js +2 -12
  92. package/src/util/deviceToken.js +59 -0
  93. package/src/util/index.js +4 -2
  94. package/src/util/math.js +4 -0
  95. package/.claude/commands/sync-ai-prompts.md +0 -180
  96. package/.claude/settings.local.json +0 -25
  97. package/.github/copilot-instructions.md +0 -459
  98. package/.husky/post-checkout +0 -32
  99. package/.husky/pre-push +0 -36
  100. package/AGENTS.md +0 -459
  101. package/AI_PROMPT_SOURCE.md +0 -457
  102. package/CLAUDE.md +0 -459
  103. package/GEMINI.md +0 -459
  104. package/docs/kibana/crypto-way-deposit-amount-bug-analysis.md +0 -1003
  105. package/docs/kibana/play-providerId-error.md +0 -202
  106. package/docs/kibana/play-selectedWalletType.md +0 -1
  107. package/docs/kibana/play-selectedWalletType_2.md +0 -1
  108. package/docs/kibana/play-selectedWalletType_analysis.md +0 -565
  109. package/docs/my-claude/feat-sharon-JT-1790247240-socket/branch-transfer.md +0 -14
  110. package/docs/my-claude/feat-sharon-JT-1790247240-socket/cash-module-preparation.json +0 -40
  111. package/docs/my-claude/feat-sharon-JT-1790247240-socket/cash-module-verification.md +0 -41
  112. package/docs/my-claude/feat-sharon-JT-1790247240-socket/implementation-ledger.md +0 -87
  113. package/docs/my-claude/feat-sharon-JT-1790247240-socket/module-report.md +0 -73
  114. package/docs/my-claude/feat-sharon-JT-1790247240-socket/plan.md +0 -309
  115. package/docs/my-claude/feat-sharon-JT-1790247240-socket/test-cases.md +0 -245
  116. package/docs/my-claude/feat-sharon-JT-1791180540-onesignal/transfer.md +0 -9
  117. package/e2e/feature-map.md +0 -19
  118. package/prepare-for-pr/JT-1776243420.md +0 -85
  119. package/prepare-for-pr/TI-16026/STATE.md +0 -18
  120. package/prepare-for-pr/TI-16026/after-prepare-authorization.md +0 -3
  121. package/prepare-for-pr/TI-16026/analysis.md +0 -38
  122. package/prepare-for-pr/TI-16026/answer-analyze-01.md +0 -1
  123. package/prepare-for-pr/TI-16026/answer-commit-01.md +0 -2
  124. package/prepare-for-pr/TI-16026/answer-commit-02.md +0 -1
  125. package/prepare-for-pr/TI-16026/bundle.json +0 -18
  126. package/prepare-for-pr/TI-16026/checklist.md +0 -196
  127. package/prepare-for-pr/TI-16026/checklist.unit-test-original.md +0 -39
  128. package/prepare-for-pr/TI-16026/claude-after-model +0 -1
  129. package/prepare-for-pr/TI-16026/claude-commit-session +0 -1
  130. package/prepare-for-pr/TI-16026/claude-harvest-session +0 -1
  131. package/prepare-for-pr/TI-16026/claude-hops/01-analyze.err +0 -1
  132. package/prepare-for-pr/TI-16026/claude-hops/01-analyze.out +0 -2
  133. package/prepare-for-pr/TI-16026/claude-hops/02-analyze.err +0 -1
  134. package/prepare-for-pr/TI-16026/claude-hops/02-analyze.out +0 -4
  135. package/prepare-for-pr/TI-16026/claude-hops/03-dev.err +0 -1
  136. package/prepare-for-pr/TI-16026/claude-hops/03-dev.out +0 -4
  137. package/prepare-for-pr/TI-16026/claude-hops/04-dev.err +0 -1
  138. package/prepare-for-pr/TI-16026/claude-hops/04-dev.out +0 -4
  139. package/prepare-for-pr/TI-16026/claude-hops/05-dev.err +0 -1
  140. package/prepare-for-pr/TI-16026/claude-hops/05-dev.out +0 -3
  141. package/prepare-for-pr/TI-16026/claude-hops/06-after.err +0 -1
  142. package/prepare-for-pr/TI-16026/claude-hops/06-after.out +0 -2
  143. package/prepare-for-pr/TI-16026/claude-hops/07-commit.err +0 -1
  144. package/prepare-for-pr/TI-16026/claude-hops/07-commit.out +0 -2
  145. package/prepare-for-pr/TI-16026/claude-hops/08-commit.err +0 -1
  146. package/prepare-for-pr/TI-16026/claude-hops/08-commit.out +0 -2
  147. package/prepare-for-pr/TI-16026/claude-hops/09-commit.err +0 -1
  148. package/prepare-for-pr/TI-16026/claude-hops/09-commit.out +0 -8
  149. package/prepare-for-pr/TI-16026/claude-hops/10-harvest.err +0 -1
  150. package/prepare-for-pr/TI-16026/claude-hops/10-harvest.out +0 -3
  151. package/prepare-for-pr/TI-16026/claude-hops/11-harvest.err +0 -1
  152. package/prepare-for-pr/TI-16026/claude-hops/11-harvest.out +0 -3
  153. package/prepare-for-pr/TI-16026/commit-note.md +0 -5
  154. package/prepare-for-pr/TI-16026/evidence-index.json +0 -215
  155. package/prepare-for-pr/TI-16026/feature-map.before.md +0 -61
  156. package/prepare-for-pr/TI-16026/harvest-redaction.json +0 -34
  157. package/prepare-for-pr/TI-16026/harvest-redaction.out +0 -37
  158. package/prepare-for-pr/TI-16026/harvest.md +0 -46
  159. package/prepare-for-pr/TI-16026/lessons.md +0 -5
  160. package/prepare-for-pr/TI-16026/note-harvest-redaction.md +0 -1
  161. package/prepare-for-pr/TI-16026/open-questions.md +0 -6
  162. package/prepare-for-pr/TI-16026/publish.md +0 -32
  163. package/prepare-for-pr/TI-16026/review-convergence-response.md +0 -3
  164. package/prepare-for-pr/TI-16026/review-input/scope.md +0 -18
  165. package/prepare-for-pr/TI-16026/review-log.md +0 -57
  166. package/prepare-for-pr/TI-16026/review-notes.md +0 -97
  167. package/prepare-for-pr/TI-16026/review-response-r1.md +0 -7
  168. package/prepare-for-pr/TI-16026/self-test-report.md +0 -67
  169. package/prepare-for-pr/TI-16026/spec-proposal.md +0 -34
  170. package/prepare-for-pr/TI-16026/spec-snapshot.md +0 -291
  171. package/prepare-for-pr/TI-16026/state-log.md +0 -57
  172. package/prepare-for-pr/TI-16026/user-messages/01.md +0 -12
  173. package/prepare-for-pr/TI-16026/user-messages/02.md +0 -20
  174. package/prepare-for-pr/TI-16026/user-messages/03.md +0 -1
  175. package/prepare-for-pr/TI-16026/user-messages/04.md +0 -1
  176. package/prepare-for-pr/TI-16026/user-messages/05.md +0 -1
  177. package/prepare-for-pr/TI-16026/user-messages/06.md +0 -1
  178. package/prepare-for-pr/TI-16026/user-messages/07.md +0 -1
  179. package/prepare-for-pr/TI-16026/user-messages/08.md +0 -1
  180. package/prepare-for-pr/TI-16026/user-messages/09.md +0 -1
  181. package/prepare-for-pr/TI-16026/user-messages/10.md +0 -1
  182. package/prepare-for-pr/TI-16026/user-messages/11.md +0 -1
  183. package/prepare-for-pr/TI-16026/user-messages/12.md +0 -1
  184. package/prepare-for-pr/TI-16026/user-messages/13.md +0 -1
  185. package/prepare-for-pr/TI-16026/user-messages/14.md +0 -1
  186. package/prepare-for-pr/TI-16026/user-messages/15.md +0 -1
  187. package/prepare-for-pr/TI-16026/user-messages/16.md +0 -1
  188. package/prepare-for-pr/TI-16026/user-messages/17.md +0 -1
  189. package/prepare-for-pr/TI-16026/user-messages/18.md +0 -10
  190. package/prepare-for-pr/TI-16026/user-messages/19.md +0 -1
  191. package/prepare-for-pr/TI-16026/user-messages/20.md +0 -1
  192. package/prepare-for-pr/TI-16026/user-messages/21.md +0 -1
  193. package/prepare-for-pr/TI-16026/user-messages/22.md +0 -1
  194. package/prepare-for-pr/TI-16026/user-messages/23.md +0 -8
  195. package/prepare-for-pr/TI-16026/user-messages/24.md +0 -24
  196. package/prepare-for-pr/TI-16026/user-question.md +0 -24
  197. package/prepare-for-pr/TI-16026/verify/metrics-check.json +0 -13
  198. package/prepare-for-pr/TI-16026/verify/redaction.json +0 -38
  199. package/prepare-for-pr/TI-16026/verify/row-closure.json +0 -45
  200. package/prepare-for-pr/TI-16026/verify/s04-ws-capture.md +0 -23
  201. package/prepare-for-pr/TI-16026/verify-after.md +0 -23
  202. package/prepare-for-pr/TI-16026/verify.json +0 -80
  203. package/prepare-for-pr/TI-16026.md +0 -408
  204. package/scripts/auto-version.js +0 -69
  205. package/scripts/auto-version.sh +0 -33
  206. package/scripts/branch-auto-npm-publish.js +0 -36
  207. package/scripts/check-version.sh +0 -36
  208. package/scripts/clean-tags.sh +0 -84
  209. package/src/api/account.js +0 -7
  210. package/src/api/otp.js +0 -5
  211. package/src/util/amount.js +0 -8
  212. package/src/util/err998SentryExtra.js +0 -26
  213. package/src/util/paramStore.js +0 -139
  214. package/src/util/socketPolicy.js +0 -57
  215. package/src/util/tokenStore.js +0 -44
  216. package/test/auth_otp_v3.test.js +0 -323
  217. package/test/auth_self_timeout.test.js +0 -171
  218. package/test/request_self.test.js +0 -288
  219. package/test/withdraw_manual_cash.test.js +0 -149
  220. package/tests/session.test.mjs +0 -177
  221. package/tests/websocket.test.mjs +0 -779
@@ -6,14 +6,13 @@ import { GAME_SEARCH } from '../util/constant.js'
6
6
  // 對應 intersectionObserver 版本
7
7
  export default function (request) {
8
8
  const { appSecret } = request.config
9
- // 不呼叫 game/logout 直接回 idle:session 已換新時,舊 session 的遊戲登出沒有意義
10
- const abandonGame = { target: 'idle', actions: 'clearGameURL' }
11
9
  return createMachine(
12
10
  {
13
11
  id: 'game',
14
12
  type: 'parallel',
15
13
  context: {
16
14
  base: '/',
15
+ batch: null,
17
16
  loadable: false,
18
17
  isLastPage: false,
19
18
  pageLoading: true,
@@ -54,7 +53,6 @@ export default function (request) {
54
53
  gameWalletType: null,
55
54
  switchGame: null,
56
55
  isPlaying: false,
57
- entry: null,
58
56
  },
59
57
  states: {
60
58
  flow: {
@@ -66,6 +64,9 @@ export default function (request) {
66
64
  SET_STATIC_DATA: {
67
65
  actions: 'setStaticData',
68
66
  },
67
+ SET_ADDITION_ENABLE: {
68
+ actions: 'setAdditionEnable',
69
+ },
69
70
  LOAD: {
70
71
  target: 'routing',
71
72
  actions: 'setLoadable',
@@ -79,23 +80,38 @@ export default function (request) {
79
80
  cond: 'isDifferentRoom',
80
81
  actions: ['setRoom', 'resetContent'],
81
82
  },
83
+ BATCH: {
84
+ target: 'batchFetching',
85
+ },
82
86
  ENTER_GAME: {
83
87
  target: 'connecting',
84
- actions: ['setGameInfo', 'setLang', 'setEntry', 'setWalletType'],
88
+ actions: ['setGameInfo', 'setLang', 'setWalletType'],
85
89
  },
86
90
  DEMO_GAME: {
87
91
  target: 'demoGame',
88
- actions: ['setGameInfo', 'setLang', 'setEntry', 'setSite'],
92
+ actions: ['setGameInfo', 'setLang', 'setSite'],
89
93
  },
90
94
  MENU_ENTER_GAME: {
91
95
  target: 'connecting',
92
- actions: ['setGameInfo', 'setLang', 'setEntry', 'setWalletType'],
96
+ actions: ['setGameInfo', 'setLang', 'setWalletType'],
93
97
  },
94
98
  UPDATE: {
95
99
  target: 'updating',
96
100
  },
97
101
  },
98
102
  },
103
+ batchFetching: {
104
+ invoke: {
105
+ src: 'batchFetch',
106
+ onDone: {
107
+ target: 'idle',
108
+ actions: 'setBatch',
109
+ },
110
+ onError: {
111
+ target: 'idle',
112
+ },
113
+ },
114
+ },
99
115
  loading: {
100
116
  entry: 'increaseIndex',
101
117
  invoke: {
@@ -162,7 +178,6 @@ export default function (request) {
162
178
  EXIT_GAME: {
163
179
  target: 'disconnect',
164
180
  },
165
- ABANDON_GAME: abandonGame,
166
181
  },
167
182
  },
168
183
  demoGame: {
@@ -181,7 +196,6 @@ export default function (request) {
181
196
  EXIT_GAME: {
182
197
  target: 'disconnect',
183
198
  },
184
- ABANDON_GAME: abandonGame,
185
199
  },
186
200
  },
187
201
  connectSwitching: {
@@ -200,7 +214,6 @@ export default function (request) {
200
214
  EXIT_GAME: {
201
215
  target: 'disconnect',
202
216
  },
203
- ABANDON_GAME: abandonGame,
204
217
  },
205
218
  },
206
219
  playing: {
@@ -208,20 +221,19 @@ export default function (request) {
208
221
  EXIT_GAME: {
209
222
  target: 'disconnect',
210
223
  },
211
- ABANDON_GAME: abandonGame,
212
224
  REFRESH: {
213
225
  target: 'refreshing',
214
226
  },
215
227
  MENU_ENTER_GAME: {
216
228
  target: 'connectSwitching',
217
- actions: ['setSwitch', 'setLang', 'setEntry', 'setWalletType'],
229
+ actions: ['setSwitch', 'setLang', 'setWalletType'],
218
230
  },
219
231
  ENTER_GAME_PAUSE: {
220
- actions: ['setIsPlaying', 'resetContent'],
232
+ actions: ['setIsPlaying', 'resetContent', 'resetSHA'],
221
233
  },
222
234
  ENTER_GAME: {
223
235
  target: 'connecting',
224
- actions: ['setGameInfo', 'setLang', 'setEntry', 'setWalletType'],
236
+ actions: ['setGameInfo', 'setLang', 'setWalletType'],
225
237
  },
226
238
  },
227
239
  },
@@ -230,13 +242,12 @@ export default function (request) {
230
242
  EXIT_GAME: {
231
243
  target: 'disconnect',
232
244
  },
233
- ABANDON_GAME: abandonGame,
234
245
  EXIT_DEMO_GAME: {
235
246
  target: 'idle',
236
247
  },
237
248
  ENTER_GAME: {
238
249
  target: 'connecting',
239
- actions: ['setGameInfo', 'setLang', 'setEntry', 'setWalletType'],
250
+ actions: ['setGameInfo', 'setLang', 'setWalletType'],
240
251
  },
241
252
  },
242
253
  },
@@ -252,9 +263,6 @@ export default function (request) {
252
263
  actions: 'setGameURL',
253
264
  },
254
265
  },
255
- on: {
256
- ABANDON_GAME: abandonGame,
257
- },
258
266
  },
259
267
  refreshPending: {
260
268
  after: {
@@ -262,9 +270,6 @@ export default function (request) {
262
270
  target: 'connecting',
263
271
  },
264
272
  },
265
- on: {
266
- ABANDON_GAME: abandonGame,
267
- },
268
273
  },
269
274
  disconnect: {
270
275
  invoke: {
@@ -279,7 +284,6 @@ export default function (request) {
279
284
  },
280
285
  },
281
286
  on: {
282
- ABANDON_GAME: abandonGame,
283
287
  LOAD: {
284
288
  target: 'routing',
285
289
  actions: 'setLoadable',
@@ -339,6 +343,11 @@ export default function (request) {
339
343
  staticData: event.data,
340
344
  }
341
345
  }),
346
+ setAdditionEnable: assign((context, event) => {
347
+ return {
348
+ additionEnable: event.data,
349
+ }
350
+ }),
342
351
  setLoadable: assign((context, event) => {
343
352
  return {
344
353
  loadable: event.data,
@@ -356,6 +365,11 @@ export default function (request) {
356
365
  room: event.data,
357
366
  }
358
367
  }),
368
+ setBatch: assign((context, event) => {
369
+ return {
370
+ batch: event.data,
371
+ }
372
+ }),
359
373
  resetContent: assign((context, event) => {
360
374
  return {
361
375
  loadable: false,
@@ -376,10 +390,6 @@ export default function (request) {
376
390
  }),
377
391
  appendContent: assign((context, event) => {
378
392
  const { room, additionEnable } = context
379
- // [防呆] 確保有 categoryId
380
- if (!room?.categoryId) {
381
- return
382
- }
383
393
  if (room.categoryId === GAME_SEARCH) {
384
394
  return
385
395
  } else if (additionEnable) {
@@ -440,7 +450,6 @@ export default function (request) {
440
450
  return event.data.gameWalletType
441
451
  },
442
452
  }),
443
- clearGameURL: assign({ type: undefined, gameToken: undefined, gameHtml: undefined, gameURL: undefined, gameWalletType: undefined }),
444
453
  setGameInfo: assign((context, event) => {
445
454
  const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name, gameName } = event.data.game
446
455
  return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name, gameName } }
@@ -452,18 +461,13 @@ export default function (request) {
452
461
  const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name, gameName } = context.switchGame
453
462
  return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name, gameName } }
454
463
  }),
455
- // 頁面刷新或深層連結時,event.data.walletType 可能為 undefined/null
456
- // 使用 ?? 確保不會覆蓋 context 中已有的 walletType,避免後端收到 selectedWalletType=null
457
464
  setWalletType: assign((context, event) => {
458
- return { walletType: event.data.walletType ?? context.walletType }
465
+ return { walletType: event.data.walletType }
459
466
  }),
460
467
  setLang: assign((context, event) => {
461
468
  const lang = event.data.locale.replace('-', '_')
462
469
  return { lang }
463
470
  }),
464
- setEntry: assign((context, event) => {
465
- return { entry: event?.data?.entrySource }
466
- }),
467
471
  setSite: assign((context, event) => {
468
472
  const site = event.data.site
469
473
  return { site }
@@ -496,18 +500,55 @@ export default function (request) {
496
500
  },
497
501
  },
498
502
  services: {
499
- getPageContent: async (context, event) => {
503
+ batchFetch: async (context, event) => {
500
504
  const { room, index, additionEnable, staticData } = context
501
- // [防呆] 確保有 categoryId
502
- if (!room?.categoryId) {
503
- return [
504
- {
505
- data: [],
506
- totalPage: 0,
507
- timestamp: context.content?.timestamp ?? null,
508
- },
509
- ]
505
+ let requestChain = null
506
+ if (!request.getToken()) {
507
+ // 如果沒 token ,id 列表去 static 找
508
+ const list = event.data.list.map((targetCategory, b) => {
509
+ return {
510
+ id: targetCategory.id,
511
+ i18n: targetCategory.i18n,
512
+ downLine: staticData
513
+ .find((item) => item.category === targetCategory.id)
514
+ .info.filter((item) => item.isGame)
515
+ .slice(0, 20),
516
+ }
517
+ })
518
+ return list.filter((item) => item.downLine.length > 0).slice(0, 6)
519
+ } else if (additionEnable) {
520
+ const param = { categoryId: room.categoryId, index, appSecret }
521
+ requestChain = event.data.list.map((category, b) => {
522
+ return request
523
+ .send(
524
+ api.getListCategory({
525
+ categoryId: category.id,
526
+ index: 0,
527
+ appSecret,
528
+ })
529
+ )
530
+ .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
531
+ })
532
+ const result = await Promise.all([...requestChain, request.send(api.getListAddition(param))])
533
+ return result.filter((item) => item.downLine.length > 0).slice(0, 6)
534
+ } else {
535
+ requestChain = event.data.list.map((category, b) => {
536
+ return request
537
+ .send(
538
+ api.getListCategory({
539
+ categoryId: category.id,
540
+ index: 0,
541
+ appSecret,
542
+ })
543
+ )
544
+ .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
545
+ })
546
+ const result = await Promise.all([...requestChain])
547
+ return result.filter((item) => item.downLine.length > 0).slice(0, 6)
510
548
  }
549
+ },
550
+ getPageContent: async (context, event) => {
551
+ const { room, index, additionEnable, staticData } = context
511
552
  if (room.categoryId === GAME_SEARCH) {
512
553
  return
513
554
  } else if (!request.getToken()) {
@@ -530,10 +571,6 @@ export default function (request) {
530
571
  },
531
572
  updatePageContent: async (context, event) => {
532
573
  const { room, content, index, additionEnable } = context
533
- // [防呆] 確保有 categoryId
534
- if (!room?.categoryId) {
535
- return []
536
- }
537
574
  if (room.categoryId === GAME_SEARCH) {
538
575
  return []
539
576
  } else if (!request.getToken()) {
@@ -571,14 +608,9 @@ export default function (request) {
571
608
  }
572
609
  },
573
610
  connectGame: async (context, event) => {
574
- // [防呆] 確保有 providerId 和 gameId(含字串 "null"/"undefined" 檢查)
575
- const { providerId, gameId } = context.game || {}
576
- if (!providerId || !gameId || providerId === 'null' || providerId === 'undefined' || gameId === 'null' || gameId === 'undefined') {
577
- return
578
- }
579
611
  const returnProviders = ['RSG', 'KP', 'EPICWIN', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
580
- const { lang, entry, isMobile, walletType } = context
581
- const { gameTypeId, mappingId } = context.game
612
+ const { lang, isMobile, walletType } = context
613
+ const { providerId, gameId, gameTypeId, mappingId } = context.game
582
614
  const params = {
583
615
  provider_id: providerId,
584
616
  game_id: gameId,
@@ -587,8 +619,7 @@ export default function (request) {
587
619
  is_demo: false,
588
620
  is_mobile: isMobile === 'mobile' ? 'y' : null,
589
621
  lang,
590
- entry_source: entry || 'Other',
591
- selected_wallet_type: walletType || null, // 統一 undefined → null,確保後端收到一致的值
622
+ selected_wallet_type: walletType,
592
623
  return_url: returnProviders.includes(providerId)
593
624
  ? `${window.location.origin}${context.base}return`
594
625
  : window.location.href?.split('?')?.[0], // For providers to return.
@@ -597,7 +628,7 @@ export default function (request) {
597
628
  return { type, gameToken, gameHtml, gameURL: redirect_url, gameWalletType: wallet_type }
598
629
  },
599
630
  demoGame: async (context, event) => {
600
- const { lang, entry, site, isMobile, game } = context
631
+ const { lang, site, isMobile, game } = context
601
632
  const { providerId, gameId, gameTypeId, mappingId } = context.game
602
633
  const params = {
603
634
  site,
@@ -607,7 +638,6 @@ export default function (request) {
607
638
  mapping_id: mappingId,
608
639
  is_mobile: isMobile === 'mobile' ? 'y' : null,
609
640
  lang,
610
- entry_source: entry || 'Other',
611
641
  appSecret,
612
642
  }
613
643
  const { type, redirect_url, gameToken, gameHtml, is_demo } = await request.send(api.demoGame(params))
@@ -0,0 +1,132 @@
1
+ import { assign, createMachine } 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
+ type: 'parallel',
10
+ context: {
11
+ tick: 6000,
12
+ isPlaying: false,
13
+ },
14
+ states: {
15
+ feed: {
16
+ initial: 'updating',
17
+ states: {
18
+ updating: {
19
+ invoke: {
20
+ src: 'fetchHonorBoardList',
21
+ onDone: {
22
+ target: 'waiting',
23
+ actions: 'setBroadcastList',
24
+ },
25
+ onError: {
26
+ target: 'waiting',
27
+ },
28
+ },
29
+ },
30
+ waiting: {
31
+ after: {
32
+ TIMEOUT: {
33
+ target: 'updating',
34
+ cond: 'isNotInGame',
35
+ },
36
+ },
37
+ },
38
+ },
39
+ },
40
+ broadcast: {
41
+ initial: 'idle',
42
+ states: {
43
+ idle: {
44
+ on: {
45
+ START_BROADCAST: {
46
+ target: 'picking',
47
+ actions: 'leaveGame',
48
+ },
49
+ },
50
+ },
51
+ picking: {
52
+ after: {
53
+ 5000: {
54
+ target: 'display',
55
+ actions: 'setBroadcast',
56
+ },
57
+ },
58
+ },
59
+ display: {
60
+ after: {
61
+ 5000: {
62
+ target: 'picking',
63
+ },
64
+ },
65
+ },
66
+ },
67
+ on: {
68
+ RESET_BROADCAST: {
69
+ target: '.idle',
70
+ actions: 'resetBroadcast',
71
+ },
72
+ },
73
+ },
74
+ },
75
+ },
76
+ {
77
+ delays: {
78
+ TIMEOUT: (context, event) => {
79
+ return context.tick * 10
80
+ },
81
+ },
82
+ actions: {
83
+ setBroadcastList: assign((context, event) => {
84
+ const broadcastList = (event.data || []).map((item) => item.data).flat()
85
+ const sortBroadcastList = broadcastList.sort((a, b) => {
86
+ if (!a.time) return -1
87
+ if (!b.time) return 1
88
+ return a.time - b.time
89
+ })
90
+ return { broadcastList: sortBroadcastList }
91
+ }),
92
+ setBroadcast: assign((context, event) => {
93
+ const { broadcastList = [], sentNormalBroadcastList = [], normalBroadcast = [] } = context
94
+ let sentNormalList = sentNormalBroadcastList
95
+ if (normalBroadcast) {
96
+ sentNormalList = [...sentNormalBroadcastList, normalBroadcast]
97
+ }
98
+ const nextNormalBroadcast = broadcastList?.find((broadcast) => {
99
+ return !sentNormalList.some((item) => item.broadcastId === broadcast.broadcastId)
100
+ })
101
+ return {
102
+ normalBroadcast: nextNormalBroadcast,
103
+ sentNormalBroadcastList: sentNormalList,
104
+ }
105
+ }),
106
+ resetBroadcast: assign((context, event) => {
107
+ return {
108
+ isPlaying: true,
109
+ normalBroadcast: null,
110
+ sentNormalBroadcastList: [],
111
+ }
112
+ }),
113
+ leaveGame: assign((context, event) => {
114
+ return {
115
+ isPlaying: false,
116
+ }
117
+ }),
118
+ },
119
+ guards: {
120
+ isNotInGame: (context, event) => {
121
+ return !context.isPlaying
122
+ },
123
+ },
124
+ services: {
125
+ fetchHonorBoardList: async (context, event) => {
126
+ const { data } = await request.send(activity.getHonorBroadcast({ isPwa: true, appSecret }))
127
+ return data
128
+ },
129
+ },
130
+ }
131
+ )
132
+ }
@@ -1,17 +1,6 @@
1
1
  import { createMachine, assign } from 'xstate'
2
2
  import activity from '../api/activity.js'
3
3
 
4
- const TAB_KEY_BY_TYPE = {
5
- CASH_RAIN: 'cashRain',
6
- DEPOSIT: 'deposit',
7
- FREE_ROULETTE_SPIN: 'roulette',
8
- JACKPOT: 'jackpot',
9
- WIN_SCORE: 'bigWin',
10
- WIN_MULTIPLIER: 'maxBet',
11
- WITHDRAW: 'withdraw',
12
- LATEST_BET: 'latestBet',
13
- }
14
-
15
4
  export default function (request) {
16
5
  const { appSecret } = request.config
17
6
  return createMachine(
@@ -28,7 +17,6 @@ export default function (request) {
28
17
  bigWin: {},
29
18
  maxBet: {},
30
19
  withdraw: {},
31
- latestBet: {},
32
20
  },
33
21
  states: {
34
22
  fetching: {
@@ -56,8 +44,24 @@ export default function (request) {
56
44
  actions: {
57
45
  setHonorBoardList: assign((context, event) => {
58
46
  return {
59
- // 後端新增的類型若尚未對應 tab key,略過以免產生 undefined tab
60
- tabs: (event.data || []).map((list) => TAB_KEY_BY_TYPE[list.type]).filter(Boolean),
47
+ tabs: (event.data || []).map((list) => {
48
+ switch (list.type) {
49
+ case 'CASH_RAIN':
50
+ return 'cashRain'
51
+ case 'DEPOSIT':
52
+ return 'deposit'
53
+ case 'FREE_ROULETTE_SPIN':
54
+ return 'roulette'
55
+ case 'JACKPOT':
56
+ return 'jackpot'
57
+ case 'WIN_SCORE':
58
+ return 'bigWin'
59
+ case 'WIN_MULTIPLIER':
60
+ return 'maxBet'
61
+ case 'WITHDRAW':
62
+ return 'withdraw'
63
+ }
64
+ }),
61
65
  cashRain: (event.data || []).find((item) => item.type === 'CASH_RAIN') || {},
62
66
  deposit: (event.data || []).find((item) => item.type === 'DEPOSIT') || {},
63
67
  roulette: (event.data || []).find((item) => item.type === 'FREE_ROULETTE_SPIN') || {},
@@ -65,7 +69,6 @@ export default function (request) {
65
69
  bigWin: (event.data || []).find((item) => item.type === 'WIN_SCORE') || {},
66
70
  maxBet: (event.data || []).find((item) => item.type === 'WIN_MULTIPLIER') || {},
67
71
  withdraw: (event.data || []).find((item) => item.type === 'WITHDRAW') || {},
68
- latestBet: (event.data || []).find((item) => item.type === 'LATEST_BET') || {},
69
72
  }
70
73
  }),
71
74
  },
@@ -223,6 +223,10 @@ export default function (request) {
223
223
  PRESET_TAB: {
224
224
  actions: ['setCurrentTab', 'hideMessage'],
225
225
  },
226
+ RESET: {
227
+ target: '.loading',
228
+ actions: 'reset',
229
+ },
226
230
  INQUIRY_ACCOUNT: {
227
231
  target: '.inquiring',
228
232
  actions: 'resetPage',
@@ -279,6 +283,14 @@ export default function (request) {
279
283
  const lang = event.data.locale || context.lang || 'en-US'
280
284
  return { lang }
281
285
  }),
286
+ reset: assign((context, event) => {
287
+ return {
288
+ currentTab: null,
289
+ inbox: {},
290
+ messageDetail: null,
291
+ currentMessage: null,
292
+ }
293
+ }),
282
294
  resetPage: assign((context, event) => {
283
295
  const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
284
296
  inbox[currentTab].page = -1
@@ -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,
@@ -37,13 +37,12 @@ export default function (request) {
37
37
  checking: {
38
38
  always: [
39
39
  { target: 'idle', actions: 'setActivityDetail', cond: 'isExist' },
40
- { target: 'loading', cond: 'hasActivityNoAndToken' },
41
- { target: 'idle' },
40
+ { target: 'loading', cond: 'hasActivityNo' },
42
41
  ],
43
42
  },
44
43
  loading: {
45
44
  invoke: {
46
- src: 'fetchActivityDetail',
45
+ src: 'fetchPublicActivityDetail',
47
46
  onDone: {
48
47
  target: 'idle',
49
48
  actions: ['setActivityMap', 'setActivityDetail'],
@@ -101,9 +100,8 @@ export default function (request) {
101
100
  const { activityMap, activityNo } = context
102
101
  return activityMap[activityNo]
103
102
  },
104
- hasActivityNoAndToken: (context, event) => {
105
- const hasToken = request.getToken()
106
- return !!context.activityNo && hasToken
103
+ hasActivityNo: (context, event) => {
104
+ return !!context.activityNo
107
105
  },
108
106
  },
109
107
  services: {
@@ -118,10 +116,15 @@ export default function (request) {
118
116
  const { data } = await request.send(hasToken ? api.getActivityList({ appSecret }) : api.getAllActivityList({ appSecret }))
119
117
  return data
120
118
  },
121
- fetchActivityDetail: async (context, event) => {
119
+ fetchPublicActivityDetail: async (context, event) => {
120
+ const hasToken = request.getToken()
122
121
  const { activityNo } = context
123
122
  let result = {}
124
- result = await request.send(api.getActivityDetail({ activityNo, appSecret }))
123
+ if (hasToken) {
124
+ result = await request.send(api.getActivityDetail({ activityNo, appSecret }))
125
+ } else {
126
+ result = await request.send(api.getTournamentDetail({ activityNo, appSecret }))
127
+ }
125
128
  return result.data
126
129
  },
127
130
  },