@jetthai/cuora 1.1.341-dev-3 → 1.1.341-dev-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
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
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.341-dev-
|
|
5
|
+
### [1.1.341-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.341-dev-3...v1.1.341-dev-4) (2025-03-03)
|
|
6
|
+
|
|
7
|
+
### [1.1.341-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.341-dev-2...v1.1.341-dev-3) (2025-03-03)
|
|
6
8
|
|
|
7
9
|
### [1.1.341-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.341-dev-1...v1.1.341-dev-2) (2025-02-27)
|
|
8
10
|
|
package/package.json
CHANGED
package/src/api/game.js
CHANGED
|
@@ -100,5 +100,4 @@ export default {
|
|
|
100
100
|
}),
|
|
101
101
|
getFreeGameList: () => ({ method: 'get', url: 'activities/getFreeGameRewardList' }),
|
|
102
102
|
getFreeGameReward: ({ activityNo, receiveNo }) => ({ method: 'post', url: 'activities/getFreeGameReward', params: { activityNo, receiveNo } }),
|
|
103
|
-
getV3GameInfo: ({ appSecret, gameCodes }) => ({ method: 'post', url: 'game/list/v3/gameInfo', params: { appSecret, gameCodes } }),
|
|
104
103
|
}
|
|
@@ -150,12 +150,8 @@ export default function (request) {
|
|
|
150
150
|
}
|
|
151
151
|
}),
|
|
152
152
|
resetActivities: assign((context, event) => {
|
|
153
|
-
const { activityList = [], specifyActivities = [] } = context
|
|
154
|
-
const keepActivities = activityList.filter((activity) => specifyActivities.includes(activity.activityType))
|
|
155
153
|
return {
|
|
156
154
|
isPlaying: true,
|
|
157
|
-
activityList: keepActivities,
|
|
158
|
-
promotionList: [],
|
|
159
155
|
}
|
|
160
156
|
}),
|
|
161
157
|
leaveGame: assign((context, event) => {
|
|
@@ -123,12 +123,8 @@ export default function (request) {
|
|
|
123
123
|
}
|
|
124
124
|
}),
|
|
125
125
|
resetActivities: assign((context, event) => {
|
|
126
|
-
const { activityList = [], detailNeededActivityTypes = [] } = context
|
|
127
|
-
const keepActivities = activityList.filter((activity) => detailNeededActivityTypes.includes(activity.activityType))
|
|
128
126
|
return {
|
|
129
127
|
isPlaying: true,
|
|
130
|
-
activityList: keepActivities,
|
|
131
|
-
promotionList: [],
|
|
132
128
|
}
|
|
133
129
|
}),
|
|
134
130
|
leaveGame: assign((context, event) => {
|
package/src/machine/error.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
|
-
import api from '../api/game.js'
|
|
3
|
-
|
|
4
|
-
export default function (request) {
|
|
5
|
-
const { appSecret } = request.config
|
|
6
2
|
|
|
3
|
+
export default function () {
|
|
7
4
|
return createMachine(
|
|
8
5
|
{
|
|
9
6
|
id: 'error',
|
|
@@ -11,7 +8,6 @@ export default function (request) {
|
|
|
11
8
|
context: {
|
|
12
9
|
error: null,
|
|
13
10
|
gameCode: null,
|
|
14
|
-
game: null,
|
|
15
11
|
},
|
|
16
12
|
states: {
|
|
17
13
|
normal: {
|
|
@@ -37,19 +33,10 @@ export default function (request) {
|
|
|
37
33
|
},
|
|
38
34
|
logout: {},
|
|
39
35
|
deposit: {},
|
|
40
|
-
unfinishedGame: {
|
|
41
|
-
invoke: {
|
|
42
|
-
src: 'getGameInfo',
|
|
43
|
-
onDone: {
|
|
44
|
-
actions: 'setGame',
|
|
45
|
-
},
|
|
46
|
-
onError: {
|
|
47
|
-
target: 'unfinishedGame',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
36
|
+
unfinishedGame: {},
|
|
51
37
|
freeGameSettle: {},
|
|
52
38
|
freeGameGiveUp: {},
|
|
39
|
+
// hall: {},
|
|
53
40
|
},
|
|
54
41
|
},
|
|
55
42
|
},
|
|
@@ -71,12 +58,6 @@ export default function (request) {
|
|
|
71
58
|
gameCode: context.error.extend.split(/_(.+)/)[1],
|
|
72
59
|
}
|
|
73
60
|
}),
|
|
74
|
-
setGame: assign((context, event) => {
|
|
75
|
-
const gameInfo = event.data
|
|
76
|
-
return {
|
|
77
|
-
game: gameInfo?.[0],
|
|
78
|
-
}
|
|
79
|
-
}),
|
|
80
61
|
},
|
|
81
62
|
guards: {
|
|
82
63
|
isLogout: (context, event) => {
|
|
@@ -95,12 +76,7 @@ export default function (request) {
|
|
|
95
76
|
return context.error.code === 'ERR_G125'
|
|
96
77
|
},
|
|
97
78
|
},
|
|
98
|
-
services: {
|
|
99
|
-
getGameInfo: async (context, event) => {
|
|
100
|
-
const { gameCode } = context
|
|
101
|
-
return await request.send(api.getV3GameInfo({ appSecret, gameCodes: [gameCode] }))
|
|
102
|
-
},
|
|
103
|
-
},
|
|
79
|
+
services: {},
|
|
104
80
|
}
|
|
105
81
|
)
|
|
106
82
|
}
|
package/src/machine/navbar.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import common from '../api/common.js'
|
|
3
|
-
import game from '../api/game.js'
|
|
4
3
|
|
|
5
4
|
export default function (request) {
|
|
6
5
|
const { appSecret } = request.config
|
|
@@ -9,35 +8,15 @@ export default function (request) {
|
|
|
9
8
|
id: 'navbar',
|
|
10
9
|
initial: 'fetching',
|
|
11
10
|
context: {
|
|
12
|
-
navbar:
|
|
13
|
-
gameCodes: [],
|
|
11
|
+
navbar: null,
|
|
14
12
|
},
|
|
15
13
|
states: {
|
|
16
14
|
fetching: {
|
|
17
15
|
invoke: {
|
|
18
16
|
src: 'fetchNavbar',
|
|
19
|
-
onDone: [
|
|
20
|
-
{
|
|
21
|
-
target: 'checking',
|
|
22
|
-
actions: ['setNavbar', 'filterGameCodes'],
|
|
23
|
-
cond: 'haveGames',
|
|
24
|
-
},
|
|
25
|
-
{ target: 'idle' },
|
|
26
|
-
],
|
|
27
|
-
onError: {
|
|
28
|
-
target: 'idle',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
checking: {
|
|
33
|
-
always: [{ target: 'combinning', cond: (context, event) => context.gameCodes?.length > 0 }, { target: 'idle' }],
|
|
34
|
-
},
|
|
35
|
-
combinning: {
|
|
36
|
-
invoke: {
|
|
37
|
-
src: 'getGameInfo',
|
|
38
17
|
onDone: {
|
|
39
18
|
target: 'idle',
|
|
40
|
-
actions: '
|
|
19
|
+
actions: 'setNavbar',
|
|
41
20
|
},
|
|
42
21
|
onError: {
|
|
43
22
|
target: 'idle',
|
|
@@ -55,47 +34,6 @@ export default function (request) {
|
|
|
55
34
|
navbar: navbarConfig.settings,
|
|
56
35
|
}
|
|
57
36
|
}),
|
|
58
|
-
filterGameCodes: assign((context, event) => {
|
|
59
|
-
const { navbar = [] } = context
|
|
60
|
-
const gameCodes = navbar.reduce((acc, item) => {
|
|
61
|
-
if (item.type.toLowerCase() === 'game' && item.gameCode) {
|
|
62
|
-
acc.push(item.gameCode)
|
|
63
|
-
}
|
|
64
|
-
return acc
|
|
65
|
-
}, [])
|
|
66
|
-
|
|
67
|
-
return { gameCodes }
|
|
68
|
-
}),
|
|
69
|
-
combindGames: assign((context, event) => {
|
|
70
|
-
const gameInfo = event.data?.data || []
|
|
71
|
-
const { navbar = [] } = context
|
|
72
|
-
const combindNavBar = navbar.map((item) => {
|
|
73
|
-
if (item.type.toLowerCase() === 'game') {
|
|
74
|
-
const currentGame = gameInfo.find((game) => game.gameCode === item.gameCode)
|
|
75
|
-
return {
|
|
76
|
-
...item,
|
|
77
|
-
...currentGame,
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
return item
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
navbar: combindNavBar,
|
|
86
|
-
}
|
|
87
|
-
}),
|
|
88
|
-
},
|
|
89
|
-
guards: {
|
|
90
|
-
haveGames: (context, event) => {
|
|
91
|
-
const { navbarConfig = {} } = event.data
|
|
92
|
-
const { settings = [] } = navbarConfig
|
|
93
|
-
if (settings?.length) {
|
|
94
|
-
return settings.some((item) => item.type.toLowerCase() === 'game')
|
|
95
|
-
} else {
|
|
96
|
-
return false
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
37
|
},
|
|
100
38
|
services: {
|
|
101
39
|
fetchNavbar: async (context, event) => {
|
|
@@ -113,10 +51,6 @@ export default function (request) {
|
|
|
113
51
|
)
|
|
114
52
|
return { navbarConfig: JSON.parse(decodeResult) }
|
|
115
53
|
},
|
|
116
|
-
getGameInfo: async (context, event) => {
|
|
117
|
-
const { gameCodes } = context
|
|
118
|
-
return await request.send(game.getV3GameInfo({ appSecret, gameCodes }))
|
|
119
|
-
},
|
|
120
54
|
},
|
|
121
55
|
}
|
|
122
56
|
)
|
package/src/machine/websocket.js
CHANGED
|
@@ -273,6 +273,18 @@ export default function (request) {
|
|
|
273
273
|
callback({ type: 'ACTIVITY_INFO', data })
|
|
274
274
|
})
|
|
275
275
|
|
|
276
|
+
// 監聽 activity-reward-info 事件
|
|
277
|
+
clientSocket.on('activity-reward-info', (data) => {
|
|
278
|
+
console.log('[socket][activity-reward-info]:', data)
|
|
279
|
+
callback({ type: 'ACTIVITY_INFO', data })
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
// 監聽 message-notice-info 事件
|
|
283
|
+
clientSocket.on('message-notice-info', (data) => {
|
|
284
|
+
console.log('[socket][message-notice-info]:', data)
|
|
285
|
+
callback({ type: 'ACTIVITY_INFO', data })
|
|
286
|
+
})
|
|
287
|
+
|
|
276
288
|
// 監聽 payment-info 事件
|
|
277
289
|
clientSocket.on('payment-info', (data) => {
|
|
278
290
|
console.log('[socket][payment-info]:', data, data.windowType)
|