The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
Update prettier styling
Ephraim Atta-Duncan964e7490392c
diff --git a/apps/web/components/editor/pdf-editor.tsx b/apps/web/components/editor/pdf-editor.tsxindex 8e133875e..dd9418a24 100644--- a/apps/web/components/editor/pdf-editor.tsx+++ b/apps/web/components/editor/pdf-editor.tsx@@ -92,9 +92,15 @@ export default function PDFEditor(props: any) {<divhidden={noRecipients}className="fixed left-0 top-1/3 max-w-xs rounded-md border border-slate-300 bg-white py-4 pr-5">- <RecipientSelector recipients={props?.document?.Recipient} onChange={setSelectedRecipient} />+ <RecipientSelector+ recipients={props?.document?.Recipient}+ onChange={setSelectedRecipient}+ /><hr className="m-3 border-slate-300"></hr>- <FieldTypeSelector selectedRecipient={selectedRecipient} onChange={setSelectedFieldType} />+ <FieldTypeSelector+ selectedRecipient={selectedRecipient}+ onChange={setSelectedFieldType}+ /></div></div></>diff --git a/apps/web/components/editor/pdf-signer.tsx b/apps/web/components/editor/pdf-signer.tsxindex b2dbbee64..797745a4c 100644--- a/apps/web/components/editor/pdf-signer.tsx+++ b/apps/web/components/editor/pdf-signer.tsx@@ -87,9 +87,13 @@ export default function PDFSigner(props: any) {icon={CheckBadgeIcon}className="float-right"onClick={() => {- signDocument(props.document, localSignatures, `${router.query.token}`).then(() => {- router.push(`/documents/${props.document.id}/signed?token=${router.query.token}`);- });+ signDocument(props.document, localSignatures, `${router.query.token}`).then(+ () => {+ router.push(+ `/documents/${props.document.id}/signed?token=${router.query.token}`+ );+ }+ );}}>Done</Button>@@ -135,7 +139,9 @@ export default function PDFSigner(props: any) {// Check if all fields are signed..if (signatureFields.length > 0) {// If there are no fields to sign at least one signature is enough- return fields.filter((field) => field.type === FieldType.SIGNATURE).every((field) => field.signature);+ return fields+ .filter((field) => field.type === FieldType.SIGNATURE)+ .every((field) => field.signature);} else {return localSignatures.length > 0;}diff --git a/apps/web/components/editor/pdf-viewer.jsx b/apps/web/components/editor/pdf-viewer.jsxindex bd930f3c3..886c02206 100644--- a/apps/web/components/editor/pdf-viewer.jsx+++ b/apps/web/components/editor/pdf-viewer.jsx@@ -30,7 +30,10 @@ export default function PDFViewer(props) {return (<>- <div hidden={loading} onMouseUp={props.onMouseUp} style={{ height: numPages * pageHeight + 1000 }}>+ <div+ hidden={loading}+ onMouseUp={props.onMouseUp}+ style={{ height: numPages * pageHeight + 1000 }}><div className="mt-6 max-w-xs"></div><Documentfile={props.pdfUrl}@@ -76,7 +79,11 @@ export default function PDFViewer(props) {onDelete={onDeleteHandler}></SignableField>) : (<EditableField- hidden={field.Signature || field.inserted || field.type === FieldType.FREE_SIGNATURE}+ hidden={+ field.Signature ||+ field.inserted ||+ field.type === FieldType.FREE_SIGNATURE+ }key={field.id}field={field}className="absolute"diff --git a/apps/web/components/editor/signature-dialog.tsx b/apps/web/components/editor/signature-dialog.tsxindex 85aa7dc50..0dd442b83 100644--- a/apps/web/components/editor/signature-dialog.tsx+++ b/apps/web/components/editor/signature-dialog.tsx@@ -71,7 +71,9 @@ export default function SignatureDialog(props: any) {aria-current={tab.current ? "page" : undefined}><tab.iconclassName={classNames(- tab.current ? "text-neon" : "text-gray-400 group-hover:text-gray-500",+ tab.current+ ? "text-neon"+ : "text-gray-400 group-hover:text-gray-500","-ml-0.5 mr-2 h-5 w-5")}aria-hidden="true"diff --git a/apps/web/components/login.tsx b/apps/web/components/login.tsxindex de215a5d7..4bbb784a1 100644--- a/apps/web/components/login.tsx+++ b/apps/web/components/login.tsx@@ -148,7 +148,9 @@ export default function Login(props: any) {) : (<p className="mt-2 text-center text-sm text-gray-600">Like Documenso{" "}- <Link href="https://documenso.com" className="text-neon hover:text-neon font-medium">+ <Link+ href="https://documenso.com"+ className="text-neon hover:text-neon font-medium">Hosted Documenso will be availible soon™</Link></p>diff --git a/apps/web/components/settings.tsx b/apps/web/components/settings.tsxindex bf277fe7d..32d868804 100644--- a/apps/web/components/settings.tsx+++ b/apps/web/components/settings.tsx@@ -77,7 +77,9 @@ export default function Setttings() {<h1 className="text-brown text-3xl font-bold leading-tight tracking-tight">Settings</h1></div></header>- <div className="mx-auto max-w-screen-xl px-4 pb-6 sm:px-6 lg:px-8 lg:pb-16" hidden={!user.email}>+ <div+ className="mx-auto max-w-screen-xl px-4 pb-6 sm:px-6 lg:px-8 lg:pb-16"+ hidden={!user.email}><div className="overflow-hidden rounded-lg bg-white shadow"><div className="divide-y divide-gray-200 lg:grid lg:grid-cols-12 lg:divide-y-0 lg:divide-x"><aside className="py-6 lg:col-span-3">diff --git a/apps/web/pages/404.jsx b/apps/web/pages/404.jsxindex 035c4a2b7..6321032d0 100644--- a/apps/web/pages/404.jsx+++ b/apps/web/pages/404.jsx@@ -12,7 +12,9 @@ export default function Custom404() {<div className="mx-auto max-w-7xl px-6 py-48 text-center sm:py-40 lg:px-8"><p className="text-brown text-base font-semibold leading-8">404</p>- <h1 className="text-brown mt-4 text-3xl font-bold tracking-tight sm:text-5xl">Page not found</h1>+ <h1 className="text-brown mt-4 text-3xl font-bold tracking-tight sm:text-5xl">+ Page not found+ </h1><p className="mt-4 text-base text-gray-700 sm:mt-6">Sorry, we couldn’t find the page you’re looking for.</p>diff --git a/apps/web/pages/500.jsx b/apps/web/pages/500.jsxindex 1fdee9281..2735dded2 100644--- a/apps/web/pages/500.jsx+++ b/apps/web/pages/500.jsx@@ -15,7 +15,9 @@ export default function Custom500() {<p className="inline-flex items-center text-3xl font-bold sm:text-5xl">500<span className="relative -top-1.5 px-3 font-thin sm:text-6xl">|</span>{" "}- <span className="align-middle text-base font-semibold sm:text-2xl">Something went wrong.</span>+ <span className="align-middle text-base font-semibold sm:text-2xl">+ Something went wrong.+ </span></p><div className="mt-10 flex justify-center"><Button color="secondary" href="/" icon={ArrowSmallLeftIcon}>diff --git a/apps/web/pages/_app.tsx b/apps/web/pages/_app.tsxindex 80253bde5..f8f86b960 100644--- a/apps/web/pages/_app.tsx+++ b/apps/web/pages/_app.tsx@@ -18,7 +18,10 @@ type AppPropsWithLayout = AppProps & {Component: NextPageWithLayout;};-export default function App({ Component, pageProps: { session, ...pageProps } }: AppPropsWithLayout) {+export default function App({+ Component,+ pageProps: { session, ...pageProps },+}: AppPropsWithLayout) {const getLayout = Component.getLayout || ((page: any) => page);return (<SessionProvider session={session}>diff --git a/apps/web/pages/dashboard.tsx b/apps/web/pages/dashboard.tsxindex 6561873fd..324560f5a 100644--- a/apps/web/pages/dashboard.tsx+++ b/apps/web/pages/dashboard.tsx@@ -12,7 +12,12 @@ import {ExclamationTriangleIcon,UsersIcon,} from "@heroicons/react/24/outline";-import { DocumentStatus, Document as PrismaDocument, SendStatus, SigningStatus } from "@prisma/client";+import {+ DocumentStatus,+ Document as PrismaDocument,+ SendStatus,+ SigningStatus,+} from "@prisma/client";import { truncate } from "fs";import { Tooltip as ReactTooltip } from "react-tooltip";@@ -50,7 +55,9 @@ const DashboardPage: NextPageWithLayout = (props: any) => {<div className="py-10 max-sm:px-4"><header>- <h1 className="text-3xl font-bold leading-tight tracking-tight text-gray-900">Dashboard</h1>+ <h1 className="text-3xl font-bold leading-tight tracking-tight text-gray-900">+ Dashboard+ </h1></header><dl className="mt-8 grid gap-5 md:grid-cols-3 ">{stats.map((item) => (@@ -143,7 +150,9 @@ export async function getServerSideProps(context: any) {e.Recipient.some((r: any) => r.signingStatus === SigningStatus.NOT_SIGNED));- const completed: PrismaDocument[] = documents.filter((d) => d.status === DocumentStatus.COMPLETED);+ const completed: PrismaDocument[] = documents.filter(+ (d) => d.status === DocumentStatus.COMPLETED+ );return {props: {diff --git a/apps/web/pages/documents.tsx b/apps/web/pages/documents.tsxindex 4ad740b3f..b1ef1fce7 100644--- a/apps/web/pages/documents.tsx+++ b/apps/web/pages/documents.tsx@@ -107,7 +107,9 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {<div className="mt-10 sm:flex sm:items-center"><div className="sm:flex-auto"><header>- <h1 className="text-3xl font-bold leading-tight tracking-tight text-gray-900">Documents</h1>+ <h1 className="text-3xl font-bold leading-tight tracking-tight text-gray-900">+ Documents+ </h1></header></div><div className="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">@@ -165,16 +167,24 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {<table className="min-w-full divide-y divide-gray-300"><thead className="bg-gray-50"><tr>- <th scope="col" className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">+ <th+ scope="col"+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Title</th>- <th scope="col" className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">+ <th+ scope="col"+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Recipients</th>- <th scope="col" className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">+ <th+ scope="col"+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Status</th>- <th scope="col" className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">+ <th+ scope="col"+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Created</th><th scope="col" className="relative py-3.5 pl-3 pr-4 sm:pr-6">@@ -215,7 +225,8 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {) : ("")}- {item.readStatus === "OPENED" && item.signingStatus === "NOT_SIGNED" ? (+ {item.readStatus === "OPENED" &&+ item.signingStatus === "NOT_SIGNED" ? (<span id="read_icon"><spanid="sent_icon"@@ -231,7 +242,8 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {{item.signingStatus === "SIGNED" ? (<span id="signed_icon"><span className="inline-block flex-shrink-0 rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-800">- <CheckBadgeIcon className="mr-1 inline h-5"></CheckBadgeIcon> {item.email}+ <CheckBadgeIcon className="mr-1 inline h-5"></CheckBadgeIcon>{" "}+ {item.email}</span></span>) : (@@ -260,8 +272,8 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {{formatDocumentStatus(document.status)}<p><small hidden={document.Recipient.length === 0}>- {document.Recipient.filter((r: any) => r.signingStatus === "SIGNED").length ||- 0}+ {document.Recipient.filter((r: any) => r.signingStatus === "SIGNED")+ .length || 0}/{document.Recipient.length || 0}</small></p>@@ -317,8 +329,8 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {</table></div><div hidden={filteredDocuments.length > 0} className="mx-auto mt-12 w-fit p-3">- <FunnelIcon className="mr-1 inline w-5 align-middle" /> Nothing here. Maybe try a different- filter.+ <FunnelIcon className="mr-1 inline w-5 align-middle" /> Nothing here. Maybe try a+ different filter.</div></div></div>@@ -339,7 +351,9 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {</svg><h3 className="mt-2 text-sm font-medium text-gray-900">No documents</h3>- <p className="mt-1 text-sm text-gray-500">Get started by adding a document. Any PDF will do.</p>+ <p className="mt-1 text-sm text-gray-500">+ Get started by adding a document. Any PDF will do.+ </p><div className="mt-6"><Buttonicon={PlusIcon}@@ -359,7 +373,11 @@ const DocumentsPage: NextPageWithLayout = (props: any) => {/></div></div>- <ReactTooltip anchorId="empty" place="bottom" content="No preparation needed. Any PDF will do." />+ <ReactTooltip+ anchorId="empty"+ place="bottom"+ content="No preparation needed. Any PDF will do."+ /></>);};diff --git a/apps/web/pages/documents/[id]/index.tsx b/apps/web/pages/documents/[id]/index.tsxindex 5402aadfc..7503902c6 100644--- a/apps/web/pages/documents/[id]/index.tsx+++ b/apps/web/pages/documents/[id]/index.tsx@@ -40,7 +40,10 @@ const DocumentsDetailPage: NextPageWithLayout = (props: any) => {</h2><div className="mt-1 flex flex-col sm:mt-0 sm:flex-row sm:flex-wrap sm:space-x-6"><div className="mt-2 flex items-center text-sm text-gray-500">- <UsersIcon className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400" aria-hidden="true" />+ <UsersIcon+ className="mr-1.5 h-5 w-5 flex-shrink-0 text-gray-400"+ aria-hidden="true"+ /><Link href={`/documents/${props.document.id}/recipients`}>{props?.document?.Recipient?.length} Recipients@@ -61,7 +64,9 @@ const DocumentsDetailPage: NextPageWithLayout = (props: any) => {className="ml-3"href={NEXT_PUBLIC_WEBAPP_URL + "/documents/" + props.document.id + "/recipients"}onClick={() => {- if (confirm(`Send document out to ${props?.document?.Recipient?.length} recipients?`)) {+ if (+ confirm(`Send document out to ${props?.document?.Recipient?.length} recipients?`)+ ) {}}}>Prepare to Senddiff --git a/apps/web/pages/documents/[id]/recipients.tsx b/apps/web/pages/documents/[id]/recipients.tsxindex 6b7af6a56..ebea8b34a 100644--- a/apps/web/pages/documents/[id]/recipients.tsx+++ b/apps/web/pages/documents/[id]/recipients.tsx@@ -105,7 +105,9 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {}}disabled={(formValues.length || 0) === 0 ||- !formValues.some((r: any) => r.email && !hasEmailError(r) && r.sendStatus === "NOT_SENT") ||+ !formValues.some(+ (r: any) => r.email && !hasEmailError(r) && r.sendStatus === "NOT_SENT"+ ) ||loading}>Send@@ -115,7 +117,9 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {<div className="mt-10 overflow-hidden rounded-md bg-white p-4 shadow sm:p-6"><div className="border-b border-gray-200 pb-3 sm:pb-5"><h3 className="text-lg font-medium leading-6 text-gray-900 ">Signers</h3>- <p className="mt-2 max-w-4xl text-sm text-gray-500">The people who will sign the document.</p>+ <p className="mt-2 max-w-4xl text-sm text-gray-500">+ The people who will sign the document.+ </p></div><FormProvider {...form}><form@@ -124,7 +128,9 @@ const RecipientsPage: NextPageWithLayout = (props: any) => {}}><ul role="list" className="divide-y divide-gray-200">{fields.map((item: any, index: number) => (- <li key={index} className="group w-full border-0 px-2 py-3 hover:bg-green-50 sm:py-4">+ <li+ key={index}+ className="group w-full border-0 px-2 py-3 hover:bg-green-50 sm:py-4"><div id="container" className="block w-full lg:flex lg:justify-between"><div className="block space-y-2 md:flex md:space-x-2 md:space-y-0"><divdiff --git a/apps/web/pages/documents/[id]/sign.tsx b/apps/web/pages/documents/[id]/sign.tsxindex d76376ce0..252d0f429 100644--- a/apps/web/pages/documents/[id]/sign.tsx+++ b/apps/web/pages/documents/[id]/sign.tsx@@ -22,8 +22,8 @@ const SignPage: NextPageWithLayout = (props: any) => {<h1 className="text-neon inline align-middle text-base font-medium">Time flies.</h1><p className="mt-2 text-4xl font-bold tracking-tight">This signing link is expired.</p><p className="mt-2 text-base text-gray-500">- Please ask {props.document.User.name ? `${props.document.User.name}` : `the sender`} to resend- it.+ Please ask {props.document.User.name ? `${props.document.User.name}` : `the sender`}{" "}+ to resend it.</p><div className="mx-auto w-fit pt-20 text-xl"></div></div>diff --git a/apps/web/pages/documents/[id]/signed.tsx b/apps/web/pages/documents/[id]/signed.tsxindex 9d3e68c96..53f375ab2 100644--- a/apps/web/pages/documents/[id]/signed.tsx+++ b/apps/web/pages/documents/[id]/signed.tsx@@ -8,7 +8,9 @@ import { ArrowDownTrayIcon, CheckBadgeIcon } from "@heroicons/react/24/outline";const Signed: NextPageWithLayout = (props: any) => {const router = useRouter();- const allRecipientsSigned = props.document.Recipient?.every((r: any) => r.signingStatus === "SIGNED");+ const allRecipientsSigned = props.document.Recipient?.every(+ (r: any) => r.signingStatus === "SIGNED"+ );return (<>@@ -18,7 +20,9 @@ const Signed: NextPageWithLayout = (props: any) => {<div className="mx-auto w-fit px-4 py-16 sm:px-6 sm:py-24 lg:px-8"><CheckBadgeIcon className="text-neon mr-1 inline w-10"></CheckBadgeIcon><h1 className="text-neon inline align-middle text-base font-medium">It's done!</h1>- <p className="mt-2 text-4xl font-bold tracking-tight">You signed "{props.document.title}"</p>+ <p className="mt-2 text-4xl font-bold tracking-tight">+ You signed "{props.document.title}"+ </p><p className="mt-2 max-w-sm text-base text-gray-500" hidden={allRecipientsSigned}>You will be notfied when all recipients have signed.</p>@@ -32,7 +36,9 @@ const Signed: NextPageWithLayout = (props: any) => {onClick={(event: any) => {event.preventDefault();event.stopPropagation();- router.push("/api/documents/" + props.document.id + "?token=" + props.recipient.token);+ router.push(+ "/api/documents/" + props.document.id + "?token=" + props.recipient.token+ );}}>Download "{props.document.title}"</Button>diff --git a/apps/web/styles/tailwind.css b/apps/web/styles/tailwind.cssindex bd13ab1f2..2ea56f9bf 100644--- a/apps/web/styles/tailwind.css+++ b/apps/web/styles/tailwind.css@@ -24,8 +24,8 @@ body,font-weight: 400;font-display: swap;src: url("/fonts/montserrat.woff2") format("woff2");- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,- U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F,+ U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}/* latin */@@ -35,6 +35,6 @@ body,font-weight: 700;font-display: swap;src: url("/fonts/montserrat.woff2") format("woff2");- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,- U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F,+ U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;}diff --git a/packages/features/uploadDocument.ts b/packages/features/uploadDocument.tsindex 41140f0f4..ef57d795f 100644--- a/packages/features/uploadDocument.ts+++ b/packages/features/uploadDocument.ts@@ -27,7 +27,9 @@ export const uploadDocument = async (event: any) => {).then((response: Response) => {response.json().then((createdDocumentIdFromBody) => {- router.push(`${NEXT_PUBLIC_WEBAPP_URL}/documents/${createdDocumentIdFromBody}/recipients`);+ router.push(+ `${NEXT_PUBLIC_WEBAPP_URL}/documents/${createdDocumentIdFromBody}/recipients`+ );});});}diff --git a/packages/lib/auth.ts b/packages/lib/auth.tsindex 77b176d2e..71efa1fbf 100644--- a/packages/lib/auth.ts+++ b/packages/lib/auth.ts@@ -62,7 +62,9 @@ export function isPasswordValid(password: string, breakdown?: boolean, strict?:return errors;}-type CtxOrReq = { req: NextApiRequest; ctx?: never } | { ctx: { req: NextApiRequest }; req?: never };+type CtxOrReq =+ | { req: NextApiRequest; ctx?: never }+ | { ctx: { req: NextApiRequest }; req?: never };export const ensureSession = async (ctxOrReq: CtxOrReq) => {const session = await getSession(ctxOrReq);diff --git a/packages/lib/getSafeRedirectUrl.ts b/packages/lib/getSafeRedirectUrl.tsindex e676d2866..59c1e9cff 100644--- a/packages/lib/getSafeRedirectUrl.ts+++ b/packages/lib/getSafeRedirectUrl.ts@@ -12,7 +12,11 @@ export const getSafeRedirectUrl = (url = "") => {const urlParsed = new URL(url);// Avoid open redirection security vulnerability- if (!["CONSOLE_URL", "WEBAPP_URL", "WEBSITE_URL"].some((u) => new URL(u).origin === urlParsed.origin)) {+ if (+ !["CONSOLE_URL", "WEBAPP_URL", "WEBSITE_URL"].some(+ (u) => new URL(u).origin === urlParsed.origin+ )+ ) {url = `${"WEBAPP_URL"}/`;}diff --git a/packages/lib/query/getDocument.ts b/packages/lib/query/getDocument.tsindex 965513699..db658794c 100644--- a/packages/lib/query/getDocument.ts+++ b/packages/lib/query/getDocument.ts@@ -2,7 +2,11 @@ import { getUserFromToken } from "@documenso/lib/server";import prisma from "@documenso/prisma";import { Document as PrismaDocument } from "@prisma/client";-export const getDocument = async (documentId: number, req: any, res: any): Promise<PrismaDocument> => {+export const getDocument = async (+ documentId: number,+ req: any,+ res: any+): Promise<PrismaDocument> => {const user = await getUserFromToken(req, res);if (!user) return Promise.reject("Invalid user or token.");if (!documentId) Promise.reject("No documentId");diff --git a/packages/lib/server/defaultHandler.ts b/packages/lib/server/defaultHandler.tsindex 1cfa351bd..69d466648 100644--- a/packages/lib/server/defaultHandler.ts+++ b/packages/lib/server/defaultHandler.ts@@ -1,24 +1,27 @@import type { NextApiHandler, NextApiRequest, NextApiResponse } from "next";type Handlers = {- [method in "GET" | "POST" | "PATCH" | "PUT" | "DELETE"]?: Promise<{ default: NextApiHandler }>;+ [method in "GET" | "POST" | "PATCH" | "PUT" | "DELETE"]?: Promise<{+ default: NextApiHandler;+ }>;};/** Allows us to split big API handlers by method */-export const defaultHandler = (handlers: Handlers) => async (req: NextApiRequest, res: NextApiResponse) => {- const handler = (await handlers[req.method as keyof typeof handlers])?.default;- // auto catch unsupported methods.- if (!handler) {- return res- .status(405)- .json({ message: `Method Not Allowed (Allow: ${Object.keys(handlers).join(",")})` });- }+export const defaultHandler =+ (handlers: Handlers) => async (req: NextApiRequest, res: NextApiResponse) => {+ const handler = (await handlers[req.method as keyof typeof handlers])?.default;+ // auto catch unsupported methods.+ if (!handler) {+ return res.status(405).json({+ message: `Method Not Allowed (Allow: ${Object.keys(handlers).join(",")})`,+ });+ }- try {- await handler(req, res);- return;- } catch (error) {- console.error(error);- return res.status(500).json({ message: "Something went wrong" });- }-};+ try {+ await handler(req, res);+ return;+ } catch (error) {+ console.error(error);+ return res.status(500).json({ message: "Something went wrong" });+ }+ };diff --git a/packages/lib/server/http-error.ts b/packages/lib/server/http-error.tsindex 223761480..b73b23f9d 100644--- a/packages/lib/server/http-error.ts+++ b/packages/lib/server/http-error.ts@@ -5,7 +5,13 @@ export class HttpError<TCode extends number = number> extends Error {public readonly url: string | undefined;public readonly method: string | undefined;- constructor(opts: { url?: string; method?: string; message?: string; statusCode: TCode; cause?: Error }) {+ constructor(opts: {+ url?: string;+ method?: string;+ message?: string;+ statusCode: TCode;+ cause?: Error;+ }) {super(opts.message ?? `HTTP Error ${opts.statusCode} `);Object.setPrototypeOf(this, HttpError.prototype);diff --git a/packages/prisma/seed.ts b/packages/prisma/seed.tsindex 0c532230f..42812331f 100644--- a/packages/prisma/seed.ts+++ b/packages/prisma/seed.ts@@ -15,7 +15,9 @@ async function createUser(userData: { email: string; password: string }) {return user;} catch (error) {- console.info(`WARN: Could not create user "${userData.email}". Maybe the email is already taken?`);+ console.info(+ `WARN: Could not create user "${userData.email}". Maybe the email is already taken?`+ );}}diff --git a/packages/signing/node-signpdf/dist/helpers/extractSignature.js b/packages/signing/node-signpdf/dist/helpers/extractSignature.jsindex 94e2479b8..e966f4dc3 100644--- a/packages/signing/node-signpdf/dist/helpers/extractSignature.js+++ b/packages/signing/node-signpdf/dist/helpers/extractSignature.js@@ -40,7 +40,10 @@ const extractSignature = (pdf, signatureCount = 1) => {const byteRangePos = getSubstringIndex(pdf, "/ByteRange [", signatureCount);if (byteRangePos === -1) {- throw new _SignPdfError.default("Failed to locate ByteRange.", _SignPdfError.default.TYPE_PARSE);+ throw new _SignPdfError.default(+ "Failed to locate ByteRange.",+ _SignPdfError.default.TYPE_PARSE+ );}const byteRangeEnd = pdf.indexOf("]", byteRangePos);@@ -56,7 +59,10 @@ const extractSignature = (pdf, signatureCount = 1) => {const matches = /\/ByteRange \[(\d+) +(\d+) +(\d+) +(\d+) *\]/.exec(byteRange);if (matches === null) {- throw new _SignPdfError.default("Failed to parse the ByteRange.", _SignPdfError.default.TYPE_PARSE);+ throw new _SignPdfError.default(+ "Failed to parse the ByteRange.",+ _SignPdfError.default.TYPE_PARSE+ );}const ByteRange = matches.slice(1).map(Number);diff --git a/packages/signing/node-signpdf/dist/helpers/pdfkit/pdfobject.js b/packages/signing/node-signpdf/dist/helpers/pdfkit/pdfobject.jsindex 0a37f8cda..7be4d3b93 100644--- a/packages/signing/node-signpdf/dist/helpers/pdfkit/pdfobject.js+++ b/packages/signing/node-signpdf/dist/helpers/pdfkit/pdfobject.js@@ -87,7 +87,10 @@ class PDFObject {let string = `D:${pad(object.getUTCFullYear(), 4)}${pad(object.getUTCMonth() + 1, 2)}${pad(object.getUTCDate(),2- )}${pad(object.getUTCHours(), 2)}${pad(object.getUTCMinutes(), 2)}${pad(object.getUTCSeconds(), 2)}Z`; // Encrypt the string when necessary+ )}${pad(object.getUTCHours(), 2)}${pad(object.getUTCMinutes(), 2)}${pad(+ object.getUTCSeconds(),+ 2+ )}Z`; // Encrypt the string when necessaryif (encryptFn) {string = encryptFn(Buffer.from(string, "ascii")).toString("binary"); // Escape characters as required by the specdiff --git a/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/getIndexFromRef.js b/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/getIndexFromRef.jsindex 2ff3c0dfe..6b8b6d0f2 100644--- a/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/getIndexFromRef.js+++ b/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/getIndexFromRef.js@@ -21,7 +21,10 @@ const getIndexFromRef = (refTable, ref) => {index = parseInt(index);if (!refTable.offsets.has(index)) {- throw new _SignPdfError.default(`Failed to locate object "${ref}".`, _SignPdfError.default.TYPE_PARSE);+ throw new _SignPdfError.default(+ `Failed to locate object "${ref}".`,+ _SignPdfError.default.TYPE_PARSE+ );}return index;diff --git a/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/index.js b/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/index.jsindex 8f9905b2f..08241d99e 100644--- a/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/index.js+++ b/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/index.js@@ -21,9 +21,13 @@ var _readPdf = _interopRequireDefault(require("./readPdf"));var _getPageRef = _interopRequireDefault(require("./getPageRef"));-var _createBufferRootWithAcroform = _interopRequireDefault(require("./createBufferRootWithAcroform"));+var _createBufferRootWithAcroform = _interopRequireDefault(+ require("./createBufferRootWithAcroform")+);-var _createBufferPageWithAnnotation = _interopRequireDefault(require("./createBufferPageWithAnnotation"));+var _createBufferPageWithAnnotation = _interopRequireDefault(+ require("./createBufferPageWithAnnotation")+);var _createBufferTrailer = _interopRequireDefault(require("./createBufferTrailer"));diff --git a/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/readRefTable.js b/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/readRefTable.jsindex 686a55c65..c5f75ca66 100644--- a/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/readRefTable.js+++ b/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/readRefTable.js@@ -3,7 +3,11 @@Object.defineProperty(exports, "__esModule", {value: true,});-exports.getXref = exports.getLastTrailerPosition = exports.getFullXrefTable = exports.default = void 0;+exports.getXref =+ exports.getLastTrailerPosition =+ exports.getFullXrefTable =+ exports.default =+ void 0;var _SignPdfError = _interopRequireDefault(require("../../SignPdfError"));@@ -16,7 +20,9 @@ function _interopRequireDefault(obj) {const getLastTrailerPosition = (pdf) => {const trailerStart = pdf.lastIndexOf(Buffer.from("trailer", "utf8"));const trailer = pdf.slice(trailerStart, pdf.length - 6);- const xRefPosition = trailer.slice(trailer.lastIndexOf(Buffer.from("startxref", "utf8")) + 10).toString();+ const xRefPosition = trailer+ .slice(trailer.lastIndexOf(Buffer.from("startxref", "utf8")) + 10)+ .toString();return parseInt(xRefPosition);};@@ -63,13 +69,19 @@ const getXref = (pdf, position) => {let size = refTable.toString().split("/Size")[1];if (!size) {- throw new _SignPdfError.default("Size not found in xref table.", _SignPdfError.default.TYPE_PARSE);+ throw new _SignPdfError.default(+ "Size not found in xref table.",+ _SignPdfError.default.TYPE_PARSE+ );}size = /^\s*(\d+)/.exec(size);if (size === null) {- throw new _SignPdfError.default("Failed to parse size of xref table.", _SignPdfError.default.TYPE_PARSE);+ throw new _SignPdfError.default(+ "Failed to parse size of xref table.",+ _SignPdfError.default.TYPE_PARSE+ );}size = parseInt(size[1]);diff --git a/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/xrefToRefMap.js b/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/xrefToRefMap.jsindex 484237333..224f7e7bc 100644--- a/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/xrefToRefMap.js+++ b/packages/signing/node-signpdf/dist/helpers/plainAddPlaceholder/xrefToRefMap.js@@ -26,7 +26,10 @@ const xrefToRefMap = (xrefString) => {}if (expectedLines <= 0) {- throw new _SignPdfError.default("Too many lines in xref table.", _SignPdfError.default.TYPE_PARSE);+ throw new _SignPdfError.default(+ "Too many lines in xref table.",+ _SignPdfError.default.TYPE_PARSE+ );}expectedLines -= 1;diff --git a/packages/signing/node-signpdf/dist/signpdf.js b/packages/signing/node-signpdf/dist/signpdf.jsindex 5c53f8ee2..133623e4b 100644--- a/packages/signing/node-signpdf/dist/signpdf.js+++ b/packages/signing/node-signpdf/dist/signpdf.js@@ -102,9 +102,16 @@ class SignPdf {let actualByteRange = `/ByteRange [${byteRange.join(" ")}]`;actualByteRange += " ".repeat(byteRangePlaceholder.length - actualByteRange.length); // Replace the /ByteRange placeholder with the actual ByteRange- pdf = Buffer.concat([pdf.slice(0, byteRangePos), Buffer.from(actualByteRange), pdf.slice(byteRangeEnd)]); // Remove the placeholder signature+ pdf = Buffer.concat([+ pdf.slice(0, byteRangePos),+ Buffer.from(actualByteRange),+ pdf.slice(byteRangeEnd),+ ]); // Remove the placeholder signature- pdf = Buffer.concat([pdf.slice(0, byteRange[1]), pdf.slice(byteRange[2], byteRange[2] + byteRange[3])]); // Convert Buffer P12 to a forge implementation.+ pdf = Buffer.concat([+ pdf.slice(0, byteRange[1]),+ pdf.slice(byteRange[2], byteRange[2] + byteRange[3]),+ ]); // Convert Buffer P12 to a forge implementation.const forgeCert = _nodeForge.default.util.createBuffer(p12Buffer.toString("binary"));@@ -190,11 +197,15 @@ class SignPdf {this.lastSignature = signature; // Pad the signature with zeroes so the it is the same length as the placeholder- signature += Buffer.from(String.fromCharCode(0).repeat(placeholderLength / 2 - raw.length)).toString(- "hex"- ); // Place it in the document.+ signature += Buffer.from(+ String.fromCharCode(0).repeat(placeholderLength / 2 - raw.length)+ ).toString("hex"); // Place it in the document.- pdf = Buffer.concat([pdf.slice(0, byteRange[1]), Buffer.from(`<${signature}>`), pdf.slice(byteRange[1])]); // Magic. Done.+ pdf = Buffer.concat([+ pdf.slice(0, byteRange[1]),+ Buffer.from(`<${signature}>`),+ pdf.slice(byteRange[1]),+ ]); // Magic. Done.return pdf;}diff --git a/packages/ui/components/breadcrumb/breadcrumb.tsx b/packages/ui/components/breadcrumb/breadcrumb.tsxindex 8ff992301..d256908c3 100644--- a/packages/ui/components/breadcrumb/breadcrumb.tsx+++ b/packages/ui/components/breadcrumb/breadcrumb.tsx@@ -7,9 +7,14 @@ export function Breadcrumb(props: any) {<><nav className="sm:hidden" aria-label="Back"><Link- href={props.items.length > 1 ? props.items[props.items.length - 2].href : props.items[0].href}+ href={+ props.items.length > 1 ? props.items[props.items.length - 2].href : props.items[0].href+ }className="flex items-center text-sm font-medium text-gray-500 hover:text-gray-700">- <ChevronLeftIcon className="-ml-1 mr-1 h-5 w-5 flex-shrink-0 text-gray-400" aria-hidden="true" />+ <ChevronLeftIcon+ className="-ml-1 mr-1 h-5 w-5 flex-shrink-0 text-gray-400"+ aria-hidden="true"+ />Back</Link></nav>@@ -18,13 +23,18 @@ export function Breadcrumb(props: any) {{props?.items.map((item: any, index: number) => (<React.Fragment key={item.href}>{index > 0 ? (- <ChevronRightIcon className="h-5 w-5 flex-shrink-0 text-gray-400" aria-hidden="true" />+ <ChevronRightIcon+ className="h-5 w-5 flex-shrink-0 text-gray-400"+ aria-hidden="true"+ />) : ("")}<li><div className="flex">- <Link href={item.href} className="text-sm font-medium text-gray-500 hover:text-gray-700">+ <Link+ href={item.href}+ className="text-sm font-medium text-gray-500 hover:text-gray-700">{item.title}</Link></div>diff --git a/packages/ui/components/dialog/Dialog.tsx b/packages/ui/components/dialog/Dialog.tsxindex 73c2e317e..07c92686b 100644--- a/packages/ui/components/dialog/Dialog.tsx+++ b/packages/ui/components/dialog/Dialog.tsx@@ -21,8 +21,18 @@ type DialogProps = {icon: React.ReactNode;};-export function Dialog({ title, open, setOpen, document, formValues, setLoading, icon }: DialogProps) {- const unsentEmailsLength = formValues.filter((s: any) => s.email && s.sendStatus != "SENT").length;+export function Dialog({+ title,+ open,+ setOpen,+ document,+ formValues,+ setLoading,+ icon,+}: DialogProps) {+ const unsentEmailsLength = formValues.filter(+ (s: any) => s.email && s.sendStatus != "SENT"+ ).length;return (<Transition.Root show={open} as={Fragment}>@@ -54,7 +64,9 @@ export function Dialog({ title, open, setOpen, document, formValues, setLoading,{icon}</div><div className="mt-3 text-center sm:mt-5">- <DialogComponent.Title as="h3" className="text-lg font-medium leading-6 text-gray-900">+ <DialogComponent.Title+ as="h3"+ className="text-lg font-medium leading-6 text-gray-900">{title}</DialogComponent.Title><div className="mt-2">diff --git a/packages/ui/components/selectBox/SelectBox.tsx b/packages/ui/components/selectBox/SelectBox.tsxindex de8d13ac0..cfab5b18b 100644--- a/packages/ui/components/selectBox/SelectBox.tsx+++ b/packages/ui/components/selectBox/SelectBox.tsx@@ -13,7 +13,9 @@ export function SelectBox(props: any) {}}>{({ open }) => (<>- <Listbox.Label className="block text-sm font-medium text-gray-700">{props.label}</Listbox.Label>+ <Listbox.Label className="block text-sm font-medium text-gray-700">+ {props.label}+ </Listbox.Label><div className="relative mt-1"><Listbox.Button className="focus:border-neon focus:ring-neon relative w-full cursor-default rounded-md border border-gray-300 bg-white py-2 pl-3 pr-10 text-left shadow-sm focus:outline-none focus:ring-1 sm:text-sm"><span className="block truncate">{props?.value?.label}</span>diff --git a/prettier.config.js b/prettier.config.jsindex 354f5d5b6..5b00582d6 100644--- a/prettier.config.js+++ b/prettier.config.js@@ -5,7 +5,7 @@ module.exports = {jsxSingleQuote: false,trailingComma: "es5",semi: true,- printWidth: 110,+ printWidth: 100,arrowParens: "always",importOrder: ["^(react/(.*)$)|^(react$)",