@jetthai/cuora 1.1.361-dev-1 → 1.1.361-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,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.361-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.361-dev-2...v1.1.361-dev-3) (2025-06-16)
6
+
7
+ ### [1.1.361-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.361-dev-1...v1.1.361-dev-2) (2025-06-11)
8
+
5
9
  ### [1.1.361-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.361...v1.1.361-dev-1) (2025-06-09)
6
10
 
7
11
  ### [1.1.361](https://github.com/jetthai/cuora-module/compare/v1.1.360...v1.1.361) (2025-06-03)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.361-dev-1",
3
+ "version": "1.1.361-dev-3",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -69,10 +69,10 @@ export default {
69
69
  method: 'get',
70
70
  params: { rewardType },
71
71
  }),
72
- getRewardList: ({ rewardType, count, appSecret, orderColumn }) => ({
72
+ getRewardList: ({ rewardType, count, appSecret, orderColum, lang }) => ({
73
73
  url: 'activities/rewards',
74
74
  method: 'get',
75
- params: { rewardType, count, appSecret, orderColumn },
75
+ params: { rewardType, count, appSecret, orderColum, lang },
76
76
  }),
77
77
  getCashRainReward: ({ activityNo, appSecret }) => ({
78
78
  url: `activities/cashRain`,
package/src/api/game.js CHANGED
@@ -99,4 +99,16 @@ export default {
99
99
  getFreeGameList: () => ({ method: 'get', url: 'activities/getFreeGameRewardList' }),
100
100
  getFreeGameReward: ({ activityNo, receiveNo }) => ({ method: 'post', url: 'activities/getFreeGameReward', params: { activityNo, receiveNo } }),
101
101
  getV3GameInfo: ({ appSecret, gameCodes }) => ({ method: 'post', url: 'game/list/v3/gameInfo', params: { appSecret, gameCodes } }),
102
+ getProvableResult: ({ providerId, seqNo, lang, uidSite, appSecret }) => ({
103
+ method: 'get',
104
+ url: 'game/provable-result',
105
+ params: { providerId, seqNo, lang, uidSite, appSecret },
106
+ isPublic: true,
107
+ }),
108
+ getBetslip: ({ providerId, seqNo, lang, appSecret }) => ({
109
+ method: 'get',
110
+ url: 'game/betslip',
111
+ params: { providerId, seqNo, lang, appSecret },
112
+ isPublic: true,
113
+ }),
102
114
  }
@@ -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_betslip',
10
+ initial: 'fetching',
11
+ context: {
12
+ gameBetSlip: {},
13
+ },
14
+ states: {
15
+ fetching: {
16
+ invoke: {
17
+ src: 'fetchBetslip',
18
+ onDone: {
19
+ target: 'idle',
20
+ actions: 'setBetslip',
21
+ },
22
+ onError: {
23
+ target: 'idle',
24
+ },
25
+ },
26
+ },
27
+ idle: {},
28
+ },
29
+ },
30
+ {
31
+ actions: {
32
+ setBetslip: assign((context, event) => {
33
+ return {
34
+ gameBetSlip: event.data,
35
+ }
36
+ }),
37
+ },
38
+ services: {
39
+ // 取得遊戲注單
40
+ fetchBetslip: async (context, event) => {
41
+ return await request.send(game.getBetslip({ providerId, seqNo, lang, appSecret }))
42
+ },
43
+ },
44
+ }
45
+ )
46
+ }
@@ -10,6 +10,7 @@ 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
12
  import game_replay from './game_replay.js'
13
+ import game_betslip from './game_betslip.js'
13
14
  import inbox from './inbox.js'
14
15
  import merge from './merge.js'
15
16
  import payment_data from './payment_data.js'
@@ -53,6 +54,7 @@ export default {
53
54
  game_hot_new,
54
55
  game_info,
55
56
  game_replay,
57
+ game_betslip,
56
58
  inbox,
57
59
  merge,
58
60
  payment_data,
@@ -2,7 +2,7 @@ import { createMachine, assign, send } from 'xstate'
2
2
  import activity from '../api/activity.js'
3
3
  import payment from '../api/payment.js'
4
4
 
5
- export default function (request) {
5
+ export default function (request, context) {
6
6
  const { appSecret } = request.config
7
7
  return createMachine(
8
8
  {
@@ -18,6 +18,7 @@ export default function (request) {
18
18
  withdrawRule: {},
19
19
  callback: () => {},
20
20
  orderColumn: 'createTime',
21
+ lang: context.locale || 'en-US',
21
22
  },
22
23
  states: {
23
24
  timer: {
@@ -78,6 +79,9 @@ export default function (request) {
78
79
  target: 'allPointsReceiving',
79
80
  actions: 'setCallback',
80
81
  },
82
+ SET_LANG: {
83
+ actions: 'setLang',
84
+ },
81
85
  },
82
86
  },
83
87
  fetching: {
@@ -201,16 +205,22 @@ export default function (request) {
201
205
  withdrawRule: event.data,
202
206
  }
203
207
  }),
208
+ setLang: assign((context, event) => {
209
+ const lang = event.data.locale || context.lang || 'en-US'
210
+ return { lang }
211
+ }),
204
212
  },
205
213
  services: {
206
214
  fetchRewardList: async (context, event) => {
207
- const getRewardAPI = request.send(activity.getRewardList({ count: 30, appSecret }))
215
+ const lang = context.lang
216
+ const getRewardAPI = request.send(activity.getRewardList({ count: 30, appSecret, lang }))
208
217
  const orderColumn = context.orderColumn
209
218
  const getPointsRewardAPI = request.send(
210
219
  activity.getRewardList({
211
220
  rewardType: 'POINTS',
212
221
  count: 30,
213
222
  appSecret,
223
+ lang,
214
224
  })
215
225
  )
216
226
  const getOtherRewardAPI = request.send(
@@ -219,6 +229,7 @@ export default function (request) {
219
229
  count: 30,
220
230
  appSecret,
221
231
  orderColumn,
232
+ lang,
222
233
  })
223
234
  )
224
235
  const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI])
@@ -233,6 +244,7 @@ export default function (request) {
233
244
  count: 30,
234
245
  appSecret,
235
246
  orderColumn,
247
+ lang,
236
248
  })
237
249
  )
238
250
  const [otherRewardList] = await Promise.all([getOtherRewardAPI])