* 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
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import type { AnnualReportEligibilityResult, AnnualReportFramework } from './compliance-types'
|
|
|
|
export interface AnnualReportCapabilities {
|
|
paper: {
|
|
enabled: boolean
|
|
delivery: 'post'
|
|
reason: string | null
|
|
}
|
|
ixbrl_preview: {
|
|
enabled: boolean
|
|
reason: string | null
|
|
}
|
|
connected_filing: {
|
|
enabled: boolean
|
|
release_gate_open: boolean
|
|
reason: string | null
|
|
}
|
|
}
|
|
|
|
export const CONNECTED_FILING_PUBLIC_RELEASED =
|
|
process.env.NEXT_PUBLIC_BOLAGSVERKET_FILING_ENABLED === 'true'
|
|
|
|
export function getAnnualReportCapabilities(
|
|
framework: AnnualReportFramework,
|
|
eligibility?: AnnualReportEligibilityResult,
|
|
): AnnualReportCapabilities {
|
|
const releaseGateOpen = process.env.NEXT_PUBLIC_BOLAGSVERKET_FILING_ENABLED === 'true'
|
|
const ixbrlEnabled = framework === 'k2'
|
|
const eligible = eligibility?.digital_filing_eligible ?? false
|
|
return {
|
|
paper: {
|
|
enabled: framework === 'k2',
|
|
delivery: 'post',
|
|
reason:
|
|
framework === 'k2'
|
|
? null
|
|
: 'K3-dokumentet är endast ett granskningsutkast tills hela upplysningsmatrisen är implementerad och granskad.',
|
|
},
|
|
ixbrl_preview: {
|
|
enabled: ixbrlEnabled,
|
|
reason: ixbrlEnabled ? null : 'iXBRL-generering stöds ännu endast för K2.',
|
|
},
|
|
connected_filing: {
|
|
enabled: releaseGateOpen && ixbrlEnabled && eligible,
|
|
release_gate_open: releaseGateOpen,
|
|
reason: !releaseGateOpen
|
|
? 'Direktinlämning öppnas först efter avtal, certifikat och godkänd acceptanstest.'
|
|
: !ixbrlEnabled
|
|
? 'Direktinlämning stöds ännu endast för K2.'
|
|
: !eligible
|
|
? 'Årsredovisningen uppfyller inte alla behörighets- och fullständighetskrav.'
|
|
: null,
|
|
},
|
|
}
|
|
}
|