@jetthai/cuora 1.1.200 → 1.1.202

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.202](https://github.com/jetthai/cuora-module/compare/v1.1.201...v1.1.202) (2023-11-09)
6
+
7
+ ### [1.1.201](https://github.com/jetthai/cuora-module/compare/v1.1.200...v1.1.201) (2023-11-03)
8
+
5
9
  ### [1.1.200](https://github.com/jetthai/cuora-module/compare/v1.1.199...v1.1.200) (2023-11-01)
6
10
 
7
11
  ### [1.1.199](https://github.com/jetthai/cuora-module/compare/v1.1.198...v1.1.199) (2023-10-31)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.200",
3
+ "version": "1.1.202",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -18,6 +18,7 @@ import mini_game_activity from './mini_game_activity.js'
18
18
  import roulette_activity_v2 from './roulette_activity_v2.js'
19
19
  import sign_in_monthly_activity from './sign_in_monthly_activity.js'
20
20
  import otp_verified_activity from './otp_verified_activity.js'
21
+ import vip_card_activity from './vip_card_activity.js'
21
22
 
22
23
  export default {
23
24
  activity,
@@ -40,4 +41,5 @@ export default {
40
41
  roulette_activity_v2,
41
42
  sign_in_monthly_activity,
42
43
  otp_verified_activity,
44
+ vip_card_activity,
43
45
  }
@@ -0,0 +1,120 @@
1
+ import { assign, createMachine } 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: 'vip_card_activity',
9
+ context: {
10
+ activityNo: null,
11
+ activityDetail: null,
12
+ conditions: null,
13
+ currentReachLevel: null,
14
+ nextReachLevel: null,
15
+ lastPeriod: null,
16
+ currentDepositLimit: null,
17
+ currentTurnoverLimit: null,
18
+ currentTotalDeposit: null,
19
+ currentTotalTurnover: null,
20
+ retainAmount: '0',
21
+ yesterdayReward: '0',
22
+ calculateWalletMode: '1',
23
+ duration: 0,
24
+ },
25
+ initial: 'idle',
26
+ states: {
27
+ idle: {
28
+ on: {
29
+ SET_ACTIVITY_NO: {
30
+ target: 'loading',
31
+ actions: 'setActivityNo',
32
+ },
33
+ },
34
+ },
35
+ loading: {
36
+ invoke: {
37
+ src: 'fetchActivityDetail',
38
+ onDone: {
39
+ target: 'loaded',
40
+ actions: ['setActivityDetail', 'setInitData'],
41
+ },
42
+ onError: {
43
+ target: 'idle',
44
+ },
45
+ },
46
+ },
47
+ loaded: {
48
+ entry: 'setDuration',
49
+ after: {
50
+ 1000: {
51
+ target: 'loaded',
52
+ },
53
+ },
54
+ },
55
+ },
56
+ on: {
57
+ START: {
58
+ target: '.loading',
59
+ },
60
+ STOP: {
61
+ target: '.idle',
62
+ },
63
+ },
64
+ },
65
+ {
66
+ actions: {
67
+ setActivityNo: assign((context, event) => {
68
+ return {
69
+ activityNo: event.data,
70
+ }
71
+ }),
72
+ setActivityDetail: assign((context, event) => {
73
+ return {
74
+ activityDetail: event.data,
75
+ }
76
+ }),
77
+ setInitData: assign((context, event) => {
78
+ const {
79
+ conditions = [],
80
+ currentReachLevel = {},
81
+ nextReachLevel = {},
82
+ lastPeriod = {},
83
+ currentTotalDeposit = '0',
84
+ currentTotalTurnover = '0',
85
+ retainAmount = '0',
86
+ yesterdayReward = '0',
87
+ calculateWalletMode = '0',
88
+ } = context.activityDetail || {}
89
+
90
+ return {
91
+ conditions,
92
+ currentReachLevel,
93
+ nextReachLevel,
94
+ lastPeriod,
95
+ currentDepositLimit: currentReachLevel?.depositLimit || '0',
96
+ currentTurnoverLimit: currentReachLevel?.turnoverLimit || '0',
97
+ currentTotalDeposit,
98
+ currentTotalTurnover,
99
+ retainAmount,
100
+ yesterdayReward,
101
+ calculateWalletMode,
102
+ }
103
+ }),
104
+ setDuration: assign((context, event) => {
105
+ const { currentEndTime } = context?.activityDetail
106
+ return {
107
+ duration: Math.max(parseInt(currentEndTime) - new Date().getTime() / 1000, 0),
108
+ }
109
+ }),
110
+ },
111
+ services: {
112
+ fetchActivityDetail: async (context, event) => {
113
+ const { activityNo } = context
114
+ const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
115
+ return data
116
+ },
117
+ },
118
+ }
119
+ )
120
+ }
@@ -143,11 +143,11 @@ export default function (request) {
143
143
  src: 'disconnectGame',
144
144
  onDone: {
145
145
  target: 'idle',
146
- // actions: 'setGameURL',
146
+ actions: 'setGameURL',
147
147
  },
148
148
  onError: {
149
149
  target: 'idle',
150
- // actions: 'setGameURL',
150
+ actions: 'setGameURL',
151
151
  },
152
152
  },
153
153
  },