@jetthai/cuora 1.1.128-dev-2 → 1.1.128
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 -424
- 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 +53 -99
- 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
|
@@ -255,9 +255,9 @@ export default function (request) {
|
|
|
255
255
|
} else {
|
|
256
256
|
const { tagId, recentlyGame, youMayLike } = context
|
|
257
257
|
let gameList = []
|
|
258
|
-
if (tagId === '
|
|
258
|
+
if (tagId === 'RECENTLY') {
|
|
259
259
|
gameList = recentlyGame
|
|
260
|
-
} else if (tagId === '
|
|
260
|
+
} else if (tagId === 'YOU MAY LIKE') {
|
|
261
261
|
gameList = youMayLike
|
|
262
262
|
}
|
|
263
263
|
return {
|
|
@@ -323,7 +323,7 @@ export default function (request) {
|
|
|
323
323
|
guards: {
|
|
324
324
|
isRecentlyYouMayLike: (context, event) => {
|
|
325
325
|
const { tagId } = context
|
|
326
|
-
return tagId === '
|
|
326
|
+
return tagId === 'RECENTLY' || tagId === 'YOU MAY LIKE'
|
|
327
327
|
},
|
|
328
328
|
hasTagList: (context, event) => {
|
|
329
329
|
const { tagList } = context
|
|
@@ -368,7 +368,7 @@ export default function (request) {
|
|
|
368
368
|
isRecentlySearch,
|
|
369
369
|
} = context
|
|
370
370
|
let id = tagId
|
|
371
|
-
if (tagId === '
|
|
371
|
+
if (tagId === 'RECENTLY' || tagId === 'YOU MAY LIKE') {
|
|
372
372
|
id = null
|
|
373
373
|
}
|
|
374
374
|
return await request.send(
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -11,7 +11,6 @@ export default function (request) {
|
|
|
11
11
|
type: 'parallel',
|
|
12
12
|
context: {
|
|
13
13
|
base: '/',
|
|
14
|
-
batch: null,
|
|
15
14
|
loadable: false,
|
|
16
15
|
isLastPage: false,
|
|
17
16
|
room: null,
|
|
@@ -37,13 +36,10 @@ export default function (request) {
|
|
|
37
36
|
mappingId: null,
|
|
38
37
|
portrait: null,
|
|
39
38
|
gameCode: null,
|
|
40
|
-
name: null,
|
|
41
39
|
},
|
|
42
40
|
lang: 'en_US',
|
|
43
41
|
isMobile: new UAParser().getResult().device.type,
|
|
44
42
|
gameURL: null,
|
|
45
|
-
gameToken: null,
|
|
46
|
-
gameHtml: null,
|
|
47
43
|
...oldContext,
|
|
48
44
|
},
|
|
49
45
|
states: {
|
|
@@ -67,28 +63,10 @@ export default function (request) {
|
|
|
67
63
|
cond: 'isDifferentRoom',
|
|
68
64
|
actions: ['setRoom', 'resetContent'],
|
|
69
65
|
},
|
|
70
|
-
BATCH: {
|
|
71
|
-
target: 'batchFetching',
|
|
72
|
-
},
|
|
73
66
|
ENTER_GAME: {
|
|
74
67
|
target: 'connecting',
|
|
75
68
|
actions: ['setGameInfo', 'setLang'],
|
|
76
69
|
},
|
|
77
|
-
UPDATE: {
|
|
78
|
-
target: 'updating',
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
batchFetching: {
|
|
83
|
-
invoke: {
|
|
84
|
-
src: 'batchFetch',
|
|
85
|
-
onDone: {
|
|
86
|
-
target: 'idle',
|
|
87
|
-
actions: 'setBatch',
|
|
88
|
-
},
|
|
89
|
-
onError: {
|
|
90
|
-
target: 'idle',
|
|
91
|
-
},
|
|
92
70
|
},
|
|
93
71
|
},
|
|
94
72
|
loading: {
|
|
@@ -116,18 +94,6 @@ export default function (request) {
|
|
|
116
94
|
{ target: 'idle' },
|
|
117
95
|
],
|
|
118
96
|
},
|
|
119
|
-
updating: {
|
|
120
|
-
invoke: {
|
|
121
|
-
src: 'updatePageContent',
|
|
122
|
-
onDone: {
|
|
123
|
-
target: 'idle',
|
|
124
|
-
actions: 'swapContent',
|
|
125
|
-
},
|
|
126
|
-
onError: {
|
|
127
|
-
target: 'idle',
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
97
|
connecting: {
|
|
132
98
|
invoke: {
|
|
133
99
|
src: 'connectGame',
|
|
@@ -137,12 +103,6 @@ export default function (request) {
|
|
|
137
103
|
},
|
|
138
104
|
onError: {
|
|
139
105
|
target: 'idle',
|
|
140
|
-
actions: 'setGameURL',
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
on: {
|
|
144
|
-
EXIT_GAME: {
|
|
145
|
-
target: 'disconnect',
|
|
146
106
|
},
|
|
147
107
|
},
|
|
148
108
|
},
|
|
@@ -151,29 +111,6 @@ export default function (request) {
|
|
|
151
111
|
EXIT_GAME: {
|
|
152
112
|
target: 'disconnect',
|
|
153
113
|
},
|
|
154
|
-
REFRESH: {
|
|
155
|
-
target: 'refreshing',
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
refreshing: {
|
|
160
|
-
invoke: {
|
|
161
|
-
src: 'disconnectGame',
|
|
162
|
-
onDone: {
|
|
163
|
-
target: 'refreshPending',
|
|
164
|
-
actions: 'setGameURL',
|
|
165
|
-
},
|
|
166
|
-
onError: {
|
|
167
|
-
target: 'idle',
|
|
168
|
-
actions: 'setGameURL',
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
refreshPending: {
|
|
173
|
-
after: {
|
|
174
|
-
500: {
|
|
175
|
-
target: 'connecting',
|
|
176
|
-
},
|
|
177
114
|
},
|
|
178
115
|
},
|
|
179
116
|
disconnect: {
|
|
@@ -181,11 +118,9 @@ export default function (request) {
|
|
|
181
118
|
src: 'disconnectGame',
|
|
182
119
|
onDone: {
|
|
183
120
|
target: 'idle',
|
|
184
|
-
actions: 'setGameURL',
|
|
185
121
|
},
|
|
186
122
|
onError: {
|
|
187
123
|
target: 'idle',
|
|
188
|
-
actions: 'setGameURL',
|
|
189
124
|
},
|
|
190
125
|
},
|
|
191
126
|
},
|
|
@@ -302,11 +237,6 @@ export default function (request) {
|
|
|
302
237
|
room: event.data,
|
|
303
238
|
}
|
|
304
239
|
}),
|
|
305
|
-
setBatch: assign((context, event) => {
|
|
306
|
-
return {
|
|
307
|
-
batch: event.data,
|
|
308
|
-
}
|
|
309
|
-
}),
|
|
310
240
|
resetContent: assign((context, event) => {
|
|
311
241
|
return {
|
|
312
242
|
loadable: false,
|
|
@@ -330,7 +260,7 @@ export default function (request) {
|
|
|
330
260
|
if (room.categoryId === GAME_SEARCH) {
|
|
331
261
|
return
|
|
332
262
|
} else if (additionEnable) {
|
|
333
|
-
const [content, addition
|
|
263
|
+
const [content, addition] = event.data
|
|
334
264
|
return {
|
|
335
265
|
content: {
|
|
336
266
|
...context.content,
|
|
@@ -371,15 +301,6 @@ export default function (request) {
|
|
|
371
301
|
}
|
|
372
302
|
}),
|
|
373
303
|
setGameURL: assign({
|
|
374
|
-
type: (context, event) => {
|
|
375
|
-
return event.data.type
|
|
376
|
-
},
|
|
377
|
-
gameToken: (context, event) => {
|
|
378
|
-
return event.data.gameToken
|
|
379
|
-
},
|
|
380
|
-
gameHtml: (context, event) => {
|
|
381
|
-
return event.data.gameHtml
|
|
382
|
-
},
|
|
383
304
|
gameURL: (context, event) => {
|
|
384
305
|
return event.data.gameURL
|
|
385
306
|
},
|
|
@@ -388,8 +309,8 @@ export default function (request) {
|
|
|
388
309
|
return { game: { providerId: null, gameId: null, gameTypeId: null, mappingId: null } }
|
|
389
310
|
}),
|
|
390
311
|
setGameInfo: assign((context, event) => {
|
|
391
|
-
const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode
|
|
392
|
-
return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode
|
|
312
|
+
const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode } = event.data.game
|
|
313
|
+
return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode } }
|
|
393
314
|
}),
|
|
394
315
|
setLang: assign((context, event) => {
|
|
395
316
|
const lang = event.data.locale.replace('-', '_')
|
|
@@ -407,51 +328,6 @@ export default function (request) {
|
|
|
407
328
|
...oldGuards,
|
|
408
329
|
},
|
|
409
330
|
services: {
|
|
410
|
-
batchFetch: async (context, event) => {
|
|
411
|
-
const { room, index, additionEnable, staticData } = context
|
|
412
|
-
let requestChain = null
|
|
413
|
-
if (!request.getToken()) {
|
|
414
|
-
// 如果沒 token ,id 列表去 static 找
|
|
415
|
-
const list = event.data.list.map((targetCategory, b) => {
|
|
416
|
-
return {
|
|
417
|
-
id: targetCategory.id,
|
|
418
|
-
i18n: targetCategory.i18n,
|
|
419
|
-
downLine: staticData
|
|
420
|
-
.find((item) => item.category === targetCategory.id)
|
|
421
|
-
.info.filter((item) => item.isGame === true)
|
|
422
|
-
.slice(0, 20),
|
|
423
|
-
}
|
|
424
|
-
})
|
|
425
|
-
return list.filter((item) => item.downLine.length > 0).slice(0, 6)
|
|
426
|
-
} else if (additionEnable) {
|
|
427
|
-
const param = { categoryId: room.categoryId, index }
|
|
428
|
-
requestChain = event.data.list.map((category, b) => {
|
|
429
|
-
return request
|
|
430
|
-
.send(
|
|
431
|
-
api.getListCategory({
|
|
432
|
-
categoryId: category.id,
|
|
433
|
-
index: 0,
|
|
434
|
-
})
|
|
435
|
-
)
|
|
436
|
-
.then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame === true).slice(0, 20) }, category))
|
|
437
|
-
})
|
|
438
|
-
const result = await Promise.all([...requestChain, request.send(api.getListAddition(param))])
|
|
439
|
-
return result.filter((item) => item.downLine.length > 0).slice(0, 6)
|
|
440
|
-
} else {
|
|
441
|
-
requestChain = event.data.list.map((category, b) => {
|
|
442
|
-
return request
|
|
443
|
-
.send(
|
|
444
|
-
api.getListCategory({
|
|
445
|
-
categoryId: category.id,
|
|
446
|
-
index: 0,
|
|
447
|
-
})
|
|
448
|
-
)
|
|
449
|
-
.then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame === true).slice(0, 20) }, category))
|
|
450
|
-
})
|
|
451
|
-
const result = await Promise.all([...requestChain])
|
|
452
|
-
return result.filter((item) => item.downLine.length > 0).slice(0, 6)
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
331
|
getPageContent: async (context, event) => {
|
|
456
332
|
const { room, index, additionEnable, staticData } = context
|
|
457
333
|
if (room.categoryId === GAME_SEARCH) {
|
|
@@ -477,7 +353,7 @@ export default function (request) {
|
|
|
477
353
|
updatePageContent: async (context, event) => {
|
|
478
354
|
const { room, content, index, additionEnable } = context
|
|
479
355
|
if (room.categoryId === GAME_SEARCH) {
|
|
480
|
-
return
|
|
356
|
+
return
|
|
481
357
|
} else if (!request.getToken()) {
|
|
482
358
|
return []
|
|
483
359
|
} else if (additionEnable) {
|
|
@@ -510,7 +386,7 @@ export default function (request) {
|
|
|
510
386
|
}
|
|
511
387
|
},
|
|
512
388
|
connectGame: async (context, event) => {
|
|
513
|
-
const returnProviders = ['RSG', 'KP', 'EPICWIN', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
|
|
389
|
+
const returnProviders = ['RSG', 'KP', 'EPICWIN', 'KA', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
|
|
514
390
|
const { lang, isMobile } = context
|
|
515
391
|
const { providerId, gameId, gameTypeId, mappingId } = context.game
|
|
516
392
|
const params = {
|
|
@@ -523,8 +399,8 @@ export default function (request) {
|
|
|
523
399
|
lang,
|
|
524
400
|
return_url: returnProviders.includes(providerId) ? `${window.location.origin}${context.base}return` : window.location.href, // For providers to return.
|
|
525
401
|
}
|
|
526
|
-
const {
|
|
527
|
-
return {
|
|
402
|
+
const { redirect_url } = await request.send(api.playGame(params))
|
|
403
|
+
return { gameURL: redirect_url }
|
|
528
404
|
},
|
|
529
405
|
disconnectGame: async (context, event) => {
|
|
530
406
|
const uid_site = event.data
|
package/src/machine/inbox.js
CHANGED
|
@@ -3,27 +3,13 @@ import mailbox from '../api/mailbox.js'
|
|
|
3
3
|
import activity from '../api/activity.js'
|
|
4
4
|
|
|
5
5
|
const messageState = {
|
|
6
|
+
// always: [{ actions: 'showUnread', cond: 'isShowUnread' }],
|
|
6
7
|
initial: 'idle',
|
|
7
8
|
states: {
|
|
8
9
|
idle: {
|
|
9
10
|
initial: 'hidden',
|
|
10
11
|
states: {
|
|
11
12
|
hidden: {},
|
|
12
|
-
deleting: {
|
|
13
|
-
invoke: {
|
|
14
|
-
src: 'deleteMessages',
|
|
15
|
-
onDone: {
|
|
16
|
-
target: 'deleted',
|
|
17
|
-
actions: 'removeMessage',
|
|
18
|
-
},
|
|
19
|
-
onError: {
|
|
20
|
-
target: 'hidden',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
deleted: {
|
|
25
|
-
entry: ['cancelSelectMessages', 'hideMessage'],
|
|
26
|
-
},
|
|
27
13
|
shown: {
|
|
28
14
|
on: {
|
|
29
15
|
HIDE_MESSAGE: {
|
|
@@ -35,15 +21,6 @@ const messageState = {
|
|
|
35
21
|
},
|
|
36
22
|
on: {
|
|
37
23
|
SHOW_MESSAGE: [
|
|
38
|
-
{
|
|
39
|
-
target: 'fetchingCustomerMessage',
|
|
40
|
-
actions: 'showMessage',
|
|
41
|
-
cond: (context, event) => {
|
|
42
|
-
const { currentTab } = context
|
|
43
|
-
const { isRead } = event.data
|
|
44
|
-
return currentTab === 'CUSTOMER' && isRead
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
24
|
{
|
|
48
25
|
target: '.shown',
|
|
49
26
|
actions: 'showMessage',
|
|
@@ -54,43 +31,19 @@ const messageState = {
|
|
|
54
31
|
actions: ['showMessage', 'setMessageIsRead'],
|
|
55
32
|
},
|
|
56
33
|
],
|
|
57
|
-
SELECT_MESSAGES: {
|
|
58
|
-
actions: ['selectMessages', 'setDelectMessages'],
|
|
59
|
-
},
|
|
60
|
-
DELETE_MESSAGES: {
|
|
61
|
-
target: '.deleting',
|
|
62
|
-
},
|
|
63
34
|
},
|
|
64
35
|
},
|
|
65
|
-
|
|
36
|
+
updating: {
|
|
66
37
|
invoke: {
|
|
67
|
-
src: '
|
|
38
|
+
src: 'updateMessageIsRead',
|
|
68
39
|
onDone: {
|
|
69
40
|
target: 'idle.shown',
|
|
70
|
-
actions: 'setCustomerMessage',
|
|
71
41
|
},
|
|
72
42
|
onError: {
|
|
73
43
|
target: 'idle.shown',
|
|
74
44
|
},
|
|
75
45
|
},
|
|
76
46
|
},
|
|
77
|
-
updating: {
|
|
78
|
-
invoke: {
|
|
79
|
-
src: 'updateMessageIsRead',
|
|
80
|
-
onDone: [
|
|
81
|
-
{
|
|
82
|
-
target: 'fetchingCustomerMessage',
|
|
83
|
-
cond: 'isCustomer',
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
target: 'idle.shown',
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
onError: {
|
|
90
|
-
target: 'idle.shown',
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
47
|
},
|
|
95
48
|
}
|
|
96
49
|
|
|
@@ -105,12 +58,8 @@ export default function (request) {
|
|
|
105
58
|
tabs: [],
|
|
106
59
|
currentTab: null,
|
|
107
60
|
inbox: {},
|
|
108
|
-
currentMessage: null,
|
|
109
61
|
messageDetail: null,
|
|
110
|
-
|
|
111
|
-
selectedDeleteMessages: null,
|
|
112
|
-
messageTitle: '',
|
|
113
|
-
messageContent: '',
|
|
62
|
+
// isShowUnread: false,
|
|
114
63
|
},
|
|
115
64
|
states: {
|
|
116
65
|
loading: {
|
|
@@ -156,62 +105,15 @@ export default function (request) {
|
|
|
156
105
|
},
|
|
157
106
|
},
|
|
158
107
|
},
|
|
159
|
-
inquiring: {
|
|
160
|
-
invoke: {
|
|
161
|
-
src: 'accountInquiry',
|
|
162
|
-
onDone: {
|
|
163
|
-
target: 'inquired',
|
|
164
|
-
},
|
|
165
|
-
onError: {
|
|
166
|
-
target: 'failed',
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
inquired: {
|
|
171
|
-
after: {
|
|
172
|
-
0: {
|
|
173
|
-
target: 'reloadMessages',
|
|
174
|
-
actions: 'cancelSelectMessages',
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
reloadMessages: {
|
|
179
|
-
invoke: {
|
|
180
|
-
src: 'reFetchMessages',
|
|
181
|
-
onDone: {
|
|
182
|
-
target: 'more',
|
|
183
|
-
actions: 'setInbox',
|
|
184
|
-
},
|
|
185
|
-
onError: {
|
|
186
|
-
target: 'end',
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
108
|
end: {
|
|
191
109
|
...messageState,
|
|
192
110
|
},
|
|
193
|
-
sending: {
|
|
194
|
-
invoke: {
|
|
195
|
-
src: 'sendMessage',
|
|
196
|
-
onDone: {
|
|
197
|
-
target: 'sended',
|
|
198
|
-
},
|
|
199
|
-
onError: {
|
|
200
|
-
target: 'end',
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
},
|
|
204
|
-
sended: {
|
|
205
|
-
after: {
|
|
206
|
-
0: {
|
|
207
|
-
target: 'reloadMessages',
|
|
208
|
-
actions: ['cancelSelectMessages', 'hideMessage'],
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
111
|
failed: {},
|
|
213
112
|
},
|
|
214
113
|
on: {
|
|
114
|
+
// SHOW_SYSTEM_MESSAGE: {
|
|
115
|
+
// actions: 'showSystemMessage',
|
|
116
|
+
// },
|
|
215
117
|
SET_TAB: {
|
|
216
118
|
target: '.checking',
|
|
217
119
|
actions: ['setCurrentTab', 'hideMessage'],
|
|
@@ -224,26 +126,6 @@ export default function (request) {
|
|
|
224
126
|
target: '.loading',
|
|
225
127
|
actions: 'reset',
|
|
226
128
|
},
|
|
227
|
-
INQUIRY_ACCOUNT: {
|
|
228
|
-
target: '.inquiring',
|
|
229
|
-
actions: 'resetPage',
|
|
230
|
-
},
|
|
231
|
-
SET_TITLE: {
|
|
232
|
-
actions: 'setMessageTitle',
|
|
233
|
-
},
|
|
234
|
-
SET_CONTENT: {
|
|
235
|
-
actions: 'setMessageContent',
|
|
236
|
-
},
|
|
237
|
-
SEND_MESSAGE: {
|
|
238
|
-
target: '.sending',
|
|
239
|
-
cond: 'isSendable',
|
|
240
|
-
},
|
|
241
|
-
CANCEL_SELECT: {
|
|
242
|
-
actions: 'cancelSelectMessages',
|
|
243
|
-
},
|
|
244
|
-
CLEAR: {
|
|
245
|
-
actions: 'hideMessage',
|
|
246
|
-
},
|
|
247
129
|
},
|
|
248
130
|
},
|
|
249
131
|
{
|
|
@@ -263,42 +145,23 @@ export default function (request) {
|
|
|
263
145
|
isRead: (context, event) => {
|
|
264
146
|
return event.data.isRead
|
|
265
147
|
},
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
},
|
|
270
|
-
isSendable: (context, event) => {
|
|
271
|
-
const { messageTitle, messageContent } = context
|
|
272
|
-
return !!messageTitle && !!messageContent
|
|
273
|
-
},
|
|
148
|
+
// isShowUnread: (context, event) => {
|
|
149
|
+
// return context.isShowUnread
|
|
150
|
+
// },
|
|
274
151
|
},
|
|
275
152
|
actions: {
|
|
276
153
|
reset: assign((context, event) => {
|
|
277
154
|
return {
|
|
155
|
+
tabs: [],
|
|
278
156
|
currentTab: null,
|
|
279
157
|
inbox: {},
|
|
280
158
|
messageDetail: null,
|
|
281
|
-
currentMessage: null,
|
|
282
|
-
}
|
|
283
|
-
}),
|
|
284
|
-
resetPage: assign((context, event) => {
|
|
285
|
-
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
286
|
-
inbox[currentTab].page = -1
|
|
287
|
-
return {
|
|
288
|
-
inbox,
|
|
289
|
-
messageDetail: null,
|
|
290
|
-
currentMessage: null,
|
|
291
159
|
}
|
|
292
160
|
}),
|
|
293
161
|
setTabs: assign((context, event) => {
|
|
294
|
-
let { currentTab
|
|
162
|
+
let { currentTab } = context
|
|
295
163
|
if (!currentTab) {
|
|
296
|
-
|
|
297
|
-
if (!!customerTab && hasCustomer) {
|
|
298
|
-
currentTab = 'CUSTOMER'
|
|
299
|
-
} else {
|
|
300
|
-
currentTab = event.data?.[0]
|
|
301
|
-
}
|
|
164
|
+
currentTab = event.data?.[0]
|
|
302
165
|
}
|
|
303
166
|
return {
|
|
304
167
|
tabs: event.data,
|
|
@@ -310,78 +173,29 @@ export default function (request) {
|
|
|
310
173
|
currentTab: event.data,
|
|
311
174
|
}
|
|
312
175
|
}),
|
|
313
|
-
selectMessages: assign((context, event) => {
|
|
314
|
-
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
315
|
-
const data = inbox[currentTab].data.map((item) => {
|
|
316
|
-
if (item.groupId === event.data.groupId) {
|
|
317
|
-
item.isSelected = !item.isSelected
|
|
318
|
-
}
|
|
319
|
-
return item
|
|
320
|
-
})
|
|
321
|
-
inbox[currentTab].data = data
|
|
322
|
-
return { inbox }
|
|
323
|
-
}),
|
|
324
|
-
cancelSelectMessages: assign((context, event) => {
|
|
325
|
-
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
326
|
-
const data = inbox[currentTab].data.map((item) => {
|
|
327
|
-
item.isSelected = false
|
|
328
|
-
return item
|
|
329
|
-
})
|
|
330
|
-
inbox[currentTab].data = data
|
|
331
|
-
return { inbox, selectedDeleteMessages: null }
|
|
332
|
-
}),
|
|
333
|
-
setDelectMessages: assign((context, event) => {
|
|
334
|
-
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
335
|
-
const selectedMessages = inbox[currentTab].data?.filter((item) => item.isSelected)
|
|
336
|
-
const groupIdsArray = selectedMessages?.map((item) => item.groupId)
|
|
337
|
-
const groupIds = groupIdsArray?.join(',')
|
|
338
|
-
return {
|
|
339
|
-
selectedDeleteMessages: groupIds,
|
|
340
|
-
}
|
|
341
|
-
}),
|
|
342
|
-
setCustomerMessage: assign((context, event) => {
|
|
343
|
-
const { data = [] } = event.data
|
|
344
|
-
const isCustomerReply = data[0]?.from === 'SYSTEM'
|
|
345
|
-
let combindedContent = ''
|
|
346
|
-
if (isCustomerReply) {
|
|
347
|
-
combindedContent = '-\n-------------------------\n' + data[0].content + '\n-------------------------\n' + data[1].content
|
|
348
|
-
} else {
|
|
349
|
-
combindedContent = `-\n-------------------------\n${data[0].content}`
|
|
350
|
-
}
|
|
351
|
-
return {
|
|
352
|
-
messageDetail: data,
|
|
353
|
-
messageTitle: data[data.length - 1]?.title,
|
|
354
|
-
messageContent: combindedContent,
|
|
355
|
-
}
|
|
356
|
-
}),
|
|
357
176
|
showMessage: assign((context, event) => {
|
|
358
177
|
return {
|
|
359
|
-
currentMessage: event.data,
|
|
360
178
|
messageDetail: event.data,
|
|
361
|
-
messageTitle: null,
|
|
362
|
-
messageContent: null,
|
|
363
179
|
}
|
|
364
180
|
}),
|
|
365
181
|
hideMessage: assign((context, event) => {
|
|
366
182
|
return {
|
|
367
|
-
messageTitle: null,
|
|
368
|
-
messageContent: null,
|
|
369
183
|
messageDetail: null,
|
|
370
|
-
currentMessage: null,
|
|
371
184
|
}
|
|
372
185
|
}),
|
|
373
|
-
removeMessage: assign((context, event) => {
|
|
374
|
-
const groupIds = event.data
|
|
375
|
-
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
376
|
-
const data = inbox[currentTab].data.filter((item) => !groupIds.find((groupId) => groupId === item.groupId))
|
|
377
|
-
inbox[currentTab].data = data
|
|
378
|
-
return { inbox }
|
|
379
|
-
}),
|
|
380
186
|
setInbox: assign((context, event) => {
|
|
381
187
|
return {
|
|
382
188
|
inbox: event.data,
|
|
383
189
|
}
|
|
384
190
|
}),
|
|
191
|
+
// showUnread: assign((context, event) => {
|
|
192
|
+
// const { currentTab, inbox } = context
|
|
193
|
+
// const messageDetail = inbox[currentTab]?.data.find((item) => !item.isRead)
|
|
194
|
+
// return {
|
|
195
|
+
// messageDetail,
|
|
196
|
+
// isShowUnread: false,
|
|
197
|
+
// }
|
|
198
|
+
// }),
|
|
385
199
|
setMessageIsRead: assign((context, event) => {
|
|
386
200
|
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
387
201
|
const data = inbox[currentTab].data.map((item) => {
|
|
@@ -393,16 +207,12 @@ export default function (request) {
|
|
|
393
207
|
inbox[currentTab].data = data
|
|
394
208
|
return { inbox }
|
|
395
209
|
}),
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
return {
|
|
403
|
-
messageContent: event.data,
|
|
404
|
-
}
|
|
405
|
-
}),
|
|
210
|
+
// showSystemMessage: assign((context, event) => {
|
|
211
|
+
// return {
|
|
212
|
+
// currentTab: 'SYSTEM',
|
|
213
|
+
// isShowUnread: true,
|
|
214
|
+
// }
|
|
215
|
+
// }),
|
|
406
216
|
},
|
|
407
217
|
services: {
|
|
408
218
|
fetchTabs: async (context, event) => {
|
|
@@ -417,53 +227,18 @@ export default function (request) {
|
|
|
417
227
|
inbox[currentTab] = { data, page: 0, totalPage: 1 }
|
|
418
228
|
} else {
|
|
419
229
|
const { page = -1 } = inbox[currentTab] || {}
|
|
420
|
-
const
|
|
421
|
-
const
|
|
230
|
+
const nextPage = page + 1
|
|
231
|
+
const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: nextPage }))
|
|
422
232
|
const currentData = inbox[currentTab]?.data || []
|
|
423
|
-
inbox[currentTab] = { data: currentData.concat(
|
|
233
|
+
inbox[currentTab] = { data: currentData.concat(data), ...rest }
|
|
424
234
|
}
|
|
425
235
|
return inbox
|
|
426
236
|
},
|
|
427
|
-
reFetchMessages: async (context, event) => {
|
|
428
|
-
const { currentTab, inbox } = JSON.parse(JSON.stringify(context))
|
|
429
|
-
const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: 0 }))
|
|
430
|
-
let formattedData = []
|
|
431
|
-
formattedData = data?.map((item) => ({ ...item, isSelected: false }))
|
|
432
|
-
inbox[currentTab] = { data: formattedData, ...rest }
|
|
433
|
-
return inbox
|
|
434
|
-
},
|
|
435
237
|
updateMessageIsRead: async (context, event) => {
|
|
436
|
-
const {
|
|
437
|
-
request.send(mailbox.updateMessage({ groupId:
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
deleteMessages: async (context, event) => {
|
|
441
|
-
const { selectedDeleteMessages } = context
|
|
442
|
-
const { groupId = '' } = await request.send(mailbox.updateMessage({ groupId: selectedDeleteMessages, isDelete: true }))
|
|
443
|
-
return groupId.split(',')
|
|
444
|
-
},
|
|
445
|
-
accountInquiry: async (context, event) => {
|
|
446
|
-
const { from, title, content } = event.data
|
|
447
|
-
return await request.send(mailbox.sendMessage({ type: 'CUSTOMER', category: 'DEPOSIT', from, to: 'SYSTEM', title, content }))
|
|
448
|
-
},
|
|
449
|
-
getMessage: async (context, event) => {
|
|
450
|
-
const { currentMessage } = context
|
|
451
|
-
return await request.send(mailbox.getMessage({ groupId: currentMessage.groupId }))
|
|
452
|
-
},
|
|
453
|
-
sendMessage: async (context, event) => {
|
|
454
|
-
const { currentMessage, messageTitle, messageContent } = context
|
|
455
|
-
const { from } = event.data
|
|
456
|
-
return await request.send(
|
|
457
|
-
mailbox.sendMessage({
|
|
458
|
-
// groupId: currentMessage?.groupId,
|
|
459
|
-
type: 'CUSTOMER',
|
|
460
|
-
category: 'MAIL',
|
|
461
|
-
from,
|
|
462
|
-
to: 'SYSTEM',
|
|
463
|
-
title: messageTitle,
|
|
464
|
-
content: messageContent,
|
|
465
|
-
})
|
|
466
|
-
)
|
|
238
|
+
const { data } = event
|
|
239
|
+
request.send(mailbox.updateMessage({ groupId: data.groupId, isRead: true }))
|
|
240
|
+
data.isRead = true
|
|
241
|
+
return data
|
|
467
242
|
},
|
|
468
243
|
},
|
|
469
244
|
}
|