(value: string | null)
| 1 | import { MAX_ITERATIONS } from '@/lib/bot/constants'; |
| 2 | |
| 3 | export function parseBotCallbackStep(value: string | null): number { |
| 4 | if (!value) return 0; |
| 5 | |
| 6 | const parsed = Number(value); |
| 7 | if (!Number.isSafeInteger(parsed) || parsed < 0) return 0; |
| 8 | |
| 9 | return Math.min(parsed, MAX_ITERATIONS); |
| 10 | } |
| 11 | |
| 12 | export function getRemainingBotIterations(completedStepCount: number): number { |
| 13 | if (!Number.isSafeInteger(completedStepCount) || completedStepCount < 0) { |
no outgoing calls
no test coverage detected