import * as RemixIcons from "@remixicon/react"; import type { ComponentType, ReactNode } from "react"; const ICON_CLASS = "h-4 w-4"; const normalizeKey = (value: string) => value .normalize("NFD") .replace(/\p{Diacritic}/gu, "") .toLowerCase() .replace(/[^a-z0-9]/g, ""); export const getIconComponent = ( iconName: string, ): ComponentType<{ className?: string }> | null => { // Busca o ícone no objeto de ícones do Remix Icon const icon = (RemixIcons as Record)[iconName]; if (icon && typeof icon === "function") { return icon as ComponentType<{ className?: string }>; } return null; }; export const getConditionIcon = (condition: string): ReactNode => { const key = normalizeKey(condition); const registry: Record = { parcelado: , recorrente: , avista: , vista: , }; return registry[key] ?? null; }; export const getPaymentMethodIcon = (paymentMethod: string): ReactNode => { const key = normalizeKey(paymentMethod); const registry: Record = { dinheiro: ( ), pix: , boleto: , credito: ( ), cartaodecredito: ( ), cartaodedebito: ( ), debito: , prepagovrva: , transferenciabancaria: ( ), }; return registry[key] ?? null; };