import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { GoogleAuthProvider, signInWithRedirect } from "firebase/auth";
import { getFirebaseAuth } from "@vertesia/ui/session";
import { Button } from "@vertesia/ui/core";
export default function GoogleSignInButton({ redirectTo }) {
    const signIn = () => {
        localStorage.removeItem("tenantName");
        let redirectPath = redirectTo || window.location.pathname || '/';
        if (redirectPath[0] !== '/') {
            redirectPath = '/' + redirectPath;
        }
        const provider = new GoogleAuthProvider();
        provider.addScope('profile');
        provider.addScope('email');
        // always ask to select the google account
        //console.log('redirectPath', window.location.origin + redirectPath)
        provider.setCustomParameters({
            prompt: 'select_account',
            redirect_uri: window.location.origin + redirectPath
        });
        signInWithRedirect(getFirebaseAuth(), provider);
    };
    return (_jsxs(Button, { variant: "outline", onClick: signIn, className: "w-full py-5 flex rounded-lg hover:shadow-sm transition duration-150 text-center mb-2", children: [_jsx("img", { className: "size-6", src: "https://www.svgrepo.com/show/475656/google-color.svg", loading: "lazy", alt: "google logo" }), _jsx("span", { className: "text-sm font-semibold", children: "Continue with Google" })] }));
}
//# sourceMappingURL=GoogleSignInButton.js.map