@jetthai/cuora 1.1.353-dev-15 → 1.1.353-dev-18

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,14 @@
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.353-dev-18](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-17...v1.1.353-dev-18) (2025-04-24)
6
+
7
+ ### [1.1.353](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-17...v1.1.353) (2025-04-24)
8
+
9
+ ### [1.1.353-dev-17](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-16...v1.1.353-dev-17) (2025-04-24)
10
+
11
+ ### [1.1.353-dev-16](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-15...v1.1.353-dev-16) (2025-04-23)
12
+
5
13
  ### [1.1.353-dev-15](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-14...v1.1.353-dev-15) (2025-04-23)
6
14
 
7
15
  ### [1.1.353-dev-14](https://github.com/jetthai/cuora-module/compare/v1.1.355...v1.1.353-dev-14) (2025-04-23)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.353-dev-15",
3
+ "version": "1.1.353-dev-18",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/game.js CHANGED
@@ -4,6 +4,7 @@ export default {
4
4
  removeFavoriteGame: (code) => ({ method: 'post', url: 'game/myfavorite/remove', params: { games: [code] } }),
5
5
  getStatements: () => ({ url: 'game/statements', method: 'get' }),
6
6
  playGame: (params) => ({ url: 'game/play', method: 'get', params }),
7
+ demoGame: (params) => ({ url: 'game/demo', method: 'get', params, isPublic: true }),
7
8
  logoutGame: ({ uid_site, provider_id }) => ({ url: 'game/logout', method: 'get', params: { uid_site, provider_id } }),
8
9
 
9
10
  getGameTags: ({ q, lang }) => ({ url: 'game/search', method: 'get', params: { q, lang } }),
@@ -42,6 +42,7 @@ export default function (request) {
42
42
  },
43
43
  walletType: null,
44
44
  lang: 'en_US',
45
+ site: '',
45
46
  isMobile: new UAParser().getResult().device.type,
46
47
  gameURL: null,
47
48
  gameToken: null,
@@ -83,6 +84,10 @@ export default function (request) {
83
84
  target: 'connecting',
84
85
  actions: ['setGameInfo', 'setLang', 'setwalletType'],
85
86
  },
87
+ DEMO_GAME: {
88
+ target: 'demoGame',
89
+ actions: ['setGameInfo', 'setLang', 'setSite'],
90
+ },
86
91
  MENU_ENTER_GAME: {
87
92
  target: 'connecting',
88
93
  actions: ['setGameInfo', 'setLang'],
@@ -172,6 +177,24 @@ export default function (request) {
172
177
  },
173
178
  },
174
179
  },
180
+ demoGame: {
181
+ invoke: {
182
+ src: 'demoGame',
183
+ onDone: {
184
+ target: 'playingDemo',
185
+ actions: 'setGameURL',
186
+ },
187
+ onError: {
188
+ target: 'idle',
189
+ actions: 'setGameURL',
190
+ },
191
+ },
192
+ on: {
193
+ EXIT_GAME: {
194
+ target: 'disconnect',
195
+ },
196
+ },
197
+ },
175
198
  connectSwitching: {
176
199
  invoke: {
177
200
  src: 'disconnectGame',
@@ -207,6 +230,17 @@ export default function (request) {
207
230
  },
208
231
  },
209
232
  },
