@jetthai/cuora 1.1.148 → 1.1.151

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,12 @@
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.151](https://github.com/jetthai/cuora-module/compare/v1.1.150...v1.1.151) (2023-07-31)
6
+
7
+ ### [1.1.150](https://github.com/jetthai/cuora-module/compare/v1.1.149...v1.1.150) (2023-07-31)
8
+
9
+ ### [1.1.149](https://github.com/jetthai/cuora-module/compare/v1.1.148...v1.1.149) (2023-07-31)
10
+
5
11
  ### [1.1.148](https://github.com/jetthai/cuora-module/compare/v1.1.143-1...v1.1.148) (2023-07-25)
6
12
 
7
13
  ### [1.1.147](https://github.com/jetthai/cuora-module/compare/v1.1.146...v1.1.147) (2023-07-25)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.148",
3
+ "version": "1.1.151",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -63,4 +63,5 @@ export default {
63
63
  exchangeAward,
64
64
  },
65
65
  }),
66
+ getHonorBoard: () => ({ url: 'activities/honorBoard', method: 'get' }),
66
67
  }
package/src/api/common.js CHANGED
@@ -2,5 +2,5 @@ export default {
2
2
  getConfig: ({ appSecret }) => ({ url: 'getConfig', method: 'get', params: { appSecret }, isPublic: true }),
3
3
  feeds: ({ appSecret }) => ({ url: 'feeds', method: 'get', params: { appSecret }, isPublic: true }),
4
4
  broadcast: () => ({ url: 'broadcast', method: 'get', isPublic: true }),
5
- getAnnouncements: () => ({ url: 'getAnnouncements', method: 'get', isPublic: true }),
5
+ getAnnouncements: ({ appSecret }) => ({ url: 'getAnnouncements', params: { appSecret }, method: 'get', isPublic: true }),
6
6
  }
@@ -11,8 +11,8 @@ export default function (request) {
11
11
  context: {
12
12
  tick: 2000,
13
13
  activityList: [],
14
- promotionList: [],
15
14
  tournamentList: [],
15
+ promotionList: [],
16
16
  uidSite: '',
17
17
  },
18
18
  states: {
@@ -94,6 +94,30 @@ export default function (request) {
94
94
  },
95
95
  },
96
96
  },
97
+ getAnnouncements: {
98
+ initial: 'updating',
99
+ states: {
100
+ updating: {
101
+ invoke: {
102
+ src: 'fetchAnnouncements',
103
+ onDone: {
104
+ target: 'idle',
105
+ actions: 'setAnnouncements',
106
+ },
107
+ onError: {
108
+ target: 'idle',
109
+ },
110
+ },
111
+ },
112
+ idle: {
113
+ on: {
114
+ FETCH_ANNOUNCEMENTS: {
115
+ target: 'updating',
116
+ },
117
+ },
118
+ },
119
+ },
120
+ },
97
121
  broadcast: {
98
122
  initial: 'idle',
99
123
  states: {
@@ -199,6 +223,10 @@ export default function (request) {
199
223
  }
200
224
  }
201
225
  }),
226
+ setAnnouncements: assign((context, event) => {
227
+ const { data } = event.data
228
+ return { announcementList: data }
229
+ }),
202
230
  setFeeds: assign((context, event) => {
203
231
  const { announcementList, broadcastList, mailBoxInfo } = event.data
204
232
  const promotions = announcementList?.announcements?.filter?.((item) => item.category === 3) || []
@@ -244,6 +272,9 @@ export default function (request) {
244
272
  fetchFeeds: async (context, event) => {
245
273
  return await request.send(api.feeds({ appSecret }))
246
274
  },
275
+ fetchAnnouncements: async (context, event) => {
276
+ return await request.send(api.getAnnouncements({ appSecret }))
277
+ },
247
278
  },
248
279
  }
249
280
  )
@@ -0,0 +1,60 @@
1
+ import { createMachine, assign } from 'xstate'
2
+ import activity from '../api/activity.js'
3
+
4
+ export default function (request) {
5
+ return createMachine(
6
+ {
7
+ id: 'honor_board',
8
+ initial: 'fetching',
9
+ context: {
10
+ tick: 2000,
11
+ bigWinList: [],
12
+ maxBetList: [],
13
+ },
14
+ states: {
15
+ fetching: {
16
+ invoke: {
17
+ src: 'fetchHonorBoardList',
18
+ onDone: {
19
+ target: 'pending',
20
+ actions: 'setHonorBoardList',
21
+ },
22
+ onError: {
23
+ target: 'pending',
24
+ },
25
+ },
26
+ },
27
+ pending: {
28
+ after: {
29
+ TIMEOUT: {
30
+ target: 'fetching',
31
+ },
32
+ },
33
+ },
34
+ },
35
+ },
36
+ {
37
+ actions: {
38
+ setHonorBoardList: assign((context, event) => {
39
+ const { bigWinList = [], maxBetList = [] } = event.data
40
+ return {
41
+ bigWinList,
42
+ maxBetList,
43
+ }
44
+ }),
45
+ },
46
+ delays: {
47
+ TIMEOUT: (context, event) => {
48
+ const { tick } = context
49
+ return tick * 10
50
+ },
51
+ },
52
+ services: {
53
+ fetchHonorBoardList: async (context, event) => {
54
+ const { data } = await request.send(activity.getHonorBoard())
55
+ return data
56
+ },
57
+ },
58
+ }
59
+ )
60
+ }
@@ -32,6 +32,7 @@ import auth_otp_v3 from './auth_otp_v3.js'
32
32
  import vip_table from './vip_table.js'
33
33
  import promotions from './promotions.js'
34
34
  import roulette_v2 from './roulette_v2.js'
35
+ import honor_board_cash from './honor_board_cash.js'
35
36
 
36
37
  export default {
37
38
  ...activity,
@@ -67,5 +68,6 @@ export default {
67
68
  vip_table,
68
69
  promotions,
69
70
  roulette_v2,
71
+ honor_board_cash,
70
72
  ...withdraw,
71
73
  }