import { useFormik, getIn, setIn } from "formik"; import classnames from "classnames"; import SelfServiceMessages from "./SelfServiceMessages"; export default function SelfServiceForm({ flow, config, fieldsConfig, title, button = "Submit" }) { const fields = config.fields .filter((field) => !field.name.startsWith("traits.name")) // drop name fields .map((field) => ({ ...field, ...fieldsConfig[field.name] })) .sort((a, b) => (a.position < b.position ? -1 : 1)); const formik = useFormik({ initialValues: fields.reduce((acc, field) => setIn(acc, field.name, field.value ?? ""), {}), }); return (