@jetthai/cuora 1.1.477-dev.1 → 1.1.478
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.
- package/.claude/commands/sync-ai-prompts.md +1 -88
- package/.claude/settings.local.json +1 -3
- package/.github/copilot-instructions.md +57 -64
- package/.husky/post-checkout +3 -3
- package/.husky/pre-push +1 -1
- package/.prettierignore +1 -2
- package/AGENTS.md +58 -65
- package/AI_PROMPT_SOURCE.md +58 -65
- package/CHANGELOG.md +6 -318
- package/CLAUDE.md +58 -65
- package/GEMINI.md +58 -65
- package/README.md +12 -11
- package/package.json +1 -1
- package/scripts/auto-version.js +0 -1
- package/scripts/branch-auto-npm-publish.js +2 -9
- package/src/api/account.js +1 -0
- package/src/api/activity.js +37 -0
- package/src/api/auth.js +31 -0
- package/src/api/game.js +10 -0
- package/src/api/payment.js +52 -1
- package/src/api/user.js +16 -0
- package/src/index.js +2 -2
- package/src/machine/activity/activity.js +209 -0
- package/src/machine/activity/diamond_shop_activity_cash.js +1 -0
- package/src/machine/activity/diamond_shop_activity_fc.js +196 -0
- package/src/machine/activity/diamond_shop_activity_vn.js +178 -0
- package/src/machine/activity/fafafa_activity.js +10 -0
- package/src/machine/activity/index.js +12 -0
- package/src/machine/activity/invite_friends_activity.js +114 -0
- package/src/machine/activity/mini_game_activity.js +68 -0
- package/src/machine/activity/return_bonus_activity.js +153 -0
- package/src/machine/auth.js +59 -37
- package/src/machine/auth_otp_v2.js +177 -0
- package/src/machine/auth_otp_v3.js +19 -30
- package/src/machine/bank_binding_amb.js +146 -0
- package/src/machine/bonus.js +76 -0
- package/src/machine/common.js +55 -0
- package/src/machine/deposit/amb.js +93 -0
- package/src/machine/deposit/crypto_bank.js +330 -0
- package/src/machine/deposit/crypto_qrcode.js +148 -0
- package/src/machine/deposit/crypto_way.js +252 -0
- package/src/machine/deposit/deposit_fc.js +272 -0
- package/src/machine/deposit/direct.js +310 -0
- package/src/machine/deposit/float.js +375 -0
- package/src/machine/deposit/index.js +28 -0
- package/src/machine/deposit/krway.js +151 -0
- package/src/machine/deposit/loadcard_vn.js +351 -0
- package/src/machine/deposit/manual_cash.js +8 -0
- package/src/machine/deposit/manual_vn.js +458 -0
- package/src/machine/deposit/qrcode_v2.js +338 -0
- package/src/machine/deposit/usdt.js +144 -0
- package/src/machine/deposit/virtual_bank_vn.js +269 -0
- package/src/machine/deposit/vpay.js +368 -0
- package/src/machine/game_hot_new.js +79 -0
- package/src/machine/game_info.js +12 -1
- package/src/machine/game_replay.js +46 -0
- package/src/machine/game_search_v2.js +401 -0
- package/src/machine/game_v2_1.js +89 -1
- package/src/machine/honor_board.js +132 -0
- package/src/machine/honor_board_cash.js +18 -15
- package/src/machine/inbox.js +12 -0
- package/src/machine/index.js +32 -0
- package/src/machine/merge.js +57 -0
- package/src/machine/payment_data.js +86 -0
- package/src/machine/promotions.js +170 -0
- package/src/machine/reward.js +255 -0
- package/src/machine/reward_cash.js +39 -0
- package/src/machine/reward_fc.js +98 -0
- package/src/machine/side.js +154 -0
- package/src/machine/side_v2.js +211 -0
- package/src/machine/user_reset_password.js +13 -0
- package/src/machine/user_sign_up.js +0 -3
- package/src/machine/vip_table.js +57 -0
- package/src/machine/websocket.js +4 -0
- package/src/machine/welcome.js +110 -0
- package/src/machine/withdraw/index.js +6 -0
- package/src/machine/withdraw/withdraw_crypto_cash.js +327 -0
- package/src/machine/withdraw/withdraw_krway.js +223 -0
- package/src/machine/withdraw/withdraw_manual.js +536 -0
- package/src/request/request.js +29 -4
- package/src/util/constant.js +1 -0
- package/src/util/index.js +4 -1
- package/src/util/math.js +4 -0
- package/test/auth_otp_v3.test.js +0 -192
package/test/auth_otp_v3.test.js
DELETED
|
@@ -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
|
-
})
|