fix(cash-in): restore cancel button and add displayingQR timeout
Cancel button is now always visible during the cash-in flow. The state machine routes CANCEL to confirmAbandon when bills are present, so the user always has an exit path with appropriate warnings. Also adds a 5-minute auto-timeout on displayingQR and allows cancel during generatingNdebit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
13ac74ab86
commit
0406a21b0e
2 changed files with 17 additions and 8 deletions
|
|
@ -16,15 +16,19 @@ const atmStore = useAtmStore()
|
|||
const isElectron = typeof window !== 'undefined' && window.electronAPI !== undefined
|
||||
|
||||
// Whether the header cancel button should be visible
|
||||
// Hide after bills are inserted — state machine routes to confirmAbandon instead
|
||||
// State machine routes CANCEL to confirmAbandon when bills are present
|
||||
const showCancelButton = computed(() => {
|
||||
const state = atmStore.nestedState
|
||||
const hasBills = (atmStore.context?.billsInserted.length ?? 0) > 0
|
||||
// Show in fetchingRate (no bills yet) and insertingBills only before bills are in
|
||||
if (state === 'fetchingRate') return true
|
||||
if (state === 'insertingBills' && !hasBills) return true
|
||||
if (state === 'error' && !hasBills) return true
|
||||
// Hide when bills are in the cash box
|
||||
// Show cancel in states where user might want to exit
|
||||
// State machine handles routing: no bills → idle, bills → confirmAbandon
|
||||
if (
|
||||
state === 'fetchingRate' ||
|
||||
state === 'insertingBills' ||
|
||||
state === 'generatingNdebit' ||
|
||||
state === 'displayingQR' ||
|
||||
state === 'error'
|
||||
)
|
||||
return true
|
||||
return false
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -449,7 +449,6 @@ export function createATMMachine(
|
|||
},
|
||||
},
|
||||
generatingNdebit: {
|
||||
// No CANCEL here — bills are already in the cash box
|
||||
invoke: {
|
||||
src: 'generateNdebit',
|
||||
input: ({ context }) => context,
|
||||
|
|
@ -465,8 +464,14 @@ export function createATMMachine(
|
|||
actions: 'setError',
|
||||
},
|
||||
},
|
||||
on: {
|
||||
CANCEL: 'confirmAbandon',
|
||||
},
|
||||
},
|
||||
displayingQR: {
|
||||
after: {
|
||||
TIMEOUT_MS: 'confirmAbandon',
|
||||
},
|
||||
on: {
|
||||
PAYMENT_RECEIVED: {
|
||||
target: 'askForReceipt',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue