'use client'; //=========================================== // THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template //=========================================== import { KnownError, KnownErrors } from "@hexclave/shared"; import { Typography } from "@hexclave/ui"; import { useStackApp } from ".."; import { KnownErrorMessageCard } from "../components/message-cards/known-error-message-card"; import { MessageCard } from "../components/message-cards/message-card"; import { PredefinedMessageCard } from "../components/message-cards/predefined-message-card"; import { useTranslation } from "../lib/translations"; export function ErrorPage(props: { fullPage?: boolean, searchParams: Record }) { const { t } = useTranslation(); const hexclaveApp = useStackApp(); const errorCode = props.searchParams.errorCode; const message = props.searchParams.message; const details = props.searchParams.details; const unknownErrorCard = ; if (!errorCode || !message) { return unknownErrorCard; } let error; try { const detailJson = details ? JSON.parse(details) : {}; error = KnownError.fromJson({ code: errorCode, message, details: detailJson }); } catch (e) { return unknownErrorCard; } if (KnownErrors.OAuthConnectionAlreadyConnectedToAnotherUser.isInstance(error)) { // TODO: add "Connect a different account" button return ( hexclaveApp.redirectToHome()} > {t("This account is already connected to another user. Please connect a different account.")} ); } if (KnownErrors.UserAlreadyConnectedToAnotherOAuthConnection.isInstance(error)) { // TODO: add "Connect again" button return ( hexclaveApp.redirectToHome()} > {t("The user is already connected to another OAuth account. Did you maybe selected the wrong account on the OAuth provider page?")} ); } if (KnownErrors.OAuthProviderAccessDenied.isInstance(error)) { return ( hexclaveApp.redirectToSignIn()} secondaryButtonText={t("Go Home")} secondaryAction={() => hexclaveApp.redirectToHome()} > {t("The sign-in operation has been cancelled or denied. Please try again.")} ); } if (KnownErrors.OAuthProviderTemporarilyUnavailable.isInstance(error)) { return ( hexclaveApp.redirectToSignIn()} secondaryButtonText={t("Go Home")} secondaryAction={() => hexclaveApp.redirectToHome()} > {t("The OAuth provider could not complete sign-in right now. Please try again in a moment.")} ); } return ; }