@jetthai/cuora 1.1.475 → 1.1.476-dev.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.
- package/.claude/commands/sync-ai-prompts.md +88 -1
- package/.claude/settings.local.json +3 -1
- package/.github/copilot-instructions.md +66 -61
- package/.husky/post-checkout +3 -3
- package/.husky/pre-push +1 -1
- package/.prettierignore +2 -1
- package/AGENTS.md +67 -62
- package/AI_PROMPT_SOURCE.md +67 -62
- package/CHANGELOG.md +260 -7
- package/CLAUDE.md +67 -62
- package/GEMINI.md +67 -62
- package/README.md +11 -12
- package/package.json +1 -1
- package/prepare-for-pr/JT-1776243420.md +85 -0
- package/scripts/auto-version.js +1 -0
- package/scripts/branch-auto-npm-publish.js +9 -2
- package/src/api/account.js +0 -1
- package/src/api/activity.js +0 -37
- package/src/api/auth.js +0 -31
- package/src/api/game.js +0 -10
- package/src/api/payment.js +1 -52
- package/src/api/user.js +0 -16
- package/src/index.js +2 -2
- package/src/machine/activity/activity_cash.js +14 -1
- package/src/machine/activity/diamond_shop_activity_cash.js +0 -1
- package/src/machine/activity/fafafa_activity.js +0 -10
- package/src/machine/activity/index.js +0 -12
- package/src/machine/auth.js +37 -59
- package/src/machine/auth_otp_v3.js +30 -19
- package/src/machine/common.js +0 -55
- package/src/machine/deposit/index.js +0 -28
- package/src/machine/deposit/manual_cash.js +0 -8
- package/src/machine/game_info.js +1 -12
- package/src/machine/game_v2_1.js +1 -89
- package/src/machine/honor_board_cash.js +15 -18
- package/src/machine/inbox.js +0 -12
- package/src/machine/index.js +0 -32
- package/src/machine/reward_cash.js +0 -39
- package/src/machine/roulette_v2.js +25 -16
- package/src/machine/user_reset_password.js +0 -13
- package/src/machine/user_sign_up.js +3 -0
- package/src/machine/websocket.js +0 -4
- package/src/machine/withdraw/index.js +0 -6
- package/src/request/request.js +0 -28
- package/src/util/constant.js +0 -1
- package/src/util/index.js +1 -4
- package/test/auth_otp_v3.test.js +192 -0
- package/src/machine/activity/activity.js +0 -209
- package/src/machine/activity/diamond_shop_activity_fc.js +0 -196
- package/src/machine/activity/diamond_shop_activity_vn.js +0 -178
- package/src/machine/activity/invite_friends_activity.js +0 -114
- package/src/machine/activity/mini_game_activity.js +0 -68
- package/src/machine/activity/return_bonus_activity.js +0 -153
- package/src/machine/auth_otp_v2.js +0 -177
- package/src/machine/bank_binding_amb.js +0 -146
- package/src/machine/bonus.js +0 -76
- package/src/machine/deposit/amb.js +0 -93
- package/src/machine/deposit/crypto_bank.js +0 -330
- package/src/machine/deposit/crypto_qrcode.js +0 -148
- package/src/machine/deposit/crypto_way.js +0 -252
- package/src/machine/deposit/deposit_fc.js +0 -272
- package/src/machine/deposit/direct.js +0 -310
- package/src/machine/deposit/float.js +0 -375
- package/src/machine/deposit/krway.js +0 -151
- package/src/machine/deposit/loadcard_vn.js +0 -351
- package/src/machine/deposit/manual_vn.js +0 -458
- package/src/machine/deposit/qrcode_v2.js +0 -338
- package/src/machine/deposit/usdt.js +0 -144
- package/src/machine/deposit/virtual_bank_vn.js +0 -269
- package/src/machine/deposit/vpay.js +0 -368
- package/src/machine/game_hot_new.js +0 -79
- package/src/machine/game_replay.js +0 -46
- package/src/machine/game_search_v2.js +0 -401
- package/src/machine/honor_board.js +0 -132
- package/src/machine/merge.js +0 -57
- package/src/machine/payment_data.js +0 -86
- package/src/machine/promotions.js +0 -170
- package/src/machine/reward.js +0 -255
- package/src/machine/reward_fc.js +0 -98
- package/src/machine/side.js +0 -154
- package/src/machine/side_v2.js +0 -211
- package/src/machine/vip_table.js +0 -57
- package/src/machine/welcome.js +0 -110
- package/src/machine/withdraw/withdraw_crypto_cash.js +0 -327
- package/src/machine/withdraw/withdraw_krway.js +0 -223
- package/src/machine/withdraw/withdraw_manual.js +0 -536
- package/src/util/math.js +0 -4
package/src/api/payment.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
getPaymentHistory: (returnDays) => ({ url: 'payment/v2/history', method: 'post', params: { returnDays } }),
|
|
3
|
-
getSpotMarket: () => ({ url: 'payment/v2/spotmarket', method: 'get' }),
|
|
4
2
|
getTransactionHistory: (payload) => ({
|
|
5
3
|
url: 'payment/v2/transactionHistory',
|
|
6
4
|
method: 'post',
|
|
@@ -59,18 +57,6 @@ export default {
|
|
|
59
57
|
getBankList: (paymentMethod) => ({ url: `payment/v2/${paymentMethod}/getBankList`, method: 'get' }),
|
|
60
58
|
getBindingBankList: ({ appSecret }) => ({ url: 'payment/v2/getBindingBankList', method: 'get', params: { appSecret }, isPublic: true }),
|
|
61
59
|
getBindingPaymentList: ({ appSecret }) => ({ url: 'payment/v2/getBindingPaymentList', method: 'get', params: { appSecret } }),
|
|
62
|
-
getWithdrawBankList: () => ({ url: 'payment/v2/getWithdrawBankList', method: 'get' }),
|
|
63
|
-
makeTransaction: ({ type, payload, paymentMethod }) => ({
|
|
64
|
-
url: `payment/v2/${paymentMethod}/transaction`,
|
|
65
|
-
method: 'post',
|
|
66
|
-
params: {
|
|
67
|
-
transferType: type,
|
|
68
|
-
...payload,
|
|
69
|
-
},
|
|
70
|
-
}),
|
|
71
|
-
checkTransaction: (paymentMethod) => ({ url: `payment/v2/${paymentMethod}/checkTransaction`, method: 'post' }),
|
|
72
|
-
setBonusSetting: ({ bonus }) => ({ url: 'payment/v2/setting', method: 'post', params: { bonus } }),
|
|
73
|
-
getCurrentWithdrawRule: () => ({ url: 'payment/v2/getCurrentWithdrawRule', method: 'get' }),
|
|
74
60
|
getDoubleWalletWithdrawRule: ({ walletType }) => ({
|
|
75
61
|
url: 'payment/v2/withdrawRule',
|
|
76
62
|
method: 'post',
|
|
@@ -81,7 +67,6 @@ export default {
|
|
|
81
67
|
method: 'post',
|
|
82
68
|
params: { exchangeType, cryptoNetwork, targetAddress },
|
|
83
69
|
}),
|
|
84
|
-
mergeWallet: () => ({ url: 'payment/v2/mergeWallet', method: 'post' }),
|
|
85
70
|
getPaymentDetail: ({ transferType } = {}) => ({
|
|
86
71
|
url: 'payment/v2/paymentDetail',
|
|
87
72
|
method: 'post',
|
|
@@ -102,11 +87,6 @@ export default {
|
|
|
102
87
|
method: 'post',
|
|
103
88
|
params: { transferType: 'WITHDRAW', amount, cryptoCurrency, promotionsNo },
|
|
104
89
|
}),
|
|
105
|
-
getWithdrawExpectedResult: ({ method, amount, cryptoNetwork }) => ({
|
|
106
|
-
url: `payment/v2/${method}/expected/result`,
|
|
107
|
-
method: 'post',
|
|
108
|
-
params: { transferType: 'WITHDRAW', amount, cryptoNetwork },
|
|
109
|
-
}),
|
|
110
90
|
submitDepositTransactionCrypto: ({ method, amount, cryptoCurrency, cryptoNetwork, sourceAddress, promotionsNo, receipt }) => ({
|
|
111
91
|
url: `payment/v2/${method}/transaction`,
|
|
112
92
|
method: 'post',
|
|
@@ -193,38 +173,6 @@ export default {
|
|
|
193
173
|
applyerHolderName,
|
|
194
174
|
},
|
|
195
175
|
}),
|
|
196
|
-
submitWithdrawTransactionManual: ({
|
|
197
|
-
method,
|
|
198
|
-
amount,
|
|
199
|
-
applyerBankCode,
|
|
200
|
-
applyerAccountNumber,
|
|
201
|
-
applyerIfscCode,
|
|
202
|
-
branch,
|
|
203
|
-
holderName,
|
|
204
|
-
cryptoCurrency,
|
|
205
|
-
cryptoNetwork,
|
|
206
|
-
targetAddress,
|
|
207
|
-
}) => ({
|
|
208
|
-
url: `payment/v2/${method}/withdraw-otp/verify`,
|
|
209
|
-
method: 'post',
|
|
210
|
-
params: {
|
|
211
|
-
transferType: 'WITHDRAW',
|
|
212
|
-
amount,
|
|
213
|
-
applyerBankCode,
|
|
214
|
-
applyerAccountNumber,
|
|
215
|
-
applyerIfscCode,
|
|
216
|
-
branch,
|
|
217
|
-
holderName,
|
|
218
|
-
cryptoCurrency,
|
|
219
|
-
cryptoNetwork,
|
|
220
|
-
targetAddress,
|
|
221
|
-
},
|
|
222
|
-
}),
|
|
223
|
-
submitWithdrawTransactionAmb: ({ method, amount }) => ({
|
|
224
|
-
url: `payment/v2/${method}/transaction`,
|
|
225
|
-
method: 'post',
|
|
226
|
-
params: { transferType: 'WITHDRAW', amount },
|
|
227
|
-
}),
|
|
228
176
|
getPromotionsList: () => ({ url: `payment/v2/bankWallet/promotions`, method: 'get' }),
|
|
229
177
|
getWithdrawRulePreview: ({ applyType, applyNo, amount, isFreeGame }) => ({
|
|
230
178
|
url: `payment/v2/bankWallet/promotion/preview`,
|
|
@@ -260,4 +208,5 @@ export default {
|
|
|
260
208
|
isPublic: true,
|
|
261
209
|
}),
|
|
262
210
|
getPaymentPromotions: () => ({ url: 'payment/v2/promotions', method: 'get' }),
|
|
211
|
+
setBonusSetting: ({ bonus }) => ({ url: 'payment/v2/setting', method: 'post', params: { bonus } }),
|
|
263
212
|
}
|
package/src/api/user.js
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
export const PASSWORD_RESET_INIT = 'otp-verifying'
|
|
2
|
-
export const PASSWORD_RESET_ALLOW = 'allow-change-password'
|
|
3
|
-
|
|
4
1
|
export default {
|
|
5
2
|
checkDt: () => ({ url: 'checkDt', method: 'get' }),
|
|
6
3
|
updateDt: (data) => ({ url: 'updateDt', method: 'post', params: data }),
|
|
7
4
|
getUserInfo: () => ({ url: 'self', method: 'get' }),
|
|
8
5
|
updateUserInfo: (data) => ({ url: 'self', method: 'post', params: data }),
|
|
9
6
|
changePassword: (data) => ({ url: 'settings/password', method: 'post', params: data }),
|
|
10
|
-
setPreference: ({ defaultCategory }) => ({ url: 'settings/preference', method: 'post', params: { defaultCategory } }),
|
|
11
7
|
resetOtp: ({ requestId, number }) => ({ url: 'reset', method: 'post', params: { requestId, number } }),
|
|
12
|
-
getAffiliate: () => ({ url: 'affiliate', method: 'get' }),
|
|
13
|
-
getAffiliateHome: () => ({ url: 'affiliate/home', method: 'get' }),
|
|
14
|
-
getAffiliateDashboard: () => ({ url: 'affiliate/dashboard', method: 'get' }),
|
|
15
|
-
getAffiliateDashboardList: ({ level, page, row }) => ({ url: 'affiliate/dashboard/list', method: 'post', params: { level, page, row } }),
|
|
16
|
-
postAffiliate: ({ affiliateCode }) => ({ url: 'affiliate', method: 'post', params: { affiliateCode } }),
|
|
17
8
|
getFriends: () => ({ url: 'friends', method: 'get' }),
|
|
18
9
|
getFriendsHome: () => ({ url: 'friends/home', method: 'get' }),
|
|
19
10
|
getFriendsDashboard: () => ({ url: 'friends/dashboard', method: 'get' }),
|
|
20
11
|
getFriendsDashboardList: ({ level, page, row }) => ({ url: 'friends/dashboard/list', method: 'post', params: { level, page, row } }),
|
|
21
12
|
getFriendsList: ({ type, page, row }) => ({ url: 'friends/reward-list', method: 'post', params: { type, page, row } }),
|
|
22
13
|
postFriends: ({ friendCode }) => ({ url: 'friends', method: 'post', params: { friendCode } }),
|
|
23
|
-
passwordRecovery: (recoveryData) => ({ url: 'recovery', method: 'post', params: recoveryData, isPublic: true }),
|
|
24
14
|
// passwordAbandon: ({ number }) => ({ url: 'recovery/abandon', method: 'post', params: { number }, isPublic: true }), 平台版和現金網未使用
|
|
25
15
|
// passwordAcknowledge: (acknowledgeData) => ({ url: 'recovery/acknowledge', method: 'post', params: acknowledgeData, isPublic: true }), 平台版和現金網未使用
|
|
26
16
|
verify: () => ({ url: 'verify', method: 'post' }),
|
|
@@ -50,12 +40,6 @@ export default {
|
|
|
50
40
|
params: { requestId, target, newPassword, appSecret },
|
|
51
41
|
isPublic: true,
|
|
52
42
|
}),
|
|
53
|
-
verifyV2Initiate: ({ strategy }) => ({
|
|
54
|
-
// strategy: 'phone' | 'email'
|
|
55
|
-
url: '/verify/v2/initiate',
|
|
56
|
-
method: 'post',
|
|
57
|
-
params: { strategy },
|
|
58
|
-
}),
|
|
59
43
|
otpAcknowledge: ({ requestId, target, code }) => ({
|
|
60
44
|
url: '/otpsso/acknowledge',
|
|
61
45
|
method: 'post',
|
package/src/index.js
CHANGED
|
@@ -2,6 +2,6 @@ import api from './api/index.js'
|
|
|
2
2
|
import machine from './machine/index.js'
|
|
3
3
|
import Request from './request/request.js'
|
|
4
4
|
import Config from './request/config.js'
|
|
5
|
-
import
|
|
5
|
+
import { constant, storage, paramStore } from './util/index.js'
|
|
6
6
|
|
|
7
|
-
export { api, machine, Request, Config,
|
|
7
|
+
export { api, machine, Request, Config, constant, storage, paramStore }
|
|
@@ -101,7 +101,7 @@ export default function (request) {
|
|
|
101
101
|
}
|
|
102
102
|
}),
|
|
103
103
|
setProgressSummary: assign((context, event) => {
|
|
104
|
-
const { progressSummary } = event.data
|
|
104
|
+
const { progressSummary } = event.data || {}
|
|
105
105
|
return {
|
|
106
106
|
progressSummary: progressSummary || null,
|
|
107
107
|
}
|
|
@@ -184,6 +184,12 @@ export default function (request) {
|
|
|
184
184
|
hasToken ? request.send(payment.getPromotionsList()) : [],
|
|
185
185
|
])
|
|
186
186
|
|
|
187
|
+
// send() 不保證回傳 { data } 信封(200 但 body 非 JSON 時回字串,data 即為 undefined)。非陣列必須在 service 內 reject 走 onError,
|
|
188
|
+
// 不可進入 setActivityList:assign 內拋錯會讓 interpreter 清空事件佇列,machine 永久停在 fetchingList、輪詢中止
|
|
189
|
+
if (!Array.isArray(data)) {
|
|
190
|
+
throw new Error('[activity_cash] fetchList: activityList is not an array')
|
|
191
|
+
}
|
|
192
|
+
|
|
187
193
|
return {
|
|
188
194
|
activityList: data,
|
|
189
195
|
promotionList,
|
|
@@ -202,6 +208,7 @@ export default function (request) {
|
|
|
202
208
|
|
|
203
209
|
const { activityList = [], detailNeededActivityTypes } = context
|
|
204
210
|
const filteredActivityList = activityList.filter((activity) => detailNeededActivityTypes.includes(activity.activityType))
|
|
211
|
+
|
|
205
212
|
const [activityDetailList, progressSummaryRes] = await Promise.all([
|
|
206
213
|
Promise.all(
|
|
207
214
|
filteredActivityList.map((item) => {
|
|
@@ -211,6 +218,12 @@ export default function (request) {
|
|
|
211
218
|
isProgressEnable ? request.send(activity.getProgressSummary({ appSecret })).catch(() => null) : Promise.resolve(null),
|
|
212
219
|
])
|
|
213
220
|
|
|
221
|
+
// ERR_800/維護中時 send() 回 undefined,進到 setActivityDetailList 讀 item.data 會在 assign 內拋錯而卡死 machine;
|
|
222
|
+
// 整輪 reject 走 onError,保留上一輪明細並於下個 TIMEOUT 重試
|
|
223
|
+
if (!activityDetailList.every((res) => res !== null && typeof res === 'object')) {
|
|
224
|
+
throw new Error('[activity_cash] fetchActivityDetailList: invalid detail response')
|
|
225
|
+
}
|
|
226
|
+
|
|
214
227
|
return {
|
|
215
228
|
activityDetailList,
|
|
216
229
|
progressSummary: progressSummaryRes?.data || null,
|
|
@@ -60,11 +60,6 @@ export default function (request, context) {
|
|
|
60
60
|
},
|
|
61
61
|
awarded: {
|
|
62
62
|
entry: 'setDuration',
|
|
63
|
-
on: {
|
|
64
|
-
REFRESH_ACTIVITY: {
|
|
65
|
-
target: 'loading',
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
63
|
after: {
|
|
69
64
|
1000: [{ target: 'loading', cond: 'shouldCheckNewPeriod' }, { target: 'awarded' }],
|
|
70
65
|
},
|
|
@@ -102,11 +97,6 @@ export default function (request, context) {
|
|
|
102
97
|
},
|
|
103
98
|
result: {
|
|
104
99
|
entry: 'setDuration',
|
|
105
|
-
on: {
|
|
106
|
-
REFRESH_ACTIVITY: {
|
|
107
|
-
target: 'loading',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
100
|
after: {
|
|
111
101
|
1000: [{ target: 'loading', cond: 'shouldCheckNewPeriod' }, { target: 'result' }],
|
|
112
102
|
},
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import activity from './activity.js'
|
|
2
1
|
import activity_cash from './activity_cash.js'
|
|
3
2
|
import continue_deposit_activity from './continue_deposit_activity.js'
|
|
4
3
|
import deposit_activity from './deposit_activity.js'
|
|
5
|
-
import diamond_shop_activity_fc from './diamond_shop_activity_fc.js'
|
|
6
|
-
import diamond_shop_activity_vn from './diamond_shop_activity_vn.js'
|
|
7
4
|
import diamond_shop_activity_cash from './diamond_shop_activity_cash.js'
|
|
8
5
|
import fafafa_activity from './fafafa_activity.js'
|
|
9
|
-
import invite_friends_activity from './invite_friends_activity.js'
|
|
10
6
|
import jackpot from './jackpot.js'
|
|
11
7
|
import friend_invite_friends_activity from './friend_invite_friends_activity.js'
|
|
12
8
|
import ranking_activity from './ranking_activity.js'
|
|
13
|
-
import return_bonus_activity from './return_bonus_activity.js'
|
|
14
9
|
import specify_bets_activity from './specify_bets_activity.js'
|
|
15
10
|
import specify_turnover_activity from './specify_turnover_activity.js'
|
|
16
11
|
import sign_in_activity from './sign_in_activity.js'
|
|
17
12
|
import time_bomb_activity from './time_bomb_activity.js'
|
|
18
|
-
import mini_game_activity from './mini_game_activity.js'
|
|
19
13
|
import roulette_activity_v2 from './roulette_activity_v2.js'
|
|
20
14
|
import sign_in_monthly_activity from './sign_in_monthly_activity.js'
|
|
21
15
|
import otp_verified_activity from './otp_verified_activity.js'
|
|
@@ -24,24 +18,18 @@ import instant_rebate_activity from './instant_rebate_activity.js'
|
|
|
24
18
|
import cash_rain_activity from './cash_rain_activity.js'
|
|
25
19
|
|
|
26
20
|
export default {
|
|
27
|
-
activity,
|
|
28
21
|
activity_cash,
|
|
29
22
|
continue_deposit_activity,
|
|
30
23
|
deposit_activity,
|
|
31
|
-
diamond_shop_activity_fc,
|
|
32
|
-
diamond_shop_activity_vn,
|
|
33
24
|
diamond_shop_activity_cash,
|
|
34
25
|
fafafa_activity,
|
|
35
|
-
invite_friends_activity,
|
|
36
26
|
jackpot,
|
|
37
27
|
friend_invite_friends_activity,
|
|
38
28
|
ranking_activity,
|
|
39
|
-
return_bonus_activity,
|
|
40
29
|
specify_bets_activity,
|
|
41
30
|
specify_turnover_activity,
|
|
42
31
|
sign_in_activity,
|
|
43
32
|
time_bomb_activity,
|
|
44
|
-
mini_game_activity,
|
|
45
33
|
roulette_activity_v2,
|
|
46
34
|
sign_in_monthly_activity,
|
|
47
35
|
otp_verified_activity,
|
package/src/machine/auth.js
CHANGED
|
@@ -10,7 +10,6 @@ import { readParamFromLocation, writeParam, normalize, AC_KEYS, FC_KEYS } from '
|
|
|
10
10
|
export default function (request) {
|
|
11
11
|
const { appSecret, clientId, sentry } = request.config
|
|
12
12
|
const tokenKey = `cuora_${clientId}`
|
|
13
|
-
const userKey = `cuora_tempuser`
|
|
14
13
|
const phoneCountryCode = 'phone_countrycode'
|
|
15
14
|
const accountPhoneKey = 'account_phone'
|
|
16
15
|
const accountEmailKey = 'account_email'
|
|
@@ -79,45 +78,56 @@ export default function (request) {
|
|
|
79
78
|
},
|
|
80
79
|
},
|
|
81
80
|
},
|
|
82
|
-
|
|
81
|
+
authenticated: {
|
|
83
82
|
invoke: {
|
|
84
|
-
src: '
|
|
83
|
+
src: 'fetchUserInfo',
|
|
85
84
|
onDone: {
|
|
86
|
-
target: '
|
|
87
|
-
actions: '
|
|
85
|
+
target: 'otpChecking',
|
|
86
|
+
actions: ['setUserInfo', 'extendToken'],
|
|
88
87
|
},
|
|
89
88
|
onError: {
|
|
90
|
-
target: '
|
|
91
|
-
actions: 'removeToken',
|
|
89
|
+
target: 'leaving',
|
|
92
90
|
},
|
|
93
91
|
},
|
|
94
92
|
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
otpChecking: {
|
|
94
|
+
initial: 'pending',
|
|
95
|
+
states: {
|
|
96
|
+
pending: {
|
|
97
|
+
after: {
|
|
98
|
+
TIMEOUT: {
|
|
99
|
+
target: 'fetching',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
101
102
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
fetching: {
|
|
104
|
+
invoke: {
|
|
105
|
+
src: 'fetchUserInfo',
|
|
106
|
+
onDone: {
|
|
107
|
+
target: 'pending',
|
|
108
|
+
actions: ['setUserInfo', 'extendToken'],
|
|
109
|
+
},
|
|
110
|
+
onError: {
|
|
111
|
+
target: 'pending',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
105
114
|
},
|
|
106
115
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
src: 'fetchUserInfo',
|
|
111
|
-
onDone: {
|
|
112
|
-
target: 'otpChecking',
|
|
113
|
-
actions: ['setUserInfo', 'extendToken'],
|
|
116
|
+
on: {
|
|
117
|
+
OTP_VERIFIED: {
|
|
118
|
+
target: 'bindBankChecking',
|
|
114
119
|
},
|
|
115
|
-
|
|
120
|
+
OTP_SKIP: {
|
|
121
|
+
target: 'bindBankChecking',
|
|
122
|
+
},
|
|
123
|
+
LOGOUT: {
|
|
116
124
|
target: 'leaving',
|
|
117
125
|
},
|
|
118
126
|
},
|
|
119
127
|
},
|
|
120
|
-
|
|
128
|
+
// 綁銀行與 OTP 同為登入完成前的關卡:放在 loginSuccess 之前,登入後的副作用(公告、活動彈窗等)
|
|
129
|
+
// 才不會在綁定窗開著時觸發。是否需要綁定由前端依 siteConfig 判斷,machine 只負責等待結果。
|
|
130
|
+
bindBankChecking: {
|
|
121
131
|
initial: 'pending',
|
|
122
132
|
states: {
|
|
123
133
|
pending: {
|
|
@@ -141,10 +151,10 @@ export default function (request) {
|
|
|
141
151
|
},
|
|
142
152
|
},
|
|
143
153
|
on: {
|
|
144
|
-
|
|
154
|
+
BIND_BANK_DONE: {
|
|
145
155
|
target: 'loginSuccess',
|
|
146
156
|
},
|
|
147
|
-
|
|
157
|
+
BIND_BANK_SKIP: {
|
|
148
158
|
target: 'loginSuccess',
|
|
149
159
|
},
|
|
150
160
|
LOGOUT: {
|
|
@@ -292,9 +302,6 @@ export default function (request) {
|
|
|
292
302
|
CLEAR: {
|
|
293
303
|
target: '.logout',
|
|
294
304
|
},
|
|
295
|
-
LOGIN_GUEST: {
|
|
296
|
-
target: '.authenticationGuest',
|
|
297
|
-
},
|
|
298
305
|
LOGIN_ID: {
|
|
299
306
|
target: '.authentication',
|
|
300
307
|
actions: ['setReCaptchaToken', 'setLoginId'],
|
|
@@ -307,16 +314,9 @@ export default function (request) {
|
|
|
307
314
|
target: '.authentication',
|
|
308
315
|
actions: ['setReCaptchaToken', 'setLoginEmail'],
|
|
309
316
|
},
|
|
310
|
-
LOGIN_LOCAL: {
|
|
311
|
-
target: '.authentication',
|
|
312
|
-
actions: 'setLoginLocal',
|
|
313
|
-
},
|
|
314
317
|
LOGIN_3PARTY: {
|
|
315
318
|
actions: 'redirectTo3Party',
|
|
316
319
|
},
|
|
317
|
-
LOGIN_APP: {
|
|
318
|
-
target: '.authenticationApp',
|
|
319
|
-
},
|
|
320
320
|
LOGIN_TELEGRAM: {
|
|
321
321
|
target: '.authentication',
|
|
322
322
|
actions: 'setLoginTelegram',
|
|
@@ -402,20 +402,6 @@ export default function (request) {
|
|
|
402
402
|
},
|
|
403
403
|
}
|
|
404
404
|
}),
|
|
405
|
-
setLoginLocal: assign((context, event) => {
|
|
406
|
-
const { username, password } = event.data
|
|
407
|
-
storage.set(userKey, username, {
|
|
408
|
-
path: '/',
|
|
409
|
-
maxAge: 60 * 60 * 24,
|
|
410
|
-
})
|
|
411
|
-
return {
|
|
412
|
-
loginData: {
|
|
413
|
-
provider: 'local',
|
|
414
|
-
username,
|
|
415
|
-
password,
|
|
416
|
-
},
|
|
417
|
-
}
|
|
418
|
-
}),
|
|
419
405
|
setLoginTelegram: assign((context, event) => {
|
|
420
406
|
const { loginType, additionalUserInfo, isSignature, idToken } = event.data
|
|
421
407
|
return {
|
|
@@ -569,19 +555,11 @@ export default function (request) {
|
|
|
569
555
|
}),
|
|
570
556
|
},
|
|
571
557
|
services: {
|
|
572
|
-
authenticateApp: async (context, event) => {
|
|
573
|
-
const { token } = await request.send(auth.loginApp(event.data))
|
|
574
|
-
return token
|
|
575
|
-
},
|
|
576
558
|
authenticate: async (context, event) => {
|
|
577
559
|
const data = { ...context.loginData, reCaptchaToken: context.reCaptchaToken }
|
|
578
560
|
const { token } = await request.send(auth.login(data))
|
|
579
561
|
return token
|
|
580
562
|
},
|
|
581
|
-
authenticateGuest: async (context, event) => {
|
|
582
|
-
const { token } = await request.send(auth.guestLogin())
|
|
583
|
-
return token
|
|
584
|
-
},
|
|
585
563
|
logout: async (context, event) => {
|
|
586
564
|
return await request.send(auth.logout())
|
|
587
565
|
},
|
|
@@ -48,16 +48,29 @@ export default function (request) {
|
|
|
48
48
|
{ target: 'notVerified', cond: 'isNotVerified' },
|
|
49
49
|
],
|
|
50
50
|
},
|
|
51
|
+
autoVerifying: {
|
|
52
|
+
invoke: {
|
|
53
|
+
src: 'fetchUserInfo',
|
|
54
|
+
onDone: {
|
|
55
|
+
target: 'checkingAutoVerification',
|
|
56
|
+
actions: 'setUserInfo',
|
|
57
|
+
},
|
|
58
|
+
onError: { target: 'fail' },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
checkingAutoVerification: {
|
|
62
|
+
always: [{ target: 'verified', cond: 'isVerified' }, { target: 'fail' }],
|
|
63
|
+
},
|
|
51
64
|
notVerified: {
|
|
52
65
|
initial: 'checkingStatus',
|
|
53
66
|
states: {
|
|
54
67
|
checkingStatus: {
|
|
55
68
|
invoke: {
|
|
56
69
|
src: 'verify',
|
|
57
|
-
onDone:
|
|
58
|
-
target: '
|
|
59
|
-
actions: 'setVerificationData',
|
|
60
|
-
|
|
70
|
+
onDone: [
|
|
71
|
+
{ target: '#auth_otp.autoVerifying', cond: 'doesNotNeedAcknowledge' },
|
|
72
|
+
{ target: 'otp', actions: 'setVerificationData' },
|
|
73
|
+
],
|
|
61
74
|
onError: {
|
|
62
75
|
target: 'errorChecking',
|
|
63
76
|
actions: 'setError',
|
|
@@ -86,20 +99,20 @@ export default function (request) {
|
|
|
86
99
|
sendingPhone: {
|
|
87
100
|
invoke: {
|
|
88
101
|
src: 'sendPhone',
|
|
89
|
-
onDone:
|
|
90
|
-
target: '
|
|
91
|
-
actions: 'setVerificationData',
|
|
92
|
-
|
|
102
|
+
onDone: [
|
|
103
|
+
{ target: '#auth_otp.autoVerifying', cond: 'doesNotNeedAcknowledge' },
|
|
104
|
+
{ target: 'otp', actions: 'setVerificationData' },
|
|
105
|
+
],
|
|
93
106
|
onError: { target: 'phone' },
|
|
94
107
|
},
|
|
95
108
|
},
|
|
96
109
|
sendingEmail: {
|
|
97
110
|
invoke: {
|
|
98
111
|
src: 'sendEmail',
|
|
99
|
-
onDone:
|
|
100
|
-
target: '
|
|
101
|
-
actions: 'setVerificationData',
|
|
102
|
-
|
|
112
|
+
onDone: [
|
|
113
|
+
{ target: '#auth_otp.autoVerifying', cond: 'doesNotNeedAcknowledge' },
|
|
114
|
+
{ target: 'otp', actions: 'setVerificationData' },
|
|
115
|
+
],
|
|
103
116
|
onError: { target: 'email' },
|
|
104
117
|
},
|
|
105
118
|
},
|
|
@@ -129,9 +142,6 @@ export default function (request) {
|
|
|
129
142
|
RESET_OTP: {
|
|
130
143
|
target: 'reset',
|
|
131
144
|
},
|
|
132
|
-
RESEND_PHONE: {
|
|
133
|
-
target: '#auth_otp.notVerified.phone',
|
|
134
|
-
},
|
|
135
145
|
},
|
|
136
146
|
},
|
|
137
147
|
acknowledging: {
|
|
@@ -216,10 +226,11 @@ export default function (request) {
|
|
|
216
226
|
}),
|
|
217
227
|
},
|
|
218
228
|
guards: {
|
|
229
|
+
doesNotNeedAcknowledge: (context, event) => event.data?.needAcknowledge === false,
|
|
219
230
|
isVerified: (context, event) => {
|
|
220
231
|
const { strategy, userInfo } = context
|
|
221
|
-
if (strategy === 'phone') return !!userInfo?.phone_verification_status
|
|
222
|
-
if (strategy === 'email') return !!userInfo?.email_verification_status
|
|
232
|
+
if (strategy === 'phone') return !!(userInfo?.phone || userInfo?.tel) && !!userInfo?.phone_verification_status
|
|
233
|
+
if (strategy === 'email') return !!userInfo?.email && !!userInfo?.email_verification_status
|
|
223
234
|
return false
|
|
224
235
|
},
|
|
225
236
|
isNotVerified: (context, event) => {
|
|
@@ -231,11 +242,11 @@ export default function (request) {
|
|
|
231
242
|
},
|
|
232
243
|
isPhoneNotVerified: (context, event) => {
|
|
233
244
|
const { strategy, userInfo } = context
|
|
234
|
-
return strategy === 'phone' && !!userInfo && !userInfo.
|
|
245
|
+
return strategy === 'phone' && !!userInfo && !(userInfo.phone || userInfo.tel)
|
|
235
246
|
},
|
|
236
247
|
isEmailNotVerified: (context, event) => {
|
|
237
248
|
const { strategy, userInfo } = context
|
|
238
|
-
return strategy === 'email' && !!userInfo && !userInfo.
|
|
249
|
+
return strategy === 'email' && !!userInfo && !userInfo.email
|
|
239
250
|
},
|
|
240
251
|
hasNoPhone: (context, event) => {
|
|
241
252
|
const { error } = context
|
package/src/machine/common.js
CHANGED
|
@@ -34,8 +34,6 @@ export default function (request) {
|
|
|
34
34
|
broadcastList: null,
|
|
35
35
|
mailBoxInfo: null,
|
|
36
36
|
promotions: [],
|
|
37
|
-
normalBroadcast: null,
|
|
38
|
-
sentNormalBroadcastList: [],
|
|
39
37
|
affiliateCode: null,
|
|
40
38
|
defaultAffiliateCode: null,
|
|
41
39
|
friendCode: null,
|
|
@@ -159,39 +157,6 @@ export default function (request) {
|
|
|
159
157
|
},
|
|
160
158
|
},
|
|
161
159
|
},
|
|
162
|
-
broadcast: {
|
|
163
|
-
initial: 'idle',
|
|
164
|
-
states: {
|
|
165
|
-
idle: {
|
|
166
|
-
on: {
|
|
167
|
-
START_BROADCAST: {
|
|
168
|
-
target: 'picking',
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
picking: {
|
|
173
|
-
after: {
|
|
174
|
-
5000: {
|
|
175
|
-
target: 'display',
|
|
176
|
-
actions: 'setBroadcast',
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
display: {
|
|
181
|
-
after: {
|
|
182
|
-
5000: {
|
|
183
|
-
target: 'picking',
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
on: {
|
|
189
|
-
RESET_BROADCAST: {
|
|
190
|
-
target: '.idle',
|
|
191
|
-
actions: 'resetBroadcast',
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
160
|
},
|
|
196
161
|
},
|
|
197
162
|
{
|
|
@@ -306,26 +271,6 @@ export default function (request) {
|
|
|
306
271
|
}
|
|
307
272
|
return { broadcastList, mailBoxInfo }
|
|
308
273
|
}),
|
|
309
|
-
setBroadcast: assign((context, event) => {
|
|
310
|
-
const { broadcastList, sentNormalBroadcastList, normalBroadcast } = context
|
|
311
|
-
let sentNormalList = sentNormalBroadcastList
|
|
312
|
-
if (normalBroadcast) {
|
|
313
|
-
sentNormalList = [...sentNormalBroadcastList, normalBroadcast]
|
|
314
|
-
}
|
|
315
|
-
const nextNormalBroadcast = broadcastList?.broadcasts?.find((broadcast) => {
|
|
316
|
-
return broadcast.type === '0' && !sentNormalList.some((item) => item.broadcast_id === broadcast.broadcast_id)
|
|
317
|
-
})
|
|
318
|
-
return {
|
|
319
|
-
normalBroadcast: nextNormalBroadcast,
|
|
320
|
-
sentNormalBroadcastList: sentNormalList,
|
|
321
|
-
}
|
|
322
|
-
}),
|
|
323
|
-
resetBroadcast: assign((context, event) => {
|
|
324
|
-
return {
|
|
325
|
-
normalBroadcast: null,
|
|
326
|
-
sentNormalBroadcastList: [],
|
|
327
|
-
}
|
|
328
|
-
}),
|
|
329
274
|
resetByEnterGame: assign((context, event) => {
|
|
330
275
|
return {
|
|
331
276
|
isPlaying: true,
|
|
@@ -1,49 +1,21 @@
|
|
|
1
|
-
import manual_vn from './manual_vn.js'
|
|
2
|
-
import loadcard_vn from './loadcard_vn.js'
|
|
3
|
-
import qrcode_v2 from './qrcode_v2.js'
|
|
4
|
-
import deposit_fc from './deposit_fc.js'
|
|
5
|
-
import direct from './direct.js'
|
|
6
|
-
import amb from './amb.js'
|
|
7
|
-
import float from './float.js'
|
|
8
|
-
import vpay from './vpay.js'
|
|
9
|
-
import krway from './krway.js'
|
|
10
|
-
import usdt from './usdt.js'
|
|
11
1
|
import manual_cash from './manual_cash.js'
|
|
12
2
|
import qrcode_cash from './qrcode_cash.js'
|
|
13
3
|
import usdt_cash from './usdt_cash.js'
|
|
14
4
|
import direct_cash from './direct_cash.js'
|
|
15
5
|
import loadcard_cash from './loadcard_cash.js'
|
|
16
|
-
import crypto_bank from './crypto_bank.js'
|
|
17
|
-
import crypto_qrcode from './crypto_qrcode.js'
|
|
18
|
-
import crypto_way from './crypto_way.js'
|
|
19
6
|
import crypto_bank_cash from './crypto_bank_cash.js'
|
|
20
7
|
import crypto_qrcode_cash from './crypto_qrcode_cash.js'
|
|
21
8
|
import crypto_way_cash from './crypto_way_cash.js'
|
|
22
|
-
import virtual_bank_vn from './virtual_bank_vn.js'
|
|
23
9
|
import virtual_bank_cash from './virtual_bank_cash.js'
|
|
24
10
|
|
|
25
11
|
export default {
|
|
26
|
-
manual_vn,
|
|
27
|
-
loadcard_vn,
|
|
28
|
-
qrcode_v2,
|
|
29
|
-
deposit_fc,
|
|
30
|
-
direct,
|
|
31
|
-
amb,
|
|
32
|
-
float,
|
|
33
|
-
vpay,
|
|
34
|
-
usdt,
|
|
35
|
-
krway,
|
|
36
12
|
manual_cash,
|
|
37
13
|
qrcode_cash,
|
|
38
14
|
usdt_cash,
|
|
39
15
|
direct_cash,
|
|
40
16
|
loadcard_cash,
|
|
41
|
-
crypto_bank,
|
|
42
|
-
crypto_qrcode,
|
|
43
|
-
crypto_way,
|
|
44
17
|
crypto_bank_cash,
|
|
45
18
|
crypto_qrcode_cash,
|
|
46
19
|
crypto_way_cash,
|
|
47
|
-
virtual_bank_vn,
|
|
48
20
|
virtual_bank_cash,
|
|
49
21
|
}
|