Add esign to document signatures
Employee document signatures recorded an acknowledgment with no cryptographic proof, unlike document approvals which already create and accept an electronic signature on every decision. Mirror the approval flow on the sign path: generate the signed document PDF, create-and-accept an esign record, and persist its id on the document_version_signatures row through a new electronic_signature_id column. Capture the signer IP and user agent in the resolver, and re-check the published/archived preconditions inside the transaction so the seal cannot race document state. Make the consent wording a single backend source of truth shared by the text that is sealed and the text shown in the UI. Define DocumentSignatureConsentText and DocumentApprovalConsentText in the probo service package and the NDA copy in the trust service, each owned by the flow that uses it, and stop esign from appending the generic clause to caller-provided consent text so approvals no longer seal a duplicated sentence. Expose the resolved consent text through GraphQL on EmployeeDocumentVersion and DocumentVersionApprovalDecision, and have the signing, approval, and NDA pages render it from the API instead of hard-coded strings, mirroring how the NDA page already worked. Align the wording with the actual interaction: the buttons read "Review and sign" and "Review and approve", the clauses reference those actions, and the inaccurate "typing my full name" phrasing is removed everywhere. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -98,6 +98,7 @@ const decisionFragment = graphql`
|
||||
fragment DocumentApprovePageDecisionFragment on DocumentVersionApprovalDecision {
|
||||
id
|
||||
state
|
||||
consentText
|
||||
canApprove: permission(action: "core:document-version:approve")
|
||||
canReject: permission(action: "core:document-version:reject")
|
||||
}
|
||||
@@ -350,12 +351,12 @@ function ViewerDecision(props: {
|
||||
});
|
||||
}}
|
||||
>
|
||||
{__("Approve")}
|
||||
{__("Review and approve")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-xs text-txt-tertiary">
|
||||
{__("By clicking Approve, I consent to approve this document electronically and agree that my electronic signature has the same legal validity as a handwritten signature.")}
|
||||
{decision.consentText}
|
||||
</p>
|
||||
<Button onClick={onBack} className="w-full" variant="secondary">
|
||||
{__("Back to Documents")}
|
||||
|
||||
@@ -22,6 +22,7 @@ const fragment = graphql`
|
||||
fragment VersionActionsFragment on EmployeeDocumentVersion {
|
||||
id
|
||||
signed
|
||||
consentText
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -59,12 +60,10 @@ export function VersionActions({
|
||||
disabled={isSigning}
|
||||
icon={isSigning ? Spinner : undefined}
|
||||
>
|
||||
{__("I acknowledge and agree")}
|
||||
{__("Review and sign")}
|
||||
</Button>
|
||||
<p className="text-xs text-txt-tertiary mt-2 h-5">
|
||||
{__(
|
||||
"By clicking 'I acknowledge and agree', your digital signature will be recorded.",
|
||||
)}
|
||||
<p className="text-xs text-txt-tertiary mt-2">
|
||||
{versionData.consentText}
|
||||
</p>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -223,11 +223,7 @@ export function NDAPage(props: {
|
||||
return <Navigate to="/overview" replace />;
|
||||
}
|
||||
|
||||
const consentText = ndaSignature?.consentText
|
||||
? ndaSignature.consentText
|
||||
: __(
|
||||
"By clicking Review & Sign, you agree to the terms of this NDA. If you have questions about the NDA, please contact security@probo.com.",
|
||||
);
|
||||
const consentText = ndaSignature?.consentText;
|
||||
|
||||
return (
|
||||
<div className="bg-level-2 flex flex-col min-h-screen lg:h-screen">
|
||||
@@ -297,7 +293,7 @@ export function NDAPage(props: {
|
||||
>
|
||||
{isFailed
|
||||
? __("Try again")
|
||||
: __("Accept")}
|
||||
: __("Review and sign")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user