@jetthai/cuora 1.1.368-dev-8 → 1.1.368-qa-2

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,29 +2,9 @@
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.368-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.368-dev-7...v1.1.368-dev-8) (2025-08-13)
5
+ ### [1.1.368-qa-2](https://github.com/jetthai/cuora-module/compare/v1.1.368-qa-1...v1.1.368-qa-2) (2025-08-06)
6
6
 
7
- ### [1.1.368-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.368-dev-6...v1.1.368-dev-7) (2025-08-13)
8
-
9
- ### [1.1.368-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.368-dev-5...v1.1.368-dev-6) (2025-08-13)
10
-
11
- ### [1.1.368-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.371...v1.1.368-dev-5) (2025-08-12)
12
-
13
- ### [1.1.368-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.369...v1.1.368-dev-4) (2025-08-06)
14
-
15
- ### [1.1.368-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.368-dev-2...v1.1.368-dev-3) (2025-08-04)
16
-
17
- ### [1.1.368-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.368-dev-1...v1.1.368-dev-2) (2025-08-04)
18
-
19
- ### [1.1.368-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.368...v1.1.368-dev-1) (2025-08-01)
20
-
21
- ### [1.1.368-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.368-dev-3...v1.1.368-dev-4) (2025-08-06)
22
-
23
- ### [1.1.368-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.368-dev-2...v1.1.368-dev-3) (2025-08-04)
24
-
25
- ### [1.1.368-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.368-dev-1...v1.1.368-dev-2) (2025-08-04)
26
-
27
- ### [1.1.368-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.368...v1.1.368-dev-1) (2025-08-01)
7
+ ### [1.1.368-qa-1](https://github.com/jetthai/cuora-module/compare/v1.1.368...v1.1.368-qa-1) (2025-08-04)
28
8
 
29
9
  ### [1.1.368](https://github.com/jetthai/cuora-module/compare/v1.1.367...v1.1.368) (2025-07-28)
30
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.368-dev-8",
3
+ "version": "1.1.368-qa-2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -19,9 +19,9 @@ export default {
19
19
  method: 'post',
20
20
  params: { activityNo, cycle, round },
21
21
  }),
