Remove full name input from nda page

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-03-05 11:19:19 +04:00
parent 46d8450ead
commit e856817d2b
12 changed files with 20 additions and 100 deletions

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<d9088a212dfa65ed0a833670cf8bc6d4>> * @generated SignedSource<<426a1227dea8949a1d77d75edf05437a>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -26,7 +26,7 @@ export type PeopleGraphPaginatedFragment$data = {
readonly emailAddress: string; readonly emailAddress: string;
readonly fullName: string; readonly fullName: string;
readonly id: string; readonly id: string;
readonly kind: ProfileKind; readonly kind: ProfileKind | null | undefined;
readonly position: string | null | undefined; readonly position: string | null | undefined;
}; };
}>; }>;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<1eea90ca68f7381b881c68f0489837cb>> * @generated SignedSource<<e88375170021c3387ee6a5491bc60e52>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -20,7 +20,7 @@ export type PersonFormFragment$data = {
readonly emailAddress: string; readonly emailAddress: string;
readonly fullName: string; readonly fullName: string;
readonly id: string; readonly id: string;
readonly kind: ProfileKind; readonly kind: ProfileKind | null | undefined;
readonly membership: { readonly membership: {
readonly role: MembershipRole; readonly role: MembershipRole;
}; };

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<7889e38e185230a2c5b41c3b0fb73cca>> * @generated SignedSource<<8ef1dc9de9a669636884e4f60f7f39fc>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -18,7 +18,7 @@ export type CreateUserInput = {
contractStartDate?: string | null | undefined; contractStartDate?: string | null | undefined;
emailAddress: string; emailAddress: string;
fullName: string; fullName: string;
kind: ProfileKind; kind?: ProfileKind | null | undefined;
organizationId: string; organizationId: string;
position?: string | null | undefined; position?: string | null | undefined;
role: MembershipRole; role: MembershipRole;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<8563f3b122bb8d5b6c2e5e7354a0a0c8>> * @generated SignedSource<<dc04e9218150e42554925f8c39d83b41>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -16,7 +16,7 @@ export type UpdateUserInput = {
contractStartDate?: string | null | undefined; contractStartDate?: string | null | undefined;
fullName: string; fullName: string;
id: string; id: string;
kind: ProfileKind; kind?: ProfileKind | null | undefined;
position?: string | null | undefined; position?: string | null | undefined;
}; };
export type PersonForm_updateMutation$variables = { export type PersonForm_updateMutation$variables = {

View File

@@ -68,7 +68,7 @@ const schema = z.object({
v => (v as string[]).filter(v => !!v), v => (v as string[]).filter(v => !!v),
z.array(z.string().email()), z.array(z.string().email()),
), ),
kind: z.enum(peopleRoles), kind: z.enum(peopleRoles).optional().nullable(),
contractStartDate: z.string().optional().nullable(), contractStartDate: z.string().optional().nullable(),
contractEndDate: z.string().optional().nullable(), contractEndDate: z.string().optional().nullable(),
}); });

View File

