@jetthai/cuora 1.1.476-dev.0 → 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 (87) 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 +61 -66
  4. package/.husky/post-checkout +3 -3
  5. package/.husky/pre-push +1 -1
  6. package/.prettierignore +1 -2
  7. package/AGENTS.md +62 -67
  8. package/AI_PROMPT_SOURCE.md +62 -67
  9. package/CHANGELOG.md +9 -256
  10. package/CLAUDE.md +62 -67
  11. package/GEMINI.md +62 -67
  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 +1 -3
  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/roulette_v2.js +16 -25
  71. package/src/machine/side.js +154 -0
  72. package/src/machine/side_v2.js +211 -0
  73. package/src/machine/user_reset_password.js +13 -0
  74. package/src/machine/user_sign_up.js +0 -3
  75. package/src/machine/vip_table.js +57 -0
  76. package/src/machine/websocket.js +4 -0
  77. package/src/machine/welcome.js +110 -0
  78. package/src/machine/withdraw/index.js +6 -0
  79. package/src/machine/withdraw/withdraw_crypto_cash.js +327 -0
  80. package/src/machine/withdraw/withdraw_krway.js +223 -0
  81. package/src/machine/withdraw/withdraw_manual.js +536 -0
  82. package/src/request/request.js +28 -0
  83. package/src/util/constant.js +1 -0
  84. package/src/util/index.js +4 -1
  85. package/src/util/math.js +4 -0
  86. package/prepare-for-pr/JT-1776243420.md +0 -85
  87. package/test/auth_otp_v3.test.js +0 -192
