@jetthai/cuora 1.1.355-dev-5 → 1.1.355-dev-7

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.355-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.355-dev-6...v1.1.355-dev-7) (2025-05-02)
6
+
7
+ ### [1.1.355-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.355-dev-5...v1.1.355-dev-6) (2025-04-29)
8
+
5
9
  ### [1.1.355-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.355-dev-4...v1.1.355-dev-5) (2025-04-29)
6
10
 
7
11
  ### [1.1.356](https://github.com/jetthai/cuora-module/compare/v1.1.355-dev-2...v1.1.356) (2025-04-29)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.355-dev-5",
3
+ "version": "1.1.355-dev-7",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -151,15 +151,14 @@ export default function (request) {
151
151
  }
152
152
  }),
153
153
  setRankingOptions: assign((context, event) => {
154
+ const isChampion = event.data?.rule === 'CHAMPION'
154
155
  const cycle = event.data?.cycle
155
156
  const currentRound = event.data?.currentRound || []
156
157
  // 取得結算週期選單列表
157
- const cycleOptions = cycleMapping.slice(0, currentRound.length)
158
- // 取得每週期的歷史期數選單列表
159
- const cycles = event.data?.rule === 'NORMAL' ? [cycle] : cycleMapping
160
- const roundOptions = roundProcess(currentRound, cycles)
161
- // 如果是月結算,則加入全部選項
162
- if (cycle === 'MONTHLY') {
158
+ const cycleOptions = isChampion ? cycleMapping.slice(0, currentRound.length) : [cycle]
159
+ const roundOptions = roundProcess(currentRound, cycleOptions)
160
+ // 如果是冠軍龍虎月結算,則加入全部選項
161
+ if (cycle === 'MONTHLY' && isChampion) {
163
162
  cycleOptions.push('ALL')
164
163
  roundOptions.ALL = roundOptions.MONTHLY
165
164
  }
@@ -167,7 +166,7 @@ export default function (request) {
167
166
  ...event.data,
168
167
  options: { cycle: cycleOptions, round: roundOptions },
169
168
  // 初始固定顯示 DAILY
170
- cycle: event.data?.rule !== 'NORMAL' ? 'DAILY' : cycle,
169
+ cycle: isChampion ? 'DAILY' : cycle,
171
170
  round: currentRound[0],
172
171
  }
173
172
  }),
@@ -18,6 +18,7 @@ export default function (request) {
18
18
  rewardType: null,
19
19
  isPlaying: false,
20
20
  callback: () => {},
21
+ orderColumn: 'createTime',
21
22
  },
22
23
  states: {
23
24
  timer: {
@@ -56,6 +57,10 @@ export default function (request) {
56
57
  target: 'fetching',
57
58
  actions: 'setRewardData',
58
59
  },
60
+ FETCH_OTHER_REWARD: {
61
+ target: 'fetchingOtherReward',
62
+ actions: 'setOrderColumn',
63
+ },
59
64
  RECEIVE_REWARD: {
60
65
  target: 'receiving',
61
66
  actions: ['setCallback', 'setRewardType'],
@@ -81,6 +86,18 @@ export default function (request) {
81
86
  },
82
87
  },
83
88
  },
89
+ fetchingOtherReward: {
90
+ invoke: {
91
+ src: 'fetchOtherRewardList',
92
+ onDone: {
93
+ target: 'idle',
94
+ actions: 'setOtherRewardList',
95
+ },
96
+ onError: {
97
+ target: 'idle',
98
+ },
99
+ },
100
+ },
84
101
  pending: {
85
102
  on: {
86
103
  RECEIVE_REWARD: {
@@ -136,6 +153,11 @@ export default function (request) {
136
153
  rewardList: event.data[2]?.data || [],
137
154
  }
138
155
  }),
156
+ setOtherRewardList: assign((context, event) => {
157
+ return {
158
+ otherRewardList: event.data[0]?.data,
159
+ }
160
+ }),
139
161
  setRewardData: assign((context, event) => {
140
162
  const { activityNo, receiveNo } = event.data
141
163
  return {
@@ -148,6 +170,11 @@ export default function (request) {
148
170
  callback: event.data?.callback || (() => {}),
149
171
  }
150
172
  }),
173
+ setOrderColumn: assign((context, event) => {
174
+ return {
175
+ orderColumn: event.data?.orderColumn || 'createTime',
176
+ }
177
+ }),
151
178
  setRewardType: assign((context, event) => {
152
179
  return {
153
180
  rewardType: event.data?.rewardType,
@@ -178,12 +205,27 @@ export default function (request) {
178
205
  },
179
206
  services: {
180
207
  fetchRewardList: async (context, event) => {
208
+ const orderColumn = context.orderColumn
181
209
  const getRewardAPI = request.send(activity.getRewardList({ count: 30, appSecret }))
182
210
  const getPointsRewardAPI = request.send(activity.getRewardList({ rewardType: 'POINTS', count: 30, appSecret }))
183
- const getOtherRewardAPI = request.send(activity.getRewardList({ rewardType: 'CASH,FREE,PRIZE', count: 30, appSecret }))
211
+ const getOtherRewardAPI = request.send(activity.getRewardList({ rewardType: 'CASH,FREE,PRIZE', count: 30, appSecret, orderColumn }))
184
212
  const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI])
185
213
  return [otherRewardList, pointsRewardList, rewardList]
186
214
  },
215
+ fetchOtherRewardList: async (context, event) => {
216
+ const orderColumn = context.orderColumn
217
+
218
+ const getOtherRewardAPI = request.send(
219
+ activity.getRewardList({
220
+ rewardType: 'CASH,FREE,PRIZE',
221
+ count: 30,
222
+ appSecret,
223
+ orderColumn,
224
+ })
225
+ )
226
+ const [otherRewardList] = await Promise.all([getOtherRewardAPI])
227
+ return [otherRewardList]
228
+ },
187
229
  fetchWithdrawRulePreview: async (context, event) => {
188
230
  const { receiveNo } = context
189
231
  const data = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }))