@jetthai/cuora 1.1.305-dev-3 → 1.1.305-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.305-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.305-dev-4...v1.1.305-dev-5) (2024-09-13)
|
|
6
|
+
|
|
7
|
+
### [1.1.305-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.305-dev-3...v1.1.305-dev-4) (2024-09-13)
|
|
8
|
+
|
|
5
9
|
### [1.1.305-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.305-dev-2...v1.1.305-dev-3) (2024-09-12)
|
|
6
10
|
|
|
7
11
|
### [1.1.305-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.305-dev-1...v1.1.305-dev-2) (2024-09-11)
|
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@ export default function (request) {
|
|
|
21
21
|
dailyRedemptionLimit: 0,
|
|
22
22
|
reachedAmountLimit: false,
|
|
23
23
|
activityNo: null,
|
|
24
|
+
claimResultData: null,
|
|
24
25
|
},
|
|
25
26
|
initial: 'idle',
|
|
26
27
|
states: {
|
|
@@ -68,7 +69,7 @@ export default function (request) {
|
|
|
68
69
|
invoke: {
|
|
69
70
|
src: 'claimRebateAmount',
|
|
70
71
|
onDone: {
|
|
71
|
-
target: '
|
|
72
|
+
target: 'checkClaimStatus',
|
|
72
73
|
actions: 'setClaimesult',
|
|
73
74
|
},
|
|
74
75
|
onError: {
|
|
@@ -76,6 +77,16 @@ export default function (request) {
|
|
|
76
77
|
},
|
|
77
78
|
},
|
|
78
79
|
},
|
|
80
|
+
checkClaimStatus: {
|
|
81
|
+
always: [{ target: 'claimed', cond: 'isClaimSuccess' }, { target: 'claimFail' }],
|
|
82
|
+
},
|
|
83
|
+
claimFail: {
|
|
84
|
+
after: {
|
|
85
|
+
0: {
|
|
86
|
+
target: 'claimEnable',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
79
90
|
claimed: {},
|
|
80
91
|
fail: {},
|
|
81
92
|
},
|
|
@@ -131,6 +142,11 @@ export default function (request) {
|
|
|
131
142
|
reachedAmountLimit,
|
|
132
143
|
}
|
|
133
144
|
}),
|
|
145
|
+
setClaimesult: assign((context, event) => {
|
|
146
|
+
return {
|
|
147
|
+
claimResultData: event.data,
|
|
148
|
+
}
|
|
149
|
+
}),
|
|
134
150
|
},
|
|
135
151
|
guards: {
|
|
136
152
|
isClaimAmountLimitReached: (context, event) => {
|
|
@@ -173,6 +189,10 @@ export default function (request) {
|
|
|
173
189
|
deformatRebateAmount >= parseFloat(`${singleMinimumAmountReceive}`)
|
|
174
190
|
)
|
|
175
191
|
},
|
|
192
|
+
isClaimSuccess: (context, event) => {
|
|
193
|
+
const { claimResultData } = context
|
|
194
|
+
return claimResultData?.result === 'success'
|
|
195
|
+
},
|
|
176
196
|
},
|
|
177
197
|
services: {
|
|
178
198
|
estimate: async (context, event) => {
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import activity from '../api/activity.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
const { appSecret } = request.config
|
|
6
|
+
return createMachine(
|
|
7
|
+
{
|
|
8
|
+
id: 'honor_board',
|
|
9
|
+
type: 'parallel',
|
|
10
|
+
context: {
|
|
11
|
+
tick: 6000,
|
|
12
|
+
},
|
|
13
|
+
states: {
|
|
14
|
+
feed: {
|
|
15
|
+
initial: 'updating',
|
|
16
|
+
states: {
|
|
17
|
+
updating: {
|
|
18
|
+
invoke: {
|
|
19
|
+
src: 'fetchHonorBoardList',
|
|
20
|
+
onDone: {
|
|
21
|
+
target: 'waiting',
|
|
22
|
+
actions: 'setBroadcastList',
|
|
23
|
+
},
|
|
24
|
+
onError: {
|
|
25
|
+
target: 'waiting',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
waiting: {
|
|
30
|
+
after: {
|
|
31
|
+
TIMEOUT: {
|
|
32
|
+
target: 'updating',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
broadcast: {
|
|
39
|
+
initial: 'idle',
|
|
40
|
+
states: {
|
|
41
|
+
idle: {
|
|
42
|
+
on: {
|
|
43
|
+
START_BROADCAST: {
|
|
44
|
+
target: 'picking',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
picking: {
|
|
49
|
+
after: {
|
|
50
|
+
5000: {
|
|
51
|
+
target: 'display',
|
|
52
|
+
actions: 'setBroadcast',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
display: {
|
|
57
|
+
after: {
|
|
58
|
+
5000: {
|
|
59
|
+
target: 'picking',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
on: {
|
|
65
|
+
RESET_BROADCAST: {
|
|
66
|
+
target: '.idle',
|
|
67
|
+
actions: 'resetBroadcast',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
delays: {
|
|
75
|
+
TIMEOUT: (context, event) => {
|
|
76
|
+
return context.tick * 10
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
actions: {
|
|
80
|
+
setBroadcastList: assign((context, event) => {
|
|
81
|
+
const broadcastList = (event.data || []).map((item) => item.data).flat()
|
|
82
|
+
const sortBroadcastList = broadcastList.sort((a, b) => {
|
|
83
|
+
if (!a.time) return -1
|
|
84
|
+
if (!b.time) return 1
|
|
85
|
+
return a.time - b.time
|
|
86
|
+
})
|
|
87
|
+
return { broadcastList: sortBroadcastList }
|
|
88
|
+
}),
|
|
89
|
+
setBroadcast: assign((context, event) => {
|
|
90
|
+
const { broadcastList = [], sentNormalBroadcastList = [], normalBroadcast = [] } = context
|
|
91
|
+
let sentNormalList = sentNormalBroadcastList
|
|
92
|
+
if (normalBroadcast) {
|
|
93
|
+
sentNormalList = [...sentNormalBroadcastList, normalBroadcast]
|
|
94
|
+
}
|
|
95
|
+
const nextNormalBroadcast = broadcastList?.find((broadcast) => {
|
|
96
|
+
return !sentNormalList.some((item) => item.broadcastId === broadcast.broadcastId)
|
|
97
|
+
})
|
|
98
|
+
return {
|
|
99
|
+
normalBroadcast: nextNormalBroadcast,
|
|
100
|
+
sentNormalBroadcastList: sentNormalList,
|
|
101
|
+
}
|
|
102
|
+
}),
|
|
103
|
+
resetBroadcast: assign((context, event) => {
|
|
104
|
+
return {
|
|
105
|
+
normalBroadcast: null,
|
|
106
|
+
sentNormalBroadcastList: [],
|
|
107
|
+
}
|
|
108
|
+
}),
|
|
109
|
+
},
|
|
110
|
+
services: {
|
|
111
|
+
fetchHonorBoardList: async (context, event) => {
|
|
112
|
+
const { data } = await request.send(activity.getHonorBroadcast(appSecret))
|
|
113
|
+
return data
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
}
|
package/src/machine/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import vip_table from './vip_table.js'
|
|
|
34
34
|
import promotions from './promotions.js'
|
|
35
35
|
import roulette_v2 from './roulette_v2.js'
|
|
36
36
|
import honor_board_cash from './honor_board_cash.js'
|
|
37
|
+
import honor_board from './honor_board.js'
|
|
37
38
|
import user_photo from './user_photo.js'
|
|
38
39
|
import navbar from './navbar.js'
|
|
39
40
|
|
|
@@ -73,6 +74,7 @@ export default {
|
|
|
73
74
|
promotions,
|
|
74
75
|
roulette_v2,
|
|
75
76
|
honor_board_cash,
|
|
77
|
+
honor_board,
|
|
76
78
|
user_photo,
|
|
77
79
|
navbar,
|
|
78
80
|
...withdraw,
|