@jetthai/cuora 1.1.360 → 1.1.361-dev-1

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.361-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.361...v1.1.361-dev-1) (2025-06-09)
6
+
7
+ ### [1.1.361](https://github.com/jetthai/cuora-module/compare/v1.1.360...v1.1.361) (2025-06-03)
8
+
5
9
  ### [1.1.360](https://github.com/jetthai/cuora-module/compare/v1.1.359...v1.1.360) (2025-06-03)
6
10
 
7
11
  ### [1.1.359](https://github.com/jetthai/cuora-module/compare/v1.1.358...v1.1.359) (2025-05-23)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.360",
3
+ "version": "1.1.361-dev-1",
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`,
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 }) => ({ url: 'game/search', method: 'get', params: { q, lang } }),
10
+ getGameTags: ({ q, lang, limit = 20 }) => ({ url: 'game/search', method: 'get', params: { q, lang, limit } }),
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,6 +3,7 @@ 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'
6
7
 
7
8
  export default function (request) {
8
9
  const { appSecret, defaultChannel, defaultSubchannel } = request.config
@@ -258,7 +259,7 @@ export default function (request) {
258
259
  const channel = urlParams.get('channel') || storage.get('channel') || defaultChannel || 'official'
259
260
  const subchannel = urlParams.get('subchannel') || storage.get('subchannel') || defaultSubchannel || 'pwa'
260
261
  const affiliateCode = urlParams.get('ac') || urlParams.get('referralCode') || storage.get('ac') || storage.get('referralCode')
261
- const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || storage.get('fc') || storage.get('affiliate')
262
+ const friendCode = urlParams.get('fc') || urlParams.get('affiliate') || sessionStorage.get('fc') || sessionStorage.get('affiliate')
262
263
 
263
264
  storage.set('channel', channel, {
264
265
  path: '/',
@@ -272,7 +273,7 @@ export default function (request) {
272
273
  path: '/',
273
274
  maxAge: 60 * 60 * 24 * 7,
274
275
  })
275
- storage.set('fc', friendCode, {
276
+ sessionStorage.set('fc', friendCode, {
276
277
  path: '/',
277
278
  maxAge: 60 * 60 * 24 * 7,
278
279
  })
@@ -229,6 +229,10 @@ 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
+ },
232
236
  },
233
237
  },
234
238
  playingDemo: {
@@ -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(
@@ -1,22 +1,10 @@
1
- import withdraw_fc from './withdraw_fc.js'
2
- import withdraw_vn from './withdraw_vn.js'
3
- import withdraw_vn2 from './withdraw_vn2.js'
4
1
  import withdraw_manual from './withdraw_manual.js'
5
- import withdraw_crypto from './withdraw_crypto.js'
6
- import withdraw_crypto2 from './withdraw_crypto2.js'
7
- import withdraw_amb from './withdraw_amb.js'
8
2
  import withdraw_krway from './withdraw_krway.js'
9
3
  import withdraw_crypto_cash from './withdraw_crypto_cash.js'
10
4
  import withdraw_manual_cash from './withdraw_manual_cash.js'
11
5
 
12
6
  export default {
13
- withdraw_fc,
14
- withdraw_vn,
15
- withdraw_vn2,
16
7
  withdraw_manual,
17
- withdraw_crypto,
18
- withdraw_crypto2,
19
- withdraw_amb,
20
8
  withdraw_krway,
21
9
  withdraw_crypto_cash,
22
10
  withdraw_manual_cash,
@@ -65,7 +65,7 @@ export default function (request) {
65
65
  invoke: {
66
66
  src: 'fetchWithdrawRules',
67
67
  onDone: {
68
- target: 'mode',
68
+ target: 'cash',
69
69
  actions: 'updateWithdrawCondition',
70
70
  },
71
71
  onError: {
@@ -73,88 +73,6 @@ export default function (request) {
73
73
  },
74
74
  },
75
75
  },
76
- mode: {
77
- always: [{ target: 'activity', cond: 'isActivity' }, { target: 'cash' }],
78
- },
79
- activity: {
80
- initial: 'checking',
81
- states: {
82
- checking: {
83
- always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
84
- },
85
- notConvertible: {
86
- on: {
87
- GIVE_UP: {
88
- target: 'fetchWithdrawRule',
89
- },
90
- },
91
- },
92
- fetchWithdrawRule: {
93
- invoke: {
94
- src: 'fetchWithdrawRulePreview',
95
- onDone: {
96
- target: 'giveUp',
97
- actions: 'setWithdrawRulePreview',
98
- },
99
- onError: {
100
- target: 'notConvertible',
101
- },
102
- },
103
- },
104
- giveUp: {
105
- on: {
106
- CONFIRM: {
107
- target: 'givingUp',
108
- },
109
- BACK: {
110
- target: 'notConvertible',
111
- },
112
- },
113
- },
114
- givingUp: {
115
- invoke: {
116
- src: 'giveUp',
117
- onDone: {
118
- target: 'gaveUp',
119
- },
120
- onError: {
121
- target: 'convertible',
122
- },
123
- },
124
- },
125
- gaveUp: {},
126
- convertible: {
127
- on: {
128
- SUBMIT: {
129
- target: 'converting',
130
- actions: 'setAttachmentType',
131
- },
132
- },
133
- },
134
- converting: {
135
- invoke: {
136
- src: 'convertFreeCredit',
137
- onDone: [
138
- // {
139
- // target: '#withdraw_manual.otp',
140
- // actions: 'setOtp',
141
- // cond: 'isOtpRequired',
142
- // },
143
- { target: 'converted' },
144
- ],
145
- onError: {
146
- target: 'convertible',
147
- },
148
- },
149
- },
150
- converted: {
151
- // always: [
152
- // { target: '#withdraw_manual.cash.unbound', cond: 'isBankNotBound' },
153
- // { target: '#withdraw_manual.cash.withdrawable', cond: 'hasAttachmentType' },
154
- // ],
155
- },
156
- },
157
- },
158
76
  cash: {
159
77
  initial: 'checking',
160
78
  states: {
@@ -333,10 +251,6 @@ export default function (request) {
333
251
  target: 'reset',
334
252
  },
335
253
  BACK: [
336
- {
337
- target: '#withdraw_manual.activity.convertible',
338
- cond: 'isActivity',
339
- },
340
254
  {
341
255
  target: '#withdraw_manual.cash.withdrawable',
342
256
  },
@@ -347,10 +261,6 @@ export default function (request) {
347
261
  invoke: {
348
262
  src: 'acknowledge',
349
263
  onDone: [
350
- {
351
- target: '#withdraw_manual.activity.converted',
352
- cond: 'isActivity',
353
- },
354
264
  {
355
265
  target: '#withdraw_manual.cash.submitted',
356
266
  },
@@ -497,9 +407,6 @@ export default function (request) {
497
407
  const lastMax = Math.min(parseFloat(balance), maximum)
498
408
  return !!currentBank && amount > 0 && minimum <= amount && amount <= lastMax
499
409
  },
500
- isActivity: (context, event) => {
501
- return context.mode === 'ACTIVITY'
502
- },
503
410
  hasAttachmentType: (context, event) => {
504
411
  return ['withdraw', 'pool'].includes(context.attachmentType)
505
412
  },
@@ -0,0 +1,28 @@
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
+ }