@jetthai/cuora 1.1.330-dev-4 → 1.1.330-dev-6

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,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.330-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.330-dev-5...v1.1.330-dev-6) (2024-12-23)
6
+
7
+ ### [1.1.330-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.330-dev-4...v1.1.330-dev-5) (2024-12-23)
8
+
5
9
  ### [1.1.330-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.330-dev-3...v1.1.330-dev-4) (2024-12-19)
6
10
 
7
11
  ### [1.1.330-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.330-dev-2...v1.1.330-dev-3) (2024-12-19)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.330-dev-4",
3
+ "version": "1.1.330-dev-6",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/game.js CHANGED
@@ -92,4 +92,11 @@ export default {
92
92
  addListFavorite: (code) => ({ method: 'post', url: 'game/list/v3/addMyFavorite', params: { games: [code] } }),
93
93
  removeListFavorite: (code) => ({ method: 'post', url: 'game/list/v3/removeMyFavorite', params: { games: [code] } }),
94
94
  getGameInfo: ({ appSecret, gameCode }) => ({ method: 'get', url: 'game/info', params: { appSecret, gameCode } }),
95
+ getGameReplayInfo: ({ providerId, seqNo, lang }) => ({
96
+ method: 'get',
97
+ url: 'game/gameReplay',
98
+ params: { providerId, seqNo, lang },
99
+ isPublic: true,
100
+ }),
101
+ getFreeGameList: () => ({ method: 'post', url: 'activities/getFreeGameRewardList' }),
95
102
  }
@@ -0,0 +1,45 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import game from '../api/game.js'
3
+
4
+ export default function (request, context) {
5
+ // const { appSecret } = request.config
6
+ return createMachine(
7
+ {
8
+ id: 'game_free',
9
+ initial: 'fetching',
10
+ context: {
11
+ freeGameList: {},
12
+ },
13
+ states: {
14
+ fetching: {
15
+ invoke: {
16
+ src: 'fetchFreeGameList',
17
+ onDone: {
18
+ target: 'idle',
19
+ actions: 'setFreeGameList',
20
+ },
21
+ onError: {
22
+ target: 'idle',
23
+ },
24
+ },
25
+ },
26
+ idle: {},
27
+ },
28
+ },
29
+ {
30
+ actions: {
31
+ setFreeGameList: assign((context, event) => {
32
+ return {
33
+ freeGameList: event.data.data,
34
+ }
35
+ }),
36
+ },
37
+ services: {
38
+ // 取得免費遊戲列表
39
+ fetchFreeGameList: async (context, event) => {
40
+ return await request.send(game.getFreeGameList())
41
+ },
42
+ },
43
+ }
44
+ )
45
+ }
@@ -0,0 +1,46 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import game from '../api/game.js'
3
+
4
+ export default function (request, context) {
5
+ // const { appSecret } = request.config
6
+ const { providerId, seqNo, lang } = context
7
+ return createMachine(
8
+ {
9
+ id: 'game_replay',
10
+ initial: 'fetching',
11
+ context: {
12
+ gameReplayInfo: {},
13
+ },
14
+ states: {
15
+ fetching: {
16
+ invoke: {
17
+ src: 'fetchGameReplayInfo',
18
+ onDone: {
19
+ target: 'idle',
20
+ actions: 'setGameReplayInfo',
21
+ },
22
+ onError: {
23
+ target: 'idle',
24
+ },
25
+ },
26
+ },
27
+ idle: {},
28
+ },
29
+ },
30
+ {
31
+ actions: {
32
+ setGameReplayInfo: assign((context, event) => {
33
+ return {
34
+ gameReplayInfo: event.data.data,
35
+ }
36
+ }),
37
+ },
38
+ services: {
39
+ // 取得遊戲重播資訊
40
+ fetchGameReplayInfo: async (context, event) => {
41
+ return await request.send(game.getGameReplayInfo({ providerId, seqNo, lang }))
42
+ },
43
+ },
44
+ }
45
+ )
46
+ }
@@ -9,6 +9,8 @@ import game_search_cash from './game_search_cash.js'
9
9
  import game_search_v2 from './game_search_v2.js'
10
10
  import game_hot_new from './game_hot_new.js'
11
11
  import game_info from './game_info.js'
12
+ import game_replay from './game_replay.js'
13
+ import game_free from './game_free.js'
12
14
  import inbox from './inbox.js'
13
15
  import merge from './merge.js'
14
16
  import payment_data from './payment_data.js'
@@ -49,6 +51,8 @@ export default {
49
51
  game_search_v2,
50
52
  game_hot_new,
51
53
  game_info,
54
+ game_replay,
55
+ game_free,
52
56
  inbox,
53
57
  merge,
54
58
  payment_data,