@jetthai/cuora 1.1.289 → 1.1.290-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.
@@ -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,10 @@ 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
+ },
77
82
  },
78
83
  },
79
84
  batchFetching: {
@@ -131,6 +136,24 @@ export default function (request) {
131
136
  },
132
137
  },
133
138
  },
139
+ connectSwitching: {
140
+ invoke: {
141
+ src: 'disconnectGame',
142
+ onDone: {
143
+ target: 'connecting',
144
+ actions: ['setSwitchGameInfo', 'setGameURL'],
145
+ },
146
+ onError: {
147
+ target: 'idle',
148
+ actions: ['setSwitchGameInfo', 'setGameURL'],
149
+ },
150
+ },
151
+ on: {
152
+ EXIT_GAME: {
153
+ target: 'disconnect',
154
+ },
155
+ },
156
+ },
134
157
  playing: {
135
158
  on: {
136
159
  EXIT_GAME: {
@@ -139,6 +162,10 @@ export default function (request) {
139
162
  REFRESH: {
140
163
  target: 'refreshing',
141
164
  },
165
+ MENU_ENTER_GAME: {
166
+ target: 'connectSwitching',
167
+ actions: ['setSwitch', 'setLang'],
168
+ },
142
169
  },
143
170
  },
144
171
  refreshing: {
@@ -376,6 +403,13 @@ export default function (request) {
376
403
  const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = event.data.game
377
404
  return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
378
405
  }),
406
+ setSwitch: assign((context, event) => {
407
+ return { switchGame: event.data.game }
408
+ }),
409
+ setSwitchGameInfo: assign((context, event) => {
410
+ const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = context.switchGame
411
+ return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
412
+ }),
379
413
  setLang: assign((context, event) => {
380
414
  const lang = event.data.locale.replace('-', '_')
381
415
  return { lang }