Repository URL to install this package:
|
Version:
0.0.3 ▾
|
import { FormState } from '@skava/packages/ui/forms';
import { securityQuestionsContainer } from '../state/securityQuestionsContainer';
import { securityQuestionsData, wording } from '../fixture';
/**
* @todo @name ITEM and LIST
*/
const renderQuestion = (index) => {
return securityQuestionsData.questions[index];
};
const renderAllQuestions = () => {
const questions = [];
for (let index = 0; index < securityQuestionsData.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: 'seperator',
labelText: 'or',
className: 'separator-label',
qa: 'seperator-label',
},
{
identity: 'securityQuestion',
type: 'select',
value: '',
name: 'securityquestion1',
isFormView: true,
labelText: wording.securityQuestion,
label: wording.selectyourquestion,
options: securityQuestions,
validationType: 'selectOption',
errorMessageFor: 'selectQuestion',
className: 'security-question-1',
onDropdownChange: this.onChange,
qa: 'qa-security-question-text',
shouldBeAbsolute: true,
},
{
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',
qa: 'qa-security-answer-text',
autocomplete: 'off',
ariaLabel: wording.answerLabel,
},
];
this.onChange = (args) => {
const { value, state } = args;
securityQuestionsContainer.disableSelectedValues(value, state, this.inputsList);
};
}
}
const securityQuestionContainer = new 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, securityQuestions, securityQuestionContainer, SecurityQuestionContainer as FormState, };
export default securityQuestionContainer;
//# sourceMappingURL=FormState.js.map