22
- getRankingGames: ({ activityNo, appSecret }) => ({
22
+ getRankingGames: ({ activityNo }) => ({
23
23
  url: 'hot-game/ranking',
24
24
  method: 'get',
25
- params: { activityNo, appSecret },
25
+ params: { activityNo },
26
26
  }),
27
27
  }
@@ -3,7 +3,6 @@ import { assign, createMachine } from 'xstate'
3
3
  import pickBy from 'lodash/pickBy.js'
4
4
  import api from '../api/common.js'
5
5
  import storage from '../util/storage.js'
6
- import sessionStorage from '../util/sessionStorage.js'
7
6
 
8
7
  export default function (request) {
9
8
  const { appSecret, defaultChannel, defaultSubchannel } = request.config
@@ -259,7 +258,7 @@ export default function (request) {
259
258
  const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official'
260
259
  const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa'
261
260
  const affiliateCode = urlParams.get('ac') || urlParams.get('referralCode') || storage.get('ac') || storage.get('referralCode')
262
- const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || sessionStorage.get('fc') || sessionStorage.get('affiliate')
261
+ const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || storage.get('fc') || storage.get('affiliate')
263
262
 
264
263
  storage.set('channel', channel, {
265
264
  path: '/',
@@ -273,7 +272,7 @@ export default function (request) {
273
272
  path: '/',
274
273
  maxAge: 60 * 60 * 24 * 7,
275
274
  })
276
- sessionStorage.set('fc', friendCode, {
275
+ storage.set('fc', friendCode, {
277
276
  path: '/',
278
277
  maxAge: 60 * 60 * 24 * 7,
279
278
  })
@@ -294,13 +293,14 @@ export default function (request) {
294
293
  return { announcementList: { data } }
295
294
  }),
296
295
  setFeeds: assign((context, event) => {
297
- const { broadcastList, mailBoxInfo } = event.data
296
+ const { announcementList, broadcastList, mailBoxInfo } = event.data
298
297
  const { siteConfig } = context
298
+ const promotions = announcementList?.announcements?.filter?.((item) => item.category === 3) || []
299
299
  const customerMessageEnable = siteConfig?.csChat?.some((item) => item.enable && item.name === 'customermessage')
300
300
  if (!customerMessageEnable) {
301
301
  mailBoxInfo.rows -= mailBoxInfo.detailRows?.CUSTOMER || 0
302
302
  }
303
- return { broadcastList, mailBoxInfo }
303
+ return { broadcastList, mailBoxInfo, promotions }
304
304
  }),
305
305
  setBroadcast: assign((context, event) => {
306
306
  const { broadcastList, sentNormalBroadcastList, normalBroadcast } = context
@@ -613,9 +613,7 @@ export default function (request) {
613
613
  is_mobile: isMobile === 'mobile' ? 'y' : null,
614
614
  lang,
615
615
  selected_wallet_type: walletType,
616
- return_url: returnProviders.includes(providerId)
617
- ? `${window.location.origin}${context.base}return`
618
- : window.location.href?.split('?')?.[0], // For providers to return.
616
+ return_url: returnProviders.includes(providerId) ? `${window.location.origin}${context.base}return` : window.location.href, // For providers to return.
619
617
  }
620
618
  const { type, redirect_url, gameToken, gameHtml, wallet_type } = await request.send(api.playGame(params))
621
619
  return { type, gameToken, gameHtml, gameURL: redirect_url, gameWalletType: wallet_type }
@@ -292,6 +292,7 @@ export default function (request) {
292
292
  }
293
293
  }),
294
294
  resetPage: assign((context, event) => {
295
+ console.log('updateMessage resetPage')
295
296
  const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
296
297
  inbox[currentTab].page = -1
297
298
  return {
@@ -423,7 +424,7 @@ export default function (request) {
423
424
  fetchMessages: async (context, event) => {
424
425
  const lang = context.lang
425
426
  const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context))
426
- if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND' || currentTab === 'FREE_GAME')) {
427
+ if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND')) {
427
428
  const { data } = await request.send(activity.getRewardList({ count: 30, appSecret, lang }))
428
429
  inbox[currentTab] = { data, page: 0, totalPage: 1 }
429
430
  } else {
@@ -436,18 +437,11 @@ export default function (request) {
436
437
  return inbox
437
438
  },
438
439
  reFetchMessages: async (context, event) => {
439
- const lang = context.lang
440
- const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context))
441
-
442
- if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND' || currentTab === 'FREE_GAME')) {
443
- const { data } = await request.send(activity.getRewardList({ count: 30, appSecret, lang }))
444
- inbox[currentTab] = { data, page: 0, totalPage: 1 }
445
- } else {
446
- const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: 0 }))
447
- let formattedData = []
448
- formattedData = data?.map((item) => ({ ...item, isSelected: false }))
449
- inbox[currentTab] = { data: formattedData, ...rest }
450
- }
440
+ const { currentTab, inbox } = JSON.parse(JSON.stringify(context))
441
+ const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: 0 }))
442
+ let formattedData = []
443
+ formattedData = data?.map((item) => ({ ...item, isSelected: false }))
444
+ inbox[currentTab] = { data: formattedData, ...rest }
451
445
  return inbox
452
446
  },
453
447
  updateMessageIsRead: async (context, event) => {
@@ -210,7 +210,7 @@ export default function (request) {
210
210
  },
211
211
  fetchRankingGames: async (context) => {
212
212
  const { activityNo } = context
213
- const { data } = await request.send(ranking.getRankingGames({ activityNo, appSecret }))
213
+ const { data } = await request.send(ranking.getRankingGames({ activityNo }))
214
214
  return data
215
215
  },
216
216
  },
