@jetthai/cuora 1.1.66-sabai-2 → 1.1.66-sabai-4
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 +4 -0
- package/dist/bundle.mjs +102 -33
- package/package.json +1 -1
- package/src/machine/game_favorite_v2.js +46 -5
- package/src/machine/game_v2_1.js +34 -19
- package/src/machine/side_v2.js +22 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.66-sabai-4](https://github.com/jetthai/cuora-module/compare/v1.1.66-sabai-3...v1.1.66-sabai-4) (2024-12-25)
|
|
6
|
+
|
|
7
|
+
### [1.1.66-sabai-3](https://github.com/jetthai/cuora-module/compare/v1.1.66-sabai-2...v1.1.66-sabai-3) (2024-10-02)
|
|
8
|
+
|
|
5
9
|
### [1.1.66-sabai-2](https://github.com/jetthai/cuora-module/compare/v1.0.66-sabai-2...v1.1.66-sabai-2) (2024-09-12)
|
|
6
10
|
|
|
7
11
|
### [1.0.66-sabai-2](https://github.com/jetthai/cuora-module/compare/v1.1.66-sabai-1...v1.0.66-sabai-2) (2024-09-12)
|
package/dist/bundle.mjs
CHANGED
|
@@ -17775,6 +17775,7 @@ function game_v2_1 (request) {
|
|
|
17775
17775
|
lang: 'en_US',
|
|
17776
17776
|
isMobile: new UAParser().getResult().device.type,
|
|
17777
17777
|
gameURL: null,
|
|
17778
|
+
inGaming: false,
|
|
17778
17779
|
...oldContext,
|
|
17779
17780
|
},
|
|
17780
17781
|
states: {
|
|
@@ -17863,15 +17864,12 @@ function game_v2_1 (request) {
|
|
|
17863
17864
|
states: {
|
|
17864
17865
|
pending: {
|
|
17865
17866
|
after: {
|
|
17866
|
-
20000: [
|
|
17867
|
-
|
|
17868
|
-
|
|
17869
|
-
|
|
17870
|
-
|
|
17871
|
-
|
|
17872
|
-
target: 'pending',
|
|
17873
|
-
},
|
|
17874
|
-
],
|
|
17867
|
+
20000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'hasRoom' }, { target: 'pending' }],
|
|
17868
|
+
},
|
|
17869
|
+
},
|
|
17870
|
+
inGaming: {
|
|
17871
|
+
after: {
|
|
17872
|
+
3000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'hasRoom' }, { target: 'pending' }],
|
|
17875
17873
|
},
|
|
17876
17874
|
},
|
|
17877
17875
|
updating: {
|
|
@@ -17911,7 +17909,7 @@ function game_v2_1 (request) {
|
|
|
17911
17909
|
src: 'fetchStatus',
|
|
17912
17910
|
onDone: {
|
|
17913
17911
|
target: 'updatingOption',
|
|
17914
|
-
actions:
|
|
17912
|
+
actions: 'setStatus',
|
|
17915
17913
|
},
|
|
17916
17914
|
onError: {
|
|
17917
17915
|
target: 'pending',
|
|
@@ -17932,14 +17930,25 @@ function game_v2_1 (request) {
|
|
|
17932
17930
|
},
|
|
17933
17931
|
pending: {
|
|
17934
17932
|
after: {
|
|
17935
|
-
20000: {
|
|
17936
|
-
|
|
17937
|
-
|
|
17933
|
+
20000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'fetchingGameSHA' }],
|
|
17934
|
+
},
|
|
17935
|
+
},
|
|
17936
|
+
inGaming: {
|
|
17937
|
+
after: {
|
|
17938
|
+
3000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'fetchingGameSHA' }],
|
|
17938
17939
|
},
|
|
17939
17940
|
},
|
|
17940
17941
|
},
|
|
17941
17942
|
},
|
|
17942
17943
|
},
|
|
17944
|
+
on: {
|
|
17945
|
+
SET_IN_GAME: {
|
|
17946
|
+
actions: 'setInGaming',
|
|
17947
|
+
},
|
|
17948
|
+
SET_LEAVE_GAME: {
|
|
17949
|
+
actions: 'setLeaveGame',
|
|
17950
|
+
},
|
|
17951
|
+
},
|
|
17943
17952
|
},
|
|
17944
17953
|
{
|
|
17945
17954
|
actions: {
|
|
@@ -17959,11 +17968,6 @@ function game_v2_1 (request) {
|
|
|
17959
17968
|
isLastPage: index >= content?.totalPage - 1,
|
|
17960
17969
|
}
|
|
17961
17970
|
}),
|
|
17962
|
-
setFavoriteList: assign((context, event) => {
|
|
17963
|
-
return {
|
|
17964
|
-
favoriteList: event.data.data || [],
|
|
17965
|
-
}
|
|
17966
|
-
}),
|
|
17967
17971
|
setRoom: assign((context, event) => {
|
|
17968
17972
|
return {
|
|
17969
17973
|
room: event.data,
|
|
@@ -18048,6 +18052,12 @@ function game_v2_1 (request) {
|
|
|
18048
18052
|
const lang = event.data.locale.replace('-', '_');
|
|
18049
18053
|
return { lang }
|
|
18050
18054
|
}),
|
|
18055
|
+
setInGaming: assign((context, event) => {
|
|
18056
|
+
return { inGaming: true }
|
|
18057
|
+
}),
|
|
18058
|
+
setLeaveGame: assign((context, event) => {
|
|
18059
|
+
return { inGaming: false }
|
|
18060
|
+
}),
|
|
18051
18061
|
...oldActions,
|
|
18052
18062
|
},
|
|
18053
18063
|
guards: {
|
|
@@ -18056,7 +18066,12 @@ function game_v2_1 (request) {
|
|
|
18056
18066
|
const { loadable, isLastPage } = context;
|
|
18057
18067
|
return loadable && !isLastPage
|
|
18058
18068
|
},
|
|
18059
|
-
hasRoom: (context, event) =>
|
|
18069
|
+
hasRoom: (context, event) => {
|
|
18070
|
+
return context.room?.categoryId
|
|
18071
|
+
},
|
|
18072
|
+
isInGaming: (context, event) => {
|
|
18073
|
+
return context.inGaming
|
|
18074
|
+
},
|
|
18060
18075
|
...oldGuards,
|
|
18061
18076
|
},
|
|
18062
18077
|
services: {
|
|
@@ -18306,9 +18321,23 @@ function game_favorite_v2 (request) {
|
|
|
18306
18321
|
id: 'favorite',
|
|
18307
18322
|
initial: 'fetching',
|
|
18308
18323
|
context: {
|
|
18324
|
+
auth: false,
|
|
18309
18325
|
list: [],
|
|
18310
18326
|
},
|
|
18311
18327
|
states: {
|
|
18328
|
+
idle: {},
|
|
18329
|
+
checking: {
|
|
18330
|
+
always: [
|
|
18331
|
+
{
|
|
18332
|
+
target: 'fetching',
|
|
18333
|
+
cond: 'hasAuth',
|
|
18334
|
+
},
|
|
18335
|
+
{
|
|
18336
|
+
target: 'idle',
|
|
18337
|
+
actions: 'clearList',
|
|
18338
|
+
},
|
|
18339
|
+
],
|
|
18340
|
+
},
|
|
18312
18341
|
fetching: {
|
|
18313
18342
|
invoke: {
|
|
18314
18343
|
src: 'fetchList',
|
|
@@ -18316,7 +18345,7 @@ function game_favorite_v2 (request) {
|
|
|
18316
18345
|
actions: 'setList',
|
|
18317
18346
|
},
|
|
18318
18347
|
onError: {
|
|
18319
|
-
actions:
|
|
18348
|
+
actions: 'clearList',
|
|
18320
18349
|
},
|
|
18321
18350
|
},
|
|
18322
18351
|
},
|
|
@@ -18330,7 +18359,9 @@ function game_favorite_v2 (request) {
|
|
|
18330
18359
|
enable: {
|
|
18331
18360
|
invoke: {
|
|
18332
18361
|
src: 'add',
|
|
18333
|
-
onDone: {
|
|
18362
|
+
onDone: {
|
|
18363
|
+
target: 'disable',
|
|
18364
|
+
},
|
|
18334
18365
|
onError: {
|
|
18335
18366
|
actions: 'removeFromList',
|
|
18336
18367
|
},
|
|
@@ -18345,7 +18376,9 @@ function game_favorite_v2 (request) {
|
|
|
18345
18376
|
enable: {
|
|
18346
18377
|
invoke: {
|
|
18347
18378
|
src: 'remove',
|
|
18348
|
-
onDone: {
|
|
18379
|
+
onDone: {
|
|
18380
|
+
target: 'disable',
|
|
18381
|
+
},
|
|
18349
18382
|
onError: {
|
|
18350
18383
|
actions: 'addToList',
|
|
18351
18384
|
},
|
|
@@ -18367,6 +18400,13 @@ function game_favorite_v2 (request) {
|
|
|
18367
18400
|
actions: 'removeFromList',
|
|
18368
18401
|
cond: 'isExist',
|
|
18369
18402
|
},
|
|
18403
|
+
SET_AUTH: [
|
|
18404
|
+
{
|
|
18405
|
+
target: 'checking',
|
|
18406
|
+
actions: 'setAuth',
|
|
18407
|
+
cond: 'isAuthChanged',
|
|
18408
|
+
},
|
|
18409
|
+
],
|
|
18370
18410
|
},
|
|
18371
18411
|
},
|
|
18372
18412
|
{
|
|
@@ -18376,6 +18416,11 @@ function game_favorite_v2 (request) {
|
|
|
18376
18416
|
list: event.data,
|
|
18377
18417
|
}
|
|
18378
18418
|
}),
|
|
18419
|
+
clearList: assign((context, event) => {
|
|
18420
|
+
return {
|
|
18421
|
+
list: [],
|
|
18422
|
+
}
|
|
18423
|
+
}),
|
|
18379
18424
|
addToList: assign((context, event) => {
|
|
18380
18425
|
return {
|
|
18381
18426
|
list: [...context.list, event.data],
|
|
@@ -18386,10 +18431,17 @@ function game_favorite_v2 (request) {
|
|
|
18386
18431
|
list: context.list.filter((item) => item.gameCode !== event.data.gameCode),
|
|
18387
18432
|
}
|
|
18388
18433
|
}),
|
|
18434
|
+
setAuth: assign((context, event) => {
|
|
18435
|
+
return {
|
|
18436
|
+
auth: !!event.data,
|
|
18437
|
+
}
|
|
18438
|
+
}),
|
|
18389
18439
|
},
|
|
18390
18440
|
guards: {
|
|
18391
18441
|
isExist: (context, event) => context.list.some((item) => item.gameCode === event.data.gameCode),
|
|
18392
18442
|
isNotExist: (context, event) => !context.list.some((item) => item.gameCode === event.data.gameCode),
|
|
18443
|
+
isAuthChanged: (context, event) => context.auth !== !!event.data,
|
|
18444
|
+
hasAuth: (context, event) => context.auth,
|
|
18393
18445
|
},
|
|
18394
18446
|
services: {
|
|
18395
18447
|
add: async (context, event) => {
|
|
@@ -18409,8 +18461,12 @@ function game_favorite_v2 (request) {
|
|
|
18409
18461
|
}
|
|
18410
18462
|
},
|
|
18411
18463
|
fetchList: async (context, event) => {
|
|
18412
|
-
|
|
18413
|
-
|
|
18464
|
+
if (request.getToken()) {
|
|
18465
|
+
const { data } = await request.send(game$1.getListMyFavorite());
|
|
18466
|
+
return data
|
|
18467
|
+
} else {
|
|
18468
|
+
return []
|
|
18469
|
+
}
|
|
18414
18470
|
},
|
|
18415
18471
|
},
|
|
18416
18472
|
}
|
|
@@ -19968,6 +20024,7 @@ function side_v2 (request) {
|
|
|
19968
20024
|
previousMenuItemStack: [],
|
|
19969
20025
|
historyStack: [],
|
|
19970
20026
|
defaultMenuItemStack: [],
|
|
20027
|
+
inGaming: false,
|
|
19971
20028
|
},
|
|
19972
20029
|
states: {
|
|
19973
20030
|
loading: {
|
|
@@ -19984,15 +20041,12 @@ function side_v2 (request) {
|
|
|
19984
20041
|
states: {
|
|
19985
20042
|
pending: {
|
|
19986
20043
|
after: {
|
|
19987
|
-
20000: [
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
|
|
19992
|
-
|
|
19993
|
-
target: 'pending',
|
|
19994
|
-
},
|
|
19995
|
-
],
|
|
20044
|
+
20000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'isInMenu' }, { target: 'pending' }],
|
|
20045
|
+
},
|
|
20046
|
+
},
|
|
20047
|
+
inGaming: {
|
|
20048
|
+
after: {
|
|
20049
|
+
3000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'isInMenu' }, { target: 'pending' }],
|
|
19996
20050
|
},
|
|
19997
20051
|
},
|
|
19998
20052
|
updating: {
|
|
@@ -20021,6 +20075,12 @@ function side_v2 (request) {
|
|
|
20021
20075
|
RESET: {
|
|
20022
20076
|
actions: 'resetMenuItemStack',
|
|
20023
20077
|
},
|
|
20078
|
+
SET_IN_GAME: {
|
|
20079
|
+
actions: 'setInGame',
|
|
20080
|
+
},
|
|
20081
|
+
SET_LEAVE_GAME: {
|
|
20082
|
+
actions: 'setLeaveGame',
|
|
20083
|
+
},
|
|
20024
20084
|
},
|
|
20025
20085
|
},
|
|
20026
20086
|
},
|
|
@@ -20096,6 +20156,12 @@ function side_v2 (request) {
|
|
|
20096
20156
|
const { defaultMenuItemStack } = context;
|
|
20097
20157
|
return { menuItemStack: defaultMenuItemStack }
|
|
20098
20158
|
}),
|
|
20159
|
+
setInGame: assign((context, event) => {
|
|
20160
|
+
return { inGaming: true }
|
|
20161
|
+
}),
|
|
20162
|
+
setLeaveGame: assign((context, event) => {
|
|
20163
|
+
return { inGaming: false }
|
|
20164
|
+
}),
|
|
20099
20165
|
},
|
|
20100
20166
|
guards: {
|
|
20101
20167
|
isInMenu: (context, event) => {
|
|
@@ -20105,6 +20171,9 @@ function side_v2 (request) {
|
|
|
20105
20171
|
if (!menuItem || !menuItem.categoryId) return false
|
|
20106
20172
|
return isItemInMenu(menuItem, menu.data)
|
|
20107
20173
|
},
|
|
20174
|
+
isInGaming: (context, event) => {
|
|
20175
|
+
return context.inGaming
|
|
20176
|
+
},
|
|
20108
20177
|
},
|
|
20109
20178
|
services: {
|
|
20110
20179
|
getMenu: async (context, event) => {
|
package/package.json
CHANGED
|
@@ -7,9 +7,23 @@ export default function (request) {
|
|
|
7
7
|
id: 'favorite',
|
|
8
8
|
initial: 'fetching',
|
|
9
9
|
context: {
|
|
10
|
+
auth: false,
|
|
10
11
|
list: [],
|
|
11
12
|
},
|
|
12
13
|
states: {
|
|
14
|
+
idle: {},
|
|
15
|
+
checking: {
|
|
16
|
+
always: [
|
|
17
|
+
{
|
|
18
|
+
target: 'fetching',
|
|
19
|
+
cond: 'hasAuth',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
target: 'idle',
|
|
23
|
+
actions: 'clearList',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
13
27
|
fetching: {
|
|
14
28
|
invoke: {
|
|
15
29
|
src: 'fetchList',
|
|
@@ -17,7 +31,7 @@ export default function (request) {
|
|
|
17
31
|
actions: 'setList',
|
|
18
32
|
},
|
|
19
33
|
onError: {
|
|
20
|
-
actions:
|
|
34
|
+
actions: 'clearList',
|
|
21
35
|
},
|
|
22
36
|
},
|
|
23
37
|
},
|
|
@@ -31,7 +45,9 @@ export default function (request) {
|
|
|
31
45
|
enable: {
|
|
32
46
|
invoke: {
|
|
33
47
|
src: 'add',
|
|
34
|
-
onDone: {
|
|
48
|
+
onDone: {
|
|
49
|
+
target: 'disable',
|
|
50
|
+
},
|
|
35
51
|
onError: {
|
|
36
52
|
actions: 'removeFromList',
|
|
37
53
|
},
|
|
@@ -46,7 +62,9 @@ export default function (request) {
|
|
|
46
62
|
enable: {
|
|
47
63
|
invoke: {
|
|
48
64
|
src: 'remove',
|
|
49
|
-
onDone: {
|
|
65
|
+
onDone: {
|
|
66
|
+
target: 'disable',
|
|
67
|
+
},
|
|
50
68
|
onError: {
|
|
51
69
|
actions: 'addToList',
|
|
52
70
|
},
|
|
@@ -68,6 +86,13 @@ export default function (request) {
|
|
|
68
86
|
actions: 'removeFromList',
|
|
69
87
|
cond: 'isExist',
|
|
70
88
|
},
|
|
89
|
+
SET_AUTH: [
|
|
90
|
+
{
|
|
91
|
+
target: 'checking',
|
|
92
|
+
actions: 'setAuth',
|
|
93
|
+
cond: 'isAuthChanged',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
71
96
|
},
|
|
72
97
|
},
|
|
73
98
|
{
|
|
@@ -77,6 +102,11 @@ export default function (request) {
|
|
|
77
102
|
list: event.data,
|
|
78
103
|
}
|
|
79
104
|
}),
|
|
105
|
+
clearList: assign((context, event) => {
|
|
106
|
+
return {
|
|
107
|
+
list: [],
|
|
108
|
+
}
|
|
109
|
+
}),
|
|
80
110
|
addToList: assign((context, event) => {
|
|
81
111
|
return {
|
|
82
112
|
list: [...context.list, event.data],
|
|
@@ -87,10 +117,17 @@ export default function (request) {
|
|
|
87
117
|
list: context.list.filter((item) => item.gameCode !== event.data.gameCode),
|
|
88
118
|
}
|
|
89
119
|
}),
|
|
120
|
+
setAuth: assign((context, event) => {
|
|
121
|
+
return {
|
|
122
|
+
auth: !!event.data,
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
90
125
|
},
|
|
91
126
|
guards: {
|
|
92
127
|
isExist: (context, event) => context.list.some((item) => item.gameCode === event.data.gameCode),
|
|
93
128
|
isNotExist: (context, event) => !context.list.some((item) => item.gameCode === event.data.gameCode),
|
|
129
|
+
isAuthChanged: (context, event) => context.auth !== !!event.data,
|
|
130
|
+
hasAuth: (context, event) => context.auth,
|
|
94
131
|
},
|
|
95
132
|
services: {
|
|
96
133
|
add: async (context, event) => {
|
|
@@ -110,8 +147,12 @@ export default function (request) {
|
|
|
110
147
|
}
|
|
111
148
|
},
|
|
112
149
|
fetchList: async (context, event) => {
|
|
113
|
-
|
|
114
|
-
|
|
150
|
+
if (request.getToken()) {
|
|
151
|
+
const { data } = await request.send(api.getListMyFavorite())
|
|
152
|
+
return data
|
|
153
|
+
} else {
|
|
154
|
+
return []
|
|
155
|
+
}
|
|
115
156
|
},
|
|
116
157
|
},
|
|
117
158
|
}
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -37,6 +37,7 @@ export default function (request) {
|
|
|
37
37
|
lang: 'en_US',
|
|
38
38
|
isMobile: new UAParser().getResult().device.type,
|
|
39
39
|
gameURL: null,
|
|
40
|
+
inGaming: false,
|
|
40
41
|
...oldContext,
|
|
41
42
|
},
|
|
42
43
|
states: {
|
|
@@ -125,15 +126,12 @@ export default function (request) {
|
|
|
125
126
|
states: {
|
|
126
127
|
pending: {
|
|
127
128
|
after: {
|
|
128
|
-
20000: [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
target: 'pending',
|
|
135
|
-
},
|
|
136
|
-
],
|
|
129
|
+
20000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'hasRoom' }, { target: 'pending' }],
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
inGaming: {
|
|
133
|
+
after: {
|
|
134
|
+
3000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'hasRoom' }, { target: 'pending' }],
|
|
137
135
|
},
|
|
138
136
|
},
|
|
139
137
|
updating: {
|
|
@@ -173,7 +171,7 @@ export default function (request) {
|
|
|
173
171
|
src: 'fetchStatus',
|
|
174
172
|
onDone: {
|
|
175
173
|
target: 'updatingOption',
|
|
176
|
-
actions:
|
|
174
|
+
actions: 'setStatus',
|
|
177
175
|
},
|
|
178
176
|
onError: {
|
|
179
177
|
target: 'pending',
|
|
@@ -194,14 +192,25 @@ export default function (request) {
|
|
|
194
192
|
},
|
|
195
193
|
pending: {
|
|
196
194
|
after: {
|
|
197
|
-
20000: {
|
|
198
|
-
|
|
199
|
-
|
|
195
|
+
20000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'fetchingGameSHA' }],
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
inGaming: {
|
|
199
|
+
after: {
|
|
200
|
+
3000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'fetchingGameSHA' }],
|
|
200
201
|
},
|
|
201
202
|
},
|
|
202
203
|
},
|
|
203
204
|
},
|
|
204
205
|
},
|
|
206
|
+
on: {
|
|
207
|
+
SET_IN_GAME: {
|
|
208
|
+
actions: 'setInGaming',
|
|
209
|
+
},
|
|
210
|
+
SET_LEAVE_GAME: {
|
|
211
|
+
actions: 'setLeaveGame',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
205
214
|
},
|
|
206
215
|
{
|
|
207
216
|
actions: {
|
|
@@ -221,11 +230,6 @@ export default function (request) {
|
|
|
221
230
|
isLastPage: index >= content?.totalPage - 1,
|
|
222
231
|
}
|
|
223
232
|
}),
|
|
224
|
-
setFavoriteList: assign((context, event) => {
|
|
225
|
-
return {
|
|
226
|
-
favoriteList: event.data.data || [],
|
|
227
|
-
}
|
|
228
|
-
}),
|
|
229
233
|
setRoom: assign((context, event) => {
|
|
230
234
|
return {
|
|
231
235
|
room: event.data,
|
|
@@ -310,6 +314,12 @@ export default function (request) {
|
|
|
310
314
|
const lang = event.data.locale.replace('-', '_')
|
|
311
315
|
return { lang }
|
|
312
316
|
}),
|
|
317
|
+
setInGaming: assign((context, event) => {
|
|
318
|
+
return { inGaming: true }
|
|
319
|
+
}),
|
|
320
|
+
setLeaveGame: assign((context, event) => {
|
|
321
|
+
return { inGaming: false }
|
|
322
|
+
}),
|
|
313
323
|
...oldActions,
|
|
314
324
|
},
|
|
315
325
|
guards: {
|
|
@@ -318,7 +328,12 @@ export default function (request) {
|
|
|
318
328
|
const { loadable, isLastPage } = context
|
|
319
329
|
return loadable && !isLastPage
|
|
320
330
|
},
|
|
321
|
-
hasRoom: (context, event) =>
|
|
331
|
+
hasRoom: (context, event) => {
|
|
332
|
+
return context.room?.categoryId
|
|
333
|
+
},
|
|
334
|
+
isInGaming: (context, event) => {
|
|
335
|
+
return context.inGaming
|
|
336
|
+
},
|
|
322
337
|
...oldGuards,
|
|
323
338
|
},
|
|
324
339
|
services: {
|
package/src/machine/side_v2.js
CHANGED
|
@@ -12,6 +12,7 @@ export default function (request) {
|
|
|
12
12
|
previousMenuItemStack: [],
|
|
13
13
|
historyStack: [],
|
|
14
14
|
defaultMenuItemStack: [],
|
|
15
|
+
inGaming: false,
|
|
15
16
|
},
|
|
16
17
|
states: {
|
|
17
18
|
loading: {
|
|
@@ -28,15 +29,12 @@ export default function (request) {
|
|
|
28
29
|
states: {
|
|
29
30
|
pending: {
|
|
30
31
|
after: {
|
|
31
|
-
20000: [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
target: 'pending',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
32
|
+
20000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'isInMenu' }, { target: 'pending' }],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
inGaming: {
|
|
36
|
+
after: {
|
|
37
|
+
3000: [{ target: 'inGaming', cond: 'isInGaming' }, { target: 'updating', cond: 'isInMenu' }, { target: 'pending' }],
|
|
40
38
|
},
|
|
41
39
|
},
|
|
42
40
|
updating: {
|
|
@@ -65,6 +63,12 @@ export default function (request) {
|
|
|
65
63
|
RESET: {
|
|
66
64
|
actions: 'resetMenuItemStack',
|
|
67
65
|
},
|
|
66
|
+
SET_IN_GAME: {
|
|
67
|
+
actions: 'setInGame',
|
|
68
|
+
},
|
|
69
|
+
SET_LEAVE_GAME: {
|
|
70
|
+
actions: 'setLeaveGame',
|
|
71
|
+
},
|
|
68
72
|
},
|
|
69
73
|
},
|
|
70
74
|
},
|
|
@@ -140,6 +144,12 @@ export default function (request) {
|
|
|
140
144
|
const { defaultMenuItemStack } = context
|
|
141
145
|
return { menuItemStack: defaultMenuItemStack }
|
|
142
146
|
}),
|
|
147
|
+
setInGame: assign((context, event) => {
|
|
148
|
+
return { inGaming: true }
|
|
149
|
+
}),
|
|
150
|
+
setLeaveGame: assign((context, event) => {
|
|
151
|
+
return { inGaming: false }
|
|
152
|
+
}),
|
|
143
153
|
},
|
|
144
154
|
guards: {
|
|
145
155
|
isInMenu: (context, event) => {
|
|
@@ -149,6 +159,9 @@ export default function (request) {
|
|
|
149
159
|
if (!menuItem || !menuItem.categoryId) return false
|
|
150
160
|
return isItemInMenu(menuItem, menu.data)
|
|
151
161
|
},
|
|
162
|
+
isInGaming: (context, event) => {
|
|
163
|
+
return context.inGaming
|
|
164
|
+
},
|
|
152
165
|
},
|
|
153
166
|
services: {
|
|
154
167
|
getMenu: async (context, event) => {
|