The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
feat: remove the existing empty signer if its the only one
Adithya Krishnae82e40254006
diff --git a/packages/ui/primitives/document-flow/add-signers.tsx b/packages/ui/primitives/document-flow/add-signers.tsxindex 2f9f2f234..b83e5064c 100644--- a/packages/ui/primitives/document-flow/add-signers.tsx+++ b/packages/ui/primitives/document-flow/add-signers.tsx@@ -138,16 +138,6 @@ export const AddSignersFormPartial = ({);};- const onAddSelfSigner = () => {- appendSigner({- formId: nanoid(12),- name: user?.name ?? '',- email: user?.email ?? '',- role: RecipientRole.SIGNER,- actionAuth: undefined,- });- };-const onAddSigner = () => {appendSigner({formId: nanoid(12),@@ -174,6 +164,17 @@ export const AddSignersFormPartial = ({removeSigner(index);};+ const onAddSelfSigner = () => {+ if(signers.length !== 0) onRemoveSigner(0);+ appendSigner({+ formId: nanoid(12),+ name: user?.name ?? '',+ email: user?.email ?? '',+ role: RecipientRole.SIGNER,+ actionAuth: undefined,+ });+ };+const onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {if (event.key === 'Enter' && event.target instanceof HTMLInputElement) {onAddSigner();@@ -302,10 +303,10 @@ export const AddSignersFormPartial = ({global action signing authentication method configured inthe "General Settings" step</li>- {/* <li>+ <li><strong>Require account</strong> - The recipient must besigned in- </li> */}+ </li><li><strong>Require passkey</strong> - The recipient must havean account and passkey configured via their settings@@ -326,13 +327,11 @@ export const AddSignersFormPartial = ({{/* Note: -1 is remapped in the Zod schema to the required value. */}<SelectItem value="-1">Inherit authentication method</SelectItem>- {Object.values(RecipientActionAuth)- .filter((auth) => auth !== RecipientActionAuth.ACCOUNT)- .map((authType) => (- <SelectItem key={authType} value={authType}>- {DOCUMENT_AUTH_TYPES[authType].value}- </SelectItem>- ))}+ {Object.values(RecipientActionAuth).map((authType) => (+ <SelectItem key={authType} value={authType}>+ {DOCUMENT_AUTH_TYPES[authType].value}+ </SelectItem>+ ))}</SelectContent></Select></FormControl>