@jetthai/cuora 1.1.160 → 1.1.161-barbet

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.161-barbet](https://github.com/jetthai/cuora-module/compare/v1.1.161...v1.1.161-barbet) (2023-08-11)
6
+
7
+ ### [1.1.159-barbet](https://github.com/jetthai/cuora-module/compare/v1.1.159...v1.1.159-barbet) (2023-08-09)
8
+
9
+ ### [1.1.157-barbet](https://github.com/jetthai/cuora-module/compare/v1.1.157...v1.1.157-barbet) (2023-08-09)
10
+
11
+ ### [1.1.161](https://github.com/jetthai/cuora-module/compare/v1.1.160...v1.1.161) (2023-08-11)
12
+
5
13
  ### [1.1.160](https://github.com/jetthai/cuora-module/compare/v1.1.159...v1.1.160) (2023-08-10)
6
14
 
7
15
  ### [1.1.159](https://github.com/jetthai/cuora-module/compare/v1.1.158...v1.1.159) (2023-08-09)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.160",
3
+ "version": "1.1.161-barbet",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -6,6 +6,12 @@ export default {
6
6
  params: { appSecret, include },
7
7
  isPublic: true,
8
8
  }),
9
+ getTournamentDetail: ({ activityNo, appSecret }) => ({
10
+ url: 'tournament/detail',
11
+ method: 'get',
12
+ params: { activityNo, appSecret },
13
+ isPublic: true,
14
+ }),
9
15
  getActivityDetail: ({ activityNo, appSecret }) => ({
10
16
  url: 'activities',
11
17
  method: 'get',
@@ -63,5 +69,5 @@ export default {
63
69
  exchangeAward,
64
70
  },
65
71
  }),
66
- getHonorBoard: (appSecret) => ({ url: 'activities/honorBoard', method: 'get', params: { appSecret } }),
72
+ getHonorBoard: (appSecret) => ({ url: 'activities/honorBoard', method: 'get', params: { appSecret }, isPublic: true }),
67
73
  }
package/src/api/game.js CHANGED
@@ -45,10 +45,10 @@ export default {
45
45
  isRecentlySearch,
46
46
  },
47
47
  }),
48
- gameHistory: ({ requestTimestamp, lang, provider, type }) => ({
48
+ gameHistory: ({ requestTimestamp, lang, provider, type, seqStatus }) => ({
49
49
  url: 'game/history',
50
50
  method: 'post',
51
- params: { requestTimestamp, lang, provider, type },
51
+ params: { requestTimestamp, lang, provider, type, seqStatus },
52
52
  }),
53
53
  gameHistoryDetail: ({ requestTimestamp, provider, gameId, lang, page, row }) => ({
54
54
  url: 'game/history/detail',
@@ -18,7 +18,7 @@ export default function (request) {
18
18
  invoke: {
19
19
  src: 'fetchActivityList',
20
20
  onDone: {
21
- target: 'checking',
21
+ target: 'idle',
22
22
  actions: 'setRankActivities',
23
23
  },
24
24
  onError: {
@@ -42,7 +42,7 @@ export default function (request) {
42
42
  },
43
43
  loading: {
44
44
  invoke: {
45
- src: 'fetchActivityDetail',
45
+ src: 'fetchPublicActivityDetail',
46
46
  onDone: {
47
47
  target: 'idle',
48
48
  actions: ['setActivityMap', 'setActivityDetail'],
@@ -62,7 +62,6 @@ export default function (request) {
62
62
  // 200: cl_activity
63
63
  return {
64
64
  rankActivities,
65
- activityNo: rankActivities?.[0]?.activityNo,
66
65
  }
67
66
  }),
68
67
  setActivityNo: assign((context, event) => {
@@ -72,8 +71,21 @@ export default function (request) {
72
71
  }),
73
72
  setActivityMap: assign((context, event) => {
74
73
  const { activityMap, activityNo } = context
75
- return {
76
- activityMap: { ...activityMap, [activityNo]: event.data },
74
+ if (event.data.rankingList) {
75
+ return {
76
+ activityMap: {
77
+ ...activityMap,
78
+ [activityNo]: {
79
+ topRanking: event.data.rankingList,
80
+ awards: event.data.awards,
81
+ },
82
+ },
83
+ }
84
+ } else {
85
+ return {
86
+ activityMap: { ...activityMap, [activityNo]: event.data },
87
+ awards: event.data?.awards,
88
+ }
77
89
  }
78
90
  }),
79
91
  setActivityDetail: assign((context, event) => {
@@ -102,10 +114,16 @@ export default function (request) {
102
114
  const { data } = await request.send(api.getActivityList({ appSecret }))
103
115
  return data
104
116
  },
105
- fetchActivityDetail: async (context, event) => {
117
+ fetchPublicActivityDetail: async (context, event) => {
118
+ const hasToken = request.getToken()
106
119
  const { activityNo } = context
107
- const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
108
- return data
120
+ let result = {}
121
+ if (hasToken) {
122
+ result = await request.send(api.getActivityDetail({ activityNo, appSecret }))
123
+ } else {
124
+ result = await request.send(api.getTournamentDetail({ activityNo, appSecret }))
125
+ }
126
+ return result.data
109
127
  },
110
128
  },
111
129
  }