Skip to content

Commit

Permalink
Show which SEP-12 KYC fields are optional (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits authored Oct 20, 2023
1 parent cf50ec8 commit 76a81fa
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 28 deletions.
26 changes: 16 additions & 10 deletions packages/demo-wallet-client/src/components/Sep31Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,22 @@ export const Sep31Send = () => {
return (
<div className="vertical-spacing" key={sectionTitle}>
<Heading3>{capitalizeString(sectionTitle)}</Heading3>
{Object.entries(sectionItems || {}).map(([id, input]) => (
// TODO: if input.choices, render Select
<Input
key={`${sectionTitle}#${id}`}
id={`${sectionTitle}#${id}`}
label={(input as any).description}
required={!(input as any).optional}
onChange={handleChange}
/>
))}
{Object.entries(sectionItems || {}).map(([id, input]) => {
const label = `${(input as any).description}${
input.optional ? " (optional)" : ""
}`;

return (
// TODO: if input.choices, render Select
<Input
key={`${sectionTitle}#${id}`}
id={`${sectionTitle}#${id}`}
label={label}
required={!(input as any).optional}
onChange={handleChange}
/>
);
})}
</div>
);
})}
Expand Down
24 changes: 15 additions & 9 deletions packages/demo-wallet-client/src/components/Sep6/Sep6Deposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,21 @@ export const Sep6Deposit = () => {
) : null}
<div className="vertical-spacing">
{Object.entries(sep6DepositAsset.data.customerFields || {}).map(
([id, input]) => (
<Input
key={id}
id={id}
label={(input as any).description}
required
onChange={handleCustomerFieldChange}
/>
),
([id, input]) => {
const label = `${(input as any).description}${
input.optional ? " (optional)" : ""
}`;

return (
<Input
key={id}
id={id}
label={label}
required={!(input as any).optional}
onChange={handleCustomerFieldChange}
/>
);
},
)}
</div>
</Modal.Body>
Expand Down
24 changes: 15 additions & 9 deletions packages/demo-wallet-client/src/components/Sep6/Sep6Withdraw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,21 @@ export const Sep6Withdraw = () => {

<div className="vertical-spacing">
{Object.entries(sep6WithdrawAsset.data.fields || {}).map(
([field, fieldInfo]) => (
<Input
key={field}
id={field}
label={(fieldInfo as any)?.description}
required
onChange={handleCustomerFieldChange}
/>
),
([field, fieldInfo]) => {
const label = `${(fieldInfo as any).description}${
fieldInfo.optional ? " (optional)" : ""
}`;

return (
<Input
key={field}
id={field}
label={label}
required={!(fieldInfo as any).optional}
onChange={handleCustomerFieldChange}
/>
);
},
)}
</div>

Expand Down

0 comments on commit 76a81fa

Please sign in to comment.