@jetthai/cuora 1.1.288 → 1.1.289-dev-1

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.289-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.289...v1.1.289-dev-1) (2024-07-26)
6
+
7
+ ### [1.1.289](https://github.com/jetthai/cuora-module/compare/v1.1.288...v1.1.289) (2024-07-23)
8
+
5
9
  ### [1.1.288](https://github.com/jetthai/cuora-module/compare/v1.1.287...v1.1.288) (2024-07-15)
6
10
 
7
11
  ### [1.1.287](https://github.com/jetthai/cuora-module/compare/v1.1.286...v1.1.287) (2024-07-09)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.288",
3
+ "version": "1.1.289-dev-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -6,6 +6,12 @@ export default {
6
6
  params: { appSecret, include },
7
7
  isPublic: true,
8
8
  }),
9
+ getJackpotList: ({ appSecret }) => ({
10
+ url: 'activities/jackpot/list',
11
+ method: 'get',
12
+ params: { appSecret },
13
+ isPublic: true,
14
+ }),
9
15
  getTournamentDetail: ({ activityNo, appSecret }) => ({
10
16
  url: 'tournament/detail',
11
17
  method: 'get',
@@ -14,6 +14,7 @@ export default function (request) {
14
14
  activitiesDetailList: [],
15
15
  activityList: [],
16
16
  promotionList: [],
17
+ jackpotList: [],
17
18
  activityMap: {},
18
19
  tournamentList: [],
19
20
  refs: {},
@@ -34,7 +35,7 @@ export default function (request) {
34
35
  src: 'fetchList',
35
36
  onDone: {
36
37
  target: 'idle',
37
- actions: ['setActivityList', 'setTournamentList', 'setPromotionList'],
38
+ actions: ['setActivityList', 'setTournamentList', 'setPromotionList', 'setJackpotList'],
38
39
  },
39
40
  onError: {
40
41
  target: 'idle',
@@ -123,6 +124,12 @@ export default function (request) {
123
124
  promotionList,
124
125
  }
125
126
  }),
127
+ setJackpotList: assign((context, event) => {
128
+ const { jackpotList } = event.data
129
+ return {
130
+ jackpotList,
131
+ }
132
+ }),
126
133
  setActivitiesDetailList: assign((context, event) => {
127
134
  return {
128
135
  activitiesDetailList: event.data.map((item) => item.data),
@@ -162,12 +169,13 @@ export default function (request) {
162
169
  const hasToken = request.getToken()
163
170
  const isDoubleWallet = context.siteConfig?.walletMode === '4'
164
171
  const apiCallable = hasToken && isDoubleWallet
165
- const [{ data }, promotionList] = await Promise.all([
172
+ const [{ data }, promotionList, jackpotList] = await Promise.all([
166
173
  request.send(activity.getActivityList({ appSecret })),
167
174
  apiCallable ? request.send(payment.getPromotionsList()) : [],
175
+ request.send(activity.getJackpotList({ appSecret })),
168
176
  ])
169
177
 
170
- return { activityList: data, promotionList }
178
+ return { activityList: data, promotionList, jackpotList: jackpotList.data }
171
179
  },
172
180
  fetchActivitiesDetail: async (context, event) => {
173
181
  await new Promise((resolve) => setTimeout(resolve, 1000)) // delay 1 second
@@ -13,6 +13,7 @@ export default function (request) {
13
13
  activityList: [],
14
14
  tournamentList: [],
15
15
  promotionList: [],
16
+ jackpotList: [],
16
17
  uidSite: '',
17
18
  detailNeededActivityTypes: [29, 34],
18
19
  activityDetailList: [],
@@ -23,7 +24,7 @@ export default function (request) {
23
24
  src: 'fetchList',
24
25
  onDone: {
25
26
  target: 'checking',
26
- actions: ['setActivityList', 'setTournamentList', 'setPromotionList'],
27
+ actions: ['setActivityList', 'setTournamentList', 'setPromotionList', 'setJackpotList'],
27
28
  },
28
29
  onError: {
29
30
  target: 'pending',
@@ -96,6 +97,12 @@ export default function (request) {
96
97
  promotionList,
97
98
  }
98
99
  }),
100
+ setJackpotList: assign((context, event) => {
101
+ const { jackpotList } = event.data
102
+ return {
103
+ jackpotList,
104
+ }
105
+ }),
99
106
  setUnread: assign((context, event) => {
100
107
  const { uidSite, activityNo, unread } = event.data
101
108
  const list = JSON.parse(JSON.stringify(context.activityList))
@@ -132,12 +139,13 @@ export default function (request) {
132
139
  services: {
133
140
  fetchList: async (context, event) => {
134
141
  const hasToken = request.getToken()
135
- const [{ data }, promotionList] = await Promise.all([
142
+ const [{ data }, promotionList, jackpotList] = await Promise.all([
136
143
  request.send(activity.getActivityList({ appSecret })),
137
144
  hasToken ? request.send(payment.getPromotionsList()) : [],
145
+ request.send(activity.getJackpotList({ appSecret })),
138
146
  ])
139
147
 
140
- return { activityList: data, promotionList }
148
+ return { activityList: data, promotionList, jackpotList: jackpotList.data }
141
149
  },
142
150
  fetchActivityDetailList: async (context, event) => {
143
151
  await new Promise((resolve) => setTimeout(resolve, 1000)) // delay 1 second
@@ -44,6 +44,7 @@ export default function (request) {
44
44
  gameURL: null,
45
45
  gameToken: null,
46
46
  gameHtml: null,
47
+ switchGame: null,
47
48
  ...oldContext,
48
49
  },
49
50
  states: {
@@ -74,6 +75,13 @@ export default function (request) {
74
75
  target: 'connecting',
75
76
  actions: ['setGameInfo', 'setLang'],
76
77
  },
78
+ MENU_ENTER_GAME: {
79
+ target: 'connecting',
80
+ actions: ['setGameInfo', 'setLang'],
81
+ },
82
+ UPDATE: {
83
+ target: 'updating',
84
+ },
77
85
  },
78
86
  },
79
87
  batchFetching: {
@@ -113,6 +121,18 @@ export default function (request) {
113
121
  { target: 'idle' },
114
122
  ],
115
123
  },
124
+ updating: {
125
+ invoke: {
126
+ src: 'updatePageContent',
127
+ onDone: {
128
+ target: 'idle',
129
+ actions: 'swapContent',
130
+ },
131
+ onError: {
132
+ target: 'idle',
133
+ },
134
+ },
135
+ },
116
136
  connecting: {
117
137
  invoke: {
118
138
  src: 'connectGame',
@@ -131,6 +151,24 @@ export default function (request) {
131
151
  },
132
152
  },
133
153
  },
154
+ connectSwitching: {
155
+ invoke: {
156
+ src: 'disconnectGame',
157
+ onDone: {
158
+ target: 'connecting',
159
+ actions: ['setSwitchGameInfo', 'setGameURL'],
160
+ },
161
+ onError: {
162
+ target: 'idle',
163
+ actions: ['setSwitchGameInfo', 'setGameURL'],
164
+ },
165
+ },
166
+ on: {
167
+ EXIT_GAME: {
168
+ target: 'disconnect',
169
+ },
170
+ },
171
+ },
134
172
  playing: {
135
173
  on: {
136
174
  EXIT_GAME: {
@@ -139,6 +177,10 @@ export default function (request) {
139
177
  REFRESH: {
140
178
  target: 'refreshing',
141
179
  },
180
+ MENU_ENTER_GAME: {
181
+ target: 'connectSwitching',
182
+ actions: ['setSwitch', 'setLang'],
183
+ },
142
184
  },
143
185
  },
144
186
  refreshing: {
@@ -315,7 +357,7 @@ export default function (request) {
315
357
  if (room.categoryId === GAME_SEARCH) {
316
358
  return
317
359
  } else if (additionEnable) {
318
- const [content, addition] = event.data
360
+ const [content, addition = {}] = event.data
319
361
  return {
320
362
  content: {
321
363
  ...context.content,
@@ -376,6 +418,13 @@ export default function (request) {
376
418
  const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = event.data.game
377
419
  return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
378
420
  }),
421
+ setSwitch: assign((context, event) => {
422
+ return { switchGame: event.data.game }
423
+ }),
424
+ setSwitchGameInfo: assign((context, event) => {
425
+ const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = context.switchGame
426
+ return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
427
+ }),
379
428
  setLang: assign((context, event) => {
380
429
  const lang = event.data.locale.replace('-', '_')
381
430
  return { lang }
@@ -87,7 +87,7 @@ export default function (request) {
87
87
  const { menuItemStack } = context
88
88
  const inputItem = event.data
89
89
  const isTopItem = inputItem.level === 0
90
- const hasSubMenu = inputItem.sub.length
90
+ const hasSubMenu = inputItem.sub?.length
91
91
 
92
92
  if (isTopItem) {
93
93
  if (hasSubMenu) {
@@ -177,7 +177,7 @@ function isItemInMenu(targetItem, menuList) {
177
177
  }
178
178
 
179
179
  function getDefaultItem(node) {
180
- if (node.sub.length > 0) {
180
+ if (node.sub?.length > 0) {
181
181
  const stack = getDefaultItem(node.sub[0])
182
182
  return [node, ...stack]
183
183
  } else {