mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 09:54:51 +10:00
c0ae68c28b
Introduces the ability for users with the **Assistant** role to prefill fields on behalf of other signers. Assistants can fill in various field types such as text, checkboxes, dates, and more, streamlining the document preparation process before it reaches the final signers.
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { Outlet, isRouteErrorResponse, useRouteError } from 'react-router';
|
|
|
|
import { EmbedAuthenticationRequired } from '~/components/embed/embed-authentication-required';
|
|
import { EmbedDocumentWaitingForTurn } from '~/components/embed/embed-document-waiting-for-turn';
|
|
import { EmbedPaywall } from '~/components/embed/embed-paywall';
|
|
|
|
import type { Route } from './+types/_layout';
|
|
|
|
// Todo: Test
|
|
export function headers({ loaderHeaders }: Route.HeadersArgs) {
|
|
const origin = loaderHeaders.get('Origin') ?? '*';
|
|
|
|
// Allow third parties to iframe the document.
|
|
return {
|
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
|
|
'Access-Control-Allow-Origin': origin,
|
|
'Content-Security-Policy': `frame-ancestors ${origin}`,
|
|
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
|
'X-Content-Type-Options': 'nosniff',
|
|
};
|
|
}
|
|
|
|
export default function Layout() {
|
|
return <Outlet />;
|
|
}
|
|
|
|
export function ErrorBoundary() {
|
|
const error = useRouteError();
|
|
|
|
if (isRouteErrorResponse(error)) {
|
|
if (error.status === 401 && error.data.type === 'embed-authentication-required') {
|
|
return (
|
|
<EmbedAuthenticationRequired email={error.data.email} returnTo={error.data.returnTo} />
|
|
);
|
|
}
|
|
|
|
if (error.status === 403 && error.data.type === 'embed-paywall') {
|
|
return <EmbedPaywall />;
|
|
}
|
|
|
|
if (error.status === 403 && error.data.type === 'embed-waiting-for-turn') {
|
|
return <EmbedDocumentWaitingForTurn />;
|
|
}
|
|
}
|
|
|
|
return <div>Not Found</div>;
|
|
}
|