@jetthai/cuora 1.1.368-dev-8 → 1.1.368-qa-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,29 +2,7 @@
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)
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)
5
+ ### [1.1.368-qa-1](https://github.com/jetthai/cuora-module/compare/v1.1.368...v1.1.368-qa-1) (2025-08-04)
28
6
 
29
7
  ### [1.1.368](https://github.com/jetthai/cuora-module/compare/v1.1.367...v1.1.368) (2025-07-28)
30
8
 
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-1",
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
@@ -233,7 +233,7 @@ export default function (request) {
233
233
  return await request.send(
234
234
  payment.getDepositExpectedResult({
235
235
  method: currentCrypto.method,
236
- amount: Number(currentAmount),
236
+ amount: currentAmount,
237
237
  cryptoCurrency: currentCrypto.channel,
238
238
  })
239
239
  )
@@ -280,7 +280,7 @@ export default function (request) {
280
280
  return await request.send(
281
281
  payment.getDepositExpectedResult({
282
282
  method: currentMethod,
283
- amount: Number(amount),
283
+ amount,
284
284
  promotionsNo: promotion?.activityNo,
285
285
  })
286
286
  )
@@ -195,7 +195,7 @@ export default function (request, context) {
195
195
  return await request.send(
196
196
  payment.getDepositExpectedResult({
197
197
  method: selectedDirect.method,
198
- amount: Number(selectedAmount),
198
+ amount: selectedAmount,
199
199
  promotionsNo: promotion?.promotionsNo,
200
200
  })
201
201
  )
@@ -355,7 +355,7 @@ export default function (request) {
355
355
  return await request.send(
356
356
  payment.getDepositExpectedResult({
357
357
  method,
358
- amount: Number(amount),
358
+ amount,
359
359
  promotionsNo: promotion?.activityNo,
360
360
  })
361
361
  )
@@ -183,7 +183,7 @@ export default function (request, context) {
183
183
  return await request.send(
184
184
  payment.getDepositExpectedResult({
185
185
  method: selectedLoadcard.method,
186
- amount: Number(selectedAmount),
186
+ amount: selectedAmount,
187
187
  promotionsNo: promotion?.promotionsNo,
188
188
  })
189
189
  )
@@ -319,7 +319,7 @@ export default function (request) {
319
319
  return await request.send(
320
320
  payment.getDepositExpectedResult({
321
321
  method: currentMethod,
322
- amount: Number(selectedAmount),
322
+ amount: selectedAmount,
323
323
  promotionsNo: promotion?.activityNo,
324
324
  })
325
325
  )
@@ -308,7 +308,7 @@ export default function (request, context) {
308
308
  return await request.send(
309
309
  payment.getDepositExpectedResult({
310
310
  method,
311
- amount: Number(selectedAmount),
311
+ amount: selectedAmount,
312
312
  promotionsNo: promotion?.promotionsNo,
313
313
  })
314
314
  )
@@ -402,7 +402,7 @@ export default function (request) {
402
402
  return await request.send(
403
403
  payment.getDepositExpectedResult({
404
404
  method,
405
- amount: Number(amount),
405
+ amount,
406
406
  promotionsNo: promotion?.activityNo,
407
407
  })
408
408
  )
@@ -196,7 +196,7 @@ export default function (request, context) {
196
196
  return await request.send(
197
197
  payment.getDepositExpectedResult({
198
198
  method: selectedQrcode.method,
199
- amount: Number(selectedAmount),
199
+ amount: selectedAmount,
200
200
  promotionsNo: promotion?.promotionsNo,
201
201
  })
202
202
  )
@@ -309,7 +309,7 @@ export default function (request) {
309
309
  return await request.send(
310
310
  payment.getDepositExpectedResult({
311
311
  method: currentMethod,
312
- amount: Number(selectedAmount),
312
+ amount: selectedAmount,
313
313
  promotionsNo: promotion?.activityNo,
314
314
  })
315
315
  )
@@ -179,7 +179,7 @@ export default function (request, context) {
179
179
  return await request.send(
180
180
  payment.getDepositExpectedResult({
181
181
  method,
182
- amount: Number(selectedAmount),
182
+ amount: selectedAmount,
183
183
  promotionsNo: promotion?.promotionsNo,
184
184
  })
185
185
  )
@@ -239,7 +239,7 @@ export default function (request) {
239
239
  return await request.send(
240
240
  payment.getDepositExpectedResult({
241
241
  method,
242
- amount: Number(amount),
242
+ amount,
243
243
  promotionsNo: promotion?.activityNo,
244
244
  })
245
245
  )
@@ -348,7 +348,7 @@ export default function (request) {
348
348
  return await request.send(
349
349
  payment.getDepositExpectedResult({
350
350
  method,
351
- amount: Number(amount),
351
+ amount,
352
352
  promotionsNo: promotion?.activityNo,
353
353
  })
354
354
  )
@@ -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
- }