feat: improve error handling for withdraw modal (#5054)

* feat: improve error handling for withdraw modal

* fix: add headers to error info

* prepr

---------

Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
Calum H.
2026-01-06 00:46:34 +00:00
committed by GitHub
parent 0cf28c6392
commit a6cd4dfc0f
4 changed files with 243 additions and 50 deletions

View File

@@ -49,8 +49,13 @@
x{{ item.count }}
</div>
<ButtonStyled circular size="small">
<button v-tooltip="'Copy to clipboard'" @click="copyToClipboard(item)">
<CheckIcon v-if="copied[createNotifText(item)]" />
<button
v-tooltip="
item.supportData ? 'Copy error details for support' : 'Copy to clipboard'
"
@click="copyToClipboard(item)"
>
<CheckIcon v-if="copied[getCopyKey(item)]" />
<CopyIcon v-else />
</button>
</ButtonStyled>
@@ -106,18 +111,26 @@ function createNotifText(notif: WebNotification): string {
return [notif.title, notif.text, notif.errorCode].filter(Boolean).join('\n')
}
function getCopyKey(notif: WebNotification): string {
return notif.supportData ? `support-${notif.id}` : createNotifText(notif)
}
function checkIntercomPresence(): void {
isIntercomPresent.value = !!document.querySelector('.intercom-lightweight-app')
}
function copyToClipboard(notif: WebNotification): void {
const text = createNotifText(notif)
// If supportData is present, copy the full JSON for support; otherwise copy plain text
const text = notif.supportData
? JSON.stringify(notif.supportData, null, 2)
: createNotifText(notif)
copied.value[text] = true
const key = getCopyKey(notif)
copied.value[key] = true
navigator.clipboard.writeText(text)
setTimeout(() => {
const { [text]: _, ...rest } = copied.value
const { [key]: _, ...rest } = copied.value
copied.value = rest
}, 2000)
}

View File

@@ -8,6 +8,7 @@ export interface WebNotification {
errorCode?: string
count?: number
timer?: NodeJS.Timeout
supportData?: Record<string, unknown>
}
export type NotificationPanelLocation = 'left' | 'right'