@jetthai/cuora 1.1.358-apiv2-2 → 1.1.358-dev-2

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,11 +2,9 @@
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.358-apiv2-2](https://github.com/jetthai/cuora-module/compare/v1.1.359...v1.1.358-apiv2-2) (2025-05-27)
5
+ ### [1.1.358-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.358-dev-1...v1.1.358-dev-2) (2025-05-12)
6
6
 
7
- ### [1.1.359](https://github.com/jetthai/cuora-module/compare/v1.1.358...v1.1.359) (2025-05-23)
8
-
9
- ### [1.1.358-apiv2-1](https://github.com/jetthai/cuora-module/compare/v1.1.358...v1.1.358-apiv2-1) (2025-05-09)
7
+ ### [1.1.358-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.358...v1.1.358-dev-1) (2025-05-09)
10
8
 
11
9
  ### [1.1.358](https://github.com/jetthai/cuora-module/compare/v1.1.357...v1.1.358) (2025-05-09)
12
10
 
@@ -14,10 +12,6 @@ All notable changes to this project will be documented in this file. See [standa
14
12
 
15
13
  ### [1.1.356](https://github.com/jetthai/cuora-module/compare/v1.1.355...v1.1.356) (2025-04-29)
16
14
 
17
- ### [1.1.355-apiv2-2](https://github.com/jetthai/cuora-module/compare/v1.1.355-apiv2-1...v1.1.355-apiv2-2) (2025-05-07)
18
-
19
- ### [1.1.355-apiv2-1](https://github.com/jetthai/cuora-module/compare/v1.1.355...v1.1.355-apiv2-1) (2025-05-05)
20
-
21
15
  ### [1.1.355](https://github.com/jetthai/cuora-module/compare/v1.1.353-data-1...v1.1.355) (2025-04-22)
22
16
 
23
17
  ### [1.1.354](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.354) (2025-04-14)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.358-apiv2-2",
3
+ "version": "1.1.358-dev-2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -69,10 +69,10 @@ export default {
69
69
  method: 'get',
70
70
  params: { rewardType },
71
71
  }),
