@jetthai/cuora 1.1.234 → 1.1.235
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.235](https://github.com/jetthai/cuora-module/compare/v1.1.234...v1.1.235) (2024-03-25)
|
|
6
|
+
|
|
5
7
|
### [1.1.234](https://github.com/jetthai/cuora-module/compare/v1.1.233...v1.1.234) (2024-03-13)
|
|
6
8
|
|
|
7
9
|
### Bug Fixes
|
package/package.json
CHANGED
package/src/api/activity.js
CHANGED
|
@@ -57,6 +57,11 @@ export default {
|
|
|
57
57
|
method: 'get',
|
|
58
58
|
params: { rewardType, count, appSecret },
|
|
59
59
|
}),
|
|
60
|
+
getCashRainReward: ({ activityNo, appSecret }) => ({
|
|
61
|
+
url: `activities/cashRain`,
|
|
62
|
+
method: 'post',
|
|
63
|
+
params: { activityNo, appSecret },
|
|
64
|
+
}),
|
|
60
65
|
getMaxExchangeAmount: (data) => ({ url: 'activities/exchange/diamond/max-amount', method: 'post', params: data }),
|
|
61
66
|
settleAmount: (data) => ({ url: 'activities/exchange/diamond/settle', method: 'post', params: data }),
|
|
62
67
|
exchange: (data) => ({ url: 'activities/exchange', method: 'post', params: data }),
|
|
@@ -11,6 +11,10 @@ export default function (request, context) {
|
|
|
11
11
|
activityNo,
|
|
12
12
|
activityDetail: null,
|
|
13
13
|
duration: null,
|
|
14
|
+
|
|
15
|
+
// 領獎後得到的資訊
|
|
16
|
+
amount: null,
|
|
17
|
+
message: null,
|
|
14
18
|
},
|
|
15
19
|
initial: 'idle',
|
|
16
20
|
states: {
|
|
@@ -20,6 +24,10 @@ export default function (request, context) {
|
|
|
20
24
|
target: 'loading',
|
|
21
25
|
actions: 'setActivityNo',
|
|
22
26
|
},
|
|
27
|
+
RESET_AWARD: {
|
|
28
|
+
target: 'loaded',
|
|
29
|
+
actions: 'resetAward',
|
|
30
|
+
},
|
|
23
31
|
},
|
|
24
32
|
},
|
|
25
33
|
loading: {
|
|
@@ -42,6 +50,28 @@ export default function (request, context) {
|
|
|
42
50
|
target: 'loaded',
|
|
43
51
|
},
|
|
44
52
|
},
|
|
53
|
+
on: {
|
|
54
|
+
AWARD_PRIZE: {
|
|
55
|
+
target: 'awarding',
|
|
56
|
+
actions: 'setCallback',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
awarding: {
|
|
61
|
+
invoke: {
|
|
62
|
+
src: 'awardPrize',
|
|
63
|
+
onDone: [{ target: 'receivable', actions: 'setAward' }],
|
|
64
|
+
onError: {
|
|
65
|
+
target: 'loaded',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
receivable: {
|
|
70
|
+
after: {
|
|
71
|
+
0: {
|
|
72
|
+
target: 'loading',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
45
75
|
},
|
|
46
76
|
expired: {},
|
|
47
77
|
},
|
|
@@ -72,6 +102,24 @@ export default function (request, context) {
|
|
|
72
102
|
duration: activityDetail.periodEndTime - new Date().getTime() / 1000,
|
|
73
103
|
}
|
|
74
104
|
}),
|
|
105
|
+
setAward: assign((context, event) => {
|
|
106
|
+
const { amount, message } = event.data
|
|
107
|
+
return {
|
|
108
|
+
amount,
|
|
109
|
+
message,
|
|
110
|
+
}
|
|
111
|
+
}),
|
|
112
|
+
setCallback: assign((context, event) => {
|
|
113
|
+
return {
|
|
114
|
+
callback: event.data?.callback || (() => {}),
|
|
115
|
+
}
|
|
116
|
+
}),
|
|
117
|
+
resetAward: assign((context, event) => {
|
|
118
|
+
return {
|
|
119
|
+
amount: null,
|
|
120
|
+
message: null,
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
75
123
|
},
|
|
76
124
|
guards: {
|
|
77
125
|
isExpired: (context, event) => {
|
|
@@ -84,6 +132,11 @@ export default function (request, context) {
|
|
|
84
132
|
const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
|
|
85
133
|
return data
|
|
86
134
|
},
|
|
135
|
+
awardPrize: async (context, event) => {
|
|
136
|
+
const { activityNo } = context
|
|
137
|
+
const { data } = await request.send(api.getCashRainReward({ activityNo, appSecret }))
|
|
138
|
+
return data
|
|
139
|
+
},
|
|
87
140
|
},
|
|
88
141
|
}
|
|
89
142
|
)
|