@jetthai/cuora 1.1.476-dev.1 → 1.1.476

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 (85) hide show
  1. package/.claude/commands/sync-ai-prompts.md +1 -88
  2. package/.claude/settings.local.json +1 -3
  3. package/.github/copilot-instructions.md +58 -68
  4. package/.husky/post-checkout +3 -3
  5. package/.husky/pre-push +1 -1
  6. package/.prettierignore +1 -2
  7. package/AGENTS.md +59 -69
  8. package/AI_PROMPT_SOURCE.md +59 -69
  9. package/CHANGELOG.md +5 -273
  10. package/CLAUDE.md +59 -69
  11. package/GEMINI.md +59 -69
  12. package/README.md +12 -11
  13. package/package.json +1 -1
  14. package/scripts/auto-version.js +0 -1
  15. package/scripts/branch-auto-npm-publish.js +2 -9
  16. package/src/api/account.js +1 -0
  17. package/src/api/activity.js +37 -0
  18. package/src/api/auth.js +31 -0
  19. package/src/api/game.js +10 -0
  20. package/src/api/payment.js +52 -1
  21. package/src/api/user.js +16 -0
  22. package/src/index.js +2 -2
  23. package/src/machine/activity/activity.js +209 -0
  24. package/src/machine/activity/activity_cash.js +0 -1
  25. package/src/machine/activity/diamond_shop_activity_cash.js +1 -0
  26. package/src/machine/activity/diamond_shop_activity_fc.js +196 -0
  27. package/src/machine/activity/diamond_shop_activity_vn.js +178 -0
  28. package/src/machine/activity/fafafa_activity.js +10 -0
  29. package/src/machine/activity/index.js +12 -0
  30. package/src/machine/activity/invite_friends_activity.js +114 -0
  31. package/src/machine/activity/mini_game_activity.js +68 -0
  32. package/src/machine/activity/return_bonus_activity.js +153 -0
  33. package/src/machine/auth.js +59 -37
  34. package/src/machine/auth_otp_v2.js +177 -0
  35. package/src/machine/auth_otp_v3.js +19 -30
  36. package/src/machine/bank_binding_amb.js +146 -0
  37. package/src/machine/bonus.js +76 -0
  38. package/src/machine/common.js +55 -0
  39. package/src/machine/deposit/amb.js +93 -0
  40. package/src/machine/deposit/crypto_bank.js +330 -0
  41. package/src/machine/deposit/crypto_qrcode.js +148 -0
  42. package/src/machine/deposit/crypto_way.js +252 -0
  43. package/src/machine/deposit/deposit_fc.js +272 -0
  44. package/src/machine/deposit/direct.js +310 -0
  45. package/src/machine/deposit/float.js +375 -0
  46. package/src/machine/deposit/index.js +28 -0
  47. package/src/machine/deposit/krway.js +151 -0
  48. package/src/machine/deposit/loadcard_vn.js +351 -0
  49. package/src/machine/deposit/manual_cash.js +8 -0
  50. package/src/machine/deposit/manual_vn.js +458 -0
  51. package/src/machine/deposit/qrcode_v2.js +338 -0
  52. package/src/machine/deposit/usdt.js +144 -0
  53. package/src/machine/deposit/virtual_bank_vn.js +269 -0
  54. package/src/machine/deposit/vpay.js +368 -0
  55. package/src/machine/game_hot_new.js +79 -0
  56. package/src/machine/game_info.js +12 -1
  57. package/src/machine/game_replay.js +46 -0
  58. package/src/machine/game_search_v2.js +401 -0
  59. package/src/machine/game_v2_1.js +89 -1
  60. package/src/machine/honor_board.js +132 -0
  61. package/src/machine/honor_board_cash.js +18 -15
  62. package/src/machine/inbox.js +12 -0
  63. package/src/machine/index.js +32 -0
  64. package/src/machine/merge.js +57 -0
  65. package/src/machine/payment_data.js +86 -0
  66. package/src/machine/promotions.js +170 -0
  67. package/src/machine/reward.js +255 -0
  68. package/src/machine/reward_cash.js +39 -0
  69. package/src/machine/reward_fc.js +98 -0
  70. package/src/machine/side.js +154 -0
  71. package/src/machine/side_v2.js +211 -0
  72. package/src/machine/user_reset_password.js +13 -0
  73. package/src/machine/user_sign_up.js +0 -3
  74. package/src/machine/vip_table.js +57 -0
  75. package/src/machine/websocket.js +4 -0
  76. package/src/machine/welcome.js +110 -0
  77. package/src/machine/withdraw/index.js +6 -0
  78. package/src/machine/withdraw/withdraw_crypto_cash.js +327 -0
  79. package/src/machine/withdraw/withdraw_krway.js +223 -0
  80. package/src/machine/withdraw/withdraw_manual.js +536 -0
  81. package/src/request/request.js +28 -0
  82. package/src/util/constant.js +1 -0
  83. package/src/util/index.js +4 -1
  84. package/src/util/math.js +4 -0
  85. package/test/auth_otp_v3.test.js +0 -192
