@jetthai/cuora 1.1.366-dev-2 → 1.1.366-dev-3
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 +2 -0
- package/package.json +1 -1
- package/src/api/activity.js +2 -2
- package/src/machine/inbox.js +9 -1
- package/src/machine/reward.js +15 -5
- package/src/machine/reward_cash.js +15 -3
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.366-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.366-dev-2...v1.1.366-dev-3) (2025-07-18)
|
|
6
|
+
|
|
5
7
|
### [1.1.366-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.366-dev-1...v1.1.366-dev-2) (2025-07-18)
|
|
6
8
|
|
|
7
9
|
### [1.1.366-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.366...v1.1.366-dev-1) (2025-07-18)
|
package/package.json
CHANGED
package/src/api/activity.js
CHANGED
|
@@ -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, orderColum, lang }) => ({
|
|
73
73
|
url: 'activities/rewards',
|
|
74
74
|
method: 'get',
|
|
75
|
-
params: { rewardType, count, appSecret,
|
|
75
|
+
params: { rewardType, count, appSecret, orderColum, lang },
|
|
76
76
|
}),
|
|
77
77
|
getCashRainReward: ({ activityNo, appSecret }) => ({
|
|
78
78
|
url: `activities/cashRain`,
|
package/src/machine/inbox.js
CHANGED
|
@@ -247,6 +247,9 @@ export default function (request) {
|
|
|
247
247
|
CLEAR: {
|
|
248
248
|
actions: 'hideMessage',
|
|
249
249
|
},
|
|
250
|
+
SET_LANG: {
|
|
251
|
+
actions: 'setLang',
|
|
252
|
+
},
|
|
250
253
|
},
|
|
251
254
|
},
|
|
252
255
|
{
|
|
@@ -276,6 +279,10 @@ export default function (request) {
|
|
|
276
279
|
},
|
|
277
280
|
},
|
|
278
281
|
actions: {
|
|
282
|
+
setLang: assign((context, event) => {
|
|
283
|
+
const lang = event.data.locale || context.lang || 'en-US'
|
|
284
|
+
return { lang }
|
|
285
|
+
}),
|
|
279
286
|
reset: assign((context, event) => {
|
|
280
287
|
return {
|
|
281
288
|
currentTab: null,
|
|
@@ -415,9 +422,10 @@ export default function (request) {
|
|
|
415
422
|
return tabs
|
|
416
423
|
},
|
|
417
424
|
fetchMessages: async (context, event) => {
|
|
425
|
+
const lang = context.lang
|
|
418
426
|
const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context))
|
|
419
427
|
if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND')) {
|
|
420
|
-
const { data } = await request.send(activity.getRewardList({ count: 30, appSecret }))
|
|
428
|
+
const { data } = await request.send(activity.getRewardList({ count: 30, appSecret, lang }))
|
|
421
429
|
inbox[currentTab] = { data, page: 0, totalPage: 1 }
|
|
422
430
|
} else {
|
|
423
431
|
const { page = -1 } = inbox[currentTab] || {}
|
package/src/machine/reward.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createMachine, assign, send } from 'xstate'
|
|
|
2
2
|
import activity from '../api/activity.js'
|
|
3
3
|
import payment from '../api/payment.js'
|
|
4
4
|
|
|
5
|
-
export default function (request) {
|
|
5
|
+
export default function (request, context) {
|
|
6
6
|
const { appSecret } = request.config
|
|
7
7
|
return createMachine(
|
|
8
8
|
{
|
|
@@ -19,6 +19,7 @@ export default function (request) {
|
|
|
19
19
|
isPlaying: false,
|
|
20
20
|
callback: () => {},
|
|
21
21
|
orderColumn: 'createTime',
|
|
22
|
+
lang: context?.locale,
|
|
22
23
|
},
|
|
23
24
|
states: {
|
|
24
25
|
timer: {
|
|
@@ -72,6 +73,9 @@ export default function (request) {
|
|
|
72
73
|
SET_IS_PLAYING: {
|
|
73
74
|
actions: 'setIsPlaying',
|
|
74
75
|
},
|
|
76
|
+
SET_LANG: {
|
|
77
|
+
actions: 'setLang',
|
|
78
|
+
},
|
|
75
79
|
},
|
|
76
80
|
},
|
|
77
81
|
fetching: {
|
|
@@ -193,6 +197,10 @@ export default function (request) {
|
|
|
193
197
|
isPlaying: event.data,
|
|
194
198
|
}
|
|
195
199
|
}),
|
|
200
|
+
setLang: assign((context, event) => {
|
|
201
|
+
const lang = event.data.locale || context.lang || 'en-US'
|
|
202
|
+
return { lang }
|
|
203
|
+
}),
|
|
196
204
|
},
|
|
197
205
|
guards: {
|
|
198
206
|
isPrize: (context, event) => {
|
|
@@ -205,22 +213,24 @@ export default function (request) {
|
|
|
205
213
|
},
|
|
206
214
|
services: {
|
|
207
215
|
fetchRewardList: async (context, event) => {
|
|
216
|
+
const lang = context.lang
|
|
208
217
|
const orderColumn = context.orderColumn
|
|
209
|
-
const getRewardAPI = request.send(activity.getRewardList({ count: 30, appSecret }))
|
|
210
|
-
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 }))
|
|
218
|
+
const getRewardAPI = request.send(activity.getRewardList({ count: 30, appSecret, lang }))
|
|
219
|
+
const getPointsRewardAPI = request.send(activity.getRewardList({ rewardType: 'POINTS', count: 30, appSecret, lang }))
|
|
220
|
+
const getOtherRewardAPI = request.send(activity.getRewardList({ rewardType: 'CASH,FREE,PRIZE', count: 30, appSecret, orderColumn, lang }))
|
|
212
221
|
const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI])
|
|
213
222
|
return [otherRewardList, pointsRewardList, rewardList]
|
|
214
223
|
},
|
|
215
224
|
fetchOtherRewardList: async (context, event) => {
|
|
216
225
|
const orderColumn = context.orderColumn
|
|
217
|
-
|
|
226
|
+
const lang = context.lang
|
|
218
227
|
const getOtherRewardAPI = request.send(
|
|
219
228
|
activity.getRewardList({
|
|
220
229
|
rewardType: 'CASH,FREE,PRIZE',
|
|
221
230
|
count: 30,
|
|
222
231
|
appSecret,
|
|
223
232
|
orderColumn,
|
|
233
|
+
lang,
|
|
224
234
|
})
|
|
225
235
|
)
|
|
226
236
|
const [otherRewardList] = await Promise.all([getOtherRewardAPI])
|
|
@@ -2,7 +2,7 @@ import { createMachine, assign, send } from 'xstate'
|
|
|
2
2
|
import activity from '../api/activity.js'
|
|
3
3
|
import payment from '../api/payment.js'
|
|
4
4
|
|
|
5
|
-
export default function (request) {
|
|
5
|
+
export default function (request, context) {
|
|
6
6
|
const { appSecret } = request.config
|
|
7
7
|
return createMachine(
|
|
8
8
|
{
|
|
@@ -18,6 +18,7 @@ export default function (request) {
|
|
|
18
18
|
withdrawRule: {},
|
|
19
19
|
callback: () => {},
|
|
20
20
|
orderColumn: 'createTime',
|
|
21
|
+
lang: context?.locale,
|
|
21
22
|
},
|
|
22
23
|
states: {
|
|
23
24
|
timer: {
|
|
@@ -78,6 +79,9 @@ export default function (request) {
|
|
|
78
79
|
target: 'allPointsReceiving',
|
|
79
80
|
actions: 'setCallback',
|
|
80
81
|
},
|
|
82
|
+
SET_LANG: {
|
|
83
|
+
actions: 'setLang',
|
|
84
|
+
},
|
|
81
85
|
},
|
|
82
86
|
},
|
|
83
87
|
fetching: {
|
|
@@ -201,16 +205,22 @@ export default function (request) {
|
|
|
201
205
|
withdrawRule: event.data,
|
|
202
206
|
}
|
|
203
207
|
}),
|
|
208
|
+
setLang: assign((context, event) => {
|
|
209
|
+
const lang = event.data.locale || context.lang || 'en-US'
|
|
210
|
+
return { lang }
|
|
211
|
+
}),
|
|
204
212
|
},
|
|
205
213
|
services: {
|
|
206
214
|
fetchRewardList: async (context, event) => {
|
|
207
|
-
const
|
|
215
|
+
const lang = context.lang
|
|
216
|
+
const getRewardAPI = request.send(activity.getRewardList({ count: 30, appSecret, lang }))
|
|
208
217
|
const orderColumn = context.orderColumn
|
|
209
218
|
const getPointsRewardAPI = request.send(
|
|
210
219
|
activity.getRewardList({
|
|
211
220
|
rewardType: 'POINTS',
|
|
212
221
|
count: 30,
|
|
213
222
|
appSecret,
|
|
223
|
+
lang,
|
|
214
224
|
})
|
|
215
225
|
)
|
|
216
226
|
const getOtherRewardAPI = request.send(
|
|
@@ -219,6 +229,7 @@ export default function (request) {
|
|
|
219
229
|
count: 30,
|
|
220
230
|
appSecret,
|
|
221
231
|
orderColumn,
|
|
232
|
+
lang,
|
|
222
233
|
})
|
|
223
234
|
)
|
|
224
235
|
const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI])
|
|
@@ -226,13 +237,14 @@ export default function (request) {
|
|
|
226
237
|
},
|
|
227
238
|
fetchOtherRewardList: async (context, event) => {
|
|
228
239
|
const orderColumn = context.orderColumn
|
|
229
|
-
|
|
240
|
+
const lang = context.lang
|
|
230
241
|
const getOtherRewardAPI = request.send(
|
|
231
242
|
activity.getRewardList({
|
|
232
243
|
rewardType: 'CASH,FREE,PRIZE',
|
|
233
244
|
count: 30,
|
|
234
245
|
appSecret,
|
|
235
246
|
orderColumn,
|
|
247
|
+
lang,
|
|
236
248
|
})
|
|
237
249
|
)
|
|
238
250
|
const [otherRewardList] = await Promise.all([getOtherRewardAPI])
|