@jetthai/cuora 1.1.353-data-1 → 1.1.353-dev-2
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 +5 -1
- package/package.json +1 -1
- package/src/api/activity.js +5 -0
- package/src/api/index.js +2 -1
- package/src/api/ranking.js +26 -0
- package/src/machine/activity/activity.js +5 -12
- package/src/machine/activity/activity_cash.js +0 -4
- package/src/machine/activity/vip_card_activity.js +67 -28
- package/src/machine/common.js +5 -2
- package/src/machine/deposit/direct.js +2 -6
- package/src/machine/deposit/float.js +2 -2
- package/src/machine/deposit/loadcard_vn.js +10 -51
- package/src/machine/deposit/manual_vn.js +3 -23
- package/src/machine/deposit/qrcode_v2.js +6 -132
- package/src/machine/deposit/virtual_bank_vn.js +3 -31
- package/src/machine/deposit/vpay.js +2 -2
- package/src/machine/game_v2_1.js +12 -11
- package/src/machine/honor_board.js +8 -5
- package/src/machine/index.js +2 -0
- package/src/machine/promotions.js +4 -5
- package/src/machine/ranking.js +202 -0
- package/src/machine/reward.js +4 -6
- package/src/machine/reward_cash.js +15 -1
- package/src/machine/websocket.js +12 -0
- package/src/machine/withdraw/withdraw_crypto.js +1 -3
- package/src/machine/withdraw/withdraw_crypto2.js +1 -1
- package/src/machine/withdraw/withdraw_manual.js +1 -2
- package/src/machine/withdraw/withdraw_vn.js +1 -3
- package/src/machine/withdraw/withdraw_vn2.js +1 -1
|
@@ -49,16 +49,8 @@ export default function (request) {
|
|
|
49
49
|
target: 'fetching',
|
|
50
50
|
cond: (context, event) => {
|
|
51
51
|
const { siteConfig = {}, promotion = {}, selectedQrcode } = context
|
|
52
|
-
const {
|
|
53
|
-
return !!selectedQrcode &&
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
target: 'debouncing',
|
|
58
|
-
actions: 'setPromotionDefaultAmount',
|
|
59
|
-
cond: (context, event) => {
|
|
60
|
-
const { siteConfig = {}, promotion = {} } = context
|
|
61
|
-
return siteConfig.walletMode === '3' && !!promotion?.minimumAmount
|
|
52
|
+
const { bonusPreviewEnable } = siteConfig
|
|
53
|
+
return !!selectedQrcode && bonusPreviewEnable && promotion.activityNo != 'none'
|
|
62
54
|
},
|
|
63
55
|
},
|
|
64
56
|
{ target: 'loaded' },
|
|
@@ -86,51 +78,21 @@ export default function (request) {
|
|
|
86
78
|
actions: 'setQrcode',
|
|
87
79
|
cond: (context, event) => {
|
|
88
80
|
const { siteConfig = {}, promotion = {} } = context
|
|
89
|
-
const {
|
|
90
|
-
return
|
|
81
|
+
const { bonusPreviewEnable } = siteConfig
|
|
82
|
+
return bonusPreviewEnable && promotion.activityNo != 'none'
|
|
91
83
|
},
|
|
92
84
|
},
|
|
93
|
-
{
|
|
94
|
-
target: 'debouncing',
|
|
95
|
-
actions: ['setQrcode', 'setPromotionDefaultAmount'],
|
|
96
|
-
cond: (context, event) => context.siteConfig?.walletMode === '3' && context.promotion?.minimumAmount,
|
|
97
|
-
},
|
|
98
85
|
{
|
|
99
86
|
actions: 'setQrcode',
|
|
100
87
|
},
|
|
101
88
|
],
|
|
102
89
|
SELECT_AMOUNT: [
|
|
103
|
-
{
|
|
104
|
-
target: 'debouncing',
|
|
105
|
-
actions: 'setAmount',
|
|
106
|
-
cond: 'isDoubleWalletMode',
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
target: 'pending',
|
|
110
|
-
actions: 'addAmount',
|
|
111
|
-
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
target: 'pending',
|
|
115
|
-
actions: 'setAmount',
|
|
116
|
-
cond: 'isFreeWalletMode',
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
target: 'debouncing',
|
|
120
|
-
actions: 'addAmount',
|
|
121
|
-
cond: 'isGrandTotalEnable',
|
|
122
|
-
},
|
|
123
90
|
{
|
|
124
91
|
target: 'debouncing',
|
|
125
92
|
actions: 'setAmount',
|
|
126
93
|
},
|
|
127
94
|
],
|
|
128
95
|
KEY_IN: [
|
|
129
|
-
{
|
|
130
|
-
target: 'pending',
|
|
131
|
-
actions: 'setAmount',
|
|
132
|
-
cond: 'isFreeWalletMode',
|
|
133
|
-
},
|
|
134
96
|
{
|
|
135
97
|
target: 'calculating',
|
|
136
98
|
actions: 'setAmount',
|
|
@@ -138,51 +100,9 @@ export default function (request) {
|
|
|
138
100
|
],
|
|
139
101
|
},
|
|
140
102
|
},
|
|
141
|
-
pending: {
|
|
142
|
-
on: {
|
|
143
|
-
SELECT_AMOUNT: [
|
|
144
|
-
{
|
|
145
|
-
actions: 'addAmount',
|
|
146
|
-
cond: 'isGrandTotalEnable',
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
actions: 'setAmount',
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
KEY_IN: {
|
|
153
|
-
actions: 'setAmount',
|
|
154
|
-
},
|
|
155
|
-
CONFIRM: {
|
|
156
|
-
target: 'calculating',
|
|
157
|
-
},
|
|
158
|
-
BACK: {
|
|
159
|
-
target: 'loaded',
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
103
|
debouncing: {
|
|
164
104
|
on: {
|
|
165
105
|
SELECT_AMOUNT: [
|
|
166
|
-
{
|
|
167
|
-
target: 'debouncing',
|
|
168
|
-
actions: 'setAmount',
|
|
169
|
-
cond: 'isDoubleWalletMode',
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
target: 'debouncing',
|
|
173
|
-
actions: 'addAmount',
|
|
174
|
-
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
target: 'debouncing',
|
|
178
|
-
actions: 'setAmount',
|
|
179
|
-
cond: 'isFreeWalletMode',
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
target: 'debouncing',
|
|
183
|
-
actions: 'addAmount',
|
|
184
|
-
cond: 'isGrandTotalEnable',
|
|
185
|
-
},
|
|
186
106
|
{
|
|
187
107
|
target: 'debouncing',
|
|
188
108
|
actions: 'setAmount',
|
|
@@ -202,26 +122,6 @@ export default function (request) {
|
|
|
202
122
|
entry: 'clearCalculation',
|
|
203
123
|
on: {
|
|
204
124
|
SELECT_AMOUNT: [
|
|
205
|
-
{
|
|
206
|
-
target: 'debouncing',
|
|
207
|
-
actions: 'setAmount',
|
|
208
|
-
cond: 'isDoubleWalletMode',
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
target: 'pending',
|
|
212
|
-
actions: 'addAmount',
|
|
213
|
-
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
target: 'pending',
|
|
217
|
-
actions: 'setAmount',
|
|
218
|
-
cond: 'isFreeWalletMode',
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
target: 'debouncing',
|
|
222
|
-
actions: 'addAmount',
|
|
223
|
-
cond: 'isGrandTotalEnable',
|
|
224
|
-
},
|
|
225
125
|
{
|
|
226
126
|
target: 'debouncing',
|
|
227
127
|
actions: 'setAmount',
|
|
@@ -240,11 +140,6 @@ export default function (request) {
|
|
|
240
140
|
invoke: {
|
|
241
141
|
src: 'fetchCalculation',
|
|
242
142
|
onDone: [
|
|
243
|
-
{
|
|
244
|
-
target: 'submitting',
|
|
245
|
-
actions: 'setCalculation',
|
|
246
|
-
cond: 'isFreeWalletMode',
|
|
247
|
-
},
|
|
248
143
|
{
|
|
249
144
|
target: 'calculated',
|
|
250
145
|
actions: 'setCalculation',
|
|
@@ -258,16 +153,6 @@ export default function (request) {
|
|
|
258
153
|
calculated: {
|
|
259
154
|
on: {
|
|
260
155
|
SELECT_AMOUNT: [
|
|
261
|
-
{
|
|
262
|
-
target: 'pending',
|
|
263
|
-
actions: 'addAmount',
|
|
264
|
-
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
target: 'pending',
|
|
268
|
-
actions: 'setAmount',
|
|
269
|
-
cond: 'isFreeWalletMode',
|
|
270
|
-
},
|
|
271
156
|
{
|
|
272
157
|
target: 'debouncing',
|
|
273
158
|
actions: 'addAmount',
|
|
@@ -314,8 +199,8 @@ export default function (request) {
|
|
|
314
199
|
actions: 'setQrcode',
|
|
315
200
|
cond: (context, event) => {
|
|
316
201
|
const { siteConfig = {}, promotion = {} } = context
|
|
317
|
-
const {
|
|
318
|
-
return
|
|
202
|
+
const { bonusPreviewEnable } = siteConfig
|
|
203
|
+
return bonusPreviewEnable && promotion.activityNo != 'none'
|
|
319
204
|
},
|
|
320
205
|
},
|
|
321
206
|
{
|
|
@@ -395,19 +280,8 @@ export default function (request) {
|
|
|
395
280
|
promotion,
|
|
396
281
|
}
|
|
397
282
|
}),
|
|
398
|
-
setPromotionDefaultAmount: assign((context, event) => {
|
|
399
|
-
return {
|
|
400
|
-
selectedAmount: context.promotion.minimumAmount,
|
|
401
|
-
}
|
|
402
|
-
}),
|
|
403
283
|
},
|
|
404
284
|
guards: {
|
|
405
|
-
isDoubleWalletMode: (context, event) => {
|
|
406
|
-
return context.siteConfig?.walletMode === '4'
|
|
407
|
-
},
|
|
408
|
-
isFreeWalletMode: (context, event) => {
|
|
409
|
-
return context.siteConfig?.walletMode === '2'
|
|
410
|
-
},
|
|
411
285
|
isGrandTotalEnable: (context, event) => {
|
|
412
286
|
return context.grandTotalEnable === 1
|
|
413
287
|
},
|
|
@@ -45,24 +45,8 @@ export default function (request) {
|
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
step1: {
|
|
48
|
-
initial: '
|
|
48
|
+
initial: 'idle',
|
|
49
49
|
states: {
|
|
50
|
-
promotion: {
|
|
51
|
-
always: [
|
|
52
|
-
{
|
|
53
|
-
target: 'idle',
|
|
54
|
-
cond: 'isDoubleWalletMode',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
target: 'calculating',
|
|
58
|
-
actions: 'setPromotionDefaultAmount',
|
|
59
|
-
cond: 'hasMinPromotionDeposit',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
target: 'idle',
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
50
|
idle: {},
|
|
67
51
|
calculating: {
|
|
68
52
|
invoke: {
|
|
@@ -104,11 +88,10 @@ export default function (request) {
|
|
|
104
88
|
{
|
|
105
89
|
target: 'pending',
|
|
106
90
|
cond: (context, event) => {
|
|
107
|
-
const {
|
|
108
|
-
const { walletMode } = siteConfig
|
|
91
|
+
const { calculation, promotion } = context
|
|
109
92
|
const { promotionsNo, activityNo } = promotion
|
|
110
93
|
const isNoBonus = promotionsNo === 'none' || activityNo === 'none'
|
|
111
|
-
return
|
|
94
|
+
return !!calculation && !isNoBonus
|
|
112
95
|
},
|
|
113
96
|
},
|
|
114
97
|
{
|
|
@@ -231,16 +214,8 @@ export default function (request) {
|
|
|
231
214
|
promotion: event.data,
|
|
232
215
|
}
|
|
233
216
|
}),
|
|
234
|
-
setPromotionDefaultAmount: assign((context, event) => {
|
|
235
|
-
return {
|
|
236
|
-
amount: context.promotion.minimumAmount,
|
|
237
|
-
}
|
|
238
|
-
}),
|
|
239
217
|
},
|
|
240
218
|
guards: {
|
|
241
|
-
isDoubleWalletMode: (context, event) => {
|
|
242
|
-
return context.siteConfig?.walletMode === '4'
|
|
243
|
-
},
|
|
244
219
|
isCalculable: (context, event) => {
|
|
245
220
|
const {
|
|
246
221
|
amount,
|
|
@@ -254,9 +229,6 @@ export default function (request) {
|
|
|
254
229
|
isProcessing: (context, event) => {
|
|
255
230
|
return context.processing
|
|
256
231
|
},
|
|
257
|
-
hasMinPromotionDeposit: (context, event) => {
|
|
258
|
-
return context.promotion?.minimumAmount
|
|
259
|
-
},
|
|
260
232
|
},
|
|
261
233
|
services: {
|
|
262
234
|
fetchPaymentDetail: async (context, event) => {
|
|
@@ -74,8 +74,8 @@ export default function (request) {
|
|
|
74
74
|
target: 'fetching',
|
|
75
75
|
cond: (context, event) => {
|
|
76
76
|
const { siteConfig = {}, promotion = {} } = context
|
|
77
|
-
const {
|
|
78
|
-
return
|
|
77
|
+
const { bonusPreviewEnable } = siteConfig
|
|
78
|
+
return bonusPreviewEnable && promotion.activityNo != 'none'
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
{ target: 'loaded' },
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -40,7 +40,7 @@ export default function (request) {
|
|
|
40
40
|
gameCode: null,
|
|
41
41
|
name: null,
|
|
42
42
|
},
|
|
43
|
-
|
|
43
|
+
walletType: null,
|
|
44
44
|
lang: 'en_US',
|
|
45
45
|
isMobile: new UAParser().getResult().device.type,
|
|
46
46
|
gameURL: null,
|
|
@@ -81,7 +81,7 @@ export default function (request) {
|
|
|
81
81
|
},
|
|
82
82
|
ENTER_GAME: {
|
|
83
83
|
target: 'connecting',
|
|
84
|
-
actions: ['setGameInfo', 'setLang', '
|
|
84
|
+
actions: ['setGameInfo', 'setLang', 'setwalletType'],
|
|
85
85
|
},
|
|
86
86
|
MENU_ENTER_GAME: {
|
|
87
87
|
target: 'connecting',
|
|
@@ -205,6 +205,9 @@ export default function (request) {
|
|
|
205
205
|
ENTER_GAME_PAUSE: {
|
|
206
206
|
actions: ['setIsPlaying', 'resetContent', 'resetSHA'],
|
|
207
207
|
},
|
|
208
|
+
LEAVE_GAME_REFRESH: {
|
|
209
|
+
actions: 'setIsPlaying',
|
|
210
|
+
},
|
|
208
211
|
},
|
|
209
212
|
},
|
|
210
213
|
refreshing: {
|
|
@@ -240,6 +243,9 @@ export default function (request) {
|
|
|
240
243
|
},
|
|
241
244
|
},
|
|
242
245
|
on: {
|
|
246
|
+
LEAVE_GAME_REFRESH: {
|
|
247
|
+
actions: 'setIsPlaying',
|
|
248
|
+
},
|
|
243
249
|
LOAD: {
|
|
244
250
|
target: 'routing',
|
|
245
251
|
actions: 'setLoadable',
|
|
@@ -286,11 +292,6 @@ export default function (request) {
|
|
|
286
292
|
},
|
|
287
293
|
},
|
|
288
294
|
},
|
|
289
|
-
on: {
|
|
290
|
-
LEAVE_GAME_REFRESH: {
|
|
291
|
-
actions: 'setIsPlaying',
|
|
292
|
-
},
|
|
293
|
-
},
|
|
294
295
|
},
|
|
295
296
|
{
|
|
296
297
|
actions: {
|
|
@@ -417,8 +418,8 @@ export default function (request) {
|
|
|
417
418
|
const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = context.switchGame
|
|
418
419
|
return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
|
|
419
420
|
}),
|
|
420
|
-
|
|
421
|
-
return {
|
|
421
|
+
setwalletType: assign((context, event) => {
|
|
422
|
+
return { walletType: event.data.walletType }
|
|
422
423
|
}),
|
|
423
424
|
setLang: assign((context, event) => {
|
|
424
425
|
const lang = event.data.locale.replace('-', '_')
|
|
@@ -556,7 +557,7 @@ export default function (request) {
|
|
|
556
557
|
},
|
|
557
558
|
connectGame: async (context, event) => {
|
|
558
559
|
const returnProviders = ['RSG', 'KP', 'EPICWIN', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
|
|
559
|
-
const { lang, isMobile,
|
|
560
|
+
const { lang, isMobile, walletType } = context
|
|
560
561
|
const { providerId, gameId, gameTypeId, mappingId } = context.game
|
|
561
562
|
const params = {
|
|
562
563
|
provider_id: providerId,
|
|
@@ -566,7 +567,7 @@ export default function (request) {
|
|
|
566
567
|
is_demo: false,
|
|
567
568
|
is_mobile: isMobile === 'mobile' ? 'y' : null,
|
|
568
569
|
lang,
|
|
569
|
-
selected_wallet_type:
|
|
570
|
+
selected_wallet_type: walletType,
|
|
570
571
|
return_url: returnProviders.includes(providerId) ? `${window.location.origin}${context.base}return` : window.location.href, // For providers to return.
|
|
571
572
|
}
|
|
572
573
|
const { type, redirect_url, gameToken, gameHtml, wallet_type } = await request.send(api.playGame(params))
|
|
@@ -40,7 +40,14 @@ export default function (request) {
|
|
|
40
40
|
broadcast: {
|
|
41
41
|
initial: 'idle',
|
|
42
42
|
states: {
|
|
43
|
-
idle: {
|
|
43
|
+
idle: {
|
|
44
|
+
on: {
|
|
45
|
+
START_BROADCAST: {
|
|
46
|
+
target: 'picking',
|
|
47
|
+
actions: 'leaveGame',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
44
51
|
picking: {
|
|
45
52
|
after: {
|
|
46
53
|
5000: {
|
|
@@ -62,10 +69,6 @@ export default function (request) {
|
|
|
62
69
|
target: '.idle',
|
|
63
70
|
actions: 'resetBroadcast',
|
|
64
71
|
},
|
|
65
|
-
START_BROADCAST: {
|
|
66
|
-
target: '.picking',
|
|
67
|
-
actions: 'leaveGame',
|
|
68
|
-
},
|
|
69
72
|
},
|
|
70
73
|
},
|
|
71
74
|
},
|
package/src/machine/index.js
CHANGED
|
@@ -39,6 +39,7 @@ import honor_board from './honor_board.js'
|
|
|
39
39
|
import user_photo from './user_photo.js'
|
|
40
40
|
import navbar from './navbar.js'
|
|
41
41
|
import websocket from './websocket.js'
|
|
42
|
+
import ranking from './ranking.js'
|
|
42
43
|
|
|
43
44
|
export default {
|
|
44
45
|
...activity,
|
|
@@ -82,4 +83,5 @@ export default {
|
|
|
82
83
|
navbar,
|
|
83
84
|
...withdraw,
|
|
84
85
|
websocket,
|
|
86
|
+
ranking,
|
|
85
87
|
}
|
|
@@ -7,7 +7,6 @@ export default function (request) {
|
|
|
7
7
|
id: 'promotions',
|
|
8
8
|
initial: 'loading',
|
|
9
9
|
context: {
|
|
10
|
-
noBonus: {},
|
|
11
10
|
userInfo: {},
|
|
12
11
|
siteConfig: {},
|
|
13
12
|
withdrawRule: {},
|
|
@@ -87,10 +86,10 @@ export default function (request) {
|
|
|
87
86
|
actions: {
|
|
88
87
|
setPromotionsList: assign((context, event) => {
|
|
89
88
|
const promotionsList = JSON.parse(JSON.stringify(event.data))
|
|
90
|
-
const {
|
|
89
|
+
const { userInfo, siteConfig } = context
|
|
91
90
|
const { withdraw_rule, balance, bank_amount } = userInfo
|
|
92
|
-
const { currencyConversionLimit
|
|
93
|
-
const balanceAvailable = parseFloat(
|
|
91
|
+
const { currencyConversionLimit } = siteConfig
|
|
92
|
+
const balanceAvailable = parseFloat(bank_amount) < parseFloat(`${currencyConversionLimit}`)
|
|
94
93
|
const isFreeLimitRule = withdraw_rule.includes('FREE_LIMIT')
|
|
95
94
|
const includesDefaultRule = withdraw_rule === 'DEFAULT' || withdraw_rule.includes('FREE_DEFAULT')
|
|
96
95
|
|
|
@@ -112,7 +111,7 @@ export default function (request) {
|
|
|
112
111
|
}
|
|
113
112
|
return {
|
|
114
113
|
promotionsList,
|
|
115
|
-
selectedPromo:
|
|
114
|
+
selectedPromo: promotionsList[0],
|
|
116
115
|
}
|
|
117
116
|
}),
|
|
118
117
|
setSelectedPromo: assign((context, event) => {
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { createMachine, assign } from 'xstate'
|
|
2
|
+
import ranking from '../api/ranking.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
const cycleMapping = ['DAILY', 'WEEKLY', 'MONTHLY']
|
|
6
|
+
|
|
7
|
+
function roundProcess(rounds) {
|
|
8
|
+
const roundArrays = rounds.map((round) => Array.from({ length: round }, (_, i) => i + 1))
|
|
9
|
+
return roundArrays.reduce((acc, roundArray, index) => {
|
|
10
|
+
acc[cycleMapping[index]] = roundArray.reverse()
|
|
11
|
+
return acc
|
|
12
|
+
}, {})
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function transGameData(item) {
|
|
16
|
+
if (!item) return {}
|
|
17
|
+
item.providerId = item.provider
|
|
18
|
+
return item
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return createMachine(
|
|
22
|
+
{
|
|
23
|
+
id: 'ranking',
|
|
24
|
+
initial: 'idle',
|
|
25
|
+
context: {
|
|
26
|
+
auth: false,
|
|
27
|
+
activityNo: '',
|
|
28
|
+
// api options 回傳的資料
|
|
29
|
+
currentRound: [],
|
|
30
|
+
cycle: '',
|
|
31
|
+
round: 0,
|
|
32
|
+
rule: '',
|
|
33
|
+
// api detail 資料
|
|
34
|
+
description: '',
|
|
35
|
+
descriptionUrl: [],
|
|
36
|
+
// api detail 排名資料
|
|
37
|
+
playerRanking: {},
|
|
38
|
+
gameRanking: [],
|
|
39
|
+
topRanking: [],
|
|
40
|
+
settleStatus: false,
|
|
41
|
+
// 前端這邊用的選單資料 { cycle, round }
|
|
42
|
+
options: {},
|
|
43
|
+
},
|
|
44
|
+
states: {
|
|
45
|
+
idle: {
|
|
46
|
+
on: {
|
|
47
|
+
SET_ACTIVITY: {
|
|
48
|
+
target: 'loading',
|
|
49
|
+
},
|
|
50
|
+
SET_OPTIONS: {
|
|
51
|
+
target: 'setting',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
loading: {
|
|
56
|
+
entry: 'setActivity',
|
|
57
|
+
always: [{ target: 'getRankingOptions', cond: 'hasAuth' }, { target: 'getTournament' }],
|
|
58
|
+
},
|
|
59
|
+
setting: {
|
|
60
|
+
entry: 'setOptions',
|
|
61
|
+
always: [{ target: 'getRankingDetail' }],
|
|
62
|
+
},
|
|
63
|
+
// 未登入時取得排名資料
|
|
64
|
+
getTournament: {
|
|
65
|
+
invoke: {
|
|
66
|
+
src: 'fetchTournament',
|
|
67
|
+
onDone: {
|
|
68
|
+
target: 'idle',
|
|
69
|
+
actions: 'setRanking',
|
|
70
|
+
},
|
|
71
|
+
onError: {
|
|
72
|
+
target: 'idle',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
// 登入後取得排名選單資料
|
|
77
|
+
getRankingOptions: {
|
|
78
|
+
invoke: {
|
|
79
|
+
src: 'fetchRankingOptions',
|
|
80
|
+
onDone: {
|
|
81
|
+
target: 'getRankingGames',
|
|
82
|
+
actions: 'setRankingOptions',
|
|
83
|
+
},
|
|
84
|
+
onError: {
|
|
85
|
+
target: 'idle',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
// 登入後取得排名資料
|
|
90
|
+
getRankingDetail: {
|
|
91
|
+
invoke: {
|
|
92
|
+
src: 'fetchRankingDetail',
|
|
93
|
+
onDone: {
|
|
94
|
+
target: 'idle',
|
|
95
|
+
actions: 'setRanking',
|
|
96
|
+
},
|
|
97
|
+
onError: {
|
|
98
|
+
target: 'idle',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
getRankingGames: {
|
|
103
|
+
invoke: {
|
|
104
|
+
src: 'fetchRankingGames',
|
|
105
|
+
onDone: {
|
|
106
|
+
target: 'getRankingDetail',
|
|
107
|
+
actions: 'setRankingGames',
|
|
108
|
+
},
|
|
109
|
+
onError: {
|
|
110
|
+
target: 'idle',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
actions: {
|
|
118
|
+
setActivity: assign((context, event) => {
|
|
119
|
+
return {
|
|
120
|
+
auth: !!request.getToken(),
|
|
121
|
+
activityNo: event.data?.activityNo,
|
|
122
|
+
}
|
|
123
|
+
}),
|
|
124
|
+
setRanking: assign((context, event) => {
|
|
125
|
+
const topRanking = event.data?.topRanking?.map((rank) => transGameData(rank)) || []
|
|
126
|
+
return {
|
|
127
|
+
description: event.data?.description,
|
|
128
|
+
descriptionUrl: event.data?.descriptionUrl,
|
|
129
|
+
topRanking: topRanking,
|
|
130
|
+
playerRanking: transGameData(event.data?.playerRanking) || {},
|
|
131
|
+
settleStatus: !!topRanking[0]?.settleStatus,
|
|
132
|
+
}
|
|
133
|
+
}),
|
|
134
|
+
setRankingGames: assign((context, event) => {
|
|
135
|
+
const gameRanking = event.data?.map((rank) => transGameData(rank))
|
|
136
|
+
return {
|
|
137
|
+
gameRanking: gameRanking || [],
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
setRankingOptions: assign((context, event) => {
|
|
141
|
+
const cycle = event.data?.cycle
|
|
142
|
+
const currentRound = event.data?.currentRound || []
|
|
143
|
+
// 取得結算週期選單列表
|
|
144
|
+
const cycleOptions = cycleMapping.slice(0, currentRound.length)
|
|
145
|
+
// 取得每週期的歷史期數選單列表
|
|
146
|
+
const roundOptions = roundProcess(currentRound)
|
|
147
|
+
// 如果是月結算,則加入全部選項
|
|
148
|
+
if (cycle === 'MONTHLY') {
|
|
149
|
+
cycleOptions.push('ALL')
|
|
150
|
+
roundOptions.ALL = roundOptions.MONTHLY
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
...event.data,
|
|
154
|
+
options: { cycle: cycleOptions, round: roundOptions },
|
|
155
|
+
// 初始固定顯示 DAILY
|
|
156
|
+
cycle: event.data?.rule !== 'NORMAL' ? 'DAILY' : cycle,
|
|
157
|
+
round: currentRound[0],
|
|
158
|
+
}
|
|
159
|
+
}),
|
|
160
|
+
setOptions: assign((context, event) => {
|
|
161
|
+
const { cycle, round } = context
|
|
162
|
+
// 處理變更 cycle,如果沒有輸入或沒有變更就不更新
|
|
163
|
+
if (event.data?.cycle && cycle !== event.data?.cycle) {
|
|
164
|
+
const { currentRound } = context
|
|
165
|
+
const cycleForRound = event.data?.cycle === 'ALL' ? 'MONTHLY' : event.data?.cycle
|
|
166
|
+
const cycleIndex = cycleMapping.indexOf(cycleForRound)
|
|
167
|
+
return { cycle: event.data?.cycle, round: currentRound[cycleIndex] }
|
|
168
|
+
}
|
|
169
|
+
if (event.data?.round && round !== event.data?.round) {
|
|
170
|
+
return { round: event.data?.round }
|
|
171
|
+
}
|
|
172
|
+
return {}
|
|
173
|
+
}),
|
|
174
|
+
},
|
|
175
|
+
guards: {
|
|
176
|
+
hasAuth: (context) => context.auth,
|
|
177
|
+
},
|
|
178
|
+
services: {
|
|
179
|
+
fetchTournament: async (context) => {
|
|
180
|
+
const { activityNo } = context
|
|
181
|
+
const { data } = await request.send(ranking.getTournament({ activityNo }))
|
|
182
|
+
return data
|
|
183
|
+
},
|
|
184
|
+
fetchRankingOptions: async (context) => {
|
|
185
|
+
const { activityNo } = context
|
|
186
|
+
const { data } = await request.send(ranking.getRankingOptions({ activityNo }))
|
|
187
|
+
return data
|
|
188
|
+
},
|
|
189
|
+
fetchRankingDetail: async (context, event) => {
|
|
190
|
+
const { activityNo, cycle, round } = context
|
|
191
|
+
const { data } = await request.send(ranking.getRankingDetail({ activityNo, cycle, round }))
|
|
192
|
+
return data
|
|
193
|
+
},
|
|
194
|
+
fetchRankingGames: async (context) => {
|
|
195
|
+
const { activityNo } = context
|
|
196
|
+
const { data } = await request.send(ranking.getRankingGames({ activityNo }))
|
|
197
|
+
return data
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
}
|
package/src/machine/reward.js
CHANGED
|
@@ -37,7 +37,7 @@ export default function (request) {
|
|
|
37
37
|
},
|
|
38
38
|
pending: {
|
|
39
39
|
after: {
|
|
40
|
-
20000:
|
|
40
|
+
20000: { target: 'loading', cond: 'isNotInGame' },
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
},
|
|
@@ -64,6 +64,9 @@ export default function (request) {
|
|
|
64
64
|
target: 'allPointsReceiving',
|
|
65
65
|
actions: 'setCallback',
|
|
66
66
|
},
|
|
67
|
+
SET_IS_PLAYING: {
|
|
68
|
+
actions: 'setIsPlaying',
|
|
69
|
+
},
|
|
67
70
|
},
|
|
68
71
|
},
|
|
69
72
|
fetching: {
|
|
@@ -122,11 +125,6 @@ export default function (request) {
|
|
|
122
125
|
},
|
|
123
126
|
},
|
|
124
127
|
},
|
|
125
|
-
on: {
|
|
126
|
-
SET_IS_PLAYING: {
|
|
127
|
-
actions: 'setIsPlaying',
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
128
|
},
|
|
131
129
|
},
|
|
132
130
|
{
|