@jetthai/cuora 1.1.281 → 1.1.283
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.283](https://github.com/jetthai/cuora-module/compare/v1.1.282...v1.1.283) (2024-06-24)
|
|
6
|
+
|
|
7
|
+
### [1.1.282](https://github.com/jetthai/cuora-module/compare/v1.1.281...v1.1.282) (2024-06-24)
|
|
8
|
+
|
|
5
9
|
### [1.1.281](https://github.com/jetthai/cuora-module/compare/v1.1.280...v1.1.281) (2024-06-18)
|
|
6
10
|
|
|
7
11
|
### [1.1.280](https://github.com/jetthai/cuora-module/compare/v1.1.270-fix-7...v1.1.280) (2024-06-15)
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ export default function (request) {
|
|
|
13
13
|
settlementTime: null,
|
|
14
14
|
validTurnover: null,
|
|
15
15
|
rebateAmount: null,
|
|
16
|
+
rewardType: null,
|
|
16
17
|
singleMinimumAmountReceive: null,
|
|
17
18
|
remainingCount: 0,
|
|
18
19
|
dailyRedemptionLimit: 0,
|
|
@@ -129,6 +130,7 @@ export default function (request) {
|
|
|
129
130
|
settlementTime = 0,
|
|
130
131
|
validTurnover = '0',
|
|
131
132
|
rebateAmount = '0',
|
|
133
|
+
rewardType = null,
|
|
132
134
|
singleMinimumAmountReceive = 0,
|
|
133
135
|
remainingCount = 0,
|
|
134
136
|
dailyRedemptionLimit = 0,
|
|
@@ -140,6 +142,7 @@ export default function (request) {
|
|
|
140
142
|
settlementTime,
|
|
141
143
|
validTurnover,
|
|
142
144
|
rebateAmount,
|
|
145
|
+
rewardType,
|
|
143
146
|
singleMinimumAmountReceive,
|
|
144
147
|
remainingCount,
|
|
145
148
|
dailyRedemptionLimit,
|
package/src/machine/common.js
CHANGED
|
@@ -286,7 +286,18 @@ export default function (request) {
|
|
|
286
286
|
services: {
|
|
287
287
|
fetchConfig: async (context, event) => {
|
|
288
288
|
const [site, layout] = await Promise.all([request.send(api.getConfig({ appSecret })), request.send(api.getLayoutConfig({ appSecret }))])
|
|
289
|
-
|
|
289
|
+
const base64Url = site.config.split('.')[0]
|
|
290
|
+
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')
|
|
291
|
+
const decodeResult = decodeURIComponent(
|
|
292
|
+
window
|
|
293
|
+
.atob(base64)
|
|
294
|
+
.split('')
|
|
295
|
+
.map((c) => {
|
|
296
|
+
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
|
|
297
|
+
})
|
|
298
|
+
.join('')
|
|
299
|
+
)
|
|
300
|
+
return { siteConfig: JSON.parse(decodeResult), layoutConfig: layout.config }
|
|
290
301
|
},
|
|
291
302
|
fetchFeeds: async (context, event) => {
|
|
292
303
|
return await request.send(api.feeds({ appSecret }))
|
|
@@ -152,7 +152,9 @@ export default function (request, context) {
|
|
|
152
152
|
setAmount: assign((context, event) => {
|
|
153
153
|
// 現金網可自由填額度,grandTotalEnable 欄位感覺不再需要?
|
|
154
154
|
if (context.selectedCrypto?.grandTotalEnable === 1) {
|
|
155
|
-
return {
|
|
155
|
+
return {
|
|
156
|
+
selectedAmount: preciseAdd(`${parseFloat(context.selectedAmount || 0)}`, `${parseFloat(event.data)}`),
|
|
157
|
+
}
|
|
156
158
|
} else {
|
|
157
159
|
return { selectedAmount: event.data }
|
|
158
160
|
}
|
|
@@ -240,3 +242,15 @@ export default function (request, context) {
|
|
|
240
242
|
}
|
|
241
243
|
)
|
|
242
244
|
}
|
|
245
|
+
|
|
246
|
+
function preciseAdd(a, b) {
|
|
247
|
+
let aStr = a.toString()
|
|
248
|
+
let bStr = b.toString()
|
|
249
|
+
|
|
250
|
+
let aDecimalPlaces = aStr.split('.')[1] ? aStr.split('.')[1].length : 0
|
|
251
|
+
let bDecimalPlaces = bStr.split('.')[1] ? bStr.split('.')[1].length : 0
|
|
252
|
+
|
|
253
|
+
let factor = Math.pow(10, Math.max(aDecimalPlaces, bDecimalPlaces))
|
|
254
|
+
|
|
255
|
+
return (Math.round(a * factor) + Math.round(b * factor)) / factor
|
|
256
|
+
}
|