72
- getRewardList: ({ rewardType, count, appSecret }) => ({
72
+ getRewardList: ({ rewardType, count, appSecret, orderColumn }) => ({
73
73
  url: 'activities/rewards',
74
74
  method: 'get',
75
- params: { rewardType, count, appSecret },
75
+ params: { rewardType, count, appSecret, orderColumn },
76
76
  }),
77
77
  getCashRainReward: ({ activityNo, appSecret }) => ({
78
78
  url: `activities/cashRain`,
@@ -242,5 +242,4 @@ export default {
242
242
  getPendingOrder: ({ transferType }) => ({ url: 'payment/v2/pendingOrder', method: 'post', params: { transferType } }),
243
243
  withdrawCheck: () => ({ url: `payment/v2/withdrawCheck`, method: 'post' }),
244
244
  updateUtr: ({ applyId, utr }) => ({ url: 'payment/v2/updateUtr', method: 'post', params: { applyId, utr } }),
245
- uploadCommonSlip: ({ applyId, slip }) => ({ url: 'payment/v2/uploadCommonSlip', method: 'post', params: { applyId, slip } }),
246
245
  }
@@ -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'],
95
95
  },
96
96
  UPDATE: {
97
97
  target: 'updating',
@@ -233,9 +233,6 @@ export default function (request) {
233
233
  },
234
234
  playingDemo: {
235
235
  on: {
236
- EXIT_GAME: {
237
- target: 'disconnect',
238
- },
239
236
  EXIT_DEMO_GAME: {
240
237
  target: 'idle',
241
238
  },
@@ -4,10 +4,10 @@ import ranking from '../api/ranking.js'
4
4
  export default function (request) {
5
5
  const cycleMapping = ['DAILY', 'WEEKLY', 'MONTHLY']
6
6
 
7
- function roundProcess(rounds) {
7
+ function roundProcess(rounds, cycles) {
8
8
  const roundArrays = rounds.map((round) => Array.from({ length: round }, (_, i) => i + 1))
9
9
  return roundArrays.reduce((acc, roundArray, index) => {
10
- acc[cycleMapping[index]] = roundArray.reverse()
10
+ acc[cycles[index]] = roundArray.reverse()
11
11
  return acc
12
12
  }, {})
13
13
  }
@@ -151,14 +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 roundOptions = roundProcess(currentRound)
160
- // 如果是月結算,則加入全部選項
161
- 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) {
162
162
  cycleOptions.push('ALL')
163
163
  roundOptions.ALL = roundOptions.MONTHLY
164
164
  }
@@ -166,7 +166,7 @@ export default function (request) {
166
166
  ...event.data,
167
167
  options: { cycle: cycleOptions, round: roundOptions },
168
168
  // 初始固定顯示 DAILY
169
- cycle: event.data?.rule !== 'NORMAL' ? 'DAILY' : cycle,
169
+ cycle: isChampion ? 'DAILY' : cycle,
170
170
  round: currentRound[0],
171
171
  }
172
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 }))
@@ -17,6 +17,7 @@ export default function (request) {
17
17
  receiveNo: null,
18
18
  withdrawRule: {},
19
19
  callback: () => {},
20
+ orderColumn: 'createTime',
20
21
  },
21
22
  states: {
22
23
  timer: {
@@ -65,6 +66,10 @@ export default function (request) {
65
66
  target: 'fetching',
66
67
  actions: 'setRewardData',
67
68
  },
69
+ FETCH_OTHER_REWARD: {
70
+ target: 'fetchingOtherReward',
71
+ actions: 'setOrderColumn',
72
+ },
68
73
  RECEIVE_REWARD: {
69
74
  target: 'receiving',
70
75
  actions: 'setCallback',
@@ -87,6 +92,18 @@ export default function (request) {
87
92
  },
88
93
  },
89
94
  },
95
+ fetchingOtherReward: {
96
+ invoke: {
97
+ src: 'fetchOtherRewardList',
98
+ onDone: {
99
+ target: 'idle',
100
+ actions: 'setOtherRewardList',
101
+ },
102
+ onError: {
103
+ target: 'idle',
104
+ },
105
+ },
106
+ },
90
107
  pending: {
91
108
  on: {
92
109
  RECEIVE_REWARD: {
@@ -154,6 +171,11 @@ export default function (request) {
154
171
  rewardList: event.data[2]?.data || [],
155
172
  }
156
173
  }),
174
+ setOtherRewardList: assign((context, event) => {
175
+ return {
176
+ otherRewardList: event.data[0]?.data,
177
+ }
178
+ }),
157
179
  setRewardData: assign((context, event) => {
158
180
  const { activityNo, receiveNo } = event.data
159
181
  return {
@@ -166,6 +188,11 @@ export default function (request) {
166
188
  callback: event.data?.callback || (() => {}),
167
189
  }
168
190
  }),
191
+ setOrderColumn: assign((context, event) => {
192
+ return {
193
+ orderColumn: event.data?.orderColumn || 'createTime',
194
+ }
195
+ }),
169
196
  doCallback: (context, event) => {
170
197
  context.callback()
171
198
  },
@@ -178,6 +205,7 @@ export default function (request) {
178
205
  services: {
179
206
  fetchRewardList: async (context, event) => {
180
207
  const getRewardAPI = request.send(activity.getRewardList({ count: 30, appSecret }))
208
+ const orderColumn = context.orderColumn
181
209
  const getPointsRewardAPI = request.send(
182
210
  activity.getRewardList({
183
211
  rewardType: 'POINTS',
@@ -190,11 +218,26 @@ export default function (request) {
190
218
  rewardType: 'CASH,FREE,PRIZE',
191
219
  count: 30,
192
220
  appSecret,
221
+ orderColumn,
193
222
  })
194
223
  )
195
224
  const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI])
196
225
  return [otherRewardList, pointsRewardList, rewardList]
197
226
  },
227
+ fetchOtherRewardList: async (context, event) => {
228
+ const orderColumn = context.orderColumn
229
+
230
+ const getOtherRewardAPI = request.send(
231
+ activity.getRewardList({
232
+ rewardType: 'CASH,FREE,PRIZE',
233
+ count: 30,
234
+ appSecret,
235
+ orderColumn,
236
+ })
237
+ )
238
+ const [otherRewardList] = await Promise.all([getOtherRewardAPI])
239
+ return [otherRewardList]
240
+ },
198
241
  fetchWithdrawRulePreview: async (context, event) => {
199
242
  const { receiveNo } = context
200
243
  const data = await request.send(
@@ -2,80 +2,6 @@ import pickBy from 'lodash/pickBy.js'
2
2
  import storage from '../util/storage.js'
3
3
 
4
4
  // const pickBy = require('lodash/pickBy')
5
- const supportVersion2List = [
6
- 'game/play',
7
- 'game/gameReplay',
8
- 'game/logout',
9
- 'game/list/v3/root',
10
- 'game/list/v3/category',
11
- 'game/list/v3/addition',
12
- 'game/list/v3/categoryByRange',
13
- 'game/list/v3/additionByRange',
14
- 'game/list/v3/myFavorite',
15
- 'game/list/v3/addMyFavorite',
16
- 'game/list/v3/removeMyFavorite',
17
- 'login',
18
- 'callback/:strategy',
19
- 'guestLogin',
20
- 'appLogin',
21
- 'logout',
22
- 'self',
23
- 'register',
24
- 'settings/password',
25
- 'verify',
26
- 'reset',
27
- 'acknowledge',
28
- 'friends',
29
- 'friends/home',
30
- 'friends/reward-list',
31
- 'recovery',
32
- 'recovery/abandon',
33
- 'recovery/acknowledge',
34
- 'checkDt',
35
- 'updateDt',
36
- 'checkAC',
37
- 'checkAccount',
38
- 'getAllAvatar',
39
- 'updateUserAvatar',
40
- 'getConfig',
41
- 'getQuickLayout',
42
- 'getNavbarSetting',
43
- 'getAffiliateCode',
44
- 'get-site-config',
45
- 'friends/dashboard',
46
- 'friends/dashboard/list',
47
- 'mailbox/sendMessage',
48
- 'mailbox/getMessageList',
49
- 'mailbox/getMessage',
50
- 'mailbox/updateMessage',
51
- 'mailbox/getMessageTypes',
52
- ]
53
-
54
- const version2ListName = {
55
- 'game/gameReplay': 'game/game-replay',
56
- 'game/list/v3/categoryByRange': 'game/list/v3/category-by-range',
57
- 'game/list/v3/additionByRange': 'game/list/v3/addition-by-range',
58
- 'game/list/v3/myFavorite': 'game/list/v3/my-favorite',
59
- 'game/list/v3/addMyFavorite': 'game/list/v3/add-my-favorite',
60
- 'game/list/v3/removeMyFavorite': 'game/list/v3/remove-my-favorite',
61
- guestLogin: 'guest-login',
62
- appLogin: 'app-login',
63
- checkDt: 'check-dt',
64
- updateDt: 'update-dt',
65
- checkAC: 'check-ac',
66
- checkAccount: 'check-account',
67
- getAllAvatar: 'get-all-avatar',
68
- updateUserAvatar: 'update-user-avatar',
69
- getConfig: 'get-config',
70
- getQuickLayout: 'get-quick-layout',
71
- getNavbarSetting: 'get-navbar-setting',
72
- getAffiliateCode: 'get-affiliate-code',
73
- 'mailbox/sendMessage': 'mailbox/send-message',
74
- 'mailbox/getMessageList': 'mailbox/get-message-list',
75
- 'mailbox/getMessage': 'mailbox/get-message',
76
- 'mailbox/updateMessage': 'mailbox/update-message',
77
- 'mailbox/getMessageTypes': 'mailbox/get-message-types',
78
- }
79
5
 
80
6
  function isValid(value) {
81
7
  return value !== undefined && value !== null
@@ -98,8 +24,7 @@ export default class Request {
98
24
  axiosConfig.headers['X-TH1GAMES-VERSION'] = this.config.version
99
25
  axiosConfig.headers['X-TH1GAMES-PLATFORM'] = this.config.platform
100
26
  if (this.getToken()) {
101
- // 為了支援V2版本的API接口新增Bearer來進行身份驗證
102
- axiosConfig.headers.Authorization = `Bearer ${this.getToken()}`
27
+ axiosConfig.headers.Authorization = this.getToken()
103
28
  }
104
29
  return axiosConfig
105
30
  })
@@ -160,21 +85,11 @@ export default class Request {
160
85
 
161
86
  _createConfig(req, cancelToken) {
162
87
  const { method, url, params, isPublic, isFormData, headers } = req
163
- let fullURL = this.config.fullURL
164
- let urlName = url
165
- // 有些API會將參數(/?)直接帶在URL上,所以要將參數排除
166
- if (supportVersion2List.includes(url.split('?')[0])) {
167
- fullURL = fullURL.replace('/v1/', '/v2/')
168
- urlName = version2ListName[url] || url
169
- console.log('*[DEV_ONLY]支援V2API-原本路徑:', url)
170
- console.log('*[DEV_ONLY]支援V2API-調整路徑:', fullURL, urlName)
171
- }
172
-
173
88
  if (isFormData) {
174
89
  return {
175
- baseURL: fullURL,
90
+ baseURL: this.config.fullURL,
176
91
  method,
177
- url: urlName,
92
+ url,
178
93
  cancelToken,
179
94
  isPublic,
180
95
  headers: { 'Content-Type': 'multipart/form-data' },
@@ -182,9 +97,9 @@ export default class Request {
182
97
  }
183
98
  } else {
184
99
  return {
185
- baseURL: fullURL,
100
+ baseURL: this.config.fullURL,
186
101
  method,
187
- url: urlName,
102
+ url,
188
103
  cancelToken,
189
104
  isPublic,
190
105
  headers,