@jetthai/cuora 1.1.128-dev-2 → 1.1.129
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/CHANGELOG.md +0 -422
- package/package.json +1 -1
- package/src/api/activity.js +0 -28
- package/src/api/auth.js +0 -6
- package/src/api/common.js +1 -2
- package/src/api/game.js +4 -5
- package/src/api/mailbox.js +5 -9
- package/src/api/payment.js +8 -103
- package/src/api/user.js +0 -2
- package/src/machine/activity/activity.js +16 -56
- package/src/machine/activity/activity_cash.js +14 -78
- package/src/machine/activity/diamond_shop_activity_cash.js +92 -57
- package/src/machine/activity/diamond_shop_activity_vn.js +89 -54
- package/src/machine/activity/fafafa_activity.js +1 -8
- package/src/machine/activity/friend_invite_friends_activity.js +1 -3
- package/src/machine/activity/index.js +0 -6
- package/src/machine/activity/roulette_activity_v2.js +2 -11
- package/src/machine/activity/sign_in_activity.js +13 -20
- package/src/machine/auth.js +5 -54
- package/src/machine/bank_binding.js +12 -112
- package/src/machine/bank_binding_amb.js +1 -6
- package/src/machine/common.js +24 -92
- package/src/machine/deposit/amb.js +3 -5
- package/src/machine/deposit/crypto.js +10 -14
- package/src/machine/deposit/crypto_button.js +5 -9
- package/src/machine/deposit/crypto_cash.js +5 -2
- package/src/machine/deposit/direct.js +15 -2
- package/src/machine/deposit/direct_cash.js +26 -6
- package/src/machine/deposit/float.js +3 -5
- package/src/machine/deposit/index.js +0 -14
- package/src/machine/deposit/loadcard_cash.js +27 -6
- package/src/machine/deposit/loadcard_vn.js +13 -2
- package/src/machine/deposit/manual_cash.js +38 -89
- package/src/machine/deposit/manual_vn.js +47 -97
- package/src/machine/deposit/qrcode_cash.js +23 -12
- package/src/machine/deposit/qrcode_v2.js +14 -3
- package/src/machine/deposit/usdt_cash.js +2 -0
- package/src/machine/deposit/vpay.js +3 -5
- package/src/machine/game_search_cash.js +12 -137
- package/src/machine/game_search_v2.js +4 -4
- package/src/machine/game_v2_1.js +7 -131
- package/src/machine/inbox.js +34 -259
- package/src/machine/index.js +0 -6
- package/src/machine/leaderboard.js +8 -31
- package/src/machine/reward_cash.js +1 -1
- package/src/machine/side_v2.js +1 -1
- package/src/machine/user_sign_up.js +7 -71
- package/src/machine/withdraw/index.js +0 -6
- package/src/machine/withdraw/withdraw_crypto.js +66 -1
- package/src/machine/withdraw/withdraw_manual_cash.js +14 -44
- package/src/machine/withdraw/withdraw_vn.js +7 -42
- package/src/machine/withdraw/withdraw_vn2.js +37 -64
- package/src/util/constant.js +0 -18
- package/src/util/deviceToken.js +2 -2
- package/src/machine/activity/cash_rain_activity.js +0 -153
- package/src/machine/activity/instant_rebate_activity.js +0 -214
- package/src/machine/activity/vip_card_activity.js +0 -140
- package/src/machine/deposit/crypto_bank.js +0 -317
- package/src/machine/deposit/crypto_bank_cash.js +0 -280
- package/src/machine/deposit/crypto_qrcode.js +0 -147
- package/src/machine/deposit/crypto_qrcode_cash.js +0 -131
- package/src/machine/deposit/crypto_way.js +0 -220
- package/src/machine/deposit/crypto_way_cash.js +0 -242
- package/src/machine/deposit/krway.js +0 -151
- package/src/machine/game_info.js +0 -57
- package/src/machine/honor_board_cash.js +0 -63
- package/src/machine/user_photo.js +0 -65
- package/src/machine/withdraw/withdraw_crypto2.js +0 -540
- package/src/machine/withdraw/withdraw_krway.js +0 -207
- package/src/machine/withdraw/withdraw_manual.js +0 -595
package/src/machine/auth.js
CHANGED
|
@@ -14,7 +14,6 @@ export default function (request) {
|
|
|
14
14
|
const phoneCountryCode = 'phone_countrycode'
|
|
15
15
|
const accountPhoneKey = 'account_phone'
|
|
16
16
|
const accountEmailKey = 'account_email'
|
|
17
|
-
const accountUsernameKey = 'account_username'
|
|
18
17
|
|
|
19
18
|
return createMachine(
|
|
20
19
|
{
|
|
@@ -55,7 +54,7 @@ export default function (request) {
|
|
|
55
54
|
},
|
|
56
55
|
idle: {
|
|
57
56
|
entry: 'fetchToken',
|
|
58
|
-
always: [{ target: '
|
|
57
|
+
always: [{ target: 'authenticated', cond: 'hasToken' }],
|
|
59
58
|
},
|
|
60
59
|
authentication: {
|
|
61
60
|
invoke: {
|
|
@@ -97,25 +96,6 @@ export default function (request) {
|
|
|
97
96
|
},
|
|
98
97
|
},
|
|
99
98
|
authenticated: {
|
|
100
|
-
invoke: {
|
|
101
|
-
src: 'fetchUserInfo',
|
|
102
|
-
onDone: {
|
|
103
|
-
target: 'loginSuccess',
|
|
104
|
-
actions: ['setUserInfo', 'extendToken'],
|
|
105
|
-
},
|
|
106
|
-
onError: {
|
|
107
|
-
target: 'leaving',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
loginSuccess: {
|
|
112
|
-
after: {
|
|
113
|
-
0: {
|
|
114
|
-
target: 'inline',
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
tokenAuthenticated: {
|
|
119
99
|
invoke: {
|
|
120
100
|
src: 'fetchUserInfo',
|
|
121
101
|
onDone: {
|
|
@@ -230,10 +210,6 @@ export default function (request) {
|
|
|
230
210
|
LOGIN_GUEST: {
|
|
231
211
|
target: '.authenticationGuest',
|
|
232
212
|
},
|
|
233
|
-
LOGIN_ID: {
|
|
234
|
-
target: '.authentication',
|
|
235
|
-
actions: ['setReCaptchaToken', 'setLoginId'],
|
|
236
|
-
},
|
|
237
213
|
LOGIN_PHONE: {
|
|
238
214
|
target: '.authentication',
|
|
239
215
|
actions: ['setReCaptchaToken', 'setLoginPhone'],
|
|
@@ -288,16 +264,6 @@ export default function (request) {
|
|
|
288
264
|
reCaptchaToken,
|
|
289
265
|
}
|
|
290
266
|
}),
|
|
291
|
-
setLoginId: assign((context, event) => {
|
|
292
|
-
const { username, password } = event.data
|
|
293
|
-
return {
|
|
294
|
-
loginData: {
|
|
295
|
-
provider: 'local',
|
|
296
|
-
username,
|
|
297
|
-
password,
|
|
298
|
-
},
|
|
299
|
-
}
|
|
300
|
-
}),
|
|
301
267
|
setLoginPhone: assign((context, event) => {
|
|
302
268
|
const { countryCode, countryAbbr, phone, password } = event.data
|
|
303
269
|
return {
|
|
@@ -350,31 +316,22 @@ export default function (request) {
|
|
|
350
316
|
}
|
|
351
317
|
}),
|
|
352
318
|
setAccount: assign((context, event) => {
|
|
353
|
-
if (context.loginData.
|
|
354
|
-
storage.remove(accountEmailKey)
|
|
355
|
-
storage.remove(accountPhoneKey)
|
|
356
|
-
storage.set(accountUsernameKey, `${context.loginData.username}`, {
|
|
357
|
-
path: '/',
|
|
358
|
-
maxAge: 60 * 60 * 24 * 31,
|
|
359
|
-
})
|
|
360
|
-
} else if (context.loginData.phone) {
|
|
319
|
+
if (context.loginData.phone) {
|
|
361
320
|
storage.remove(accountEmailKey)
|
|
362
|
-
storage.remove(accountUsernameKey)
|
|
363
321
|
storage.set(accountPhoneKey, `${context.loginData.phone}`, {
|
|
364
322
|
path: '/',
|
|
365
|
-
maxAge: 60 * 60 * 24 *
|
|
323
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
366
324
|
})
|
|
367
325
|
storage.set(phoneCountryCode, `${context.countryAbbr}_${context.loginData.countryCode}`, {
|
|
368
326
|
path: '/',
|
|
369
|
-
maxAge: 60 * 60 * 24 *
|
|
327
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
370
328
|
})
|
|
371
329
|
} else if (context.loginData.email) {
|
|
372
330
|
storage.remove(accountPhoneKey)
|
|
373
331
|
storage.remove(phoneCountryCode)
|
|
374
|
-
storage.remove(accountUsernameKey)
|
|
375
332
|
storage.set(accountEmailKey, context.loginData.email, {
|
|
376
333
|
path: '/',
|
|
377
|
-
maxAge: 60 * 60 * 24 *
|
|
334
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
378
335
|
})
|
|
379
336
|
}
|
|
380
337
|
}),
|
|
@@ -405,7 +362,6 @@ export default function (request) {
|
|
|
405
362
|
})
|
|
406
363
|
|
|
407
364
|
const affiliateCode = storage.get('ac')
|
|
408
|
-
const nickname = storage.get('nk')
|
|
409
365
|
const messages = {
|
|
410
366
|
url: window.location.href,
|
|
411
367
|
channelOrders: [
|
|
@@ -414,7 +370,6 @@ export default function (request) {
|
|
|
414
370
|
{ channel: channel, subchannel: subchannel },
|
|
415
371
|
],
|
|
416
372
|
affiliateCode,
|
|
417
|
-
nickname,
|
|
418
373
|
}
|
|
419
374
|
sentry.captureMessage(JSON.stringify(messages))
|
|
420
375
|
|
|
@@ -423,10 +378,6 @@ export default function (request) {
|
|
|
423
378
|
referralObj.ac = affiliateCode
|
|
424
379
|
}
|
|
425
380
|
|
|
426
|
-
if (![undefined, 'undefined', null, 'null'].includes(nickname)) {
|
|
427
|
-
referralObj.nick_name = nickname
|
|
428
|
-
}
|
|
429
|
-
|
|
430
381
|
referralObj.channel = storage.get('channel') || defaultChannel || channel
|
|
431
382
|
referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel
|
|
432
383
|
|
|
@@ -2,32 +2,17 @@ import { assign, createMachine } from 'xstate'
|
|
|
2
2
|
import payment from '../api/payment.js'
|
|
3
3
|
|
|
4
4
|
export default function (request) {
|
|
5
|
-
const { appSecret } = request.config
|
|
6
|
-
|
|
7
5
|
return createMachine(
|
|
8
6
|
{
|
|
9
7
|
id: 'bank_binding',
|
|
10
8
|
initial: 'fetching',
|
|
11
9
|
context: {
|
|
12
10
|
hasAnyAccount: false,
|
|
13
|
-
|
|
14
|
-
bankList: [],
|
|
15
|
-
cryptoList: [],
|
|
16
|
-
ewalletList: [],
|
|
17
|
-
},
|
|
18
|
-
currency: null,
|
|
19
|
-
bindingType: 'BANK',
|
|
11
|
+
bankList: [],
|
|
20
12
|
bank: null,
|
|
21
|
-
ifscCode: null,
|
|
22
|
-
crypto: null,
|
|
23
|
-
network: null,
|
|
24
|
-
cryptoAddress: null,
|
|
25
|
-
walletCode: null,
|
|
26
13
|
branch: null,
|
|
27
|
-
branchCode: null,
|
|
28
14
|
accountNumber: null,
|
|
29
15
|
holderName: null,
|
|
30
|
-
pixType: null,
|
|
31
16
|
},
|
|
32
17
|
states: {
|
|
33
18
|
fetching: {
|
|
@@ -44,13 +29,6 @@ export default function (request) {
|
|
|
44
29
|
},
|
|
45
30
|
idle: {
|
|
46
31
|
on: {
|
|
47
|
-
SET_BIND_TYPE: {
|
|
48
|
-
actions: assign((context, event) => {
|
|
49
|
-
return {
|
|
50
|
-
bindingType: event.data,
|
|
51
|
-
}
|
|
52
|
-
}),
|
|
53
|
-
},
|
|
54
32
|
SET_BANK_CODE: {
|
|
55
33
|
actions: assign((context, event) => {
|
|
56
34
|
return {
|
|
@@ -58,34 +36,6 @@ export default function (request) {
|
|
|
58
36
|
}
|
|
59
37
|
}),
|
|
60
38
|
},
|
|
61
|
-
SET_CRYPTO_CODE: {
|
|
62
|
-
actions: assign((context, event) => {
|
|
63
|
-
return {
|
|
64
|
-
crypto: event.data,
|
|
65
|
-
}
|
|
66
|
-
}),
|
|
67
|
-
},
|
|
68
|
-
SET_NETWORK_CODE: {
|
|
69
|
-
actions: assign((context, event) => {
|
|
70
|
-
return {
|
|
71
|
-
network: event.data,
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
},
|
|
75
|
-
SET_CRYPTO_ADDRESS: {
|
|
76
|
-
actions: assign((context, event) => {
|
|
77
|
-
return {
|
|
78
|
-
cryptoAddress: event.data,
|
|
79
|
-
}
|
|
80
|
-
}),
|
|
81
|
-
},
|
|
82
|
-
SET_WALLET_CODE: {
|
|
83
|
-
actions: assign((context, event) => {
|
|
84
|
-
return {
|
|
85
|
-
walletCode: event.data,
|
|
86
|
-
}
|
|
87
|
-
}),
|
|
88
|
-
},
|
|
89
39
|
SET_BRANCH: {
|
|
90
40
|
actions: assign((context, event) => {
|
|
91
41
|
return {
|
|
@@ -93,13 +43,6 @@ export default function (request) {
|
|
|
93
43
|
}
|
|
94
44
|
}),
|
|
95
45
|
},
|
|
96
|
-
SET_BRANCH_CODE: {
|
|
97
|
-
actions: assign((context, event) => {
|
|
98
|
-
return {
|
|
99
|
-
branchCode: event.data,
|
|
100
|
-
}
|
|
101
|
-
}),
|
|
102
|
-
},
|
|
103
46
|
SET_ACCOUNT_NUMBER: {
|
|
104
47
|
actions: assign((context, event) => {
|
|
105
48
|
return {
|
|
@@ -114,20 +57,6 @@ export default function (request) {
|
|
|
114
57
|
}
|
|
115
58
|
}),
|
|
116
59
|
},
|
|
117
|
-
SET_PIX_TYPE: {
|
|
118
|
-
actions: assign((context, event) => {
|
|
119
|
-
return {
|
|
120
|
-
pixType: event.data,
|
|
121
|
-
}
|
|
122
|
-
}),
|
|
123
|
-
},
|
|
124
|
-
SET_IFSC_CODE: {
|
|
125
|
-
actions: assign((context, event) => {
|
|
126
|
-
return {
|
|
127
|
-
ifscCode: event.data,
|
|
128
|
-
}
|
|
129
|
-
}),
|
|
130
|
-
},
|
|
131
60
|
BIND_BANK: {
|
|
132
61
|
target: 'binding',
|
|
133
62
|
cond: 'isBindable',
|
|
@@ -151,66 +80,37 @@ export default function (request) {
|
|
|
151
80
|
{
|
|
152
81
|
actions: {
|
|
153
82
|
setBanks: assign((context, event) => {
|
|
154
|
-
const {
|
|
83
|
+
const { bankList = [], paymentInfo = {} } = event.data
|
|
155
84
|
const { bankInfo = [] } = paymentInfo
|
|
156
85
|
return {
|
|
157
86
|
hasAnyAccount: bankInfo.length > 0,
|
|
158
87
|
holderName: bankInfo[0]?.holderName,
|
|
159
|
-
|
|
160
|
-
bank:
|
|
88
|
+
bankList,
|
|
89
|
+
bank: bankList[0],
|
|
161
90
|
}
|
|
162
91
|
}),
|
|
163
92
|
},
|
|
164
93
|
guards: {
|
|
165
94
|
isBindable: (context, event) => {
|
|
166
|
-
const {
|
|
167
|
-
|
|
168
|
-
if (bindingType === 'CRYPTO') {
|
|
169
|
-
// 虛擬貨幣
|
|
170
|
-
const { crypto, network, cryptoAddress, holderName } = context
|
|
171
|
-
return crypto && network && cryptoAddress && holderName
|
|
172
|
-
} else if (bindingType === 'EWALLET') {
|
|
173
|
-
// 電子錢包
|
|
174
|
-
const { walletCode, accountNumber, holderName } = context
|
|
175
|
-
return walletCode?.bankCode && accountNumber && holderName
|
|
176
|
-
} else {
|
|
177
|
-
// 一般銀行
|
|
178
|
-
if (currency === 'INR') {
|
|
179
|
-
// 如果是印度幣別
|
|
180
|
-
const { bank, ifscCode, accountNumber, branch, holderName } = context
|
|
181
|
-
return bank.bankCode && ifscCode && accountNumber && branch && holderName
|
|
182
|
-
} else {
|
|
183
|
-
const { bank, accountNumber, branch, holderName } = context
|
|
184
|
-
return bank.bankCode && accountNumber && branch && holderName
|
|
185
|
-
}
|
|
186
|
-
}
|
|
95
|
+
const { bank, accountNumber, branch, holderName } = context
|
|
96
|
+
return bank.bankCode && accountNumber && branch && holderName
|
|
187
97
|
},
|
|
188
98
|
},
|
|
189
99
|
services: {
|
|
190
100
|
fetchInitData: async (context, event) => {
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return { paymentList, paymentInfo }
|
|
101
|
+
const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }))
|
|
102
|
+
const method = paymentDetail.find((payment) => payment.category === 'manual').method
|
|
103
|
+
const [bankList, paymentInfo] = await Promise.all([request.send(payment.getBankList(method)), request.send(payment.getPaymentInfo())])
|
|
104
|
+
return { bankList, paymentInfo }
|
|
196
105
|
},
|
|
197
106
|
updatePaymentInfo: async (context, event) => {
|
|
198
|
-
const {
|
|
199
|
-
context
|
|
107
|
+
const { bank, branch, accountNumber, holderName } = context
|
|
200
108
|
return await request.send(
|
|
201
109
|
payment.updatePaymentInfo({
|
|
202
|
-
|
|
203
|
-
ifscCode,
|
|
204
|
-
bankCode: bank?.bankCode || '',
|
|
205
|
-
cryptoCurrency: crypto?.symbol || '',
|
|
206
|
-
cryptoNetwork: network?.label || '',
|
|
207
|
-
cryptoAddress: cryptoAddress,
|
|
208
|
-
walletCode: walletCode?.bankCode || '',
|
|
110
|
+
bankCode: bank.bankCode,
|
|
209
111
|
branch: branch === 'BLANK' ? '' : branch, // 'BLANK'會置換成空值
|
|
210
|
-
branchCode,
|
|
211
112
|
bankAccount: accountNumber,
|
|
212
113
|
holderName,
|
|
213
|
-
pixType,
|
|
214
114
|
})
|
|
215
115
|
)
|
|
216
116
|
},
|
|
@@ -2,8 +2,6 @@ import { assign, createMachine } from 'xstate'
|
|
|
2
2
|
import payment from '../api/payment.js'
|
|
3
3
|
|
|
4
4
|
export default function (request) {
|
|
5
|
-
const { appSecret } = request.config
|
|
6
|
-
|
|
7
5
|
return createMachine(
|
|
8
6
|
{
|
|
9
7
|
id: 'bank_binding_amb',
|
|
@@ -118,10 +116,7 @@ export default function (request) {
|
|
|
118
116
|
},
|
|
119
117
|
services: {
|
|
120
118
|
fetchInitData: async (context, event) => {
|
|
121
|
-
const [bankList, paymentInfo] = await Promise.all([
|
|
122
|
-
request.send(payment.getBindingBankList({ appSecret })),
|
|
123
|
-
request.send(payment.getPaymentInfo()),
|
|
124
|
-
])
|
|
119
|
+
const [bankList, paymentInfo] = await Promise.all([request.send(payment.getBankList('amb')), request.send(payment.getPaymentInfo())])
|
|
125
120
|
return { bankList, paymentInfo }
|
|
126
121
|
},
|
|
127
122
|
updatePaymentInfo: async (context, event) => {
|
package/src/machine/common.js
CHANGED
|
@@ -29,19 +29,19 @@ export default function (request) {
|
|
|
29
29
|
},
|
|
30
30
|
paymentMethods: {},
|
|
31
31
|
},
|
|
32
|
-
layoutConfig: null,
|
|
33
32
|
userAgent: '',
|
|
34
33
|
isMobile: false,
|
|
35
34
|
announcementList: null,
|
|
36
35
|
broadcastList: null,
|
|
37
36
|
mailBoxInfo: null,
|
|
38
37
|
promotions: [],
|
|
38
|
+
emergencyBroadcast: null,
|
|
39
39
|
normalBroadcast: null,
|
|
40
|
+
sentEmergencyBroadcastList: [],
|
|
40
41
|
sentNormalBroadcastList: [],
|
|
41
42
|
channel: null,
|
|
42
43
|
subchannel: null,
|
|
43
44
|
affiliateCode: null,
|
|
44
|
-
friendCode: null,
|
|
45
45
|
},
|
|
46
46
|
states: {
|
|
47
47
|
config: {
|
|
@@ -55,12 +55,12 @@ export default function (request) {
|
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
fetching: {
|
|
58
|
-
entry: ['setUA', 'setAgent', 'setPixel'
|
|
58
|
+
entry: ['setUA', 'setAgent', 'setPixel'],
|
|
59
59
|
invoke: {
|
|
60
|
-
src: '
|
|
60
|
+
src: 'fetchSiteConfig',
|
|
61
61
|
onDone: {
|
|
62
62
|
target: 'idle',
|
|
63
|
-
actions: '
|
|
63
|
+
actions: 'setSiteConfig',
|
|
64
64
|
},
|
|
65
65
|
onError: {
|
|
66
66
|
target: 'idle',
|
|
@@ -93,30 +93,6 @@ export default function (request) {
|
|
|
93
93
|
},
|
|
94
94
|
},
|
|
95
95
|
},
|
|
96
|
-
getAnnouncements: {
|
|
97
|
-
initial: 'updating',
|
|
98
|
-
states: {
|
|
99
|
-
updating: {
|
|
100
|
-
invoke: {
|
|
101
|
-
src: 'fetchAnnouncements',
|
|
102
|
-
onDone: {
|
|
103
|
-
target: 'idle',
|
|
104
|
-
actions: 'setAnnouncements',
|
|
105
|
-
},
|
|
106
|
-
onError: {
|
|
107
|
-
target: 'idle',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
idle: {
|
|
112
|
-
on: {
|
|
113
|
-
FETCH_ANNOUNCEMENTS: {
|
|
114
|
-
target: 'updating',
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
96
|
broadcast: {
|
|
121
97
|
initial: 'idle',
|
|
122
98
|
states: {
|
|
@@ -159,28 +135,10 @@ export default function (request) {
|
|
|
159
135
|
},
|
|
160
136
|
},
|
|
161
137
|
actions: {
|
|
162
|
-
|
|
163
|
-
const {
|
|
164
|
-
const { loginMethods = {}, registerMethods = {} } = siteConfig
|
|
165
|
-
let layoutConfigDecoded = ''
|
|
166
|
-
|
|
167
|
-
if (layoutConfig) {
|
|
168
|
-
const base64Url = layoutConfig.split('.')[0]
|
|
169
|
-
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')
|
|
170
|
-
layoutConfigDecoded = decodeURIComponent(
|
|
171
|
-
window
|
|
172
|
-
.atob(base64)
|
|
173
|
-
.split('')
|
|
174
|
-
.map((c) => {
|
|
175
|
-
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
|
|
176
|
-
})
|
|
177
|
-
.join('')
|
|
178
|
-
)
|
|
179
|
-
layoutConfigDecoded = JSON.parse(layoutConfigDecoded)
|
|
180
|
-
}
|
|
138
|
+
setSiteConfig: assign((context, event) => {
|
|
139
|
+
const { loginMethods = {}, registerMethods = {} } = event.data
|
|
181
140
|
return {
|
|
182
|
-
siteConfig: { ...
|
|
183
|
-
layoutConfig: layoutConfigDecoded,
|
|
141
|
+
siteConfig: { ...event.data, loginMethods: pickBy(loginMethods), registerMethods: pickBy(registerMethods) },
|
|
184
142
|
}
|
|
185
143
|
}),
|
|
186
144
|
setUA: assign((context, event) => {
|
|
@@ -204,19 +162,6 @@ export default function (request) {
|
|
|
204
162
|
pix,
|
|
205
163
|
}
|
|
206
164
|
}),
|
|
207
|
-
setKPixel: assign(() => {
|
|
208
|
-
let urlParams = new URLSearchParams(window.location.search)
|
|
209
|
-
const kpix = urlParams.get('kpix') || storage.get('kpix') || ''
|
|
210
|
-
if (kpix !== '') {
|
|
211
|
-
storage.set('kpix', kpix, {
|
|
212
|
-
path: '/',
|
|
213
|
-
maxAge: 60 * 60 * 24 * 7,
|
|
214
|
-
})
|
|
215
|
-
}
|
|
216
|
-
return {
|
|
217
|
-
kpix,
|
|
218
|
-
}
|
|
219
|
-
}),
|
|
220
165
|
setAgent: assign((context, event) => {
|
|
221
166
|
if (window.CC_JSB === true) {
|
|
222
167
|
// is cocos native app
|
|
@@ -226,7 +171,6 @@ export default function (request) {
|
|
|
226
171
|
const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official'
|
|
227
172
|
const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa'
|
|
228
173
|
const affiliateCode = urlParams.get('ac') || urlParams.get('referralCode') || storage.get('ac') || storage.get('referralCode')
|
|
229
|
-
const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || storage.get('fc') || storage.get('affiliate')
|
|
230
174
|
|
|
231
175
|
storage.set('channel', channel, {
|
|
232
176
|
path: '/',
|
|
@@ -240,71 +184,59 @@ export default function (request) {
|
|
|
240
184
|
path: '/',
|
|
241
185
|
maxAge: 60 * 60 * 24 * 7,
|
|
242
186
|
})
|
|
243
|
-
storage.set('fc', friendCode, {
|
|
244
|
-
path: '/',
|
|
245
|
-
maxAge: 60 * 60 * 24 * 7,
|
|
246
|
-
})
|
|
247
187
|
|
|
248
188
|
return {
|
|
249
189
|
channel,
|
|
250
190
|
subchannel,
|
|
251
191
|
affiliateCode,
|
|
252
|
-
friendCode,
|
|
253
192
|
}
|
|
254
193
|
}
|
|
255
194
|
}),
|
|
256
|
-
setAnnouncements: assign((context, event) => {
|
|
257
|
-
const { data } = event.data
|
|
258
|
-
return { announcementList: { data } }
|
|
259
|
-
}),
|
|
260
195
|
setFeeds: assign((context, event) => {
|
|
261
196
|
const { announcementList, broadcastList, mailBoxInfo } = event.data
|
|
262
197
|
const promotions = announcementList?.announcements?.filter?.((item) => item.category === 3) || []
|
|
263
|
-
return { broadcastList, mailBoxInfo, promotions }
|
|
198
|
+
return { announcementList, broadcastList, mailBoxInfo, promotions }
|
|
264
199
|
}),
|
|
265
200
|
setBroadcast: assign((context, event) => {
|
|
266
|
-
const { broadcastList, sentNormalBroadcastList, normalBroadcast } = context
|
|
201
|
+
const { broadcastList, sentEmergencyBroadcastList, emergencyBroadcast, sentNormalBroadcastList, normalBroadcast } = context
|
|
202
|
+
let sentEmergencyList = sentEmergencyBroadcastList
|
|
267
203
|
let sentNormalList = sentNormalBroadcastList
|
|
204
|
+
if (emergencyBroadcast) {
|
|
205
|
+
sentEmergencyList = [...sentEmergencyBroadcastList, emergencyBroadcast]
|
|
206
|
+
}
|
|
268
207
|
if (normalBroadcast) {
|
|
269
208
|
sentNormalList = [...sentNormalBroadcastList, normalBroadcast]
|
|
270
209
|
}
|
|
210
|
+
const nextEmergencyBroadcast = broadcastList?.broadcasts?.find((broadcast) => {
|
|
211
|
+
return broadcast.type === '1' && !sentEmergencyList.some((item) => item.broadcast_id === broadcast.broadcast_id)
|
|
212
|
+
})
|
|
271
213
|
const nextNormalBroadcast = broadcastList?.broadcasts?.find((broadcast) => {
|
|
272
214
|
return broadcast.type === '0' && !sentNormalList.some((item) => item.broadcast_id === broadcast.broadcast_id)
|
|
273
215
|
})
|
|
274
216
|
return {
|
|
217
|
+
emergencyBroadcast: nextEmergencyBroadcast,
|
|
218
|
+
sentEmergencyBroadcastList: sentEmergencyList,
|
|
275
219
|
normalBroadcast: nextNormalBroadcast,
|
|
276
220
|
sentNormalBroadcastList: sentNormalList,
|
|
277
221
|
}
|
|
278
222
|
}),
|
|
279
223
|
resetBroadcast: assign((context, event) => {
|
|
280
224
|
return {
|
|
225
|
+
emergencyBroadcast: null,
|
|
226
|
+
sentEmergencyBroadcastList: [],
|
|
281
227
|
normalBroadcast: null,
|
|
282
228
|
sentNormalBroadcastList: [],
|
|
283
229
|
}
|
|
284
230
|
}),
|
|
285
231
|
},
|
|
286
232
|
services: {
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')
|
|
291
|
-
const decodeResult = decodeURIComponent(
|
|
292
|
-
window
|
|
293
|
-
.atob(base64)
|
|
294
|
-
.split('')
|
|
295
|
-
.map((c) => {
|
|
296
|
-
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
|
|
297
|
-
})
|
|
298
|
-
.join('')
|
|
299
|
-
)
|
|
300
|
-
return { siteConfig: JSON.parse(decodeResult), layoutConfig: layout.config }
|
|
233
|
+
fetchSiteConfig: async (context, event) => {
|
|
234
|
+
const { config } = await request.send(api.getConfig({ appSecret }))
|
|
235
|
+
return JSON.parse(window.atob(config))
|
|
301
236
|
},
|
|
302
237
|
fetchFeeds: async (context, event) => {
|
|
303
238
|
return await request.send(api.feeds({ appSecret }))
|
|
304
239
|
},
|
|
305
|
-
fetchAnnouncements: async (context, event) => {
|
|
306
|
-
return await request.send(api.getAnnouncements({ appSecret }))
|
|
307
|
-
},
|
|
308
240
|
},
|
|
309
241
|
}
|
|
310
242
|
)
|
|
@@ -54,7 +54,7 @@ export default function (request) {
|
|
|
54
54
|
actions: {
|
|
55
55
|
setUserAccount: assign((context, event) => {
|
|
56
56
|
return {
|
|
57
|
-
userAccount: event.data?.[0],
|
|
57
|
+
userAccount: event.data.bankInfo?.[0],
|
|
58
58
|
}
|
|
59
59
|
}),
|
|
60
60
|
setInitialization: assign((context, event) => {
|
|
@@ -69,14 +69,12 @@ export default function (request) {
|
|
|
69
69
|
},
|
|
70
70
|
guards: {
|
|
71
71
|
hasUserAccount: (context, event) => {
|
|
72
|
-
return event.data?.[0]
|
|
72
|
+
return event.data.bankInfo?.[0]
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
75
|
services: {
|
|
76
76
|
fetchPaymentInfo: async (context, event) => {
|
|
77
|
-
|
|
78
|
-
const filterArray = bankInfo?.filter((item) => item.bindingType !== 'CRYPTO' && item.bindingType !== 'EWALLET')
|
|
79
|
-
return filterArray || []
|
|
77
|
+
return await request.send(payment.getPaymentInfo())
|
|
80
78
|
},
|
|
81
79
|
initialize: async (context, event) => {
|
|
82
80
|
const { method } = context
|
|
@@ -19,7 +19,6 @@ export default function (request) {
|
|
|
19
19
|
sourceAddress: '',
|
|
20
20
|
|
|
21
21
|
amount: null,
|
|
22
|
-
selectedChannel: null,
|
|
23
22
|
selectedCrypto: null,
|
|
24
23
|
selectedNetwork: null,
|
|
25
24
|
|
|
@@ -37,7 +36,7 @@ export default function (request) {
|
|
|
37
36
|
invoke: {
|
|
38
37
|
src: 'fetchInitData',
|
|
39
38
|
onDone: {
|
|
40
|
-
target: '
|
|
39
|
+
target: 'idle',
|
|
41
40
|
actions: 'setInitData',
|
|
42
41
|
},
|
|
43
42
|
onError: {
|
|
@@ -45,7 +44,7 @@ export default function (request) {
|
|
|
45
44
|
},
|
|
46
45
|
},
|
|
47
46
|
},
|
|
48
|
-
|
|
47
|
+
idle: {
|
|
49
48
|
always: [{ target: 'debouncing', cond: 'isCalculable' }],
|
|
50
49
|
},
|
|
51
50
|
debouncing: {
|
|
@@ -63,7 +62,7 @@ export default function (request) {
|
|
|
63
62
|
actions: 'setCalculation',
|
|
64
63
|
},
|
|
65
64
|
onError: {
|
|
66
|
-
target: '
|
|
65
|
+
target: 'idle',
|
|
67
66
|
},
|
|
68
67
|
},
|
|
69
68
|
},
|
|
@@ -97,7 +96,7 @@ export default function (request) {
|
|
|
97
96
|
actions: 'setResult',
|
|
98
97
|
},
|
|
99
98
|
onError: {
|
|
100
|
-
target: '
|
|
99
|
+
target: 'idle',
|
|
101
100
|
},
|
|
102
101
|
},
|
|
103
102
|
},
|
|
@@ -106,22 +105,22 @@ export default function (request) {
|
|
|
106
105
|
},
|
|
107
106
|
on: {
|
|
108
107
|
SET_CHANNEL: {
|
|
109
|
-
target: '.
|
|
108
|
+
target: '.idle',
|
|
110
109
|
actions: 'setChannel',
|
|
111
110
|
},
|
|
112
111
|
SET_CRYPTO: {
|
|
113
|
-
target: '.
|
|
112
|
+
target: '.idle',
|
|
114
113
|
actions: 'setCrypto',
|
|
115
114
|
},
|
|
116
115
|
SET_NETWORK: {
|
|
117
|
-
target: '.
|
|
116
|
+
target: '.idle',
|
|
118
117
|
actions: 'setNetwork',
|
|
119
118
|
},
|
|
120
119
|
SET_ADDRESS: {
|
|
121
120
|
actions: 'setAddress',
|
|
122
121
|
},
|
|
123
122
|
SET_AMOUNT: {
|
|
124
|
-
target: '.
|
|
123
|
+
target: '.idle',
|
|
125
124
|
actions: ['setAmount', 'clearCalculation'],
|
|
126
125
|
},
|
|
127
126
|
CALCULATE: {
|
|
@@ -134,11 +133,8 @@ export default function (request) {
|
|
|
134
133
|
actions: {
|
|
135
134
|
setInitData: assign((context, event) => {
|
|
136
135
|
const { siteConfig, paymentDetail } = event.data
|
|
137
|
-
const cryptos =
|
|
138
|
-
|
|
139
|
-
.filter((element) => element.category === context.currentCategory)
|
|
140
|
-
.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || []
|
|
141
|
-
const currentPayment = cryptos[0]
|
|
136
|
+
const cryptos = paymentDetail.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || []
|
|
137
|
+
const currentPayment = cryptos.find((element) => element.category === context.currentCategory)
|
|
142
138
|
const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart(String(i + 1), 2, '0')}`, icon: 'channel' }))
|
|
143
139
|
const defaultNetworks =
|
|
144
140
|
cryptos[0].networkName.map((value, i) => {
|