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AgBlB,EAAMC,OAAOkE,OAAOC,GAAgB,KAARA,IACjF,gBAAoB,WAAgB,MAEvC,gBAAoB,MAAO,CAAE5D,UAAW,IAAW,eAAgB,CAAE,aAAcR,EAAMqE,mBAAqBJ,GAAc,mBAAoB,CAAE,OAAUA,GAAcjE,EAAMQ,WAAY8D,KAAM,SACtMtE,EAAMC,OAAOsE,KAAI,CAACnD,EAAGoD,IAAO,gBAAoB,MAAO,CAAEC,IAAKD,IAAMpD,GAAK,IAAIsD,cAC7E1E,EAAM2E,OACF,gBAAoB,SAAU,CAAEnE,UAAW,eAAgBoE,QAAS,KAAQV,GAAc,EAAK,GAC3F,gBAAoB,IAAM,CAAErC,KAAM,WAAa,C,mECV/D,MAQA,EARiB7B,GACL,gBAAoB,WAAgB,KAAMA,EAAM6E,OAAU,gBAAoB,MAAO,CAAErE,UAAW,IAAW,SAAU,CAAEsE,MAAO9E,EAAM+E,UAAWC,YAAahF,EAAMgF,aAAe,YACvL,gBAAoB,OAAQ,CAAExE,UAAW,gBACzC,gBAAoB,OAAQ,CAAEA,UAAW,gBACzC,gBAAoB,OAAQ,CAAEA,UAAW,iBAAsB,gBAAoB,MAAO,CAAEyE,GAAI,eAAgBzE,UAAW,wBAC3H,gBAAoB,OAAQ,CAAEA,UAAW,4CACzC,gBAAoB,OAAQ,CAAEA,UAAW,4C","sources":["webpack:///./assets/src/components/account/ForgotPasswordStep1.tsx","webpack:///./assets/src/components/account/AccountForgotPasswordStep1Loader.tsx","webpack:///./assets/src/components/account/ForgotPasswordStep2.tsx","webpack:///./assets/src/components/account/AccountForgotPasswordStep2Loader.tsx","webpack:///./assets/src/components/common/ErrorBox.tsx","webpack:///./assets/src/ui/loading/Loading.tsx"],"sourcesContent":["import ErrorBox from '@components/common/ErrorBox';\nimport Button from '@ui/button/Button';\nimport FormField from '@ui/formfield/FormField';\nimport api from '@utils/api';\nimport React, { useState } from 'react';\nimport { Form } from 'react-final-form';\nimport { withTranslation } from 'react-i18next';\nconst ForgotPasswordStep1 = (props) => {\n const { t } = props;\n const [errors, setErrors] = useState([]);\n const [message, setMessage] = useState();\n const [isSubmitting, setIsSubmitting] = useState(false);\n const onSubmit = async (values) => {\n setErrors([]);\n setIsSubmitting(true);\n api\n .forgotPasswordSendMail(values.resetPasswordEmail)\n .then((data) => {\n if (data.error && data.error.length > 0) {\n setErrors(data.error);\n return;\n }\n setIsSubmitting(false);\n setMessage(data.message);\n })\n .catch((e) => {\n setErrors([e]);\n setIsSubmitting(false);\n });\n };\n const validate = (values) => {\n const errors = {};\n if (values.resetPasswordEmail) {\n if (!/^[\\w.%+-]+@[\\w.-]+\\.[\\w]{2,6}$/.test(values.resetPasswordEmail)) {\n errors.resetPasswordEmail = t('checkout.email.notvalid');\n }\n }\n else {\n errors.resetPasswordEmail = t('required.field');\n }\n return errors;\n };\n return (React.createElement(React.Fragment, null, message ? (React.createElement(\"p\", { className: 'password-reset-modal--text' }, message)) : (React.createElement(React.Fragment, null,\n React.createElement(\"p\", { className: 'password-reset-modal--text' }, t('account.password.forgot.text')),\n React.createElement(Form, { onSubmit: onSubmit, validate: validate, render: ({ handleSubmit, form, submitting, pristine, values }) => (React.createElement(\"form\", { onSubmit: handleSubmit },\n React.createElement(\"div\", { className: \"field-row\" },\n React.createElement(FormField, { name: \"resetPasswordEmail\", label: t('label.email'), type: \"email\", autocomplete: \"email\", required: true })),\n React.createElement(Button, { type: \"submit\", disabled: submitting || isSubmitting, cls: ['cta-primary'] }, t('account.password.reset')),\n React.createElement(\"div\", { className: \"pw-error\" },\n React.createElement(ErrorBox, { errors: errors })))) })))));\n};\nexport default withTranslation()(ForgotPasswordStep1);\n","import React from 'react';\nimport { Provider } from 'react-redux';\nimport { configureAccountStore } from '@state';\nimport ForgotPasswordStep1 from '@components/account/ForgotPasswordStep1';\nconst store = configureAccountStore();\nconst AccountForgotPassword = (props) => {\n return (React.createElement(Provider, { store: store },\n React.createElement(ForgotPasswordStep1, Object.assign({}, props))));\n};\nexport default AccountForgotPassword;\n","import ErrorBox from '@components/common/ErrorBox';\nimport Button from '@ui/button/Button';\nimport DwFormField from '@ui/formfield/DwFormField';\nimport api from '@utils/api';\nimport formutils from '@utils/formutils';\nimport React, { useEffect, useState } from 'react';\nimport { Form } from 'react-final-form';\nimport { withTranslation } from 'react-i18next';\nimport Loading from '../../ui/loading/Loading';\nconst ForgotPasswordStep2 = (props) => {\n const { t } = props;\n const [formdef, setFormdef] = useState();\n const [initialValues, setInitialValues] = useState();\n const [errors, setErrors] = React.useState([]);\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [success, setSuccess] = React.useState(false);\n useEffect(() => {\n if (!props.token) {\n window.location.href = props.forgotpasswordform;\n return;\n }\n let val = {};\n api.getForm('newPasswords', val).then((data) => {\n setInitialValues(val);\n setFormdef(data);\n });\n }, []);\n const validate = async (values) => {\n const checkPasswordValidateErrors = {};\n if (values.newpassword) {\n if (/^\\s|\\s$/.test(values.newpassword)) {\n checkPasswordValidateErrors.newpassword = t('error.password.space');\n }\n if (values.newpasswordconfirm !== '' && values.newpassword !== values.newpasswordconfirm) {\n checkPasswordValidateErrors.newpasswordconfirm = t('account.form.password.notmatch');\n }\n }\n let backValidation = await formutils.validateForm(values, formdef, 'newPasswords');\n let errors = Object.assign(Object.assign({}, backValidation), checkPasswordValidateErrors);\n return errors;\n };\n const onSubmit = async (values) => {\n setIsSubmitting(true);\n setErrors([]);\n let errors = await validate(values);\n if (errors && Object.keys(errors).length > 0) {\n setIsSubmitting(false);\n return errors;\n }\n return api\n .forgotPasswordChange(values, formdef, props.token)\n .then((data) => {\n if (data.error && data.error.length > 0) {\n setIsSubmitting(false);\n setErrors(data.error);\n return;\n }\n if (!formutils.checkValidationAfterSubmit(data, errors)) {\n setIsSubmitting(false);\n return errors;\n }\n setSuccess(true);\n if (data.redirectUrl) {\n window.location.href = data.redirectUrl;\n return;\n }\n })\n .catch((e) => setErrors([e]));\n };\n if (!formdef || !initialValues) {\n return React.createElement(React.Fragment, null);\n }\n const form = () => {\n return (React.createElement(React.Fragment, null,\n React.createElement(Form, { initialValues: initialValues, onSubmit: onSubmit, validate: validate, render: ({ handleSubmit, form, submitting, pristine, values }) => (React.createElement(\"form\", { onSubmit: handleSubmit },\n React.createElement(\"div\", { className: 'formfields' },\n React.createElement(\"div\", { className: \"field-row\" },\n React.createElement(DwFormField, { def: formdef, name: \"newpassword\", type: \"password\", autocomplete: \"new-password\" })),\n React.createElement(\"div\", { className: \"field-row\" },\n React.createElement(DwFormField, { def: formdef, name: \"newpasswordconfirm\", type: \"password\", autocomplete: \"new-password\" }))),\n React.createElement(Button, { type: \"submit\", disabled: submitting, cls: ['cta-primary'] }, t('account.password.confirm')),\n React.createElement(\"div\", { className: \"pw-error\" },\n React.createElement(ErrorBox, { errors: errors })))) }),\n isSubmitting && React.createElement(Loading, null)));\n };\n return (React.createElement(\"div\", { className: 'new-password--form-container' },\n React.createElement(\"h2\", { className: 'new-password--title' }, t('account.password.reset')),\n React.createElement(\"p\", { className: 'new-password--description' }, t('account.password.description')),\n form()));\n};\nexport default withTranslation()(ForgotPasswordStep2);\n","import React from 'react';\nimport { Provider } from 'react-redux';\nimport { configureAccountStore } from '@state';\nimport ForgotPasswordStep2 from '@components/account/ForgotPasswordStep2';\nconst store = configureAccountStore();\nconst AccountForgotPassword = (props) => {\n return (React.createElement(Provider, { store: store },\n React.createElement(ForgotPasswordStep2, Object.assign({}, props))));\n};\nexport default AccountForgotPassword;\n","import classNames from 'classnames';\nimport React from 'react';\nimport Icon from './Icon';\nconst ErrorBox = (props) => {\n const [closeError, setCloseError] = React.useState(false);\n if (closeError || !props.errors || props.errors.length === 0 || props.errors.every((err) => err === '')) {\n return React.createElement(React.Fragment, null);\n }\n return (React.createElement(\"div\", { className: classNames('globalerrors', { 'is-invalid': props.isInvalidTrigger && !closeError }, 'invalid-feedback', { 'closed': closeError }, props.className), role: \"alert\" },\n props.errors.map((e, i) => (React.createElement(\"div\", { key: i }, (e || '').toString()))),\n props.close &&\n React.createElement(\"button\", { className: \"close-button\", onClick: () => { setCloseError(true); } },\n React.createElement(Icon, { name: 'close' }))));\n};\nexport default ErrorBox;\n","import classNames from 'classnames';\nimport React from 'react';\nconst Loading = (props) => {\n return (React.createElement(React.Fragment, null, props.inline ? (React.createElement(\"div\", { className: classNames('loader', { light: props.lightMode, transparent: props.transparent }, 'visible') },\n React.createElement(\"span\", { className: \"loader__dot\" }),\n React.createElement(\"span\", { className: \"loader__dot\" }),\n React.createElement(\"span\", { className: \"loader__dot\" }))) : (React.createElement(\"div\", { id: \"html-spinner\", className: \"spinner full visible\" },\n React.createElement(\"span\", { className: \"spinner__dot spinner__dot--string_light\" }),\n React.createElement(\"span\", { className: \"spinner__dot spinner__dot--string_dark\" })))));\n};\nexport default Loading;\n"],"names":["props","errors","setErrors","useState","message","setMessage","isSubmitting","setIsSubmitting","className","t","onSubmit","async","values","api","resetPasswordEmail","then","data","error","length","catch","e","validate","test","render","handleSubmit","form","submitting","pristine","FormField","name","label","type","autocomplete","required","Button","disabled","cls","ErrorBox","store","Object","assign","withTranslation","formdef","setFormdef","initialValues","setInitialValues","success","setSuccess","useEffect","token","window","location","href","forgotpasswordform","val","checkPasswordValidateErrors","newpassword","newpasswordconfirm","backValidation","formutils","keys","redirectUrl","DwFormField","def","Loading","closeError","setCloseError","every","err","isInvalidTrigger","role","map","i","key","toString","close","onClick","inline","light","lightMode","transparent","id"],"sourceRoot":""}