import { readCachedPaymentLink, writeCachedPaymentLink, } from '../utils/paymentLinkCache'; export function usePaymentLinkCache() { const lastLink = useState('payment-link-cache', () => null); if (import.meta.client && lastLink.value === null) { lastLink.value = readCachedPaymentLink(window.localStorage); } function rememberLink(link: string) { if (!import.meta.client || !link) return; lastLink.value = link; writeCachedPaymentLink(window.localStorage, link); } return { lastLink, rememberLink }; }