UNPKG

@ledgerhq/live-common

Version:
35 lines 1.81 kB
import React, { ReactElement } from "react"; import type { State, ServiceStatusUserSettings, Incident, ServiceStatusApi } from "./types"; import { EntryPoint } from "./entry-points"; type Props = { children: React.ReactNode; autoUpdateDelay: number; networkApi?: ServiceStatusApi; context?: ServiceStatusUserSettings; }; type API = { updateData: () => Promise<void>; }; export type StatusContextType = State & API; export declare function useServiceStatus(): StatusContextType; /** * Filters service status incidents based on related tickers or Ledger components. * * ## Behavior: * - If there are no `tickers` or no `incidents`, returns an empty list. * - For each incident: * 1. ✅ If the incident has no components → keep it (always relevant). * 2. ✅ If at least one component name matches a known **Ledger component** → keep it. * 3. ✅ If at least one component name contains a **currency ticker** → keep it. * 4. ❌ Otherwise, the incident is discarded. * * @param {Incident[]} [incidents=[]] - List of incidents to filter. * @param {string[]} [tickers=[]] - List of currency tickers to match against incident components. * @param {EntryPoint} [entryPoint] - Entry point where the incidents are displayed (specifically for Ledger components) * @returns {Incident[]} The list of incidents relevant to the provided tickers or Ledger components. */ export declare function filterServiceStatusIncidents(incidents?: Incident[], tickers?: string[], entryPoint?: EntryPoint): Incident[]; export declare function useFilteredServiceStatus(filters?: ServiceStatusUserSettings): StatusContextType; export declare const ServiceStatusProvider: ({ children, autoUpdateDelay, networkApi, context, }: Props) => ReactElement; export {}; //# sourceMappingURL=index.d.ts.map