Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const getResourceAddressFormFieldsSchema = ({
zip_code: z.string().nullish(),
state_code: zodRequiredField,
country_code: zodRequiredField,
email: z.string().email().nullish(),
phone: zodRequiredField,
billing_info: requiresBillingInfo
? zodRequiredField
Expand Down Expand Up @@ -95,6 +96,11 @@ export interface ResourceAddressFormFieldsProps {
* @default false
*/
showNameOrCompany?: boolean
/**
* Optional setting to define if given `Address` `email` data is editable.
* @default false
*/
showEmail?: boolean
}

export const ResourceAddressFormFields =
Expand All @@ -104,6 +110,7 @@ export const ResourceAddressFormFields =
showBillingInfo = false,
showNotes = true,
showNameOrCompany = false,
showEmail = false,
}) => {
const namePrefix = name == null ? "" : `${name}.`
const { watch } = useFormContext()
Expand Down Expand Up @@ -170,6 +177,12 @@ export const ResourceAddressFormFields =
</div>
</FieldRow>

{showEmail && (
<FieldRow columns="1">
<HookedInput name={`${namePrefix}email`} label={"Email"} />
</FieldRow>
)}

<FieldRow columns="1">
<HookedInput
name={`${namePrefix}phone`}
Expand Down
Loading