@jetthai/cuora 1.1.359 → 1.1.360

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,8 @@
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.360](https://github.com/jetthai/cuora-module/compare/v1.1.359...v1.1.360) (2025-06-03)
6
+
5
7
  ### [1.1.359](https://github.com/jetthai/cuora-module/compare/v1.1.358...v1.1.359) (2025-05-23)
6
8
 
7
9
  ### [1.1.358](https://github.com/jetthai/cuora-module/compare/v1.1.357...v1.1.358) (2025-05-09)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.359",
3
+ "version": "1.1.360",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -83,7 +83,7 @@ export default function (request) {
83
83
  },
84
84
  ENTER_GAME: {
85
85
  target: 'connecting',
86
- actions: ['setGameInfo', 'setLang', 'setwalletType'],
86
+ actions: ['setGameInfo', 'setLang', 'setWalletType'],
87
87
  },
88
88
  DEMO_GAME: {
89
89
  target: 'demoGame',
@@ -91,7 +91,7 @@ export default function (request) {
91
91
  },
92
92
  MENU_ENTER_GAME: {
93
93
  target: 'connecting',
94
- actions: ['setGameInfo', 'setLang', 'setwalletType'],
94
+ actions: ['setGameInfo', 'setLang', 'setWalletType'],
95
95
  },
96
96
  UPDATE: {
97
97
  target: 'updating',
@@ -241,7 +241,7 @@ export default function (request) {
241
241
  },
242
242
  ENTER_GAME: {
243
243
  target: 'connecting',
244
- actions: ['setGameInfo', 'setLang', 'setwalletType'],
244
+ actions: ['setGameInfo', 'setLang', 'setWalletType'],
245
245
  },
246
246
  },
247
247
  },
@@ -455,7 +455,7 @@ export default function (request) {
455
455
  const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = context.switchGame
456
456
  return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
457
457
  }),
458
- setwalletType: assign((context, event) => {
458
+ setWalletType: assign((context, event) => {
459
459
  return { walletType: event.data.walletType }
460
460
  }),
461
461
  setLang: assign((context, event) => {
@@ -3,11 +3,13 @@ import ranking from '../api/ranking.js'
3
3
 
4
4
  export default function (request) {
5
5
  const cycleMapping = ['DAILY', 'WEEKLY', 'MONTHLY']
6
+ const limit = { DAILY: 56, WEEKLY: 8, MONTHLY: 2, ALL: 2 }
6
7
 
7
- function roundProcess(rounds) {
8
+ function roundProcess(rounds, cycles) {
8
9
  const roundArrays = rounds.map((round) => Array.from({ length: round }, (_, i) => i + 1))
9
10
  return roundArrays.reduce((acc, roundArray, index) => {
10
- acc[cycleMapping[index]] = roundArray.reverse()
11
+ const max = limit[cycles[index]] || rounds[index] // 若沒限制則取全部
12
+ acc[cycles[index]] = roundArray.reverse().slice(0, max)
11
13
  return acc
12
14
  }, {})
13
15
  }
@@ -151,14 +153,14 @@ export default function (request) {
151
153
  }
152
154
  }),
153
155
  setRankingOptions: assign((context, event) => {
156
+ const isChampion = event.data?.rule === 'CHAMPION'
154
157
  const cycle = event.data?.cycle
155
158
  const currentRound = event.data?.currentRound || []
156
159
  // 取得結算週期選單列表
157
- const cycleOptions = cycleMapping.slice(0, currentRound.length)
158
- // 取得每週期的歷史期數選單列表
159
- const roundOptions = roundProcess(currentRound)
160
- // 如果是月結算,則加入全部選項
161
- if (cycle === 'MONTHLY') {
160
+ const cycleOptions = isChampion ? cycleMapping.slice(0, currentRound.length) : [cycle]
161
+ const roundOptions = roundProcess(currentRound, cycleOptions)
162
+ // 如果是冠軍龍虎月結算,則加入全部選項
163
+ if (cycle === 'MONTHLY' && isChampion) {
162
164
  cycleOptions.push('ALL')
163
165
  roundOptions.ALL = roundOptions.MONTHLY
164
166
  }
@@ -166,7 +168,7 @@ export default function (request) {
166
168
  ...event.data,
167
169
  options: { cycle: cycleOptions, round: roundOptions },
168
170
  // 初始固定顯示 DAILY
169
- cycle: event.data?.rule !== 'NORMAL' ? 'DAILY' : cycle,
171
+ cycle: isChampion ? 'DAILY' : cycle,
170
172
  round: currentRound[0],
171
173
  }
172
174
  }),