@jetthai/cuora 1.1.369 → 1.1.371

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.371](https://github.com/jetthai/cuora-module/compare/v1.1.370...v1.1.371) (2025-08-11)
6
+
7
+ ### [1.1.370](https://github.com/jetthai/cuora-module/compare/v1.1.369...v1.1.370) (2025-08-07)
8
+
5
9
  ### [1.1.369](https://github.com/jetthai/cuora-module/compare/v1.1.368...v1.1.369) (2025-08-06)
6
10
 
7
11
  ### [1.1.368](https://github.com/jetthai/cuora-module/compare/v1.1.367...v1.1.368) (2025-07-28)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.369",
3
+ "version": "1.1.371",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -292,7 +292,6 @@ export default function (request) {
292
292
  }
293
293
  }),
294
294
  resetPage: assign((context, event) => {
295
- console.log('updateMessage resetPage')
296
295
  const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
297
296
  inbox[currentTab].page = -1
298
297
  return {
@@ -437,14 +436,18 @@ export default function (request) {
437
436
  return inbox
438
437
  },
439
438
  reFetchMessages: async (context, event) => {
440
- const { currentTab, inbox } = JSON.parse(JSON.stringify(context))
441
-
442
- if (currentTab === 'FREE_GAME') return inbox
439
+ const lang = context.lang
440
+ const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context))
443
441
 
444
- const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: 0 }))
445
- let formattedData = []
446
- formattedData = data?.map((item) => ({ ...item, isSelected: false }))
447
- inbox[currentTab] = { data: formattedData, ...rest }
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
+ }
448
451
  return inbox
449
452
  },
450
453
  updateMessageIsRead: async (context, event) => {
@@ -1,6 +1,12 @@
1
1
  export default {
2
2
  get(name, options) {
3
- const itemStr = localStorage.getItem(name)
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
+ }
4
10
 
5
11
  if (!itemStr) {
6
12
  return null
@@ -12,7 +18,7 @@ export default {
12
18
  return null
13
19
  }
14
20
 
15
- return item.value
21
+ return 'value' in item ? item.value : item
16
22
  },
17
23
  set(name, value, options) {
18
24
  const item = { value }
@@ -20,9 +26,17 @@ export default {
20
26
  if (options?.maxAge) {
21
27
  item.expiry = new Date().getTime() + options.maxAge * 1000
22
28
  }
23
- localStorage.setItem(name, JSON.stringify(item))
29
+ try {
30
+ localStorage.setItem(name, JSON.stringify(item))
31
+ } catch (error) {
32
+ console.error(`Error setting item in localStorage: ${error}`)
33
+ }
24
34
  },
25
35
  remove(name, options) {
26
- localStorage.removeItem(name)
36
+ try {
37
+ localStorage.removeItem(name)
38
+ } catch (error) {
39
+ console.error(`Error removing item from localStorage: ${error}`)
40
+ }
27
41
  },
28
42
  }