Repository URL to install this package:
|
Version:
0.0.13 ▾
|
import { FormState } from '@skava/packages/ui/forms';
import { securityQuestionsContainer } from './container';
import { securityQuestionsFixture, wording } from './fixture';
/**
* @todo @name ITEM and LIST
*/
const renderQuestion = (index) => {
return securityQuestionsFixture.questions[index];
};
const renderAllQuestions = () => {
const questions = [];
for (let index = 0; index < securityQuestionsFixture.questions.length; index++) {
questions.push(renderQuestion(index));
}
return questions;
};
const securityQuestions = renderAllQuestions();
class SecurityQuestionContainer extends FormState {
constructor() {
super(...arguments);
this.name = 'updateSecurityQuestionFormData';
this.inputsList = [
{
type: 'label',
name: 'security-question',
labelText: wording.securityQuestion,
classes: 'security-question-label',
qa: 'security-question-label',
},
{
type: 'select',
value: '',
className: 'security-question-1',
name: 'securityquestion1',
title: wording.questionOne,
options: securityQuestions,
validationType: 'required',
errorMessageFor: 'selectSecurityQuestion',
onChange: this.onChange,
},
{
isHidden: true,
type: 'text',
value: '',
className: 'custom-security-question',
name: 'custom-security-question-1',
maxLength: 60,
validationType: 'required',
errorMessageFor: 'customSecurityQuestion',
placeholderText: wording.chooseYourQuestionLabel,
ariaLabel: wording.chooseYourQuestionLabel,
},
{
type: 'text',
value: '',
className: 'security-question-1-answer',
name: 'securityanswer1',
maxLength: 20,
labelText: wording.answerLabel,
wrapperClassName: 'security-question-1-answer-wrapper',
validationType: 'required',
errorMessageFor: 'securityQuestionAnswer',
ariaLabel: wording.answerLabel,
},
{
type: 'label',
name: 'security-question',
labelText: wording.securityQuestion,
classes: 'security-question-label',
qa: 'security-question-label',
},
{
type: 'select',
value: '',
className: 'security-question-2',
name: 'securityquestion2',
title: wording.questionTwo,
options: securityQuestions,
validationType: 'required',
errorMessageFor: 'selectSecurityQuestion',
onChange: this.onChange,
},
{
isHidden: true,
type: 'text',
value: '',
className: 'custom-security-question',
name: 'custom-security-question-2',
maxLength: 60,
validationType: 'required',
errorMessageFor: 'customSecurityQuestion',
placeholderText: wording.chooseYourQuestionLabel,
ariaLabel: wording.chooseYourQuestionLabel,
},
{
type: 'text',
value: '',
className: 'security-question-2-answer',
name: 'securityanswer2',
maxLength: 20,
labelText: wording.answerLabel,
wrapperClassName: 'security-question-2-answer-wrapper',
validationType: 'required',
errorMessageFor: 'securityQuestionAnswer',
ariaLabel: wording.answerLabel,
},
{
type: 'label',
name: 'security-question',
labelText: wording.securityQuestion,
classes: 'security-question-label',
qa: 'security-question-label',
},
{
type: 'select',
value: '',
className: 'security-question-3',
name: 'securityquestion3',
title: wording.questionThree,
options: securityQuestions,
validationType: 'required',
errorMessageFor: 'selectSecurityQuestion',
onChange: this.onChange,
},
{
isHidden: true,
type: 'text',
value: '',
className: 'custom-security-question',
name: 'custom-security-question-3',
maxLength: 60,
validationType: 'required',
errorMessageFor: 'customSecurityQuestion',
placeholderText: wording.chooseYourQuestionLabel,
ariaLabel: wording.chooseYourQuestionLabel,
},
{
type: 'text',
value: '',
className: 'security-question-3-answer',
name: 'securityanswer3',
maxLength: 20,
labelText: wording.answerLabel,
wrapperClassName: 'security-question-3-answer-wrapper',
validationType: 'required',
errorMessageFor: 'securityQuestionAnswer',
ariaLabel: wording.answerLabel,
},
];
this.onChange = (args) => {
const { value, state } = args;
securityQuestionsContainer.disableSelectedValues(value, state, this.inputsList);
};
}
}
/**
* @todo @fixme
*/
// const securityQuestionContainer = new SecurityQuestionContainer()
const securityQuestionContainer = {};
// read the warnings
// WARNING in ./src/views/widgets/MyAccountWidget/SecurityQuestions/FormView.js
// 70:11-36 "export 'securityQuestionContainer' was not found in './FormState'
export { SecurityQuestionContainer as FormState, securityQuestionContainer, SecurityQuestionContainer, securityQuestions, };
export default securityQuestionContainer;
//# sourceMappingURL=FormState.js.map