@jetthai/cuora 1.1.340-dev-2 → 1.1.340-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 +18 -0
- package/package.json +1 -1
- package/src/api/game.js +1 -0
- package/src/machine/error.js +28 -3
- package/src/machine/websocket.js +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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.340-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.341...v1.1.340-dev-4) (2025-02-26)
|
|
6
|
+
|
|
7
|
+
### [1.1.340-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.340-dev-2...v1.1.340-dev-3) (2025-02-23)
|
|
8
|
+
|
|
9
|
+
### [1.1.340-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.340-dev-1...v1.1.340-dev-2) (2025-02-19)
|
|
10
|
+
|
|
11
|
+
### [1.1.340-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.340...v1.1.340-dev-1) (2025-02-19)
|
|
12
|
+
|
|
13
|
+
### [1.1.338-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.338-dev-9...v1.1.338-dev-10) (2025-02-17)
|
|
14
|
+
|
|
15
|
+
### [1.1.338-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.338-dev-8...v1.1.338-dev-9) (2025-02-17)
|
|
16
|
+
|
|
17
|
+
### [1.1.338-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.338-dev-7...v1.1.338-dev-8) (2025-02-14)
|
|
18
|
+
|
|
19
|
+
### [1.1.338-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.338-perf-1...v1.1.338-dev-7) (2025-02-14)
|
|
20
|
+
|
|
21
|
+
### [1.1.340-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.340-dev-2...v1.1.340-dev-3) (2025-02-23)
|
|
22
|
+
|
|
5
23
|
### [1.1.340-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.340-dev-1...v1.1.340-dev-2) (2025-02-19)
|
|
6
24
|
|
|
7
25
|
### [1.1.340](https://github.com/jetthai/cuora-module/compare/v1.1.339...v1.1.340) (2025-02-18)
|
package/package.json
CHANGED
package/src/api/game.js
CHANGED
|
@@ -100,4 +100,5 @@ 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 } }),
|
|
103
104
|
}
|
package/src/machine/error.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
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
|
|
2
6
|
|
|
3
|
-
export default function () {
|
|
4
7
|
return createMachine(
|
|
5
8
|
{
|
|
6
9
|
id: 'error',
|
|
@@ -8,6 +11,7 @@ export default function () {
|
|
|
8
11
|
context: {
|
|
9
12
|
error: null,
|
|
10
13
|
gameCode: null,
|
|
14
|
+
game: null,
|
|
11
15
|
},
|
|
12
16
|
states: {
|
|
13
17
|
normal: {
|
|
@@ -33,9 +37,19 @@ export default function () {
|
|
|
33
37
|
},
|
|
34
38
|
logout: {},
|
|
35
39
|
deposit: {},
|
|
36
|
-
unfinishedGame: {},
|
|
37
40
|
freeGameSettle: {},
|
|
38
41
|
freeGameGiveUp: {},
|
|
42
|
+
unfinishedGame: {
|
|
43
|
+
invoke: {
|
|
44
|
+
src: 'getGameInfo',
|
|
45
|
+
onDone: {
|
|
46
|
+
actions: 'setGame',
|
|
47
|
+
},
|
|
48
|
+
onError: {
|
|
49
|
+
target: 'unfinishedGame',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
39
53
|
// hall: {},
|
|
40
54
|
},
|
|
41
55
|
},
|
|
@@ -58,6 +72,12 @@ export default function () {
|
|
|
58
72
|
gameCode: context.error.extend.split(/_(.+)/)[1],
|
|
59
73
|
}
|
|
60
74
|
}),
|
|
75
|
+
setGame: assign((context, event) => {
|
|
76
|
+
const gameInfo = event.data
|
|
77
|
+
return {
|
|
78
|
+
game: gameInfo?.[0],
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
61
81
|
},
|
|
62
82
|
guards: {
|
|
63
83
|
isLogout: (context, event) => {
|
|
@@ -76,7 +96,12 @@ export default function () {
|
|
|
76
96
|
return context.error.code === 'ERR_G125'
|
|
77
97
|
},
|
|
78
98
|
},
|
|
79
|
-
services: {
|
|
99
|
+
services: {
|
|
100
|
+
getGameInfo: async (context, event) => {
|
|
101
|
+
const { gameCode } = context
|
|
102
|
+
return await request.send(api.getV3GameInfo({ appSecret, gameCodes: [gameCode] }))
|
|
103
|
+
},
|
|
104
|
+
},
|
|
80
105
|
}
|
|
81
106
|
)
|
|
82
107
|
}
|
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)
|