import { jsx as _jsx } from "react/jsx-runtime";
import { useCallback } from 'react';
import { useComponentTelemetry } from '../../../../lib/telemetry/index.js';
import { withRequiredCommonProps, } from '../../../../lib/seam/components/common-props.js';
import { useCreateConnectWebview } from '../../../../lib/seam/connect-webviews/use-create-connect-webview.js';
import { Button } from '../../../../lib/ui/Button.js';
export const NestedConnectAccountButton = withRequiredCommonProps(ConnectAccountButton);
export function ConnectAccountButton({ className, } = {}) {
    useComponentTelemetry('ConnectAccountButton');
    const { isLoading, mutate } = useCreateConnectWebview({
        willNavigateToWebview: true,
    });
    const handleClick = useCallback(() => {
        mutate({
            custom_redirect_url: globalThis.location?.href,
        });
    }, [mutate]);
    return (_jsx(Button, { size: 'small', onClick: handleClick, className: className, disabled: isLoading, children: t.connectAccount }));
}
const t = {
    connectAccount: 'Connect Account',
};
//# sourceMappingURL=ConnectAccountButton.js.map