import React__default from 'react';
import Typography from '../atoms/Typography.mjs';

const RedirectUrlsErrorMessage = ({ niceName, variableName })=>/*#__PURE__*/ React__default.createElement(Typography, {
        variant: "body",
        color: "destructive"
    }, "One Tap cannot render because there are no ", niceName, " set for this project so we are unable to verify the", ' ', /*#__PURE__*/ React__default.createElement("code", null, variableName), "\xa0 provided in the configuration. To set ", niceName, "for this project please visit\xa0", /*#__PURE__*/ React__default.createElement("a", {
        href: "https://stytch.com/dashboard/redirect-urls"
    }, "the Stytch dashboard."), "\xa0 For more information on why this validation is necessary please visit\xa0", /*#__PURE__*/ React__default.createElement("a", {
        href: "https://stytch.com/docs/api/url-validation"
    }, "https://stytch.com/docs/api/url-validation."));
const OneTapErrors = {
    // These come from the Google GSI Client
    OriginNotAllowedForClient: 'origin_not_allowed_for_client',
    InvalidOAuthClient: 'invalid_client',
    // These come from the API directly - err.error_type
    NoConfiguredOAuthClient: 'oauth_config_not_found',
    NoConfiguredLoginRedirectUrls: 'no_login_redirect_urls_set',
    NoConfiguredSignupRedirectUrls: 'no_signup_redirect_urls_set',
    DefaultProviderNotAllowed: 'default_provider_not_allowed'
};
const ErrorMessages = ({ error })=>{
    switch(error){
        case OneTapErrors.OriginNotAllowedForClient:
            return /*#__PURE__*/ React__default.createElement(Typography, {
                variant: "body",
                color: "destructive"
            }, "One Tap cannot render because the current host\xa0", /*#__PURE__*/ React__default.createElement("code", null, window.location.host), "is not allowed for this project. Make sure to put your project's host into the Google API console. When using localhost for development, you must add both\xa0        ", /*#__PURE__*/ React__default.createElement("code", null, "http://localhost"), "and\xa0", /*#__PURE__*/ React__default.createElement("code", null, `http://localhost:<port_number>`), "\xa0 to the Authorized JavaScript origins box. You can learn more\xa0", /*#__PURE__*/ React__default.createElement("a", {
                href: "https://stytch.com/docs/sdks"
            }, "here."));
        case OneTapErrors.InvalidOAuthClient:
            return /*#__PURE__*/ React__default.createElement(Typography, {
                variant: "body",
                color: "destructive"
            }, "One Tap cannot render because the client ID configured for your project is not recognized by Google. \xa0 Please check that the client ID saved in", ' ', /*#__PURE__*/ React__default.createElement("a", {
                href: "https://stytch.com/dashboard/oauth/google"
            }, "the Stytch Dashboard"), "\xa0 matches the client ID in your Google Cloud Console.");
        case OneTapErrors.NoConfiguredOAuthClient:
            return /*#__PURE__*/ React__default.createElement(Typography, {
                variant: "body",
                color: "destructive"
            }, "One Tap cannot render because no Google OAuth client configuration could be found for this project. Please make sure a client is configured in the\xa0", /*#__PURE__*/ React__default.createElement("a", {
                href: "https://stytch.com/dashboard/oauth"
            }, "dashboard."));
        case OneTapErrors.NoConfiguredLoginRedirectUrls:
            return /*#__PURE__*/ React__default.createElement(RedirectUrlsErrorMessage, {
                niceName: "login redirect URLs",
                variableName: "oauthOptions.loginRedirectURL"
            });
        case OneTapErrors.NoConfiguredSignupRedirectUrls:
            return /*#__PURE__*/ React__default.createElement(RedirectUrlsErrorMessage, {
                niceName: "signup redirect URLs",
                variableName: "oauthOptions.signupRedirectURL"
            });
        case OneTapErrors.DefaultProviderNotAllowed:
            return /*#__PURE__*/ React__default.createElement(Typography, {
                variant: "body",
                color: "destructive"
            }, "One Tap cannot render because the Stytch Default OAuth Provider is not compatible with One Tap. Please configure your own Google client in the\xa0", /*#__PURE__*/ React__default.createElement("a", {
                href: "https://stytch.com/dashboard/oauth"
            }, "dashboard."));
    }
};

export { ErrorMessages, OneTapErrors };
//# sourceMappingURL=OneTapError.mjs.map
