mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-31 21:52:54 +00:00
Subscribe icon consumers to snapshot SVG metadata so compiler-cached fallbacks update when provider discovery completes.
26 lines
780 B
TypeScript
26 lines
780 B
TypeScript
import {
|
|
BUILTIN_PROVIDER_ICON_NAMES,
|
|
KNOWN_PROVIDER_ICON_NAMES,
|
|
} from "@getpaseo/protocol/provider-icon-names";
|
|
|
|
export type ProviderIconName =
|
|
| { kind: "builtin"; id: string }
|
|
| { kind: "catalog"; id: string }
|
|
| { kind: "svg"; svg: string }
|
|
| { kind: "bot" };
|
|
|
|
const BUILTIN_PROVIDER_IDS = new Set(BUILTIN_PROVIDER_ICON_NAMES);
|
|
const KNOWN_PROVIDER_IDS = new Set(KNOWN_PROVIDER_ICON_NAMES);
|
|
export function resolveProviderIconName(provider: string, iconSvg?: string): ProviderIconName {
|
|
if (BUILTIN_PROVIDER_IDS.has(provider)) {
|
|
return { kind: "builtin", id: provider };
|
|
}
|
|
if (iconSvg) {
|
|
return { kind: "svg", svg: iconSvg };
|
|
}
|
|
if (KNOWN_PROVIDER_IDS.has(provider)) {
|
|
return { kind: "catalog", id: provider };
|
|
}
|
|
return { kind: "bot" };
|
|
}
|