questionSets/index
@boldpenguin/sdk-redux › Globals › "questionSets/index"
Index
Variables
- getCompletedQuestionSets
- getCurrentActiveQuestionSet
- getCurrentActiveQuestionSetCode
- getCurrentActiveQuestionSetId
- getIdOfNextQuestionSetNotInState
- getIncompleteQuestionSets
- getNonEmptyQuestionSets
- getQuestionSetByCode
- getQuestionSetById
- getQuestionSets
- hasCompletedQuestionSetAnswerHasChanged
- selectCurrentActiveAnswerId
- selectLatestAddressMapToValidate
- selectParentQuestionSets
- selectQuestionSetsState
Variables
Const
getCompletedQuestionSets
• getCompletedQuestionSets: function & OutputSelectorFields‹function› & object = createSelector(getQuestionSets, (questionSets) => questionSets.filter((qs) => qs.is_active && qs.is_completed), )
Returns array of the completed question sets in the store
param
The BpSdk Redux store
Const
getCurrentActiveQuestionSet
• getCurrentActiveQuestionSet: function & OutputSelectorFields‹function› & object = createSelector( getQuestionSets, getCurrentActiveQuestionSetId, (allQuestionSets, activeQuestionSetId) => allQuestionSets.find((qs) => qs.question_set_id === activeQuestionSetId), )
Returns the entire current active question set
param
The BpSdk Redux store
Const
getCurrentActiveQuestionSetCode
• getCurrentActiveQuestionSetCode: function & OutputSelectorFields‹function› & object = createSelector( getCurrentActiveQuestionSet, (activeQuestionSet) => activeQuestionSet?.question_set?.code, )
Returns the current question set code or undefined
param
The BpSdk Redux store
Const
getCurrentActiveQuestionSetId
• getCurrentActiveQuestionSetId: function & OutputSelectorFields‹function› & object = createSelector(selectQuestionSetsState, (questionSets) => questionSets.active)
Returns the current active question set ID
param
The BpSdk Redux store
Const
getIdOfNextQuestionSetNotInState
• getIdOfNextQuestionSetNotInState: function & OutputSelectorFields‹function› & object = createSelector( selectQuestionSetsState, (questionSetState) => questionSetState.idOfNextActiveQuestionSetNotInState, )
Returns the id of a question set that is next but not in state
Const
getIncompleteQuestionSets
• getIncompleteQuestionSets: function & OutputSelectorFields‹function› & object = createSelector(getQuestionSets, (questionSets) => questionSets.filter((qs) => qs.is_active && !qs.is_completed), )
Returns array of the incomplete question sets in the store
param
The entire Redux store
Const
getNonEmptyQuestionSets
• getNonEmptyQuestionSets: function & OutputSelectorFields‹function› & object = createSelector(getQuestionSets, (questionSets) => questionSets.filter((qs) => qs.is_active && qs.answers.some((ans) => ans.active)), )
Returns array of the non-empty question sets in the store
param
The BpSdk Redux store
Const
getQuestionSetByCode
• getQuestionSetByCode: function & OutputSelectorFields‹function› & object = createSelector([getQuestionSets, (_: BpSdkStore, code: string) => code], (allQuestionSets, code) => findQuestionSetByCode(allQuestionSets, code), )
Returns a specific question set from the store
param
The entire Redux store
param
ID of requested question set
Const
getQuestionSetById
• getQuestionSetById: function & OutputSelectorFields‹function› & object = createSelector([getQuestionSets, (_: BpSdkStore, id: string) => id], (allQuestionSets, id) => allQuestionSets.find((qs) => qs.id === id), )
Returns a specific question set from the store
param
The entire Redux store
param
ID of requested question set
Const
getQuestionSets
• getQuestionSets: function & OutputSelectorFields‹function› & object = createSelector(selectQuestionSetsState, (questionSets) => questionSets.list)
Returns all question sets in the store
param
The BpSdk Redux store
Const
hasCompletedQuestionSetAnswerHasChanged
• hasCompletedQuestionSetAnswerHasChanged: function & OutputSelectorFields‹function› & object = createSelector( selectQuestionSetsState, (state) => state.completedQuestionSetAnswerHasChanged, )
Returns whether a complete question set answer has been modified
param
The entire Redux store
Const
selectCurrentActiveAnswerId
• selectCurrentActiveAnswerId: function & OutputSelectorFields‹function› & object = createSelector(selectQuestionSetsState, (questionSets) => questionSets.activeAnswerId)
Returns the current active answer ID
param
The BpSdk Redux store
Const
selectLatestAddressMapToValidate
• selectLatestAddressMapToValidate: function & OutputSelectorFields‹function› & object = createSelector( [selectQuestionSetsState, (_, answerMap: { [key: string]: IAnswer }) => answerMap], (questionSets, answerMap) => { const latestMap = { ...answerMap }; if ( questionSets.pendingActiveAnswerUpdate?.question.reference_type && latestMap[questionSets.pendingActiveAnswerUpdate.question.reference_type] && questionSets.pendingActiveAnswerUpdate.id === latestMap[questionSets.pendingActiveAnswerUpdate.question.reference_type].id ) { latestMap[questionSets.pendingActiveAnswerUpdate?.question.reference_type] = questionSets.pendingActiveAnswerUpdate; } return latestMap; }, )
Returns the answer map updated with the pending active answer value
param
The entire BpSdk Redux store
param
A mapped object of the address in question to its reference type
Const
selectParentQuestionSets
• selectParentQuestionSets: function & OutputSelectorFields‹function› & object = createSelector(selectQuestionSetsState, (questionSetState) => { return questionSetState.parentQuestionSets; })
Returns the array of parent question sets from the store
param
The entire Redux store
Const
selectQuestionSetsState
• selectQuestionSetsState: function & OutputSelectorFields‹function› & object = createSelector([selectApplicationState], (appState) => appState.questionSets)
Selects the entire question sets state