import { Disclosure } from "@headlessui/react" import { Badge, Button, clx } from "@medusajs/ui" import { useEffect } from "react" import useToggleState from "@lib/hooks/use-toggle-state" import { useFormStatus } from "react-dom" type AccountInfoProps = { label: string currentInfo: string | React.ReactNode isSuccess?: boolean isError?: boolean errorMessage?: string clearState: () => void children?: React.ReactNode 'data-testid'?: string } const AccountInfo = ({ label, currentInfo, isSuccess, isError, clearState, errorMessage = "An error occurred, please try again", children, 'data-testid': dataTestid }: AccountInfoProps) => { const { state, close, toggle } = useToggleState() const { pending } = useFormStatus() const handleToggle = () => { clearState() setTimeout(() => toggle(), 100) } useEffect(() => { if (isSuccess) { close() } }, [isSuccess, close]) return (