@jetthai/cuora 1.1.302-dev-1 → 1.1.302-dev-3
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.302-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.302-dev-2...v1.1.302-dev-3) (2024-09-06)
|
|
6
|
+
|
|
7
|
+
### [1.1.302-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.302-dev-1...v1.1.302-dev-2) (2024-09-04)
|
|
8
|
+
|
|
5
9
|
### [1.1.302-dev-1](https://github.com/jetthai/cuora-module/compare/v1.0.302-dev-1...v1.1.302-dev-1) (2024-09-04)
|
|
6
10
|
|
|
7
11
|
### [1.0.302-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.302...v1.0.302-dev-1) (2024-09-04)
|
package/package.json
CHANGED
|
@@ -7,12 +7,14 @@ export default function (request) {
|
|
|
7
7
|
id: 'instant_rebate_activity',
|
|
8
8
|
context: {
|
|
9
9
|
enableCollectButton: false,
|
|
10
|
+
estimateStartTime: null,
|
|
11
|
+
estimateEndTime: null,
|
|
10
12
|
lastCollectTime: null,
|
|
11
13
|
lastEstimateTime: null,
|
|
12
14
|
collectAvailable: false,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
cumulativeValidTurnover: null,
|
|
16
|
+
cumulativeRebateAmount: null,
|
|
17
|
+
actualRebateAmount: null,
|
|
16
18
|
rewardType: null,
|
|
17
19
|
singleMinimumAmountReceive: null,
|
|
18
20
|
remainingCount: 0,
|
|
@@ -120,16 +122,25 @@ export default function (request) {
|
|
|
120
122
|
}
|
|
121
123
|
}),
|
|
122
124
|
setInitData: assign((context, event) => {
|
|
123
|
-
const {
|
|
124
|
-
|
|
125
|
+
const {
|
|
126
|
+
enableCollectButton = false,
|
|
127
|
+
lastCollectTime = 0,
|
|
128
|
+
lastEstimateTime = 0,
|
|
129
|
+
estimateStartTime = 0,
|
|
130
|
+
estimateEndTime = 0,
|
|
131
|
+
rewardType,
|
|
132
|
+
} = event.data
|
|
133
|
+
return { enableCollectButton, lastCollectTime, lastEstimateTime, estimateStartTime, estimateEndTime, rewardType }
|
|
125
134
|
}),
|
|
126
135
|
setEstimateResult: assign((context, event) => {
|
|
127
136
|
const {
|
|
137
|
+
estimateStartTime = 0,
|
|
138
|
+
estimateEndTime = 0,
|
|
128
139
|
lastCollectTime = 0,
|
|
129
140
|
collectAvailable = false,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
141
|
+
cumulativeValidTurnover = '0',
|
|
142
|
+
cumulativeRebateAmount = '0',
|
|
143
|
+
actualRebateAmount = '0',
|
|
133
144
|
rewardType = null,
|
|
134
145
|
singleMinimumAmountReceive = 0,
|
|
135
146
|
remainingCount = 0,
|
|
@@ -137,11 +148,13 @@ export default function (request) {
|
|
|
137
148
|
} = event.data
|
|
138
149
|
|
|
139
150
|
return {
|
|
151
|
+
estimateStartTime,
|
|
152
|
+
estimateEndTime,
|
|
140
153
|
lastCollectTime,
|
|
141
154
|
collectAvailable,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
155
|
+
cumulativeValidTurnover,
|
|
156
|
+
cumulativeRebateAmount,
|
|
157
|
+
actualRebateAmount,
|
|
145
158
|
rewardType,
|
|
146
159
|
singleMinimumAmountReceive,
|
|
147
160
|
remainingCount,
|
|
@@ -151,14 +164,14 @@ export default function (request) {
|
|
|
151
164
|
},
|
|
152
165
|
guards: {
|
|
153
166
|
isEstimatable: (context, event) => {
|
|
154
|
-
const {
|
|
155
|
-
|
|
167
|
+
const { lastEstimateTime } = context
|
|
168
|
+
const currentTime = new Date().getTime() / 1000
|
|
169
|
+
if (Math.floor(`${currentTime}`) === Math.floor(`${lastEstimateTime}`)) {
|
|
156
170
|
return true
|
|
157
171
|
} else {
|
|
158
172
|
const fiveMinutes = 60 * 5
|
|
159
|
-
const currentTime = new Date().getTime() / 1000
|
|
160
173
|
|
|
161
|
-
return
|
|
174
|
+
return Math.floor(`${currentTime}`) - Math.floor(`${lastEstimateTime}`) > fiveMinutes
|
|
162
175
|
}
|
|
163
176
|
},
|
|
164
177
|
isClaimExhausted: (context, event) => {
|
|
@@ -166,29 +179,29 @@ export default function (request) {
|
|
|
166
179
|
return !collectAvailable && parseInt(`${remainingCount}`) === parseInt(`${dailyRedemptionLimit}`)
|
|
167
180
|
},
|
|
168
181
|
isInsufficientAmount: (context, event) => {
|
|
169
|
-
const { collectAvailable, singleMinimumAmountReceive,
|
|
170
|
-
let splitArray =
|
|
182
|
+
const { collectAvailable, singleMinimumAmountReceive, actualRebateAmount } = context
|
|
183
|
+
let splitArray = actualRebateAmount?.split(',')
|
|
171
184
|
let combindString = '0'
|
|
172
185
|
if (splitArray?.length > 0) {
|
|
173
186
|
splitArray.forEach((item) => {
|
|
174
187
|
combindString += item
|
|
175
188
|
})
|
|
176
189
|
} else {
|
|
177
|
-
combindString =
|
|
190
|
+
combindString = actualRebateAmount
|
|
178
191
|
}
|
|
179
192
|
const deformatRebateAmount = parseFloat(`${combindString}`)
|
|
180
193
|
return !collectAvailable && deformatRebateAmount < parseFloat(`${singleMinimumAmountReceive}`)
|
|
181
194
|
},
|
|
182
195
|
isClaimEnable: (context, event) => {
|
|
183
|
-
const { collectAvailable, remainingCount, dailyRedemptionLimit,
|
|
184
|
-
let splitArray =
|
|
196
|
+
const { collectAvailable, remainingCount, dailyRedemptionLimit, actualRebateAmount, singleMinimumAmountReceive } = context
|
|
197
|
+
let splitArray = actualRebateAmount?.split(',')
|
|
185
198
|
let combindString = '0'
|
|
186
199
|
if (splitArray?.length > 0) {
|
|
187
200
|
splitArray.forEach((item) => {
|
|
188
201
|
combindString += item
|
|
189
202
|
})
|
|
190
203
|
} else {
|
|
191
|
-
combindString =
|
|
204
|
+
combindString = actualRebateAmount
|
|
192
205
|
}
|
|
193
206
|
const deformatRebateAmount = parseFloat(combindString)
|
|
194
207
|
return (
|
package/src/machine/auth.js
CHANGED
|
@@ -166,13 +166,25 @@ export default function (request) {
|
|
|
166
166
|
invoke: {
|
|
167
167
|
src: 'checkDeviceToken',
|
|
168
168
|
onDone: {
|
|
169
|
-
target: '
|
|
169
|
+
target: 'checkDeviceTokenDone',
|
|
170
170
|
},
|
|
171
171
|
onError: {
|
|
172
172
|
target: 'fetching',
|
|
173
173
|
},
|
|
174
174
|
},
|
|
175
175
|
},
|
|
176
|
+
checkDeviceTokenDone: {
|
|
177
|
+
invoke: {
|
|
178
|
+
src: 'fetchUserInfo',
|
|
179
|
+
onDone: {
|
|
180
|
+
target: 'pending',
|
|
181
|
+
actions: ['setUserInfo', 'extendToken'],
|
|
182
|
+
},
|
|
183
|
+
onError: {
|
|
184
|
+
target: '#auth.leaving',
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
176
188
|
fetching: {
|
|
177
189
|
invoke: {
|
|
178
190
|
src: 'fetchUserInfo',
|