@jetthai/cuora 1.1.340-dev-2 → 1.1.340-dev-3

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,6 +2,8 @@
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-3](https://github.com/jetthai/cuora-module/compare/v1.1.340-dev-2...v1.1.340-dev-3) (2025-02-23)
6
+
5
7
  ### [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
8
 
7
9
  ### [1.1.340](https://github.com/jetthai/cuora-module/compare/v1.1.339...v1.1.340) (2025-02-18)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.340-dev-2",
3
+ "version": "1.1.340-dev-3",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
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
  }
@@ -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
  }