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
* @nogrep
*/
@@ -26,7 +26,7 @@ export type PeopleGraphPaginatedFragment$data = {
readonly emailAddress: string;
readonly fullName: string;
readonly id: string;
readonly kind: ProfileKind;
readonly kind: ProfileKind | null | undefined;
readonly position: string | null | undefined;
};
}>;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<41e415a03c63efbb590b1c2c782d5eac>>
* @generated SignedSource<<319d6df7ac6b5452d4a74501a35cec43>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -11,7 +11,6 @@
import { ConcreteRequest } from 'relay-runtime';
export type ElectronicSignatureStatus = "ACCEPTED" | "COMPLETED" | "FAILED" | "PENDING" | "PROCESSING";
export type AcceptElectronicSignatureInput = {
fullName: string;
signatureId: string;
};
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
}
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 {
hash := sha256.Sum256([]byte(token))
return hash[:]

View File

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

View File

@@ -2223,7 +2223,6 @@ type ElectronicSignature implements Node {
input AcceptElectronicSignatureInput {
signatureId: ID!
fullName: String!
}
type AcceptElectronicSignaturePayload {
@@ -9294,7 +9293,7 @@ func (ec *executionContext) unmarshalInputAcceptElectronicSignatureInput(ctx con
asMap[k] = v
}
fieldsInOrder := [...]string{"signatureId", "fullName"}
fieldsInOrder := [...]string{"signatureId"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
@@ -9308,13 +9307,6 @@ func (ec *executionContext) unmarshalInputAcceptElectronicSignatureInput(ctx con
return it, err
}
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

View File

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

View File

@@ -597,16 +597,6 @@ func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input
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)
if signerIP == "" {
signerIP = httpReq.RemoteAddr
@@ -616,7 +606,7 @@ func (r *mutationResolver) AcceptElectronicSignature(ctx context.Context, input
ctx,
&esign.AcceptSignatureRequest{
SignatureID: input.SignatureID,
SignerFullName: input.FullName,
SignerFullName: identity.FullName,
SignerEmail: identity.EmailAddress,
SignerIPAddr: signerIP,
SignerUA: httpReq.UserAgent(),