Repository URL to install this package:
|
Version:
0.0.15 ▾
|
import * as tslib_1 from "tslib";
import React from 'react';
import { isFunction } from 'exotic';
import { observer } from 'xmobx/mobx-react';
import { userContainer } from '@skava/packages/core/auth/user';
import { FormState, ObserverForm } from '@skava/packages/ui/forms';
// src
import { ContinueButton } from '@skava/packages/ui';
// local
import { wording, stepValue } from '../fixture';
class ResetPasswordFormContainer extends FormState {
constructor() {
super(...arguments);
this.name = 'resetPasswordFormData';
this.inputsList = [
{
identity: 'email',
type: 'text',
value: '',
className: 'reset-password-email-address',
name: 'email',
labelText: wording.email,
maxLength: 50,
wrapperClassName: 'reset-password-email-address-wrapper',
validationType: 'emailOrPhone',
errorMessageFor: 'emailAndPhone',
qa: 'qa-reset-email-textbox',
ariaLabel: wording.email,
},
];
}
}
const resetPasswordFormContainer = new ResetPasswordFormContainer();
let ResetPasswordForm = class ResetPasswordForm extends ObserverForm {
constructor() {
super(...arguments);
this.handleSubmit = (event) => {
event.preventDefault();
if (this.validateForm()) {
const serialized = this.state.toSerialized();
const { email } = serialized;
userContainer.setEmail(email);
console.log(serialized);
if (isFunction(this.props.onResetSubmit)) {
this.props.onResetSubmit(serialized);
}
if (isFunction(this.props.onNext)) {
this.props.onNext(stepValue.stepTwo);
}
}
else {
console.error('Form has invalid inputs!');
}
};
}
render() {
return (React.createElement(this.Form, { setRef: this.state.setFormReference },
this.renderInputList(),
React.createElement(ContinueButton, { className: "reset-continue-button", onClick: this.handleSubmit, text: wording.resetPasswordText, qa: "qa-reset-password-button" })));
}
};
ResetPasswordForm.defaultProps = {
state: resetPasswordFormContainer,
};
ResetPasswordForm = tslib_1.__decorate([
observer
], ResetPasswordForm);
export { ResetPasswordForm, resetPasswordFormContainer };
export default ResetPasswordForm;
//# sourceMappingURL=ResetPasswordForm.js.map