@jetthai/cuora 1.1.359-dev-6 → 1.1.359

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,18 +2,6 @@
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.359-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.359-dev-5...v1.1.359-dev-6) (2025-06-02)
6
-
7
- ### [1.1.359-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.359-dev-4...v1.1.359-dev-5) (2025-06-02)
8
-
9
- ### [1.1.359-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.359-dev-3...v1.1.359-dev-4) (2025-05-26)
10
-
11
- ### [1.1.359-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.359-dev-2...v1.1.359-dev-3) (2025-05-26)
12
-
13
- ### [1.1.359-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.359-dev-1...v1.1.359-dev-2) (2025-05-26)
14
-
15
- ### [1.1.359-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.359...v1.1.359-dev-1) (2025-05-24)
16
-
17
5
  ### [1.1.359](https://github.com/jetthai/cuora-module/compare/v1.1.358...v1.1.359) (2025-05-23)
18
6
 
19
7
  ### [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-dev-6",
3
+ "version": "1.1.359",
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, orderColumn }) => ({
72
+ getRewardList: ({ rewardType, count, appSecret }) => ({
73
73
  url: 'activities/rewards',
74
74
  method: 'get',
75
- params: { rewardType, count, appSecret, orderColumn },
75
+ params: { rewardType, count, appSecret },
76
76
  }),
77
77
  getCashRainReward: ({ activityNo, appSecret }) => ({
78
78
  url: `activities/cashRain`,
package/src/api/game.js CHANGED
@@ -7,7 +7,7 @@ export default {
7
7
  demoGame: (params) => ({ url: 'game/demo', method: 'get', params, isPublic: true }),
8
8
  logoutGame: ({ uid_site, provider_id }) => ({ url: 'game/logout', method: 'get', params: { uid_site, provider_id } }),
9
9
 
10
- getGameTags: ({ q, lang, limit = 20 }) => ({ url: 'game/search', method: 'get', params: { q, lang, limit } }),
10
+ getGameTags: ({ q, lang }) => ({ url: 'game/search', method: 'get', params: { q, lang } }),
11
11
  getGameSearchHome: () => ({ url: 'game/search/home', method: 'get' }),
12
12
  getGameSearchList: ({ id, index, q, click, clickDefault, providerName }) => ({
13
13
  url: 'game/search/list',
@@ -3,7 +3,6 @@ import { assign, createMachine } from 'xstate'
3
3
  import pickBy from 'lodash/pickBy.js'
4
4
  import api from '../api/common.js'
5
5
  import storage from '../util/storage.js'
6
- import sessionStorage from '../util/sessionStorage.js'
7
6
 
8
7
  export default function (request) {
9
8
  const { appSecret, defaultChannel, defaultSubchannel } = request.config
@@ -259,7 +258,7 @@ export default function (request) {
259
258
  const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official'
260
259
  const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa'
261
260
  const affiliateCode = urlParams.get('ac') || urlParams.get('referralCode') || storage.get('ac') || storage.get('referralCode')
262
- const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || sessionStorage.get('fc') || sessionStorage.get('affiliate')
261
+ const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || storage.get('fc') || storage.get('affiliate')
263
262
 
264
263
  storage.set('channel', channel, {
265
264
  path: '/',
@@ -273,7 +272,7 @@ export default function (request) {
273
272
  path: '/',
274
273
  maxAge: 60 * 60 * 24 * 7,
275
274
  })
276
- sessionStorage.set('fc', friendCode, {
275
+ storage.set('fc', friendCode, {
277
276
  path: '/',
278
277
  maxAge: 60 * 60 * 24 * 7,
279
278
  })
@@ -229,10 +229,6 @@ export default function (request) {
229
229
  ENTER_GAME_PAUSE: {
230
230
  actions: ['setIsPlaying', 'resetContent', 'resetSHA'],
231
231
  },
232
- ENTER_GAME: {
233
- target: 'connecting',
234
- actions: ['setGameInfo', 'setLang', 'setwalletType'],
235
- },
236
232
  },
237
233
  },
238
234
  playingDemo: {
@@ -3,13 +3,11 @@ 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 }
7
6
 
8
- function roundProcess(rounds, cycles) {
7
+ function roundProcess(rounds) {
9
8
  const roundArrays = rounds.map((round) => Array.from({ length: round }, (_, i) => i + 1))
10
9
  return roundArrays.reduce((acc, roundArray, index) => {
11
- const max = limit[cycles[index]] || rounds[index] // 若沒限制則取全部
12
- acc[cycles[index]] = roundArray.reverse().slice(0, max)
10
+ acc[cycleMapping[index]] = roundArray.reverse()
13
11
  return acc
14
12
  }, {})
15
13
  }
@@ -153,14 +151,14 @@ export default function (request) {
153
151
  }
154
152
  }),
155
153
  setRankingOptions: assign((context, event) => {
156
- const isChampion = event.data?.rule === 'CHAMPION'
157
154
  const cycle = event.data?.cycle
158
155
  const currentRound = event.data?.currentRound || []
159
156
  // 取得結算週期選單列表
160
- const cycleOptions = isChampion ? cycleMapping.slice(0, currentRound.length) : [cycle]
161
- const roundOptions = roundProcess(currentRound, cycleOptions)
162
- // 如果是冠軍龍虎月結算,則加入全部選項
163
- if (cycle === 'MONTHLY' && isChampion) {
157
+ const cycleOptions = cycleMapping.slice(0, currentRound.length)
158
+ // 取得每週期的歷史期數選單列表
159
+ const roundOptions = roundProcess(currentRound)
160
+ // 如果是月結算,則加入全部選項
161
+ if (cycle === 'MONTHLY') {
164
162
  cycleOptions.push('ALL')
165
163
  roundOptions.ALL = roundOptions.MONTHLY
166
164
  }
@@ -168,7 +166,7 @@ export default function (request) {
168
166
  ...event.data,
169
167
  options: { cycle: cycleOptions, round: roundOptions },
170
168
  // 初始固定顯示 DAILY
171
- cycle: isChampion ? 'DAILY' : cycle,
169
+ cycle: event.data?.rule !== 'NORMAL' ? 'DAILY' : cycle,
172
170
  round: currentRound[0],
173
171
  }
174
172
  }),
@@ -18,7 +18,6 @@ export default function (request) {
18
18
  rewardType: null,
19
19
  isPlaying: false,
20
20
  callback: () => {},
21
- orderColumn: 'createTime',
22
21
  },
23
22
  states: {
24
23
  timer: {
@@ -57,10 +56,6 @@ export default function (request) {
57
56
  target: 'fetching',
58
57
  actions: 'setRewardData',
59
58
  },
60
- FETCH_OTHER_REWARD: {
61
- target: 'fetchingOtherReward',
62
- actions: 'setOrderColumn',
63
- },
64
59
  RECEIVE_REWARD: {
65
60
  target: 'receiving',
66
61
  actions: ['setCallback', 'setRewardType'],
@@ -86,18 +81,6 @@ export default function (request) {
86
81
  },
87
82
  },
88
83
  },
89
- fetchingOtherReward: {
90
- invoke: {
91
- src: 'fetchOtherRewardList',
92
- onDone: {
93
- target: 'idle',
94
- actions: 'setOtherRewardList',
95
- },
96
- onError: {
97
- target: 'idle',
98
- },
99
- },
100
- },
101
84
  pending: {
102
85
  on: {
103
86
  RECEIVE_REWARD: {
@@ -153,11 +136,6 @@ export default function (request) {
153
136
  rewardList: event.data[2]?.data || [],
154
137
  }
155
138
  }),
156
- setOtherRewardList: assign((context, event) => {
157
- return {
158
- otherRewardList: event.data[0]?.data,
159
- }
160
- }),
161
139
  setRewardData: assign((context, event) => {
162
140
  const { activityNo, receiveNo } = event.data
163
141
  return {
@@ -170,11 +148,6 @@ export default function (request) {
170
148
  callback: event.data?.callback || (() => {}),
171
149
  }
172
150
  }),
173
- setOrderColumn: assign((context, event) => {
174
- return {
175
- orderColumn: event.data?.orderColumn || 'createTime',
176
- }
177
- }),
178
151
  setRewardType: assign((context, event) => {
179
152
  return {
180
153
  rewardType: event.data?.rewardType,
@@ -205,27 +178,12 @@ export default function (request) {
205
178
  },
206
179
  services: {
207
180
  fetchRewardList: async (context, event) => {
208
- const orderColumn = context.orderColumn
209
181
  const getRewardAPI = request.send(activity.getRewardList({ count: 30, appSecret }))
210
182
  const getPointsRewardAPI = request.send(activity.getRewardList({ rewardType: 'POINTS', count: 30, appSecret }))
211
- const getOtherRewardAPI = request.send(activity.getRewardList({ rewardType: 'CASH,FREE,PRIZE', count: 30, appSecret, orderColumn }))
183
+ const getOtherRewardAPI = request.send(activity.getRewardList({ rewardType: 'CASH,FREE,PRIZE', count: 30, appSecret }))
212
184
  const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI])
213
185
  return [otherRewardList, pointsRewardList, rewardList]
214
186
  },
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
- },
229
187
  fetchWithdrawRulePreview: async (context, event) => {
230
188
  const { receiveNo } = context
231
189
  const data = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }))
@@ -17,7 +17,6 @@ export default function (request) {
17
17
  receiveNo: null,
18
18
  withdrawRule: {},
19
19
  callback: () => {},
20
- orderColumn: 'createTime',
21
20
  },
22
21
  states: {
23
22
  timer: {
@@ -66,10 +65,6 @@ export default function (request) {
66
65
  target: 'fetching',
67
66
  actions: 'setRewardData',
68
67
  },
69
- FETCH_OTHER_REWARD: {
70
- target: 'fetchingOtherReward',
71
- actions: 'setOrderColumn',
72
- },
73
68
  RECEIVE_REWARD: {
74
69
  target: 'receiving',
75
70
  actions: 'setCallback',
@@ -92,18 +87,6 @@ export default function (request) {
92
87
  },
93
88
  },
94
89
  },
95
- fetchingOtherReward: {
96
- invoke: {
97
- src: 'fetchOtherRewardList',
98
- onDone: {
99
- target: 'idle',
100
- actions: 'setOtherRewardList',
101
- },
102
- onError: {
103
- target: 'idle',
104
- },
105
- },
106
- },
107
90
  pending: {
108
91
  on: {
109
92
  RECEIVE_REWARD: {
@@ -171,11 +154,6 @@ export default function (request) {
171
154
  rewardList: event.data[2]?.data || [],
172
155
  }
173
156
  }),
174
- setOtherRewardList: assign((context, event) => {
175
- return {
176
- otherRewardList: event.data[0]?.data,
177
- }
178
- }),
179
157
  setRewardData: assign((context, event) => {
180
158
  const { activityNo, receiveNo } = event.data
181
159
  return {
@@ -188,11 +166,6 @@ export default function (request) {
188
166
  callback: event.data?.callback || (() => {}),
189
167
  }
190
168
  }),
191
- setOrderColumn: assign((context, event) => {
192
- return {
193
- orderColumn: event.data?.orderColumn || 'createTime',
194
- }
195
- }),
196
169
  doCallback: (context, event) => {
197
170
  context.callback()
198
171
  },
@@ -205,7 +178,6 @@ export default function (request) {
205
178
  services: {
206
179
  fetchRewardList: async (context, event) => {
207
180
  const getRewardAPI = request.send(activity.getRewardList({ count: 30, appSecret }))
208
- const orderColumn = context.orderColumn
209
181
  const getPointsRewardAPI = request.send(
210
182
  activity.getRewardList({
211
183
  rewardType: 'POINTS',
@@ -218,26 +190,11 @@ export default function (request) {
218
190
  rewardType: 'CASH,FREE,PRIZE',
219
191
  count: 30,
220
192
  appSecret,
221
- orderColumn,
222
193
  })
223
194
  )
224
195
  const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI])
225
196
  return [otherRewardList, pointsRewardList, rewardList]
226
197
  },
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
- },
241
198
  fetchWithdrawRulePreview: async (context, event) => {
242
199
  const { receiveNo } = context
243
200
  const data = await request.send(
@@ -1,28 +0,0 @@
1
- export default {
2
- get(name, options) {
3
- const itemStr = sessionStorage.getItem(name)
4
-
5
- if (!itemStr) {
6
- return null
7
- }
8
-
9
- const item = JSON.parse(itemStr)
10
- if (item.expiry && new Date().getTime() > item.expiry) {
11
- sessionStorage.removeItem(name)
12
- return null
13
- }
14
-
15
- return item.value
16
- },
17
- set(name, value, options) {
18
- const item = { value }
19
-
20
- if (options?.maxAge) {
21
- item.expiry = new Date().getTime() + options.maxAge * 1000
22
- }
23
- sessionStorage.setItem(name, JSON.stringify(item))
24
- },
25
- remove(name, options) {
26
- sessionStorage.removeItem(name)
27
- },
28
- }