@jetthai/cuora 1.1.341-rank-2 → 1.1.341-rank-4

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.341-rank-4](https://github.com/jetthai/cuora-module/compare/v1.1.341-rank-3...v1.1.341-rank-4) (2025-03-12)
6
+
7
+ ### [1.1.341-rank-3](https://github.com/jetthai/cuora-module/compare/v1.1.341-rank-2...v1.1.341-rank-3) (2025-03-10)
8
+
5
9
  ### [1.1.341-rank-2](https://github.com/jetthai/cuora-module/compare/v1.1.341-rank-1...v1.1.341-rank-2) (2025-03-06)
6
10
 
7
11
  ### [1.1.341-rank-1](https://github.com/jetthai/cuora-module/compare/v1.1.341...v1.1.341-rank-1) (2025-03-05)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.341-rank-2",
3
+ "version": "1.1.341-rank-4",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -12,6 +12,12 @@ export default function (request) {
12
12
  }, {})
13
13
  }
14
14
 
15
+ function transGameData(item) {
16
+ if (!item) return {}
17
+ item.providerId = item.provider
18
+ return item
19
+ }
20
+
15
21
  return createMachine(
16
22
  {
17
23
  id: 'dragon_tiger_ranking',
@@ -115,16 +121,18 @@ export default function (request) {
115
121
  }
116
122
  }),
117
123
  setRanking: assign((context, event) => {
124
+ const topRanking = event.data?.topRanking?.map((rank) => transGameData(rank))
118
125
  return {
119
126
  description: event.data?.description,
120
127
  descriptionUrl: event.data?.descriptionUrl,
121
- topRanking: event.data?.topRanking || [],
122
- playerRanking: event.data?.playerRanking || {},
128
+ topRanking: topRanking || [],
129
+ playerRanking: transGameData(event.data?.playerRanking) || {},
123
130
  }
124
131
  }),
125
132
  setRankingGames: assign((context, event) => {
133
+ const gameRanking = event.data?.map((rank) => transGameData(rank))
126
134
  return {
127
- gameRanking: event.data || [],
135
+ gameRanking: gameRanking || [],
128
136
  }
129
137
  }),
130
138
  setRankingOptions: assign((context, event) => {
@@ -132,14 +140,19 @@ export default function (request) {
132
140
  const currentRound = event.data?.currentRound || []
133
141
  // 取得結算週期選單列表
134
142
  const cycleOptions = cycleMapping.slice(0, currentRound.length)
135
- // 如果是月結算,則加入全部選項
136
- if (cycle === 'MONTHLY') cycleOptions.push('ALL')
137
143
  // 取得每週期的歷史期數選單列表
138
144
  const roundOptions = roundProcess(currentRound)
145
+ // 如果是月結算,則加入全部選項
146
+ if (cycle === 'MONTHLY') {
147
+ cycleOptions.push('ALL')
148
+ roundOptions.ALL = roundOptions.MONTHLY
149
+ }
139
150
  return {
140
- options: { cycle: cycleOptions, round: roundOptions },
141
- round: currentRound[currentRound.length - 1],
142
151
  ...event.data,
152
+ options: { cycle: cycleOptions, round: roundOptions },
153
+ // 初始固定顯示 DAILY
154
+ cycle: event.data?.rule !== 'NORMAL' ? 'DAILY' : cycle,
155
+ round: currentRound[0],
143
156
  }
144
157
  }),
145
158
  setOptions: assign((context, event) => {