@@ -149,7 +149,6 @@ export default class Request {
149
149
  this.key = `cuora_${config.clientId}`
150
150
  this.errorHandler = null
151
151
  this.hosts = []
152
- this.isBlocked = false
153
152
  this.initialize()
154
153
  }
155
154
 
@@ -196,25 +195,10 @@ export default class Request {
196
195
  try {
197
196
  const cancelToken = customToken || this.source.token
198
197
  this._checkToken(req)
199
-
200
198
  const requestConfig = this._createConfig(req, cancelToken)
201
- // console.log('*請求資料Check', requestConfig)
202
- const configUrls = ['getConfig', 'get-config']
203
- if (this.isBlocked && !configUrls.includes(requestConfig.url)) {
204
- // 狀態是維護中&請求非siteConfig,終止所有的請求,除了維護頁需要的資料(siteConfig)
205
- // console.log('%c*禁止的請求目標', requestConfig)
206
- } else {
207
- // console.log('%c*允許的請求目標', requestConfig)
208
- const { data } = await this.axios.request(requestConfig)
209
- return data
210
- }
199
+ const { data } = await this.axios.request(requestConfig)
200
+ return data
211
201
  } catch (error) {
212
- if (error.code === 'ERR_F108') {
213
- console.log('%c*維護中', 'color: #00ff33ff; font-weight: bold;')
214
- this.isBlocked = true
215
- this.errorHandler && this.errorHandler(error)
216
- throw error
217
- }
218
202
  if (error.code !== 'ERR_800') {
219
203
  if (error.code) {
220
204
  this.errorHandler && this.errorHandler(error)
@@ -1,12 +1,6 @@
1
1
  export default {
2
2
  get(name, options) {
3
- let itemStr = null
4
- try {
5
- itemStr = localStorage.getItem(name)
6
- } catch (error) {
7
- console.error(`Error getting item from localStorage: ${error}`)
8
- return null
9
- }
3
+ const itemStr = localStorage.getItem(name)
10
4
 
11
5
  if (!itemStr) {
12
6
  return null
@@ -18,7 +12,7 @@ export default {
18
12
  return null
19
13
  }
20
14
 
21
- return 'value' in item ? item.value : item
15
+ return item.value
22
16
  },
23
17
  set(name, value, options) {
24
18
  const item = { value }
@@ -26,17 +20,9 @@ export default {
26
20
  if (options?.maxAge) {
27
21
  item.expiry = new Date().getTime() + options.maxAge * 1000
28
22
  }
29
- try {
30
- localStorage.setItem(name, JSON.stringify(item))
31
- } catch (error) {
32
- console.error(`Error setting item in localStorage: ${error}`)
33
- }
23
+ localStorage.setItem(name, JSON.stringify(item))
34
24
  },
35
25
  remove(name, options) {
36
- try {
37
- localStorage.removeItem(name)
38
- } catch (error) {
39
- console.error(`Error removing item from localStorage: ${error}`)
40
- }
26
+ localStorage.removeItem(name)
41
27
  },
42
28
  }
@@ -1,28 +0,0 @@
1
- export default {
2
- get(name, options) {
3
- const itemStr = sessionStorage.getItem(name)
4
-
5
- if (!itemStr) {
6
- return null
7
- }
8
-
9
- const item = JSON.parse(itemStr)
10
- if (item.expiry && new Date().getTime() > item.expiry) {
11
- sessionStorage.removeItem(name)
12
- return null
13
- }
14
-
15
- return item.value
16
- },
17
- set(name, value, options) {
18
- const item = { value }
19
-
20
- if (options?.maxAge) {
21
- item.expiry = new Date().getTime() + options.maxAge * 1000
22
- }
23
- sessionStorage.setItem(name, JSON.stringify(item))
24
- },
25
- remove(name, options) {
26
- sessionStorage.removeItem(name)
27
- },
28
- }