@@ -1,6 +1,6 @@
import { sprintf } from "@probo/helpers"; import { sprintf } from "@probo/helpers";
import { useTranslate } from "@probo/i18n"; import { useTranslate } from "@probo/i18n";
import { Button, Card, Field, IconCircleX, Logo, Spinner } from "@probo/ui"; import { Button, Card, IconCircleX, Logo, Spinner } from "@probo/ui";
import { startTransition, useEffect, useRef } from "react"; import { startTransition, useEffect, useRef } from "react";
import { import {
type PreloadedQuery, type PreloadedQuery,
@@ -11,10 +11,8 @@ import {
import { Navigate, useSearchParams } from "react-router"; import { Navigate, useSearchParams } from "react-router";
import { graphql } from "relay-runtime"; import { graphql } from "relay-runtime";
import { useWindowSize } from "usehooks-ts"; import { useWindowSize } from "usehooks-ts";
import { z } from "zod";
import { PDFPreview } from "#/components/PDFPreview"; import { PDFPreview } from "#/components/PDFPreview";
import { useFormWithSchema } from "#/hooks/useFormWithSchema";
import { getPathPrefix } from "#/utils/pathPrefix"; import { getPathPrefix } from "#/utils/pathPrefix";
import type { NDAPageAcceptElectronicSignatureMutation } from "./__generated__/NDAPageAcceptElectronicSignatureMutation.graphql"; import type { NDAPageAcceptElectronicSignatureMutation } from "./__generated__/NDAPageAcceptElectronicSignatureMutation.graphql";
@@ -81,10 +79,6 @@ const recordSigningEventMutation = graphql`
} }
`; `;
const schema = z.object({
fullName: z.string().min(1),
});
export function NDAPage(props: { export function NDAPage(props: {
queryRef: PreloadedQuery<NDAPageQueryType>; queryRef: PreloadedQuery<NDAPageQueryType>;
}) { }) {
@@ -137,16 +131,6 @@ export function NDAPage(props: {
const isFailed = ndaSignature?.status === "FAILED"; const isFailed = ndaSignature?.status === "FAILED";
const isCompleted = ndaSignature?.status === "COMPLETED"; const isCompleted = ndaSignature?.status === "COMPLETED";
const {
handleSubmit: handleSubmitWrapper,
register,
formState,
} = useFormWithSchema(schema, {
defaultValues: {
fullName: viewer?.fullName,
},
});
useEffect(() => { useEffect(() => {
if (isCompleted) { if (isCompleted) {
window.location.href = safeContinueUrl; window.location.href = safeContinueUrl;
@@ -182,7 +166,7 @@ export function NDAPage(props: {
} }
}, [ndaSignature, recordSigningEvent]); }, [ndaSignature, recordSigningEvent]);
const handleSubmit = handleSubmitWrapper(({ fullName }) => { const handleAccept = () => {
if (!ndaSignature) return; if (!ndaSignature) return;
if (ndaSignature.status === "PENDING") { if (ndaSignature.status === "PENDING") {
@@ -208,13 +192,12 @@ export function NDAPage(props: {
variables: { variables: {
input: { input: {
signatureId: ndaSignature.id, signatureId: ndaSignature.id,
fullName,
}, },
}, },
}); });
}, },
}); });
}); };
const nda = trustCenter.nonDisclosureAgreement; const nda = trustCenter.nonDisclosureAgreement;
if (!viewer) { if (!viewer) {
@@ -260,18 +243,7 @@ export function NDAPage(props: {
</Button> </Button>
</Card> </Card>
)} )}
<form <div className="mt-8">
onSubmit={e => void handleSubmit(e)}
className="mt-8"
>
<Field
required
label={__("Full name")}
placeholder="John Doe"
{...register("fullName")}
type="text"
disabled={isProcessing}
/>
<p className="text-xs text-txt-tertiary mt-6"> <p className="text-xs text-txt-tertiary mt-6">
{consentText} {consentText}
</p> </p>
@@ -302,9 +274,10 @@ export function NDAPage(props: {
) )
: ( : (
<Button <Button
type="submit" type="button"
onClick={handleAccept}
className="h-10 w-full mt-4" className="h-10 w-full mt-4"
disabled={formState.isSubmitting || !formState.isValid} disabled={isProcessing}
icon={isAccepting ? Spinner : undefined} icon={isAccepting ? Spinner : undefined}
> >
{isFailed {isFailed
@@ -312,7 +285,7 @@ export function NDAPage(props: {
: __("Accept")} : __("Accept")}
</Button> </Button>
)} )}
</form> </div>
</div> </div>
<a <a
href="https://www.getprobo.com/" href="https://www.getprobo.com/"

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<41e415a03c63efbb590b1c2c782d5eac>> * @generated SignedSource<<319d6df7ac6b5452d4a74501a35cec43>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -11,7 +11,6 @@
import { ConcreteRequest } from 'relay-runtime'; import { ConcreteRequest } from 'relay-runtime';
export type ElectronicSignatureStatus = "ACCEPTED" | "COMPLETED" | "FAILED" | "PENDING" | "PROCESSING"; export type ElectronicSignatureStatus = "ACCEPTED" | "COMPLETED" | "FAILED" | "PENDING" | "PROCESSING";
export type AcceptElectronicSignatureInput = { export type AcceptElectronicSignatureInput = {
fullName: string;
signatureId: string; signatureId: string;
}; };
export type NDAPageAcceptElectronicSignatureMutation$variables = { export type NDAPageAcceptElectronicSignatureMutation$variables = {

View File

@@ -751,38 +751,6 @@ func (s AuthService) OpenSessionWithMagicLink(ctx context.Context, tokenString s
return identity, session, payload.Data.Continue, nil return identity, session, payload.Data.Continue, nil
} }
func (s *AuthService) UpdateIdentity(ctx context.Context, identityID gid.GID, fullName string) (*coredata.Identity, error) {
identity := &coredata.Identity{}
err := s.pg.WithTx(
ctx,
func(tx pg.Conn) error {
if err := identity.LoadByID(ctx, tx, identityID); err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return NewIdentityNotFoundError(identityID)
}
return fmt.Errorf("cannot load identity: %w", err)
}
identity.FullName = fullName
identity.UpdatedAt = time.Now()
if err := identity.Update(ctx, tx); err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return NewIdentityNotFoundError(identityID)
}
return fmt.Errorf("cannot update identity: %w", err)
}
return nil
},
)
return identity, err
}
func HashToken(token string) []byte { func HashToken(token string) []byte {
hash := sha256.Sum256([]byte(token)) hash := sha256.Sum256([]byte(token))
return hash[:] return hash[:]

View File

@@ -801,7 +801,6 @@ type ElectronicSignature implements Node {
input AcceptElectronicSignatureInput { input AcceptElectronicSignatureInput {
signatureId: ID! signatureId: ID!
fullName: String!
} }
type AcceptElectronicSignaturePayload { type AcceptElectronicSignaturePayload {

View File

@@ -2223,7 +2223,6 @@ type ElectronicSignature implements Node {
input AcceptElectronicSignatureInput { input AcceptElectronicSignatureInput {
signatureId: ID! signatureId: ID!
fullName: String!
} }
type AcceptElectronicSignaturePayload { type AcceptElectronicSignaturePayload {
@@ -9294,7 +9293,7 @@ func (ec *executionContext) unmarshalInputAcceptElectronicSignatureInput(ctx con
asMap[k] = v asMap[k] = v
} }
fieldsInOrder := [...]string{"signatureId", "fullName"} fieldsInOrder := [...]string{"signatureId"}
for _, k := range fieldsInOrder { for _, k := range fieldsInOrder {
v, ok := asMap[k] v, ok := asMap[k]
if !ok { if !ok {
@@ -9308,13 +9307,6 @@ func (ec *executionContext) unmarshalInputAcceptElectronicSignatureInput(ctx con
return it, err return it, err
} }
it.SignatureID = data it.SignatureID = data
case "fullName":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fullName"))
data, err := ec.unmarshalNString2string(ctx, v)
if err != nil {
return it, err
}
it.FullName = data
} }
} }
return it, nil return it, nil

View File

@@ -18,7 +18,6 @@ type Node interface {
type AcceptElectronicSignatureInput struct { type AcceptElectronicSignatureInput struct {
SignatureID gid.GID `json:"signatureId"` SignatureID gid.GID `json:"signatureId"`
FullName string `json:"fullName"`
} }
type AcceptElectronicSignaturePayload struct { type AcceptElectronicSignaturePayload struct {

View File

@@ -597,16 +597,6 @@ func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input
httpReq = gqlutils.HTTPRequestFromContext(ctx) httpReq = gqlutils.HTTPRequestFromContext(ctx)
) )
if _, err := r.iam.AuthService.UpdateIdentity(ctx, identity.ID, input.FullName); err != nil {
var errNotFound *iam.ErrIdentityNotFound
if errors.As(err, &errNotFound) {
return nil, gqlutils.NotFound(ctx, err)
}
r.logger.ErrorCtx(ctx, "cannot update identity", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
signerIP, _, _ := net.SplitHostPort(httpReq.RemoteAddr) signerIP, _, _ := net.SplitHostPort(httpReq.RemoteAddr)
if signerIP == "" { if signerIP == "" {
signerIP = httpReq.RemoteAddr signerIP = httpReq.RemoteAddr
@@ -616,7 +606,7 @@ func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input
ctx, ctx,
&esign.AcceptSignatureRequest{ &esign.AcceptSignatureRequest{
SignatureID: input.SignatureID, SignatureID: input.SignatureID,
SignerFullName: input.FullName, SignerFullName: identity.FullName,
SignerEmail: identity.EmailAddress, SignerEmail: identity.EmailAddress,
SignerIPAddr: signerIP, SignerIPAddr: signerIP,
SignerUA: httpReq.UserAgent(), SignerUA: httpReq.UserAgent(),