viewState/index
@boldpenguin/sdk-redux › Globals › "viewState/index"
Index
Variables
- getViewStateFeatures
- isFeatureEnabled
- selectAddressGroupIdsThatNeedValidation
- selectAddressValidation
- selectAddressValidationAddressComponents
- selectAddressValidationAttemptNumber
- selectAddressValidationOriginalAddress
- selectAddressValidationStagedAnswers
- selectAddressValidationStatuses
- selectAddressValidationTriggerWasOverridden
- selectAddressValidationVerdict
- selectFilteredOfflineQuotes
- selectFilteredOnlineQuotes
- selectHasAddressCompletedValidation
- selectHasAddressValidationError
- selectHasValidationOccurredForAddress
- selectIsActiveQuestionSetBeingValidated
- selectIsAddressGroupValidationInitialized
- selectShouldTriggerAddressValidation
- selectValidationStatusForAddressGroup
- selectViewStateAddressValidation
- selectViewStateQuotes
Functions
Variables
Const
getViewStateFeatures
• getViewStateFeatures: function & OutputSelectorFields‹function› & object = createSelector([selectViewState], (viewState) => viewState.features)
Selects the state and features currently in the store
param
The BpSdk Redux store
Const
isFeatureEnabled
• isFeatureEnabled: function & OutputSelectorFields‹function› & object = createSelector( [getViewStateFeatures, (_: BpSdkStore, feature: string) => feature], (allFeatureFlags, feature) => allFeatureFlags.list.includes(feature), )
Check if a feature flag is enabled
Const
selectAddressGroupIdsThatNeedValidation
• selectAddressGroupIdsThatNeedValidation: function & OutputSelectorFields‹function› & object = createSelector([selectViewState], (state): string[] => Object.entries(state.addressValidation.validations) .filter(([, value]) => value.validationStatus === ValidationStatus.REQUIRED) .map(([key]) => key), )
Selects address group ids that require validation
Const
selectAddressValidation
• selectAddressValidation: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId], )
Selects the address validation view state
Const
selectAddressValidationAddressComponents
• selectAddressValidationAddressComponents: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId]?.address, )
Selects the address validation google validated address components
Const
selectAddressValidationAttemptNumber
• selectAddressValidationAttemptNumber: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId]?.attempt, )
Selects the number of validations performed on a specifc address
Const
selectAddressValidationOriginalAddress
• selectAddressValidationOriginalAddress: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId]?.originalAddress, )
Selects the user entered address that was validated
Const
selectAddressValidationStagedAnswers
• selectAddressValidationStagedAnswers: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId]?.stagedAnswers, )
Selects the address validation missing address inputs to be saved
Const
selectAddressValidationStatuses
• selectAddressValidationStatuses: function & OutputSelectorFields‹function› & object = createSelector([selectViewState], (state) => Object.fromEntries(Object.entries(state.addressValidation.validations).map(([key, value]) => [key, value.validationStatus])), )
Selects all address validation statuses by id
Const
selectAddressValidationTriggerWasOverridden
• selectAddressValidationTriggerWasOverridden: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState], (state) => state.addressValidation.shouldOverrideValidationTrigger, )
Selects a boolean to indicate if the address validation was triggered by something other than the next button
Const
selectAddressValidationVerdict
• selectAddressValidationVerdict: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId]?.verdict, )
Selects the address validation google verdict
Const
selectFilteredOfflineQuotes
• selectFilteredOfflineQuotes: function & OutputSelectorFields‹function› & object = createSelector([selectViewStateQuotes], (viewState) => viewState.filteredOfflineQuotes)
When the bp-sdk-quote-request-container component is mounted, it calculates the set of quotes that it should render based on any filters that are applied. These filters include optional carrier code filtering.
This selector returns the set of filtered offline quotes that are rendered by the bp-sdk-quote-request-container component
Const
selectFilteredOnlineQuotes
• selectFilteredOnlineQuotes: function & OutputSelectorFields‹function› & object = createSelector([selectViewStateQuotes], (viewState) => viewState.filteredOnlineQuotes)
When the bp-sdk-quote-request-container component is mounted, it calculates the set of quotes that it should render based on any filters that are applied. These filters include status filtering by default and optional carrier code filtering.
This selector returns the set of filtered online quotes that are rendered by the bp-sdk-quote-request-container component
Const
selectHasAddressCompletedValidation
• selectHasAddressCompletedValidation: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId]?.validationStatus === ValidationStatus.COMPLETED, )
Selects if address has already completed validation process
Const
selectHasAddressValidationError
• selectHasAddressValidationError: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId]?.validationStatus === ValidationStatus.VALIDATION_ERROR, )
Selects if an error occurred during address validation
Const
selectHasValidationOccurredForAddress
• selectHasValidationOccurredForAddress: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId]?.validationStatus === ValidationStatus.VALIDATED || state.addressValidation.validations[addressValidationId]?.validationStatus === ValidationStatus.COMPLETED || state.addressValidation.validations[addressValidationId]?.validationStatus === ValidationStatus.VALIDATION_ERROR || state.addressValidation.validations[addressValidationId]?.validationStatus === ValidationStatus.PROCEED_NEXT, )
Selects if validation has been performed
Const
selectIsActiveQuestionSetBeingValidated
• selectIsActiveQuestionSetBeingValidated: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, activeQuestionSet: IApplicationFormQuestionSet) => activeQuestionSet], (state, activeQuestionSet) => { return ( activeQuestionSet && !!Object.entries(state.addressValidation.validations).filter( ([id, value]) => (activeQuestionSet.answers.map((answer) => answer.answer_pool_id).includes(id) || activeQuestionSet.question_set.question_groups.map((group) => group.id).includes(id)) && value.validationStatus === ValidationStatus.VALIDATED, ).length ); }, )
Selects if status in active question set is actively being validated
Const
selectIsAddressGroupValidationInitialized
• selectIsAddressGroupValidationInitialized: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId): boolean | null => (addressValidationId ? !!state.addressValidation.validations[addressValidationId] : null), )
Selects if the address group exists for validation
Const
selectShouldTriggerAddressValidation
• selectShouldTriggerAddressValidation: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId]?.validationStatus === ValidationStatus.READY_TO_VALIDATE, )
Selects if validation is ready to be triggered
Const
selectValidationStatusForAddressGroup
• selectValidationStatusForAddressGroup: function & OutputSelectorFields‹function› & object = createSelector( [selectViewState, (_, addressValidationId) => addressValidationId], (state, addressValidationId) => state.addressValidation.validations[addressValidationId]?.validationStatus, )
Selects the address validation status for a given address group id
Const
selectViewStateAddressValidation
• selectViewStateAddressValidation: function & OutputSelectorFields‹function› & object = createSelector([selectViewState], (viewState) => viewState.addressValidation)
Selects the address validation view state
Const
selectViewStateQuotes
• selectViewStateQuotes: function & OutputSelectorFields‹function› & object = createSelector([selectViewState], (viewState) => viewState.quotes)
Selects the quotes view state
Functions
Const
selectViewState
▸ selectViewState(state
: BpSdkStore): CombinedState‹Object›
Select the entire view state
Parameters:
Name | Type |
---|---|
state | BpSdkStore |
Returns: CombinedState‹Object›