package/CHANGELOG.md CHANGED
@@ -2,69 +2,6 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ### [1.1.476-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.476-dev.0...v1.1.476-dev.1) (2026-10-14)
6
-
7
-
8
- ### Bug Fixes
9
-
10
- * **activity:** activity_cash 明細略過(resolve null)時 setProgressSummary 不再拋錯卡死 machine ([67cd813](https://github.com/jetthai/cuora-module/commit/67cd8137f1cbb310d43d02c068ed0a896e2c6623))
11
-
12
- ### [1.1.476](https://github.com/jetthai/cuora-module/compare/v1.1.475...v1.1.476) (2026-10-13)
13
-
14
- ### [1.1.475](https://github.com/jetthai/cuora-module/compare/v1.1.473...v1.1.475) (2026-10-12)
15
-
16
- ### [1.1.476-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.473-dev.0...v1.1.476-dev.0) (2026-10-13)
17
-
18
-
19
- ### ⚠ BREAKING CHANGES
20
-
21
- * 下游在 OTP 關卡送出 OTP_VERIFIED / OTP_SKIP 後,必須在 bindBankChecking 送出
22
- BIND_BANK_DONE 或 BIND_BANK_SKIP,否則會停在此關卡。目前僅 client-pwa-cash 使用本套件。
23
-
24
- Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25
-
26
- * [JT-1784011020] feat(auth): 新增 bindBankChecking 關卡,綁銀行完成前不進入 loginSuccess ([2b26e99](https://github.com/jetthai/cuora-module/commit/2b26e99eba3d37e8f954724b53da8ee3f75bec18))
27
-
28
- ### [1.1.473-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.473...v1.1.473-dev.0) (2026-10-07)
29
-
30
- ### [1.1.472-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.472...v1.1.472-dev.2) (2026-10-01)
31
-
32
-
33
- ### ⚠ BREAKING CHANGES
34
-
35
- * **export:** 移除頂層 export util 與 Request.sourceUpdate/sourceGenerate
36
-
37
- Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
38
- * **api,machine:** 移除 39 個 api 方法、2 個常數與 14 個 machine 事件
39
-
40
- Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
41
- * **machine:** 移除公開 export machine.bonus、machine.vip_table 與 util 的 max
42
-
43
- Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
44
-
45
- ### Features
46
-
47
- * **api:** add GeeMee click-id & front-event fields to sendPixel builder ([d33e488](https://github.com/jetthai/cuora-module/commit/d33e488062f81976cff35ea43ea0f2c366a2a615))
48
- * **payment:** 恢復 setBonusSetting API ([ba1118d](https://github.com/jetthai/cuora-module/commit/ba1118dabbdd6ae5ca2b68ddf281c8dd6d67a59d))
49
-
50
-
51
- ### Bug Fixes
52
-
53
- * **activity:** activity_cash 列表與明細回應格式異常時改走 onError,避免 machine 卡死 ([fea8494](https://github.com/jetthai/cuora-module/commit/fea8494d8c0ff084f8994cb58b8f1f7e3800024a))
54
- * **error:** 讓新錯誤可覆寫舊狀態避免 SET_ERROR 鎖死 ([4113751](https://github.com/jetthai/cuora-module/commit/4113751ee6cb4ced8fe1dc2fda0ce9fbac21ec06))
55
- * **machine:** 移除三處幽靈 action 引用 ([49009da](https://github.com/jetthai/cuora-module/commit/49009dae604088b819134e0d40f7719fb8e8874d))
56
- * **otp:** confirm auto verification from user status ([b3b40d8](https://github.com/jetthai/cuora-module/commit/b3b40d8dd42d438486a2110f85564ab3d839ea72))
57
- * **otp:** require contact data before provider completion ([f70058b](https://github.com/jetthai/cuora-module/commit/f70058b6bcbbc6d048049326700a79249d043a03))
58
- * **release:** 拆分 branch/tag push 避免 tag 衝突導致 npm publish 被跳過 ([f2c4baa](https://github.com/jetthai/cuora-module/commit/f2c4baa7de0bfe50b6b0c70c5a2ed8749116d72a))
59
- * **request:** 非 public 請求缺少 token 時提前返回,不再送出後端 ([065095e](https://github.com/jetthai/cuora-module/commit/065095e31ffe1cb640f9aaf6c76bbd5c6892355c))
60
- * **request:** 非 public 請求缺少 token 時改為 reject ERR_A103,觸發登出流程 ([e46281f](https://github.com/jetthai/cuora-module/commit/e46281f3ea16679404160366e4532969c3bf02ff))
61
- * **withdraw:** 修正法幣提款計算錯誤時的狀態轉移 ([a951ba8](https://github.com/jetthai/cuora-module/commit/a951ba803cccd1564a7dbe2645ea7c8d50f7da31))
62
-
63
-
64
- * **api,machine:** 移除 39 個零呼叫端 API 與 14 個無觸發來源的 machine 事件 ([14fa754](https://github.com/jetthai/cuora-module/commit/14fa75459aba9558cde1a3485d64cbdf2f8294b2))
65
- * **export:** 移除四個無消費者的對外符號 ([55afe6f](https://github.com/jetthai/cuora-module/commit/55afe6fbfadca8944dd9820d6333ee5b93e0ed25))
66
- * **machine:** 移除 client-pwa-cash 未使用的 bonus、vip_table 與 util/max ([f49977b](https://github.com/jetthai/cuora-module/commit/f49977bfd480d961f5dc37435b3c60447eb198c0))
67
-
68
5
  ### [1.1.476](https://github.com/jetthai/cuora-module/compare/v1.1.475...v1.1.476) (2026-10-13)
69
6
 
70
7
  ### Bug Fixes
@@ -77,135 +14,27 @@ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
77
14
 
78
15
  ### [1.1.473](https://github.com/jetthai/cuora-module/compare/v1.1.472...v1.1.473) (2026-10-05)
79
16
 
80
- ### [1.1.472-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.472-dev.1...v1.1.472-dev.2) (2026-10-01)
81
-
82
-
83
- ### Bug Fixes
84
-
85
- * **otp:** confirm auto verification from user status ([b3b40d8](https://github.com/jetthai/cuora-module/commit/b3b40d8dd42d438486a2110f85564ab3d839ea72))
86
- * **otp:** require contact data before provider completion ([f70058b](https://github.com/jetthai/cuora-module/commit/f70058b6bcbbc6d048049326700a79249d043a03))
87
-
88
- ### [1.1.472-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.472-dev.0...v1.1.472-dev.1) (2026-10-01)
89
-
90
-
91
- ### Bug Fixes
92
-
93
- * **activity:** activity_cash 列表與明細回應格式異常時改走 onError,避免 machine 卡死 ([fea8494](https://github.com/jetthai/cuora-module/commit/fea8494d8c0ff084f8994cb58b8f1f7e3800024a))
94
-
95
17
  ### [1.1.472](https://github.com/jetthai/cuora-module/compare/v1.1.471...v1.1.472) (2026-09-24)
96
18
 
97
19
  ### [1.1.471](https://github.com/jetthai/cuora-module/compare/v1.1.470...v1.1.471) (2026-09-23)
98
20
 
99
- ### [1.1.472-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.471-dev.1...v1.1.472-dev.0) (2026-09-29)
100
-
101
- ### [1.1.471-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.471-dev.0...v1.1.471-dev.1) (2026-09-24)
102
-
103
- ### [1.1.471-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.470-dev.2...v1.1.471-dev.0) (2026-09-23)
104
-
105
21
  ### [1.1.470](https://github.com/jetthai/cuora-module/compare/v1.1.469...v1.1.470) (2026-09-14)
106
22
 
107
- ### [1.1.469](https://github.com/jetthai/cuora-module/compare/v1.1.468...v1.1.469) (2026-09-13)
108
-
109
- ### [1.1.470-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.470-dev.1...v1.1.470-dev.2) (2026-09-17)
110
-
111
- ### [1.1.470-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.470-dev.0...v1.1.470-dev.1) (2026-09-17)
112
-
113
- ### Features
114
-
115
- * **payment:** 恢復 setBonusSetting API ([ba1118d](https://github.com/jetthai/cuora-module/commit/ba1118dabbdd6ae5ca2b68ddf281c8dd6d67a59d))
116
-
117
- ### [1.1.470-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.468-dev.1...v1.1.470-dev.0) (2026-09-14)
118
-
119
- ### [1.1.468-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.468-dev.0...v1.1.468-dev.1) (2026-09-13)
120
-
121
- ### [1.1.468-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.468...v1.1.468-dev.0) (2026-09-12)
122
-
123
- ### [1.1.467-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.467...v1.1.467-dev.2) (2026-09-10)
124
-
125
-
126
- ### ⚠ BREAKING CHANGES
127
-
128
- * **export:** 移除頂層 export util 與 Request.sourceUpdate/sourceGenerate
129
-
130
- Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
131
- * **api,machine:** 移除 39 個 api 方法、2 個常數與 14 個 machine 事件
132
-
133
- Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
134
- * **machine:** 移除公開 export machine.bonus、machine.vip_table 與 util 的 max
135
-
136
- Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
137
-
138
- ### Features
139
-
140
- * **api:** add GeeMee click-id & front-event fields to sendPixel builder ([d33e488](https://github.com/jetthai/cuora-module/commit/d33e488062f81976cff35ea43ea0f2c366a2a615))
141
-
142
-
143
- ### Bug Fixes
144
-
145
- * **auth:** 清除站台已停用登入方式殘留的記住帳號 ([2c6b965](https://github.com/jetthai/cuora-module/commit/2c6b96572108cfc977d7dc99635adebbee01db46))
146
- * **error:** 讓新錯誤可覆寫舊狀態避免 SET_ERROR 鎖死 ([4113751](https://github.com/jetthai/cuora-module/commit/4113751ee6cb4ced8fe1dc2fda0ce9fbac21ec06))
147
- * **machine:** user_sign_up 的 registrationData 補上 agentId ([833e8c9](https://github.com/jetthai/cuora-module/commit/833e8c90c0ff554cff651bdb7045ed514d42035e))
148
- * **machine:** 移除三處幽靈 action 引用 ([49009da](https://github.com/jetthai/cuora-module/commit/49009dae604088b819134e0d40f7719fb8e8874d))
149
- * **release:** 拆分 branch/tag push 避免 tag 衝突導致 npm publish 被跳過 ([f2c4baa](https://github.com/jetthai/cuora-module/commit/f2c4baa7de0bfe50b6b0c70c5a2ed8749116d72a))
150
- * **request:** 非 public 請求缺少 token 時提前返回,不再送出後端 ([065095e](https://github.com/jetthai/cuora-module/commit/065095e31ffe1cb640f9aaf6c76bbd5c6892355c))
151
- * **request:** 非 public 請求缺少 token 時改為 reject ERR_A103,觸發登出流程 ([e46281f](https://github.com/jetthai/cuora-module/commit/e46281f3ea16679404160366e4532969c3bf02ff))
152
- * **withdraw:** 修正法幣提款計算錯誤時的狀態轉移 ([a951ba8](https://github.com/jetthai/cuora-module/commit/a951ba803cccd1564a7dbe2645ea7c8d50f7da31))
153
-
154
-
155
- * **api,machine:** 移除 39 個零呼叫端 API 與 14 個無觸發來源的 machine 事件 ([14fa754](https://github.com/jetthai/cuora-module/commit/14fa75459aba9558cde1a3485d64cbdf2f8294b2))
156
- * **export:** 移除四個無消費者的對外符號 ([55afe6f](https://github.com/jetthai/cuora-module/commit/55afe6fbfadca8944dd9820d6333ee5b93e0ed25))
157
- * **machine:** 移除 client-pwa-cash 未使用的 bonus、vip_table 與 util/max ([f49977b](https://github.com/jetthai/cuora-module/commit/f49977bfd480d961f5dc37435b3c60447eb198c0))
158
-
159
- ### [1.1.467-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.467-dev.1...v1.1.467-dev.2) (2026-09-10)
160
-
161
-
162
23
  ### Bug Fixes
163
24
 
164
- * **machine:** user_sign_up 的 registrationData 補上 agentId ([833e8c9](https://github.com/jetthai/cuora-module/commit/833e8c90c0ff554cff651bdb7045ed514d42035e))
165
-
166
- ### [1.1.467-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.467-dev.0...v1.1.467-dev.1) (2026-09-09)
167
-
168
-
169
- ### ⚠ BREAKING CHANGES
25
+ - **machine:** user_sign_up 的 registrationData 補上 agentId ([833e8c9](https://github.com/jetthai/cuora-module/commit/833e8c90c0ff554cff651bdb7045ed514d42035e))
170
26
 
171
- * **export:** 移除頂層 export util 與 Request.sourceUpdate/sourceGenerate
172
-
173
- Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
174
- * **api,machine:** 移除 39 個 api 方法、2 個常數與 14 個 machine 事件
175
-
176
- Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
177
- * **machine:** 移除公開 export machine.bonus、machine.vip_table 與 util 的 max
178
-
179
- Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
27
+ ### [1.1.469](https://github.com/jetthai/cuora-module/compare/v1.1.468...v1.1.469) (2026-09-13)
180
28
 
181
29
  ### Bug Fixes
182
30
 
183
- * **machine:** 移除三處幽靈 action 引用 ([49009da](https://github.com/jetthai/cuora-module/commit/49009dae604088b819134e0d40f7719fb8e8874d))
184
-
185
-
186
- * **api,machine:** 移除 39 個零呼叫端 API 與 14 個無觸發來源的 machine 事件 ([14fa754](https://github.com/jetthai/cuora-module/commit/14fa75459aba9558cde1a3485d64cbdf2f8294b2))
187
- * **export:** 移除四個無消費者的對外符號 ([55afe6f](https://github.com/jetthai/cuora-module/commit/55afe6fbfadca8944dd9820d6333ee5b93e0ed25))
188
- * **machine:** 移除 client-pwa-cash 未使用的 bonus、vip_table 與 util/max ([f49977b](https://github.com/jetthai/cuora-module/commit/f49977bfd480d961f5dc37435b3c60447eb198c0))
189
-
190
- ### [1.1.467-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.467...v1.1.467-dev.0) (2026-09-09)
191
-
192
- ### [1.1.466-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.466...v1.1.466-dev.0) (2026-09-06)
31
+ - **auth:** 清除站台已停用登入方式殘留的記住帳號 ([2c6b965](https://github.com/jetthai/cuora-module/commit/2c6b96572108cfc977d7dc99635adebbee01db46))
193
32
 
33
+ ### [1.1.468](https://github.com/jetthai/cuora-module/compare/v1.1.467...v1.1.468) (2026-09-11)
194
34
 
195
35
  ### Features
196
36
 
197
- * **api:** add GeeMee click-id & front-event fields to sendPixel builder ([d33e488](https://github.com/jetthai/cuora-module/commit/d33e488062f81976cff35ea43ea0f2c366a2a615))
198
- * **payment:** 新增 getPaymentPromotions API 描述符 ([0319692](https://github.com/jetthai/cuora-module/commit/03196925d989333e4bdb11cd933c18b6ace65d83))
199
-
200
-
201
- ### Bug Fixes
202
-
203
- * **auth:** 清除站台已停用登入方式殘留的記住帳號 ([2c6b965](https://github.com/jetthai/cuora-module/commit/2c6b96572108cfc977d7dc99635adebbee01db46))
204
- * **error:** 讓新錯誤可覆寫舊狀態避免 SET_ERROR 鎖死 ([4113751](https://github.com/jetthai/cuora-module/commit/4113751ee6cb4ced8fe1dc2fda0ce9fbac21ec06))
205
- * **release:** 拆分 branch/tag push 避免 tag 衝突導致 npm publish 被跳過 ([f2c4baa](https://github.com/jetthai/cuora-module/commit/f2c4baa7de0bfe50b6b0c70c5a2ed8749116d72a))
206
- * **request:** 非 public 請求缺少 token 時提前返回,不再送出後端 ([065095e](https://github.com/jetthai/cuora-module/commit/065095e31ffe1cb640f9aaf6c76bbd5c6892355c))
207
- * **request:** 非 public 請求缺少 token 時改為 reject ERR_A103,觸發登出流程 ([e46281f](https://github.com/jetthai/cuora-module/commit/e46281f3ea16679404160366e4532969c3bf02ff))
208
- * **withdraw:** 修正法幣提款計算錯誤時的狀態轉移 ([a951ba8](https://github.com/jetthai/cuora-module/commit/a951ba803cccd1564a7dbe2645ea7c8d50f7da31))
37
+ - **payment:** 新增 getPaymentPromotions API 描述符 ([0319692](https://github.com/jetthai/cuora-module/commit/03196925d989333e4bdb11cd933c18b6ace65d83))
209
38
 
210
39
  ### [1.1.467](https://github.com/jetthai/cuora-module/compare/v1.1.466...v1.1.467) (2026-09-06)
211
40
 
@@ -215,74 +44,15 @@ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
215
44
 
216
45
  ### [1.1.466](https://github.com/jetthai/cuora-module/compare/v1.1.465...v1.1.466) (2026-08-31)
217
46
 
218
- ### [1.1.465-dev.4](https://github.com/jetthai/cuora-module/compare/v1.1.465-dev.3...v1.1.465-dev.4) (2026-08-24)
219
-
220
-
221
- ### Bug Fixes
222
-
223
- * **auth:** 清除站台已停用登入方式殘留的記住帳號 ([2c6b965](https://github.com/jetthai/cuora-module/commit/2c6b96572108cfc977d7dc99635adebbee01db46))
224
-
225
- ### [1.1.465-dev.3](https://github.com/jetthai/cuora-module/compare/v1.1.465-dev.2...v1.1.465-dev.3) (2026-08-19)
226
-
227
-
228
- ### Bug Fixes
229
-
230
- * **release:** 拆分 branch/tag push 避免 tag 衝突導致 npm publish 被跳過 ([f2c4baa](https://github.com/jetthai/cuora-module/commit/f2c4baa7de0bfe50b6b0c70c5a2ed8749116d72a))
231
-
232
- ### [1.1.465-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.465-dev.1...v1.1.465-dev.2) (2026-08-19)
233
-
234
- ### [1.1.465-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.465-dev.0...v1.1.465-dev.1) (2026-08-19)
235
-
236
-
237
- ### Features
238
-
239
- * **payment:** 新增 getPaymentPromotions API 描述符 ([0319692](https://github.com/jetthai/cuora-module/commit/03196925d989333e4bdb11cd933c18b6ace65d83))
240
-
241
47
  ### [1.1.465](https://github.com/jetthai/cuora-module/compare/v1.1.464...v1.1.465) (2026-08-17)
242
48
 
243
49
  ### [1.1.464](https://github.com/jetthai/cuora-module/compare/v1.1.463...v1.1.464) (2026-08-16)
244
50
 
245
- ### [1.1.465-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.463-dev.3...v1.1.465-dev.0) (2026-08-17)
246
-
247
- ### [1.1.465](https://github.com/jetthai/cuora-module/compare/v1.1.464...v1.1.465) (2026-08-17)
248
-
249
- ### [1.1.463-dev.3](https://github.com/jetthai/cuora-module/compare/v1.1.463-dev.2...v1.1.463-dev.3) (2026-08-17)
250
-
251
- ### [1.1.464](https://github.com/jetthai/cuora-module/compare/v1.1.463...v1.1.464) (2026-08-16)
252
-
253
-
254
51
  ### Bug Fixes
255
52
 
256
53
  - **deposit:** 切換存款活動不再重設使用者已選的通道 ([b9c1de2](https://github.com/jetthai/cuora-module/commit/b9c1de2f3665c56f52d7b074e892837e836d02fa))
257
54
  - **user_sign_up:** 明確輸入判定改用 !== undefined,修復三層解析成為死碼 ([770450e](https://github.com/jetthai/cuora-module/commit/770450e6065d42d497504d2f8630c6740ec1e7c4))
258
55
 
259
- ### [1.1.463-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.463-dev.1...v1.1.463-dev.2) (2026-08-16)
260
-
261
-
262
- ### Bug Fixes
263
-
264
- * **deposit:** 切換存款活動不再重設使用者已選的通道 ([b9c1de2](https://github.com/jetthai/cuora-module/commit/b9c1de2f3665c56f52d7b074e892837e836d02fa))
265
-
266
- ### [1.1.463-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.463-dev.0...v1.1.463-dev.1) (2026-08-13)
267
-
268
- ### [1.1.463-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.463...v1.1.463-dev.0) (2026-08-13)
269
-
270
- ### [1.1.455-dev.8](https://github.com/jetthai/cuora-module/compare/v1.1.455...v1.1.455-dev.8) (2026-08-09)
271
-
272
-
273
- ### Features
274
-
275
- * **api:** add GeeMee click-id & front-event fields to sendPixel builder ([d33e488](https://github.com/jetthai/cuora-module/commit/d33e488062f81976cff35ea43ea0f2c366a2a615))
276
-
277
-
278
- ### Bug Fixes
279
-
280
- * **error:** 讓新錯誤可覆寫舊狀態避免 SET_ERROR 鎖死 ([4113751](https://github.com/jetthai/cuora-module/commit/4113751ee6cb4ced8fe1dc2fda0ce9fbac21ec06))
281
- * **request:** 非 public 請求缺少 token 時提前返回,不再送出後端 ([065095e](https://github.com/jetthai/cuora-module/commit/065095e31ffe1cb640f9aaf6c76bbd5c6892355c))
282
- * **request:** 非 public 請求缺少 token 時改為 reject ERR_A103,觸發登出流程 ([e46281f](https://github.com/jetthai/cuora-module/commit/e46281f3ea16679404160366e4532969c3bf02ff))
283
- * **user_sign_up:** 明確輸入判定改用 !== undefined,修復三層解析成為死碼 ([770450e](https://github.com/jetthai/cuora-module/commit/770450e6065d42d497504d2f8630c6740ec1e7c4))
284
- * **withdraw:** 修正法幣提款計算錯誤時的狀態轉移 ([a951ba8](https://github.com/jetthai/cuora-module/commit/a951ba803cccd1564a7dbe2645ea7c8d50f7da31))
285
-
286
56
  ### [1.1.463](https://github.com/jetthai/cuora-module/compare/v1.1.462...v1.1.463) (2026-08-12)
287
57
 
288
58
  ### [1.1.462](https://github.com/jetthai/cuora-module/compare/v1.1.461...v1.1.462) (2026-08-10)
@@ -299,44 +69,6 @@ Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
299
69
 
300
70
  ### [1.1.456](https://github.com/jetthai/cuora-module/compare/v1.1.455...v1.1.456) (2026-08-09)
301
71
 
302
- ### [1.1.455-dev.8](https://github.com/jetthai/cuora-module/compare/v1.1.455-dev.7...v1.1.455-dev.8) (2026-08-09)
303
-
304
- ### [1.1.455-dev.7](https://github.com/jetthai/cuora-module/compare/v1.1.455-dev.6...v1.1.455-dev.7) (2026-08-07)
305
-
306
- ### [1.1.455-dev.6](https://github.com/jetthai/cuora-module/compare/v1.1.455-dev.5...v1.1.455-dev.6) (2026-08-07)
307
-
308
- ### [1.1.455-dev.5](https://github.com/jetthai/cuora-module/compare/v1.1.455-dev.4...v1.1.455-dev.5) (2026-08-07)
309
-
310
- ### [1.1.455-dev.4](https://github.com/jetthai/cuora-module/compare/v1.1.455-dev.3...v1.1.455-dev.4) (2026-08-07)
311
-
312
- ### [1.1.455-dev.3](https://github.com/jetthai/cuora-module/compare/v1.1.455-dev.2...v1.1.455-dev.3) (2026-08-07)
313
-
314
- ### [1.1.455-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.455-dev.1...v1.1.455-dev.2) (2026-08-06)
315
-
316
- ### [1.1.455-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.455-dev.0...v1.1.455-dev.1) (2026-08-04)
317
-
318
-
319
- ### Bug Fixes
320
-
321
- - **user_sign_up:** 明確輸入判定改用 !== undefined,修復三層解析成為死碼 ([770450e](https://github.com/jetthai/cuora-module/commit/770450e6065d42d497504d2f8630c6740ec1e7c4))
322
-
323
- ### [1.1.455-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.455...v1.1.455-dev.0) (2026-08-04)
324
-
325
- ### [1.1.454-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.453...v1.1.454-dev.0) (2026-07-29)
326
-
327
-
328
- ### Features
329
-
330
- - **api:** add GeeMee click-id & front-event fields to sendPixel builder ([d33e488](https://github.com/jetthai/cuora-module/commit/d33e488062f81976cff35ea43ea0f2c366a2a615))
331
-
332
-
333
- ### Bug Fixes
334
-
335
- - **error:** 讓新錯誤可覆寫舊狀態避免 SET_ERROR 鎖死 ([4113751](https://github.com/jetthai/cuora-module/commit/4113751ee6cb4ced8fe1dc2fda0ce9fbac21ec06))
336
- - **request:** 非 public 請求缺少 token 時提前返回,不再送出後端 ([065095e](https://github.com/jetthai/cuora-module/commit/065095e31ffe1cb640f9aaf6c76bbd5c6892355c))
337
- - **request:** 非 public 請求缺少 token 時改為 reject ERR_A103,觸發登出流程 ([e46281f](https://github.com/jetthai/cuora-module/commit/e46281f3ea16679404160366e4532969c3bf02ff))
338
- - **withdraw:** 修正法幣提款計算錯誤時的狀態轉移 ([a951ba8](https://github.com/jetthai/cuora-module/commit/a951ba803cccd1564a7dbe2645ea7c8d50f7da31))
339
-
340
72
  ### [1.1.455](https://github.com/jetthai/cuora-module/compare/v1.1.453...v1.1.455) (2026-08-03)
341
73
 
342
74
  ### Bug Fixes
package/CLAUDE.md CHANGED
@@ -55,7 +55,7 @@ Before delivering any code change, verify each of the following yourself:
55
55
  - [ ] **Follows existing conventions**: clear four-layer separation, XState v4 factory pattern (`export default function (request) { return createMachine(...) }`), naming conventions, no TypeScript
56
56
  - [ ] **Correct API descriptor object**: returns the `{ url, method, params?, isPublic?, headers?, isFormData?, silent? }` structure; HTTP method consistently lowercase; `isPublic: true` endpoints checked for whether they need `appSecret`; URLs carry no leading slash (unless deliberately bypassing `url-join`'s `baseURL`, in which case comment the reason)
57
57
  - [ ] **V1→V2 path conversion**: new V2 endpoints must be added to `supportVersion2List` **manually**; use the `:param` form for dynamic parameters; put non-standard paths in the `specifyingPath` mapping
58
- - [ ] **State machine conventions**: always modify context via `assign()`, never mutate directly; clone deep objects with `JSON.parse(JSON.stringify())`; choose the initial state name by semantics; don't let `onError` silently fall back to `idle` and lose the error information; validate response shapes inside the service and reject there — never throw inside `assign()`
58
+ - [ ] **State machine conventions**: always modify context via `assign()`, never mutate directly; clone deep objects with `JSON.parse(JSON.stringify())`; choose the initial state name by semantics; don't let `onError` silently fall back to `idle` and lose the error information
59
59
  - [ ] **Memory safety**: `setInterval` / `socket.on()` / `addEventListener` registered inside an XState callback service **must return a cleanup function** (e.g. `() => clientSocket.off(event, handler)`) to avoid accumulating listeners across reconnects; listeners registered inside a Promise must also be cleaned up after resolve / reject
60
60
  - [ ] **Token lifecycle**: token operations go through `getToken()` and the `extendToken` action, never bypass the interceptor to inject manually; prefer the existing TTL constants; when `fetchUserInfo` fails, let the session terminate naturally rather than retrying on your own
61
61
  - [ ] **Error handling**: forward through `request.errorHandler` to the error machine, with correct branches for each special code (see "Error Code System")
@@ -99,9 +99,7 @@ state machine service → request.send(api.xxx(params)) → Request class → AP
99
99
  | Request | `src/request/` | Token injection, V1→V2 path conversion, maintenance-mode detection, custom serialization, request cancellation |
100
100
  | API | `src/api/` | Each function returns a **request descriptor object** (it does not send the request) |
101
101
  | Machine | `src/machine/` | XState v4 state machines, factory pattern receiving `request` |
102
- | Util | `src/util/` | storage (with `maxAge` TTL), constant, err998SentryExtra |
103
-
104
- > **deviceToken does not live in this package**: `auth.js` / `user_sign_up.js` obtain the device token by calling `request.config.getDt?.()` — the implementation is injected by the downstream frontend when it constructs `request`; this package only calls it. Whether it is called is decided by `siteConfig.dtVerify` (login flow) or the `deviceTokenEnable` context (registration flow); when nothing is injected, `?.()` returns `undefined` instead of throwing.
102
+ | Util | `src/util/` | storage (with `maxAge` TTL), deviceToken, constant, math |
105
103
 
106
104
  **API descriptor object structure**:
107
105
 
@@ -181,49 +179,52 @@ Token 5min TTL → fetchUserInfo success → extendToken resets TTL → poll aga
181
179
 
182
180
  **Polling interval**: base `tick: 2000ms`, **multiplied by 5 while in a game** (becoming 10 seconds) to reduce server load during play.
183
181
 
184
- **Login method routing** (5 kinds; `LOGIN_TOKEN` additionally follows the token recovery path described above):
182
+ **Login method routing** (7 kinds):
185
183
 
186
184
  | Event | Method | Special Handling |
187
185
  | ---------------- | -------------------- | --------------------------------------------------------------- |
188
186
  | `LOGIN_ID` | Account + password | reCAPTCHA header |
189
187
  | `LOGIN_PHONE` | Phone number | reCAPTCHA header + country code |
190
188
  | `LOGIN_EMAIL` | Email | reCAPTCHA header |
189
+ | `LOGIN_LOCAL` | Local account | Additionally stores `cuora_tempuser` (24h TTL) |
190
+ | `LOGIN_GUEST` | Guest | No auth credentials |
191
+ | `LOGIN_APP` | OAuth App | provider + accessToken |
191
192
  | `LOGIN_TELEGRAM` | Telegram | additionalUserInfo |
192
193
  | `LOGIN_3PARTY` | Third-party redirect | **Does not switch state**; uses `window.location.href` directly |
193
194
 
194
- **OTP / bind-bank flow**: after a successful login it enters `otpChecking`; `OTP_VERIFIED` or `OTP_SKIP` moves it to `bindBankChecking`, and only `BIND_BANK_DONE` or `BIND_BANK_SKIP` proceeds to `loginSuccess` (either gate accepts `LOGOUT` to abort). Whether binding is required is decided by the downstream frontend; the machine only waits — **downstream must send one of these events in `bindBankChecking`, or the session stalls there**. The `tokenAuthenticated` path skips both gates.
195
+ **OTP flow**: after a successful login it enters `otpChecking`, and only proceeds to `loginSuccess` after an `OTP_VERIFIED` or `OTP_SKIP` event.
195
196
 
196
197
  **Account persistence**: the most recently used login account is stored in localStorage (31-day TTL) for form auto-fill. **Token expiration does not affect the account record.** However, `pruneRememberedAccounts`, which runs after `fetchSiteConfig` succeeds, **compares against `siteConfig.loginMethods` and clears the leftover account for any disabled login method** (`phone` clears the country code along with it) — fetching configuration, an apparently read-only action, carries the side effect of deleting from localStorage. The purpose is to prevent downstream frontends from back-filling a stale value into an input whose type has since changed after the backend disables a login method. When `loginMethods` is missing entirely, nothing is cleared, to avoid wiping everything by mistake.
197
198
 
198
199
  ### 2.2 Canonical Deposit Pattern
199
200
 
200
- Every machine currently under `src/machine/deposit/` is cash-site specific (`*_cash.js`); **the Non-Cash versions no longer live in this package**. All deposit state machines follow a unified core flow, with variants per payment method:
201
+ All deposit state machines follow a unified core flow, with variants per payment method:
201
202
 
202
203
  ```
203
- loading (always + setInitData: takes paymentDetail from the factory context parameter and filters this category's payment methods)
204
- → checking (invoke to fetch secondary data such as bank/network lists)
205
- → debouncing (entry clears calculation, after 1000ms debounce)
206
- → calculating (calls getDepositExpectedResult) → calculated (shows the calculation result)
207
- → loaded (the resting state when calculation isn't possible, waiting for the user to complete the options)
208
- → submitting → submitted
204
+ loading (fetch siteConfig + bankList in parallel)
205
+ → promotion (routing: has a minimum deposit → calculating, none → loaded)
206
+ → loaded (user selects bank/amount)
207
+ → debouncing (CALCULATE event, 1000ms debounce)
208
+ → calculating (calls getDepositExpectedResult)
209
+ → loaded/calculated (show the calculation result)
210
+ → submitting → submitted
209
211
  ```
210
212
 
211
- **Structural traits shared by the Cash machines** (differing from ordinary state machines — easy to trip on):
212
-
213
- | Aspect | Convention |
214
- | ------------- | ----------------------------------------------------------------------------------------------------------------- |
215
- | Constructor | `(request, context) => createMachine()` — initial data is **preloaded by the caller**, not fetched by the machine |
216
- | loading phase | `always` transitions immediately, with no async request |
217
- | Global events | `internal: false` (forces external transitions, ensuring entry/exit re-run) |
218
- | Debounce | `debouncing` uses `after: { 1000 }` + `cond`, not a separate CALCULATE event |
213
+ **Cash vs Non-Cash variants**:
219
214
 
220
- **Promotion**: the `SET_PROMOTION` global event sets the promotion context; most machines pair it with an `isPromotionChanged` guard to avoid re-running on an identical value. `direct_cash.js` additionally has `bankMap`, caching bank lists keyed by method.
215
+ | Aspect | Non-Cash (e.g. `direct.js`) | Cash (e.g. `direct_cash.js`) |
216
+ | ------------- | ---------------------------------------- | ----------------------------------------------- |
217
+ | Constructor | `(request) => createMachine()` | `(request, context) => createMachine()` |
218
+ | Initial data | Fetched asynchronously (init → fetching) | Preloaded via the context parameter |
219
+ | loading phase | Two sub-states (init + fetching) | `always` jumps straight to checking |
220
+ | Global events | `internal: true` (default) | `internal: false` (forces external transitions) |
221
+ | Bank list | Re-fetched every time | `bankMap` cache (keyed by method) |
221
222
 
222
- > ⚠️ **`promotionsNo` vs `activityNo` (easy to trip on)**: the **deposit** flow's promotion always uses `promotion?.promotionsNo` (all 7 deposit machines and `api/payment.js` do); the **activity system** uses `activityNo`. They are different fields and are not interchangeable.
223
+ **Promotion & Bonus preview**: the `SET_PROMOTION` global event sets the promotion context; if `siteConfig.bonusPreviewEnable === true` and `promotion.activityNo !== 'none'`, `getBonusPreview` is additionally called.
223
224
 
224
- > ℹ️ `getBonusPreview` in `api/payment.js` (whose parameter is `promotionsNo`) currently has **no machine calling it**, and `siteConfig.bonusPreviewEnable` is no longer referenced anywhere in this package. Wiring bonus preview back up has to be done by hand.
225
+ > ⚠️ **Naming inconsistency (easy to trip on)**: Non-Cash uses `promotion?.activityNo`, Cash uses `promotion?.promotionsNo`.
225
226
 
226
- **resultMap cache** (`usdt_cash.js`): caches keyed by `selectedNetwork.value` to avoid re-fetching the same network address.
227
+ **resultMap cache** (`usdt.js`, `usdt_cash.js`): caches keyed by `selectedNetwork.value` to avoid re-fetching the same network address.
227
228
 
228
229
  > ⚠️ **V2 API response format is inconsistent**: the same endpoint may return `{ data: {...} }` or just `{...}`, so every machine needs defensive handling:
229
230
  >
@@ -233,39 +234,27 @@ loading (always + setInitData: takes paymentDetail from the factory context para
233
234
  > return { calculation: data || event.data }
234
235
  > })
235
236
  > ```
236
- >
237
- > This pattern assumes `event.data` is always an object; `send()` may resolve `undefined`, and destructuring it inside an assign throws and stalls the machine (see item 13 of 2.9).
238
237
 
239
- **processing state check**: `manual_cash.js` and `virtual_bank_cash.js` use an `isProcessing` guard to check whether there is an in-progress deposit order, and if so jump straight to `submitted` to prevent duplicate submission.
238
+ **processing state check**: `crypto_bank.js` and `manual_cash.js` check at initialization whether there is an in-progress deposit order, and if so jump straight to `submitted` to prevent duplicate submission.
240
239
 
241
240
  ### 2.3 Withdrawal Flow & OTP
242
241
 
243
- `src/machine/withdraw/` contains only one machine, `withdraw_manual_cash.js`. Main flow:
242
+ **Five-step eligibility validation chain** (`withdraw_manual.js`); failing any step transitions to the corresponding blocking state:
244
243
 
245
244
  ```
246
- loading (fetchInitData: double-wallet rule gate + getBindingPaymentInfo + getPendingOrder)
247
- → checking (always: isProcessing → submitted, otherwise loaded)
248
- → loaded ──SET_AMOUNT──▶ debouncing (always: isSubmittable → calculated, otherwise back to loaded)
249
- → calculated → submitting / submitting_crypto
250
- → isOtpRequired → otp (parallel state)
251
- → otherwise → submitted
245
+ 1. haveProcessing → is there a withdrawal in progress? (yes → inProcessing)
246
+ 2. isBankNotBound → is a bank account bound? (no → unbound)
247
+ 3. isNotWithdrawMinDepositAmount → is the minimum deposit threshold met?
248
+ 4. isPassWithdrawCooldownTime → still within the cooldown?
249
+ 5. isNotWIthdrawServiceTime → within the service window?
250
+ All passed → withdrawable
252
251
  ```
253
252
 
254
- There are only 4 guards: `hasNoBank` (`REFRESH` only reloads when no account is bound), `isProcessing`, `isSubmittable` (amount > 0 and within `currentPayment.minimum`–`maximum`), and `isOtpRequired`. `userBanks` is `bankList` + `ewalletList` + `cryptoList` flattened together, with the first entry selected by default.
255
-
256
- **Double-wallet withdrawal rule gate** (`doubleWalletWithdrawLimitCheck` — the least intuitive part; the point is to save API calls):
257
-
258
- | Value | Behavior |
259
- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
260
- | `'0'` | Fetch only the CASH `withdrawRule` |
261
- | `'1'` | Fetch only the ACTIVITY `withdrawRule`; regardless of whether it qualifies, the CASH rule takes no part in the gate |
262
- | `'2'` | Fetch ACTIVITY first; if **not withdrawable**, adopt it directly (skipping CASH); only when it **qualifies** does it go on to fetch CASH as the basis |
263
-
264
- `enableWithdraw` deliberately uses a truthy comparison (`!activityRule?.enableWithdraw`) to align with client-pwa-ssr, avoiding misjudgment when the backend returns a non-boolean truthy value such as `1`.
253
+ **OTP parallel states**: after a withdrawal is submitted, if the response contains `request_id` plus `number`/`email`, it enters OTP verification. `countdown` (decrementing the TTL each second) and `verification` (`idle → acknowledging → submitted`) run **in parallel**, so the countdown does not block verification actions.
265
254
 
266
- **OTP parallel states**: `isOtpRequired` **only looks at whether the response contains `request_id`** (`number` / `email` are used purely for display). Once entered, the `countdown` and `verification` sub-states run **in parallel**, so the countdown does not block verification actions. Within `verification`, `idle` can branch to `acknowledging` (on success, exits OTP to the top-level `submitted`) or `reset` (resend; on success, returns to `idle` with a new `requestId`/`ttl`); the `BACK` event returns directly to the top-level `calculated`. `ttl` is in **milliseconds**, and `decreaseTtl` applies `Math.max(ttl - 1000, 0)` every second.
255
+ **Withdrawal rules system**: the `withdrawRules` array is matched against the balance, using `findLastIndex` to find the **last** matching rule (the highest amount tier), which determines `maxWithdrawAmount`.
267
256
 
268
- > ℹ️ `restore` in `api/payment.js` (bonus / free-credit redemption) currently has **no machine calling it**.
257
+ **Attachment types**: `withdraw` (normal withdrawal) vs `pool` (bonus / free-credit redemption, which calls the `restore` API).
269
258
 
270
259
  ### 2.4 Game Management
271
260
 
@@ -281,11 +270,11 @@ There are only 4 guards: `hasNoBank` (`REFRESH` only reloads when no account is
281
270
 
282
271
  **receiveStatus enum**: `0` in progress / not yet eligible (→ `progress_status`), `1` claimed (→ `received`, terminal), `2` claimable (→ `receiveable`).
283
272
 
284
- **Red-dot unread state** (`activity_cash.js`):
273
+ **Red-dot unread state**:
285
274
 
286
- - The read state is stored in localStorage under the key `unread_${activityNo}_${uidSite}`; **when the key is absent, `unread` defaults to `true`** (a new activity always shows a red dot)
275
+ - `noRedActivity = [2, 4, 13, 20, 90, 91, 92]` — these activity types **never show a red dot**
276
+ - For other activities the read state is stored in localStorage under the key `unread_${activityNo}_${uidSite}`
287
277
  - Whenever `activityList` is updated, **clone the whole array** to avoid direct mutation
288
- - The old `noRedActivity` type allowlist **no longer exists**; today every activity type is treated the same
289
278
 
290
279
  **Activity polling**: base interval `tick * 10 = 20 seconds`; **polling pauses while in a game (`isPlaying === true`)**. Fetching promotions additionally requires `hasToken`.
291
280
 
@@ -317,9 +306,10 @@ io(`${socketURL}/frontend`, {
317
306
 
318
307
  ### 2.7 Configuration & Live Info (Common Machine)
319
308
 
320
- **3 parallel sub-machines**: `config` (siteConfig + layoutConfig, event-triggered), `feed` (feeds + mailbox + promotions, 20-second polling), and `getAnnouncements` (event-triggered).
309
+ **4 parallel sub-machines**: `config` (siteConfig + layoutConfig, event-triggered), `feed` (feeds + mailbox + promotions, 20-second polling), `getAnnouncements` (event-triggered), and `broadcast` (switching every 5 seconds).
321
310
 
322
311
  - **siteConfig decoding**: the response is an encoded string; the `setConfig` action base64-decodes it to obtain the actual configuration (`loginMethods`, `paymentMethods`, `csChat`, etc.). **The downstream frontends' stores do not decode it a second time.**
312
+ - **Broadcast rotation**: `picking` (5s) → `display` (5s) → `picking`, selecting `type === '0'` entries from `broadcastList`; already-shown items are added to `sentNormalBroadcastList` and not repeated
323
313
  - **Mailbox filtering**: if `customerMessageEnable === false`, the count of CUSTOMER-type messages is deducted from the mailbox total
324
314
 
325
315
  ### 2.8 API Request Lifecycle
@@ -358,7 +348,6 @@ io(`${socketURL}/frontend`, {
358
348
  10. **`isMobile` is a string, not a boolean**: in `common.js`, `isMobile = userAgent?.device?.type` returns `'mobile'`/`'tablet'`/`undefined`, so comparisons must be string-based (e.g. `isMobile === 'mobile' ? 'y' : null`).
359
349
  11. **Requests carry no CancelToken by default**: the cancellation feature of `send(req, customToken)` is **opt-in**. In axios <0.22 the cancel handler is never unsubscribed — a shared long-lived token accumulates one handler per request, causing overnight OOM when left running (TI-15555). **Do not "helpfully" add the CancelToken back onto the shared path.**
360
350
  12. **`silent: true` only skips errorHandler**: the error is still thrown to the caller's `onError`, and `ERR_F108` is still routed as usual; but every other error code — **including logout-class codes such as `ERR_A104`, and `ERR_G106` insufficient balance** — never reaches the error machine. Use it only for background requests whose session invalidation is already covered by `fetchUserInfo` polling; never add it to user-initiated requests.
361
- 13. **`send()` does not guarantee an object, and `assign()` must never throw**: non-config requests during maintenance (`isBlocked`) and `ERR_800` cancellations make `send()` **resolve `undefined`** (they never reach `onError`); a 200 response with a non-JSON body resolves a string, so destructuring `{ data }` yields `undefined`. When an `assign()` throws, XState v4 clears the event queue and the state is not updated — the machine stays in the current invoke state and `after`-based polling stops until an external event (e.g. `REFRESH`) moves it out. **Validate response shapes inside the service and `throw` there (reject → `onError`)**; every assign in `onDone` must handle every value the service can resolve, including deliberate `return null` early exits.
362
351
 
363
352
  ---
364
353
 
@@ -366,19 +355,19 @@ io(`${socketURL}/frontend`, {
366
355
 
367
356
  > Every item below exists in the code in **two competing forms** — exploring the code cannot tell you which one is the standard, so it must be written down explicitly. New code always follows the "Target" column; existing code is not proactively refactored en masse (scope discipline).
368
357
 
369
- | Item | Current state | Target |
370
- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
371
- | HTTP method casing | `'GET'` and `'get'` coexist (`request.js` calls `toUpperCase()` internally, so behavior is unaffected) | Consistently lowercase `'get'`/`'post'`/`'put'`/`'delete'` |
372
- | Import paths | Some files self-reference via the `@jetthai/cuora` package name | Consistently relative paths (`'../../api/payment.js'`) |
373
- | lodash extension | `'lodash/pickBy.js'` and `'lodash/pickBy'` coexist | Consistently **without** the extension |
374
- | URL leading slash | A few APIs carry a leading slash | Omit it (unless deliberately bypassing `url-join`, in which case comment the reason) |
375
- | Query parameter placement | A few write them straight into the URL (`register?${qs}`, `mail?include=cl`), bypassing serialization | Always use the `params` field |
376
- | Initial state naming | `idle`(27) / `loading`(13) / `fetching`(12) / `pending`(6) / `checking` / `init` and others used interchangeably | By semantics: `idle` (awaiting action), `loading` (initial load), `fetching` (re-fetch), `submitting` / `submitted` |
377
- | Magic numbers and strings | Activity type IDs, error codes, TTLs, polling ticks, `'DEPOSIT'`/`'WITHDRAW'`, `receiveStatus`, `connectStatus` are scattered around; `util/constant.js` currently holds **only** `GAME_SEARCH` / `GAME_TYPE_LIST`, two game-category constants | Centralize in `util/constant.js` (`ERROR_CODES` / `TTL` / `INTERVAL` / `TRANSFER_TYPE` / `RECEIVE_STATUS`) |
378
- | Error handling | Three forms coexist: silent fallback to `idle` (most common, loses error info), transition to `fail`, infinite retry | `onError` with `actions: 'setError'` to preserve the error in context; distinguish recoverable from unrecoverable; retries must have a cap |
379
- | Parameter naming | e.g. `getFreeGameReward(code)` is semantically unclear | Concrete names (`gameCode`) |
380
- | Parameter validation | The API layer has no validation at all (e.g. the dynamic path following `checkDt()` is injected straight into the URL) | Validate at the system boundary: path parameters non-undefined and free of path-traversal characters, amounts positive |
381
- | Deprecated APIs | `getPaymentInfo` in `api/payment.js` carries a "deprecated" comment but still has callers | Add `@deprecated` first, then remove once confirmed unreferenced |
358
+ | Item | Current state | Target |
359
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
360
+ | HTTP method casing | `'GET'` and `'get'` coexist (`request.js` calls `toUpperCase()` internally, so behavior is unaffected) | Consistently lowercase `'get'`/`'post'`/`'put'`/`'delete'` |
361
+ | Import paths | Some files self-reference via the `@jetthai/cuora` package name | Consistently relative paths (`'../../api/payment.js'`) |
362
+ | lodash extension | `'lodash/pickBy.js'` and `'lodash/pickBy'` coexist | Consistently **without** the extension |
363
+ | URL leading slash | A few APIs carry a leading slash | Omit it (unless deliberately bypassing `url-join`, in which case comment the reason) |
364
+ | Query parameter placement | A few write them straight into the URL (`register?${qs}`, `mail?include=cl`), bypassing serialization | Always use the `params` field |
365
+ | Initial state naming | `idle` / `loading` / `fetching` / `init` / `preparing` are used interchangeably | By semantics: `idle` (awaiting action), `loading` (initial load), `fetching` (re-fetch), `submitting` / `submitted` |
366
+ | Magic numbers and strings | Activity type IDs, error codes, TTLs, polling ticks, `'DEPOSIT'`/`'WITHDRAW'`, `receiveStatus`, `connectStatus` are scattered around | Centralize in `util/constant.js` (`ERROR_CODES` / `TTL` / `INTERVAL` / `TRANSFER_TYPE` / `RECEIVE_STATUS`) |
367
+ | Error handling | Three forms coexist: silent fallback to `idle` (most common, loses error info), transition to `fail`, infinite retry | `onError` with `actions: 'setError'` to preserve the error in context; distinguish recoverable from unrecoverable; retries must have a cap |
368
+ | Parameter naming | e.g. `addFavoriteGame(code)` is semantically unclear | Concrete names (`gameCode`) |
369
+ | Parameter validation | The API layer has no validation at all (e.g. `makeTransaction({ paymentMethod })` injects straight into the URL) | Validate at the system boundary: path parameters non-undefined and free of path-traversal characters, amounts positive |
370
+ | Deprecated APIs | In `api/user.js`, V1 `passwordRecovery` coexists with the V2 `passwordV2*` family, with V1 unmarked | Add `@deprecated` first, then remove once confirmed unreferenced |
382
371
 
383
372
  ---
384
373
 
@@ -390,11 +379,12 @@ io(`${socketURL}/frontend`, {
390
379
  - **No request caching** — high-frequency endpoints (`fetchUserInfo` every 2–10 seconds, `getConfig` on every state machine initialization, `getPaymentDetail` on every entry to a deposit/withdrawal page, `getActivityList` every 20 seconds) all hit the server directly. Consider TTL caching or `stale-while-revalidate`.
391
380
  - **No rate limiting or backoff** — polling runs at a fixed interval and does not change on errors. Consider exponential backoff on errors.
392
381
  - **No automatic token refresh** — the response interceptor in `request.js` does not handle 401, so an expired token simply fails.
382
+ - **FingerprintJS bundling** — the FingerprintJS embedded in `src/lib/` is loaded at module initialization even when disabled. Consider switching to a dynamic `import()` for lazy loading.
393
383
  - **No code splitting** — `machine/index.js` eagerly imports every state machine + the APIs + Socket.IO + lodash, so importing `machine` loads everything. Consider supporting individual imports to enable tree-shaking.
394
- - **Timer management** — countdowns are largely implemented with self-referencing `after: { 1000 }` transitions (e.g. the OTP `countdown` in `withdraw_manual_cash.js`), producing one state transition per second (including a context clone + event dispatch). Consider a callback service + `setInterval`, and **compute elapsed time** rather than decrementing step by step to avoid cumulative drift.
395
- - **Large state machine files** — `game_v2_1.js`(699), `auth.js`(592), `inbox.js`(489), `common.js`(404), `game_search_cash.js`(401), `manual_cash.js`(370), `websocket.js`(357), `withdraw_manual_cash.js`(324), `auth_otp_v3.js`(307), and `crypto_bank_cash.js`(306) all exceed 300 lines and could be split into composable sub-machines.
384
+ - **Timer management** — countdowns are largely implemented with self-referencing `after: { 1000 }` transitions, producing one state transition per second (including a context clone + event dispatch). Consider a callback service + `setInterval`, and **compute elapsed time** rather than decrementing step by step to avoid cumulative drift.
385
+ - **Large state machine files** — `game_v2_1.js`, `auth.js`, `withdraw_manual.js`, `inbox.js`, `manual_vn.js`, `common.js`, and `game_search_v2.js` all exceed 300 lines and could be split into composable sub-machines.
396
386
  - **Unused context fields** — several state machines declare context fields that are never assigned or read.
397
- - **lodash exists for only two functions** — the whole repo has just 5 imports: `pickBy` (`request/request.js`, `api/auth.js`, `machine/auth.js`, `machine/common.js`) and `isEqual` (`activity/fafafa_activity.js`), yet the entire package is listed as a dependency. Both can be replaced with native implementations to drop the dependency; until then, at least unify the extension convention (see "Style Convergence Targets").
387
+ - **lodash can be replaced with natives** — only a handful of functions are actually used; `padStart` / `toNumber` can be swapped for natives directly, and `findLastIndex` is supported in modern browsers.
398
388
 
399
389
  ---
400
390