233
+ playingDemo: {
234
+ on: {
235
+ EXIT_DEMO_GAME: {
236
+ target: 'idle',
237
+ },
238
+ ENTER_GAME: {
239
+ target: 'connecting',
240
+ actions: ['setGameInfo', 'setLang', 'setWalletMode'],
241
+ },
242
+ },
243
+ },
210
244
  refreshing: {
211
245
  invoke: {
212
246
  src: 'disconnectGame',
@@ -424,6 +458,10 @@ export default function (request) {
424
458
  const lang = event.data.locale.replace('-', '_')
425
459
  return { lang }
426
460
  }),
461
+ setSite: assign((context, event) => {
462
+ const site = event.data.site
463
+ return { site }
464
+ }),
427
465
  setPageLoadingDone: assign((context, event) => {
428
466
  return {
429
467
  pageLoading: true,
@@ -572,6 +610,21 @@ export default function (request) {
572
610
  const { type, redirect_url, gameToken, gameHtml, wallet_type } = await request.send(api.playGame(params))
573
611
  return { type, gameToken, gameHtml, gameURL: redirect_url, gameWalletType: wallet_type }
574
612
  },
613
+ demoGame: async (context, event) => {
614
+ const { lang, site, isMobile } = context
615
+ const { providerId, gameId, gameTypeId, mappingId } = context.game
616
+ const params = {
617
+ site,
618
+ provider_id: providerId,
619
+ game_id: gameId,
620
+ gametype_id: gameTypeId,
621
+ mapping_id: mappingId,
622
+ is_mobile: isMobile === 'mobile' ? 'y' : null,
623
+ lang,
624
+ }
625
+ const { type, redirect_url, gameToken, gameHtml } = await request.send(api.demoGame(params))
626
+ return { type, gameToken, gameHtml, gameURL: redirect_url }
627
+ },
575
628
  disconnectGame: async (context, event) => {
576
629
  const uid_site = event.data
577
630
  const provider_id = context.game.providerId
@@ -2,54 +2,6 @@ import pickBy from 'lodash/pickBy.js'
2
2
  import storage from '../util/storage.js'
3
3
 
4
4
  // const pickBy = require('lodash/pickBy')
5
- const supportVersion2List = [
6
- 'game/play',
7
- 'game/gameReplay',
8
- 'game/logout',
9
- 'game/list/v3/root',
10
- 'game/list/v3/category',
11
- 'game/list/v3/addition',
12
- 'game/list/v3/categoryByRange',
13
- 'game/list/v3/additionByRange',
14
- 'game/list/v3/myFavorite',
15
- 'game/list/v3/addMyFavorite',
16
- 'game/list/v3/removeMyFavorite',
17
- 'login',
18
- 'callback/:strategy',
19
- 'guestLogin',
20
- 'appLogin',
21
- 'logout',
22
- 'self',
23
- 'register',
24
- 'settings/password',
25
- 'verify',
26
- 'reset',
27
- 'acknowledge',
28
- 'friends',
29
- 'friends/home',
30
- 'friends/reward-list',
31
- 'recovery',
32
- 'recovery/abandon',
33
- 'recovery/acknowledge',
34
- 'checkDt',
35
- 'updateDt',
36
- 'checkAC',
37
- 'checkAccount',
38
- 'getAllAvatar',
39
- 'updateUserAvatar',
40
- // 'getConfig',
41
- // 'getQuickLayout',
42
- // 'getNavbarSetting',
43
- // 'getAffiliateCode',
44
- // 'get-site-config',
45
- 'friends/dashboard',
46
- 'friends/dashboard/list',
47
- 'mailbox/sendMessage',
48
- 'mailbox/getMessageList',
49
- 'mailbox/getMessage',
50
- 'mailbox/updateMessage',
51
- 'mailbox/getMessageTypes',
52
- ]
53
5
 
54
6
  function isValid(value) {
55
7
  return value !== undefined && value !== null
@@ -72,8 +24,7 @@ export default class Request {
72
24
  axiosConfig.headers['X-TH1GAMES-VERSION'] = this.config.version
73
25
  axiosConfig.headers['X-TH1GAMES-PLATFORM'] = this.config.platform
74
26
  if (this.getToken()) {
75
- // 為了支援V2版本的API接口新增Bearer來進行身份驗證
76
- axiosConfig.headers.Authorization = `Bearer ${this.getToken()}`
27
+ axiosConfig.headers.Authorization = this.getToken()
77
28
  }
78
29
  return axiosConfig
79
30
  })
@@ -134,14 +85,9 @@ export default class Request {
134
85
 
135
86
  _createConfig(req, cancelToken) {
136
87
  const { method, url, params, isPublic, isFormData, headers } = req
137
- let fullURL = this.config.fullURL
138
- if (supportVersion2List.includes(url)) {
139
- console.log('*[DEV_ONLY]supportVersion2List:', url)
140
- fullURL = fullURL.replace('/v1/', '/v2/')
141
- }
142
88
  if (isFormData) {
143
89
  return {
144
- baseURL: fullURL,
90
+ baseURL: this.config.fullURL,
145
91
  method,
146
92
  url,
147
93
  cancelToken,
@@ -151,7 +97,7 @@ export default class Request {
151
97
  }
152
98
  } else {
153
99
  return {
154
- baseURL: fullURL,
100
+ baseURL: this.config.fullURL,
155
101
  method,
156
102
  url,
157
103
  cancelToken,