/**
* Auto-generated OAuth callback HTML templates
* Generated from templates/*.html and templates/*.css
*
* To regenerate: bun run templates/build.ts
*/
export const successTemplate = `
Authorization Successful
Authorization Successful
You can now return to your application
`;
export const errorTemplate = `{{ERROR_TITLE}}
{{ERROR_SVG_ICON}}
{{ERROR_TITLE}}
{{ERROR_MESSAGE}}
{{ERROR_DETAILS}}
{{HELP_TEXT}}
`;
export function renderError(params: {
error: string;
error_description?: string;
error_uri?: string;
}): string {
// Determine error title and message based on error type
let errorTitle = "Authorization Failed";
let errorMessage = "The authorization process could not be completed.";
let helpText = "If the problem persists, please contact support.";
let errorSvgIcon = "";
switch (params.error) {
case "access_denied":
errorTitle = "Access Denied";
errorMessage = "You have denied access to the application.";
helpText = 'Click "Try Again" to restart the authorization process.';
errorSvgIcon = `
`;
break;
case "invalid_request":
errorTitle = "Invalid Request";
errorMessage =
"The authorization request was malformed or missing required parameters.";
errorSvgIcon = `
`;
break;
case "unauthorized_client":
errorTitle = "Unauthorized Client";
errorMessage =
"This application is not authorized to use this authentication method.";
errorSvgIcon = `
`;
break;
case "server_error":
errorTitle = "Server Error";
errorMessage =
"The authorization server encountered an unexpected error.";
helpText = "Please wait a moment and try again.";
errorSvgIcon = `
`;
break;
default:
errorSvgIcon = `
`;
}
let errorDetails = "";
if (params.error_description || params.error) {
errorDetails = `