import type { RegionalLogic } from "../../regional" import type { PricingWidgetProps } from "../../regional" /** * ExplicitPricingWidget — Pattern 3 (explicit props, maximum testability). * * Receives `logic` as a prop instead of reading it from context. * No `RegionalProvider` ancestor required — can be unit-tested directly: * * @example * // In a test — no provider needed: * const logic = createLogic(ukConfig) * render() * * // In a component — wire logic from context in the parent: * const { logic } = useRegional() * * * Compare with DefaultPricingWidget (src/config/regions/default/components.tsx) * which reads logic via useRegional() internally (Pattern 1). */ export function ExplicitPricingWidget({ amount, logic, }: PricingWidgetProps & { logic: RegionalLogic }) { return (
{logic.formatAmount(amount)}
) }