(rawValue: number)
| 264 | ) |
| 265 | |
| 266 | const handleThresholdChange = (rawValue: number) => { |
| 267 | // Allow any value for UI display |
| 268 | setThreshold(rawValue) |
| 269 | |
| 270 | if (isEnabled) { |
| 271 | // Make sure we send a valid value to the server |
| 272 | const validValue = clamp( |
| 273 | rawValue, |
| 274 | MIN_THRESHOLD_CREDITS, |
| 275 | MAX_THRESHOLD_CREDITS, |
| 276 | ) |
| 277 | pendingSettings.current = { threshold: validValue, topUpAmountDollars } |
| 278 | |
| 279 | // Only save if the value is valid |
| 280 | if ( |
| 281 | rawValue >= MIN_THRESHOLD_CREDITS && |
| 282 | rawValue <= MAX_THRESHOLD_CREDITS |
| 283 | ) { |
| 284 | debouncedSaveSettings() |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | const handleTopUpAmountChange = (rawValue: number) => { |
| 290 | // Allow any value for UI display |
no test coverage detected