import { Typography , withStyles , WithStyles } from "@material-ui/core" ; import * as React from "react" ; import { branch , compose , pure , renderComponent , setDisplayName } from "recompose" ; import { ResetVerificationRequest } from "common" ; import { Dialog , Form , FormButton , FormPassword , Header , Notification , TextLink } from "components" ; import { WithForm , withForm } from "enhancers" ; import { Styles , styles } from "./ResetVerification.styles" ; import { ResetVerificationSuccess } from "./ResetVerificationSuccess" ; /**
 * Branch properties
 */ type BranchProps = WithForm < ResetVerificationRequest > ; /**
 * Render properties
 */ export type RenderProps = WithStyles < Styles > & WithForm < ResetVerificationRequest > ; param props return export const Render = ( { classes , form , request , handleChange , handleSubmit } ) => < Dialog > < Header primary = { window . env . COGNITO_IDENTITY_POOL_NAME } secondary = "Unlock your account" / > < Notification /> < Form onSubmit = { handleSubmit } > < FormPassword name = "password" label = "New password" required disabled = { form . success } value = { request . password } InputProps = { { readOnly : form . pending } } onChange = { handleChange } autoComplete = "new-password" / > < FormButton className = { classes . button } disabled = { form . pending || form . success } > Reset password < /FormButton> < Typography className = { classes . authenticate } > Remembered your password ? < TextLink to = "/" > Sign in < /TextLink> < /Typography> < /Form> < /Dialog>; return export function enhance ( ) { return compose < RenderProps , { } > ( withStyles ( styles ) , withForm < ResetVerificationRequest > ( { message : "You have successfully changed your password. Use your " + "email address and new password to sign in to your account" , initial : { password : "" } } ) , branch < BranchProps > ( ( { form } ) => form . success , renderComponent ( ResetVerificationSuccess ) ) , pure , setDisplayName ( "ResetVerification" ) ) ; } /**
 * Password reset verification component
 */ export const ResetVerification = enhance ( ) ( Render ) ;