Bug/gh issues fiz (#1103)
* refactor: optimize page loading and data fetching * fix: resolve recurring production runtime errors * feat: add MCP company and customer updates * fix: handle year-end tax adjustments * feat: harden annual report compliance * fix: expand invoice logo and font support * fix: sanitize API route error responses * fix: sanitize user-facing error messages * feat: persist onboarding and tax assessment notices * fix: reduce cloud backup audit churn * feat: refine invoice editor layout * fix: show saved tax adjustments in INK2 * fix: complete annual report API mappings * docs: record operational safeguards and decisions * fix: harden annual report review findings * fix: adjust column span for description based on VAT registration * New css class name
This commit is contained in:
@@ -13,6 +13,7 @@ import { ConfirmationDialog } from '@/components/ui/confirmation-dialog'
|
||||
import Link from 'next/link'
|
||||
import { FallbackPrompt } from '@/components/ui/fallback-prompt'
|
||||
import { getBranding } from '@/lib/branding/service'
|
||||
import { getErrorMessage as getUserErrorMessage } from '@/lib/errors/get-error-message'
|
||||
|
||||
const branding = getBranding()
|
||||
import {
|
||||
@@ -1827,7 +1828,7 @@ export default function ArcimMigrationWorkspace(_props: WorkspaceComponentProps)
|
||||
setMigrationOptions(prev => ({ ...prev, importSIEData: false }))
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Kunde inte hämta förhandsgranskning')
|
||||
setError(err instanceof Error ? getUserErrorMessage(err) : 'Kunde inte hämta förhandsgranskning')
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
@@ -1866,7 +1867,7 @@ export default function ArcimMigrationWorkspace(_props: WorkspaceComponentProps)
|
||||
}
|
||||
// Token-based providers stay on connect step for credential input
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Anslutning misslyckades')
|
||||
setError(err instanceof Error ? getUserErrorMessage(err) : 'Anslutning misslyckades')
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
@@ -1925,7 +1926,7 @@ export default function ArcimMigrationWorkspace(_props: WorkspaceComponentProps)
|
||||
setStep('connect')
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Kunde inte återansluta')
|
||||
setError(err instanceof Error ? getUserErrorMessage(err) : 'Kunde inte återansluta')
|
||||
setAuthExpired(true)
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
@@ -1947,7 +1948,7 @@ export default function ArcimMigrationWorkspace(_props: WorkspaceComponentProps)
|
||||
toast({ title: 'Frånkopplad', description: 'Anslutningen har tagits bort.' })
|
||||
await fetchStatus()
|
||||
} catch (err) {
|
||||
toast({ title: err instanceof Error ? err.message : 'Något gick fel', variant: 'destructive' })
|
||||
toast({ title: err instanceof Error ? getUserErrorMessage(err) : 'Något gick fel', variant: 'destructive' })
|
||||
}
|
||||
}, [toast, fetchStatus])
|
||||
|
||||
@@ -1978,7 +1979,7 @@ export default function ArcimMigrationWorkspace(_props: WorkspaceComponentProps)
|
||||
// Token stored: consent is now accepted, proceed to preview
|
||||
await loadPreview(consentId)
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Kunde inte ansluta')
|
||||
setError(err instanceof Error ? getUserErrorMessage(err) : 'Kunde inte ansluta')
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
@@ -2079,7 +2080,7 @@ export default function ArcimMigrationWorkspace(_props: WorkspaceComponentProps)
|
||||
setStep('options')
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Kunde inte hämta SIE-data')
|
||||
setError(err instanceof Error ? getUserErrorMessage(err) : 'Kunde inte hämta SIE-data')
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
@@ -2229,7 +2230,7 @@ export default function ArcimMigrationWorkspace(_props: WorkspaceComponentProps)
|
||||
description: 'Din bokföringsdata har importerats.',
|
||||
})
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : 'Migrering misslyckades'
|
||||
const msg = getUserErrorMessage(err)
|
||||
setError(msg)
|
||||
setStep('result')
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import { useToast } from '@/components/ui/use-toast'
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { formatCurrency } from '@/lib/utils'
|
||||
import type { InvoiceExtractionResult, VatTreatment } from '@/types'
|
||||
import { getErrorMessage as getUserErrorMessage } from '@/lib/errors/get-error-message'
|
||||
|
||||
// Minimal shape the dialog needs from the workspace's inbox items.
|
||||
interface BulkBookInboxItem {
|
||||
@@ -145,7 +146,7 @@ export default function BulkBookInboxDialog({ open, onOpenChange, items, onSucce
|
||||
} catch (err) {
|
||||
toast({
|
||||
title: 'Bokföringen misslyckades',
|
||||
description: err instanceof Error ? err.message : 'Okänt fel',
|
||||
description: err instanceof Error ? getUserErrorMessage(err) : 'Okänt fel',
|
||||
variant: 'destructive',
|
||||
})
|
||||
} finally {
|
||||
|
||||
@@ -16,6 +16,7 @@ import { useToast } from '@/components/ui/use-toast'
|
||||
import { AlertTriangle, Check, Copy, Loader2, RefreshCw, Trash2 } from 'lucide-react'
|
||||
import { formatDateLong } from '@/lib/utils'
|
||||
import type { CompanyInboundDomain, InboundDomainDnsRecord } from '@/types'
|
||||
import { getErrorMessage as getUserErrorMessage } from '@/lib/errors/get-error-message'
|
||||
|
||||
const BASE = '/api/extensions/ext/invoice-inbox/inbox/domain'
|
||||
|
||||
@@ -83,7 +84,7 @@ export default function InboxCustomDomainDialog({ open, onOpenChange }: Props) {
|
||||
} catch (err) {
|
||||
toast({
|
||||
title: 'Kunde inte lägga till domänen',
|
||||
description: err instanceof Error ? err.message : 'Försök igen.',
|
||||
description: err instanceof Error ? getUserErrorMessage(err) : 'Försök igen.',
|
||||
variant: 'destructive',
|
||||
})
|
||||
} finally {
|
||||
@@ -106,7 +107,7 @@ export default function InboxCustomDomainDialog({ open, onOpenChange }: Props) {
|
||||
} catch (err) {
|
||||
toast({
|
||||
title: 'Kontrollen misslyckades',
|
||||
description: err instanceof Error ? err.message : 'Försök igen.',
|
||||
description: err instanceof Error ? getUserErrorMessage(err) : 'Försök igen.',
|
||||
variant: 'destructive',
|
||||
})
|
||||
} finally {
|
||||
@@ -127,7 +128,7 @@ export default function InboxCustomDomainDialog({ open, onOpenChange }: Props) {
|
||||
} catch (err) {
|
||||
toast({
|
||||
title: 'Borttagningen misslyckades',
|
||||
description: err instanceof Error ? err.message : 'Försök igen.',
|
||||
description: err instanceof Error ? getUserErrorMessage(err) : 'Försök igen.',
|
||||
variant: 'destructive',
|
||||
})
|
||||
} finally {
|
||||
|
||||
@@ -48,6 +48,7 @@ import BulkBookInboxDialog from '@/components/extensions/general/BulkBookInboxDi
|
||||
// INBOX_CUSTOM_DOMAINS_ENABLED in extensions/general/invoice-inbox/index.ts.
|
||||
import TransactionMatchPicker from '@/components/inbox/TransactionMatchPicker'
|
||||
import { useAgentSheet } from '@/components/agent/AgentSheetProvider'
|
||||
import { getErrorMessage as getUserErrorMessage } from '@/lib/errors/get-error-message'
|
||||
|
||||
type AccountingMethod = 'accrual' | 'cash'
|
||||
|
||||
@@ -458,7 +459,7 @@ export default function InvoiceInboxWorkspace(_props: WorkspaceComponentProps) {
|
||||
} catch (err) {
|
||||
toast({
|
||||
title: 'Kunde inte ladda dokumentet',
|
||||
description: err instanceof Error ? err.message : 'Försök igen.',
|
||||
description: err instanceof Error ? getUserErrorMessage(err) : 'Försök igen.',
|
||||
variant: 'destructive',
|
||||
})
|
||||
}
|
||||
@@ -534,7 +535,7 @@ export default function InvoiceInboxWorkspace(_props: WorkspaceComponentProps) {
|
||||
}
|
||||
toast({
|
||||
title: 'Uppladdning misslyckades',
|
||||
description: err instanceof Error ? err.message : 'Försök igen.',
|
||||
description: err instanceof Error ? getUserErrorMessage(err) : 'Försök igen.',
|
||||
variant: 'destructive',
|
||||
})
|
||||
} finally {
|
||||
@@ -597,7 +598,7 @@ export default function InvoiceInboxWorkspace(_props: WorkspaceComponentProps) {
|
||||
} catch (err) {
|
||||
toast({
|
||||
title: 'Kunde inte ta bort',
|
||||
description: err instanceof Error ? err.message : 'Försök igen.',
|
||||
description: err instanceof Error ? getUserErrorMessage(err) : 'Försök igen.',
|
||||
variant: 'destructive',
|
||||
})
|
||||
} finally {
|
||||
@@ -697,7 +698,7 @@ export default function InvoiceInboxWorkspace(_props: WorkspaceComponentProps) {
|
||||
} catch (err) {
|
||||
toast({
|
||||
title: 'Rotation misslyckades',
|
||||
description: err instanceof Error ? err.message : 'Försök igen.',
|
||||
description: err instanceof Error ? getUserErrorMessage(err) : 'Försök igen.',
|
||||
variant: 'destructive',
|
||||
})
|
||||
} finally {
|
||||
@@ -2049,7 +2050,7 @@ export function EditableFieldsList({
|
||||
toast({
|
||||
variant: 'destructive',
|
||||
title: 'Nätverksfel',
|
||||
description: err instanceof Error ? err.message : 'Kunde inte spara',
|
||||
description: err instanceof Error ? getUserErrorMessage(err) : 'Kunde inte spara',
|
||||
})
|
||||
setDrafts((prev) => ({ ...prev, [key]: readField(data, key) }))
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
Upload, FileJson, FileSpreadsheet, Download, AlertCircle, Check,
|
||||
} from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getErrorMessage as getUserErrorMessage } from '@/lib/errors/get-error-message'
|
||||
|
||||
// ── Types ─────────────────────────────────────────────────────
|
||||
|
||||
@@ -192,7 +193,7 @@ export default function MockDataImportDialog<T>({
|
||||
await onImport(report, { source: 'csv', fileName, rowCount: mappedRows.length })
|
||||
handleOpenChange(false)
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : 'Import misslyckades')
|
||||
setError(e instanceof Error ? getUserErrorMessage(e) : 'Import misslyckades')
|
||||
setStep('map-csv')
|
||||
}
|
||||
}, [csvRows, csvHeaders, mappings, parseCsvRows, onImport, fileName, handleOpenChange])
|
||||
@@ -206,7 +207,7 @@ export default function MockDataImportDialog<T>({
|
||||
await onImport(jsonReport, { source: 'json', fileName, rowCount: 0 })
|
||||
handleOpenChange(false)
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : 'Import misslyckades')
|
||||
setError(e instanceof Error ? getUserErrorMessage(e) : 'Import misslyckades')
|
||||
setStep('preview-json')
|
||||
}
|
||||
}, [jsonReport, onImport, fileName, handleOpenChange])
|
||||
|
||||
Reference in New Issue
Block a user