import { Jurisdiction } from './entity-id.js'; import { withWidgetUtm as _withWidgetUtm } from './api-shared.js'; /** * Per-call options. As of v2.0 ``jurisdiction`` is REQUIRED — the * legacy /v1/companies/{id} polymorphic alias was removed from the * API, so the SDK has nowhere to fall back to. Callers must commit * to a country up front; widget components mark the prop required * in their TS types so this can't be omitted at compile time. */ export interface CompanyOptions { jurisdiction: Jurisdiction; } export interface OwnerEntry { name: string; sharePercent: number; shares?: number; } export interface CompanyData { orgNumber: string; companyName: string; legalForm: string; registrationDate: string; businessDescription?: string; sniCodes: string[]; address?: { street: string; postalCode: string; city: string; }; status: 'active' | 'inactive' | 'deregistered'; symbol?: string; isin?: string; market?: string; sector?: string; owners?: OwnerEntry[]; } export interface AnnualRow { period: string; revenue?: number; operatingProfit?: number; netIncome?: number; totalAssets?: number; equity?: number; employees?: number; /** * ISO 4217 currency code for the amount columns (`revenue`, * `operatingProfit`, `netIncome`, `totalAssets`, `equity`). Added in * Phase 3 of the cross-stack `revenue_sek` -> `(revenue, currency)` * rename. SE rows ship 'SEK', US 'USD', NO 'NOK', FI 'EUR', DK * 'DKK', UK 'GBP'. Optional in the type because legacy cached * payloads may not carry it - widgets fall back to a plain locale * number when missing. */ currency?: string; } export interface FinancialsData { annual: AnnualRow[]; quarterly: unknown[]; } export interface ApiError { code: string; message: string; } export interface EventItem { eventId: string; eventType: string; title: string; summary?: string; source: string; publishedAt: string; companyId: string; } export interface AnalysisData { healthScore: number; healthBreakdown: Record; valuation: { revenueMultiple: number | null; earningsMultiple: number | null; bookValue: number | null; estimatedValue: number | null; }; risk: { financialRisk: string; profitabilityRisk: string; growthRisk: string; overallRisk: string; }; } export interface SimilarCompany { orgNumber: string; name: string; city?: string; sniCode?: string; } export interface SimilarData { similarCompanies: SimilarCompany[]; count: number; criteria: { sniCode: string; city?: string; }; } /** * UTM tags appended to every outgoing widget API call so our backend * access logs show which traffic originated from the embedded widgets * vs. direct API consumers. The widgets ship no client-side analytics * SDK — this is the only "tracking" they do, and it's visible in the * request URL to anyone inspecting traffic. */ export declare const WIDGET_UTM: { readonly utm_source: "widget"; readonly utm_medium: "embed"; }; export declare const withWidgetUtm: typeof _withWidgetUtm; export declare function enablePublicMode(): void; export declare function isPublicMode(): boolean; declare global { interface Window { __REGNA_PUBLIC_MODE__?: boolean; } } export declare const RegnaClient: { getCompany: (id: string, apiKey: string, opts: CompanyOptions) => Promise; getFinancials: (id: string, apiKey: string, opts: CompanyOptions) => Promise; getEvents: (id: string, apiKey: string, opts: CompanyOptions) => Promise; getOwnership: (id: string, apiKey: string, opts: CompanyOptions) => Promise<{ owners: OwnerEntry[]; }>; getAnalysis: (id: string, apiKey: string, opts: CompanyOptions) => Promise; /** * List similar (peer) companies for a target. * * As of issue #274 the API scopes peer discovery to the target's * market by default. Pass `{ global: true }` to opt into cross- * market peers; the SDK forwards it as `?global=true` on the wire. * The query string survives the public-mode path rewrite because * the rewriter only touches the path, not the search params. */ getSimilar: (id: string, apiKey: string, opts: CompanyOptions & { global?: boolean; }) => Promise; /** * List filings for a company (newest first). Phase 21 of v2.0. * Returns up to 50 by default; pass cursor=next_cursor to paginate. */ listFilings: (id: string, apiKey: string, opts: CompanyOptions & { formType?: string; limit?: number; cursor?: string; }) => Promise<{ companyId: string; filings: Array<{ accessionNumber: string; companyId: string; formType: string; filedDate: string; periodOfReport: string | null; sourceUrl: string; primaryDocument: string; sizeBytes: number; isXbrl: boolean; source: string; }>; nextCursor: string | null; }>; /** * Fetch a single filing by accession number — globally unique across * jurisdictions (SEC for US, synthetic for SE). */ getFiling: (accessionNumber: string, apiKey: string) => Promise<{ accessionNumber: string; companyId: string; formType: string; filedDate: string; periodOfReport: string | null; sourceUrl: string; primaryDocument: string; sizeBytes: number; isXbrl: boolean; source: string; }>; /** * Chat with a single filing — RAG-backed. Returns the answer plus * citations pointing back to specific Items (Item 1A, Item 7, etc.). * Phase 22c of v2.0. */ chatWithFiling: (filingId: string, question: string, apiKey: string) => Promise<{ filingId: string; question: string; answer: string; citations: Array<{ itemId: string; title: string; charOffset: number; }>; }>; /** * Cross-filing semantic search. Filters: country (SE/US), formType, * sicPrefix. Returns ranked passage hits. */ searchFilings: (q: string, apiKey: string, opts?: { country?: "SE" | "US"; formType?: string; sicPrefix?: string; limit?: number; }) => Promise<{ query: string; hits: Array<{ accessionNumber: string; companyId: string; formType: string; itemId: string; title: string; excerpt: string; score: number; }>; }>; /** * Curated demo showcase — the top-10 featured companies served from * the public endpoint. Only meaningful in public mode; authed * consumers should use /companies with their own filter. */ getFeaturedCompanies: () => Promise<{ items: Array<{ orgNr: string; name: string; /** Latest annual revenue in `currency` units (ISO 4217). */ revenue: number | null; /** ISO 4217 - 'SEK' on SE rows, 'USD' on US rows, 'NOK' on NO. */ currency: string; employees: number | null; latestFiling: string | null; isListed: boolean; }>; }>; }; //# sourceMappingURL=widget-api-client.d.ts.map