@jetthai/cuora 1.1.106 → 1.1.107

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,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.107](https://github.com/jetthai/cuora-module/compare/v1.1.106...v1.1.107) (2023-05-30)
6
+
5
7
  ### [1.1.106](https://github.com/jetthai/cuora-module/compare/v1.1.105...v1.1.106) (2023-05-29)
6
8
 
7
9
  ### [1.1.105](https://github.com/jetthai/cuora-module/compare/v1.1.104...v1.1.105) (2023-05-29)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.106",
3
+ "version": "1.1.107",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -0,0 +1,67 @@
1
+ import { createMachine, assign } from 'xstate'
2
+ import api from '../../api/activity.js'
3
+
4
+ export default function (request) {
5
+ const { appSecret } = request.config
6
+ return createMachine(
7
+ {
8
+ id: 'activity',
9
+ initial: 'fetchingActivityList',
10
+ context: {
11
+ tick: 2000,
12
+ activityList: [],
13
+ activityMap: {},
14
+ tournamentList: [],
15
+ refs: {},
16
+ },
17
+ states: {
18
+ fetchingActivityList: {
19
+ invoke: {
20
+ src: 'fetchActivityList',
21
+ onDone: {
22
+ target: 'pending',
23
+ actions: ['setActivityList', 'setTournamentList'],
24
+ },
25
+ onError: {
26
+ target: 'pending',
27
+ },
28
+ },
29
+ },
30
+ pending: {
31
+ after: {
32
+ TIMEOUT: {
33
+ target: 'fetchingActivityList',
34
+ },
35
+ },
36
+ },
37
+ },
38
+ },
39
+ {
40
+ actions: {
41
+ setTournamentList: assign((context, event) => {
42
+ const tournamentList = event.data.filter((item) => item.tournament === 1)
43
+ return {
44
+ tournamentList,
45
+ }
46
+ }),
47
+ setActivityList: assign((context, event) => {
48
+ return {
49
+ activityList: event.data,
50
+ }
51
+ }),
52
+ },
53
+ delays: {
54
+ TIMEOUT: (context, event) => {
55
+ const { tick } = context
56
+ return tick * 10
57
+ },
58
+ },
59
+ services: {
60
+ fetchActivityList: async (context, event) => {
61
+ const { data } = await request.send(api.getActivityList({ appSecret }))
62
+ return data
63
+ },
64
+ },
65
+ }
66
+ )
67
+ }
@@ -1,3 +1,5 @@
1
+ import activity from './activity.js'
2
+ import activity_cash from './activity_cash.js'
1
3
  import continue_deposit_activity from './continue_deposit_activity.js'
2
4
  import deposit_activity from './deposit_activity.js'
3
5
  import diamond_shop_activity_fc from './diamond_shop_activity_fc.js'
@@ -14,10 +16,11 @@ import sign_in_activity from './sign_in_activity.js'
14
16
  import time_bomb_activity from './time_bomb_activity.js'
15
17
  import mini_game_activity from './mini_game_activity.js'
16
18
  import roulette_activity_v2 from './roulette_activity_v2.js'
17
- import activity from './activity.js'
18
19
  import otp_verified_activity from './otp_verified_activity.js'
19
20
 
20
21
  export default {
22
+ activity,
23
+ activity_cash,
21
24
  continue_deposit_activity,
22
25
  deposit_activity,
23
26
  diamond_shop_activity_fc,
@@ -34,6 +37,5 @@ export default {
34
37
  time_bomb_activity,
35
38
  mini_game_activity,
36
39
  roulette_activity_v2,
37
- activity,
38
40
  otp_verified_activity,
39
41
  }