@@ -1,85 +0,0 @@
1
- # JT-1776243420: Third-Party Register Carry Phone / Email Payload
2
-
3
- ## Key Changes
4
-
5
- 1. Extended third-party redirect payload assembly to read `tp_phone`, `tp_countryCode`, and `tp_email` from storage.
6
- 2. Preserved existing affiliate code / nickname behavior and appended new fields only when values are valid.
7
- 3. Cleans the temporary third-party storage keys after composing the redirect query.
8
-
9
- ---
10
-
11
- ## Key Findings
12
-
13
- ### Strengths
14
-
15
- 1. The change is tightly scoped to the third-party auth redirect builder in `src/machine/auth.js:477-520`.
16
- 2. Existing affiliate code and nickname logic remains unchanged while phone / email are additive only.
17
- 3. Temporary keys are removed after payload composition, reducing leakage into later unrelated auth flows.
18
-
19
- ---
20
-
21
- ### Behavior Observed
22
-
23
- 1. Static review confirms `phone`, `countryCode`, and `email` are appended only when storage values are not `undefined` / `null`.
24
- 2. Channel and subchannel fallback logic stays intact after the new fields are added.
25
- 3. No unrelated file changes were present in this repo for the review scope.
26
-
27
- ---
28
-
29
- ## 🔧 Change Type
30
-
31
- - [ ] 🐛 Bug fix
32
- - [x] ✨ New feature
33
- - [ ] 💄 Style
34
- - [ ] ♻️ Refactor
35
- - [ ] ⚡ Performance
36
- - [ ] 🔧 Chore
37
-
38
- ---
39
-
40
- ## 📱 Impact Scope
41
-
42
- - Third-party register / login redirect query assembly in cuora shared auth machine.
43
- - Downstream PWA clients that store `tp_phone`, `tp_countryCode`, and `tp_email` before `LOGIN_3PARTY`.
44
-
45
- ---
46
-
47
- ## Test Completion Status
48
-
49
- | Item | Validation Tested | Status |
50
- | -------------------------- | --------------------------------------------------------------------- | ------- |
51
- | Diff hygiene | `git diff --check` in `cuora-module` | PASS |
52
- | Shared auth payload review | Reviewed `src/machine/auth.js:477-520` against ticket intent | PASS |
53
- | Runtime redirect execution | Not run in this repo directly; validated through client repos instead | NOT RUN |
54
-
55
- ---
56
-
57
- ## 📋 Spec Validation (Aligned with review-playbook)
58
-
59
- | Spec Item | Evidence (File/Line/Result) | Status |
60
- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------ |
61
- | Third-party flow can carry phone when client stored it | `src/machine/auth.js:479-520` reads `tp_phone` / `tp_countryCode` and appends them to `referralObj` | PASS |
62
- | Third-party flow can carry email when client stored it | `src/machine/auth.js:481-520` reads `tp_email` and appends it to `referralObj` | PASS |
63
- | Affiliate code and nickname keep original logic | `src/machine/auth.js:477-500` keeps `ac` / `nick_name` handling unchanged | PASS |
64
- | Temporary third-party data does not leak into later unrelated flows | `src/machine/auth.js:518-520` removes the temporary storage keys after composing the redirect URL | PASS |
65
-
66
- ---
67
-
68
- ## 📋 Standards Checklist (Summary)
69
-
70
- | Category | Result | Notes |
71
- | ---------------------- | ------- | --------------------------------------------------------------------------- |
72
- | Memory Safety | PASS | Simple storage reads and object assembly only. |
73
- | Rendering Performance | PASS | No rendering code touched. |
74
- | Network Requests | PASS | Existing redirect flow only; no extra requests added. |
75
- | Bundle Optimization | PASS | No new imports or heavy logic added. |
76
- | Code Quality | PASS | Scope is narrow and branch contains only the required file change. |
77
- | Vue / Nuxt Standards | NOT RUN | Shared module; not a Vue / Nuxt surface. |
78
- | SSR Security Standards | PASS | Query parameters are assembled from existing client-side storage path only. |
79
- | Project Conventions | PASS | Matches existing storage-guard pattern used for affiliate / nickname. |
80
-
81
- ## Conclusion
82
-
83
- This repo’s shared auth-machine change matches the ticket intent and is internally consistent. Runtime behavior was not executed in `cuora-module` directly, but both client repos now pass the new storage keys into this shared payload path.
84
-
85
- **Overall Result:** PASS (PARTIAL)
@@ -1,192 +0,0 @@
1
- import test from 'node:test'
2
- import assert from 'node:assert/strict'
3
- import { interpret } from 'xstate'
4
- import authOtpV3 from '../src/machine/auth_otp_v3.js'
5
-
6
- function waitForState(service, matches) {
7
- if (service.state.matches(matches)) return Promise.resolve(service.state)
8
- return new Promise((resolve, reject) => {
9
- const timeout = setTimeout(() => reject(new Error(`Timed out waiting for ${matches}`)), 1000)
10
- service.onTransition((state) => {
11
- if (!state.matches(matches)) return
12
- clearTimeout(timeout)
13
- resolve(state)
14
- })
15
- })
16
- }
17
-
18
- test('phone entry skips OTP only after /self confirms phone verification', async () => {
19
- let selfReads = 0
20
- const requests = []
21
- const request = {
22
- async send(descriptor) {
23
- requests.push(descriptor.url)
24
- if (descriptor.url === 'self') {
25
- selfReads++
26
- return {
27
- phone: selfReads === 1 ? null : '123456789',
28
- phone_verification_status: selfReads > 1,
29
- email: null,
30
- email_verification_status: false,
31
- }
32
- }
33
- if (descriptor.url === 'otp-verification-point/verify') return { needAcknowledge: false }
34
- throw new Error(`Unexpected request: ${descriptor.url}`)
35
- },
36
- }
37
- const service = interpret(authOtpV3(request)).start()
38
- try {
39
- service.send({ type: 'SET_STRATEGY', data: 'phone' })
40
- await waitForState(service, 'notVerified.phone')
41
- service.send({ type: 'SEND_PHONE', data: { countryCode: '886', phone: '123456789' } })
42
- await waitForState(service, 'verified')
43
- assert.equal(selfReads, 2)
44
- assert.deepEqual(requests, ['self', 'otp-verification-point/verify', 'self'])
45
- } finally {
46
- service.stop()
47
- }
48
- })
49
-
50
- test('email entry skips OTP only after /self confirms email verification', async () => {
51
- let selfReads = 0
52
- const request = {
53
- async send(descriptor) {
54
- if (descriptor.url === 'self') {
55
- selfReads++
56
- return {
57
- phone: null,
58
- phone_verification_status: false,
59
- email: selfReads === 1 ? null : 'test@example.com',
60
- email_verification_status: selfReads > 1,
61
- }
62
- }
63
- if (descriptor.url === 'otp-verification-point/verify') return { needAcknowledge: false }
64
- throw new Error(`Unexpected request: ${descriptor.url}`)
65
- },
66
- }
67
- const service = interpret(authOtpV3(request)).start()
68
- try {
69
- service.send({ type: 'SET_STRATEGY', data: 'email' })
70
- await waitForState(service, 'notVerified.email')
71
- service.send({ type: 'SEND_EMAIL', data: { email: 'test@example.com' } })
72
- await waitForState(service, 'verified')
73
- assert.equal(selfReads, 2)
74
- } finally {
75
- service.stop()
76
- }
77
- })
78
-
79
- test('existing phone auto verification checks /self before finishing', async () => {
80
- let selfReads = 0
81
- const request = {
82
- async send(descriptor) {
83
- if (descriptor.url === 'self') {
84
- selfReads++
85
- return {
86
- phone: '123456789',
87
- phone_verification_status: selfReads > 1,
88
- email: null,
89
- email_verification_status: false,
90
- }
91
- }
92
- if (descriptor.url === 'otp-verification-point/verify') return { needAcknowledge: false }
93
- throw new Error(`Unexpected request: ${descriptor.url}`)
94
- },
95
- }
96
- const service = interpret(authOtpV3(request)).start()
97
- try {
98
- service.send({ type: 'SET_STRATEGY', data: 'phone' })
99
- await waitForState(service, 'verified')
100
- assert.equal(selfReads, 2)
101
- } finally {
102
- service.stop()
103
- }
104
- })
105
-
106
- test('needAcknowledge false never grants verification when /self is still unverified', async () => {
107
- let verifyCalls = 0
108
- const request = {
109
- async send(descriptor) {
110
- if (descriptor.url === 'self') {
111
- return { phone: null, phone_verification_status: false, email: null, email_verification_status: false }
112
- }
113
- if (descriptor.url === 'otp-verification-point/verify') {
114
- verifyCalls++
115
- return { needAcknowledge: false }
116
- }
117
- throw new Error(`Unexpected request: ${descriptor.url}`)
118
- },
119
- }
120
- const service = interpret(authOtpV3(request)).start()
121
- try {
122
- service.send({ type: 'SET_STRATEGY', data: 'phone' })
123
- await waitForState(service, 'notVerified.phone')
124
- service.send({ type: 'SEND_PHONE', data: { countryCode: '886', phone: '123456789' } })
125
- await waitForState(service, 'fail')
126
- assert.equal(verifyCalls, 1)
127
- } finally {
128
- service.stop()
129
- }
130
- })
131
-
132
- test('needAcknowledge true keeps the existing OTP input route', async () => {
133
- const request = {
134
- async send(descriptor) {
135
- if (descriptor.url === 'self') {
136
- return { phone: null, phone_verification_status: false, email: null, email_verification_status: false }
137
- }
138
- if (descriptor.url === 'otp-verification-point/verify') {
139
- return { needAcknowledge: true, request_id: 'test-request', ttl: 60000, countryCode: '886', phone: '123456789' }
140
- }
141
- throw new Error(`Unexpected request: ${descriptor.url}`)
142
- },
143
- }
144
- const service = interpret(authOtpV3(request)).start()
145
- try {
146
- service.send({ type: 'SET_STRATEGY', data: 'phone' })
147
- await waitForState(service, 'notVerified.phone')
148
- service.send({ type: 'SEND_PHONE', data: { countryCode: '886', phone: '123456789' } })
149
- await waitForState(service, 'notVerified.otp')
150
- assert.equal(service.state.context.requestId, 'test-request')
151
- } finally {
152
- service.stop()
153
- }
154
- })
155
-
156
- test('email without an address still requires input even if its verification flag is true', async () => {
157
- const request = {
158
- async send(descriptor) {
159
- if (descriptor.url === 'self') {
160
- return { phone: '123456789', phone_verification_status: true, email: null, email_verification_status: true }
161
- }
162
- throw new Error(`Unexpected request: ${descriptor.url}`)
163
- },
164
- }
165
- const service = interpret(authOtpV3(request)).start()
166
- try {
167
- service.send({ type: 'SET_STRATEGY', data: 'email' })
168
- await waitForState(service, 'notVerified.email')
169
- assert.equal(service.state.matches('verified'), false)
170
- } finally {
171
- service.stop()
172
- }
173
- })
174
-
175
- test('phone without a number still requires input even if its verification flag is true', async () => {
176
- const request = {
177
- async send(descriptor) {
178
- if (descriptor.url === 'self') {
179
- return { phone: null, phone_verification_status: true, email: 'test@example.com', email_verification_status: true }
180
- }
181
- throw new Error(`Unexpected request: ${descriptor.url}`)
182
- },
183
- }
184
- const service = interpret(authOtpV3(request)).start()
185
- try {
186
- service.send({ type: 'SET_STRATEGY', data: 'phone' })
187
- await waitForState(service, 'notVerified.phone')
188
- assert.equal(service.state.matches('verified'), false)
189
- } finally {
190
- service.stop()
191
- }
192
- })