export const resolveJourneyStageFlags = ({ representationSubmit, representationSubmitConfirmation }) => { const showCheckStage = representationSubmit === true || representationSubmit === "true"; const showCompletionStage = representationSubmitConfirmation === true || representationSubmitConfirmation === "true"; return { showFormStage: !showCheckStage, showCheckStage, showCompletionStage }; }; export const resolveRepresentationControlKey = ({ isLPA, representationCapacity, repDetailsCapacity, appealType, normalizeCapacity }) => { if (isLPA && (!representationCapacity || representationCapacity === "")) { return { controlKey: "lpa-capacity-selection", normalizedCapacity: "" }; } const rawCapacity = representationCapacity || repDetailsCapacity || "false"; const normalizedCapacity = normalizeCapacity(rawCapacity.toLowerCase()); return { controlKey: `capacity-${normalizedCapacity}`, normalizedCapacity }; }; export const resolveSubmitTransition = ({ representationType, showQuestionnaireSection, questionnaireCount }) => { if (representationType !== "Questionnaire") { return "goToCheck"; } if ( questionnaireCount !== 0 && showQuestionnaireSection < questionnaireCount ) { return "advanceQuestionnaire"; } return "goToCheck"; }; export const getQuestionnaireNextSection = ( currentSection, questionnaireCount ) => { if (questionnaireCount !== 0 && currentSection < questionnaireCount) { return currentSection + 1; } return currentSection; }; export const getQuestionnairePreviousSection = (currentSection) => { return currentSection > 1 ? currentSection - 1 : currentSection; };