e42da5c32b
* refactor: remove unnecessary secondary action from EmptyInvoices component * feat: add direct provider layer and provider_consents migration Replace Arcim Sync gateway dependency with direct provider clients for Fortnox, Visma, Briox, Bokio, and Björn Lundén. Adds OAuth config, rate limiting, retry logic, data fetching, and consent storage via new provider_consents/tokens/otc tables. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: migrate arcim extension to direct provider APIs Replace Arcim Sync gateway calls with direct provider API access. Use FortnoxClient.getText() for SIE endpoints that return plain text instead of JSON. OAuth callback now returns HTML with postMessage to communicate with the opener window instead of redirecting. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use OAuth popup window instead of new tab Open provider login in a centered popup that auto-closes on completion via postMessage, keeping the user on a single tab. Falls back to redirect flow if popup is blocked. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add connection status, consent reuse, and SIE duplicate detection - Add listConsents() to query active consents by company - Add GET /status route returning consents, SIE import history, and entity counts - /connect reuses existing accepted consent instead of creating duplicates, and cleans up abandoned (status 0) consents - /status only returns accepted (status 1) consents - /sie-data checks each file's SHA-256 hash against sie_imports to report per-file import status (alreadyImported, importedAt) - /sie-data blocks on SIE validation failure (mirrors manual upload) - /import-sie validates unmapped accounts and auto-activates missing BAS accounts in chart_of_accounts (mirrors manual upload) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: show active connections, SIE file status, and smart re-sync UI - ProviderStep shows active connections with last import date, entity counts, "Synka igen" button, and disconnect option - Already-connected providers greyed out in selection grid - OptionsStep shows per-fiscal-year import status (imported vs new) - SIE toggle disabled with explanation when all files already imported - handleStartMigration skips already-imported SIE files - Auto-skip mapping step and disable SIE on re-sync when up to date - Result step hides empty "0 importerade" rows and shows "Allt är uppdaterat" when nothing new was fetched - OptionRow supports disabled state Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: adjust COMING_SOON_PROVIDERS based on NODE_ENV for development and production * Removed duplicate * Removed duplicate * refactor: redesign reports page navigation from grid boxes to bordered card layout Replace the 4-column grid of uneven TabsList boxes with a CSS grid card using auto-sized columns separated by 1px border dividers. All sections now share equal height via items-stretch, with clear visual separation between groups. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: trigger Vercel deployment * Update supabase/migrations/20260402010000_provider_consents.sql Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update lib/providers/rate-limiter.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * chore: re-trigger checks after migration sync --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
import type { ResourceType } from './dto';
|
|
|
|
export type ProviderName = 'fortnox' | 'visma' | 'briox' | 'bokio' | 'bjornlunden';
|
|
|
|
export interface RateLimitConfig {
|
|
maxRequests: number;
|
|
windowMs: number;
|
|
}
|
|
|
|
export interface OAuthConfig {
|
|
clientId: string;
|
|
clientSecret: string;
|
|
redirectUri: string;
|
|
}
|
|
|
|
export interface TokenResponse {
|
|
access_token: string;
|
|
refresh_token: string;
|
|
token_type: string;
|
|
expires_in: number;
|
|
}
|
|
|
|
export interface ResourceConfig {
|
|
listEndpoint: string;
|
|
detailEndpoint: string;
|
|
idField: string;
|
|
mapper: (raw: Record<string, unknown>) => unknown;
|
|
singleton?: boolean;
|
|
}
|
|
|
|
export interface FortnoxResourceConfig extends ResourceConfig {
|
|
listKey: string;
|
|
detailKey: string;
|
|
supportsLastModified: boolean;
|
|
resolveDetailPath?: (resourceId: string, query?: Record<string, string>) => string;
|
|
supportsEntryHydration?: boolean;
|
|
}
|
|
|
|
export interface VismaResourceConfig extends ResourceConfig {
|
|
supportsModifiedFilter: boolean;
|
|
modifiedField?: string;
|
|
}
|
|
|
|
export interface BrioxResourceConfig extends ResourceConfig {
|
|
listKey: string;
|
|
supportsModifiedFilter: boolean;
|
|
yearScoped?: boolean;
|
|
supportsEntryHydration?: boolean;
|
|
detailKey?: string;
|
|
}
|
|
|
|
export interface BokioResourceConfig extends ResourceConfig {
|
|
paginated?: boolean;
|
|
}
|
|
|
|
export interface BjornLundenResourceConfig extends ResourceConfig {
|
|
paginated?: boolean;
|
|
}
|