import { useMemo } from 'react'; import type { Plan } from '../../useService'; export interface UseServiceReturn { currentSubscription: string; orderTotal: string; } export interface UseServiceParams { selectedPlan: Plan | null; } export function useService({ selectedPlan }: UseServiceParams): UseServiceReturn { const currentSubscription = useMemo(() => { if (!selectedPlan) { return ''; } return `${selectedPlan.subTitle}/${selectedPlan.title}`; }, [selectedPlan]); const orderTotal = useMemo(() => { if (!selectedPlan) { return '$0.00'; } return `$${selectedPlan.price.toFixed(2)}`; }, [selectedPlan]); return { currentSubscription, orderTotal, }; }