Skip to content

RegisterFromOrderForm

Create an account after a guest order with just a password: the email and names come from the order. Addresses are the site's to save in onRegistered.

import { RegisterFromOrderForm } from "@evolve-storefront/feature-auth/register-from-order-form";

Renders inside AuthProvider.

Preview

DefaultOpen in Storybook ↗

Usage

Only a password to type; the email and names are the order's.

<RegisterFromOrderForm
email={order.email}
givenName={order.billingAddress?.givenName}
familyName={order.billingAddress?.familyName}
onRegistered={() => saveOrderAddresses(order)}
/>;

Props

PropTypeDescription
emailstring

The order's email; the account is created for it.

validationBehavior?"aria" | "native"

Default "aria": mark fields via ARIA rather than blocking native submit. The form is then noValidate, so an input's own constraint (type="email") never stops the submit with a browser tooltip that the field's error does not match.

givenName?string | null
familyName?string | null
onRegistered?((customer: AuthCustomer) => void)

Called after the session is adopted, so a write made here, such as saving the order's addresses, is already the new customer's.

Any other props go to the root element, like on a plain HTML element.