@jetthai/cuora 1.1.361-dev-3 → 1.1.361-dev-5

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-5](https://github.com/jetthai/cuora-module/compare/v1.1.361-dev-4...v1.1.361-dev-5) (2025-06-17)
6
+
7
+ ### [1.1.361-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.361-dev-3...v1.1.361-dev-4) (2025-06-17)
8
+
5
9
  ### [1.1.361-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.361-dev-2...v1.1.361-dev-3) (2025-06-16)
6
10
 
7
11
  ### [1.1.361-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.361-dev-1...v1.1.361-dev-2) (2025-06-11)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.361-dev-3",
3
+ "version": "1.1.361-dev-5",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -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] || {}
@@ -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])