Skip to main content

messages/index

@boldpenguin/sdk-reduxGlobals"messages/index"

Index

Variables

Functions

Variables

Const getMessagesForApplicationForm

getMessagesForApplicationForm: function & OutputSelectorFields‹function› & object = createSelector(getMessages, (messages) => { return messages.filter((m) => m.component === MessageComponent.Application); })

Returns messages targeting the application form. This is mostly intended to capture legacy messages as non-legacy messages will likely be configured to target other components.


Const getMessagesForCurrentQuestionSet

getMessagesForCurrentQuestionSet: function & OutputSelectorFields‹function› & object = createSelector([getMessages, getCurrentActiveQuestionSet], (messages, questionSet) => { const answerIds = questionSet?.answers.map((a) => a.id) || []; if (!messages.length || !answerIds.length) return [];

return messages.filter((m) => m.component === MessageComponent.Answer && answerIds.includes(m.metadata.answer_id || '')); })

Returns an array of messages matching any answer id in the current question set


Const getMessagesForQuoteRequest

getMessagesForQuoteRequest: function & OutputSelectorFields‹function› & object = createSelector( [getMessages, (_: BpSdkStore, quoteRequestId: string) => quoteRequestId], (messages, quoteRequestId) => { return messages.filter((m) => m.component === MessageComponent.QuoteRequest && m.metadata.quote_request_id === quoteRequestId); } )

Returns messages targeting specific quote request


Const getMessagesForStepperStepQuestionSet

getMessagesForStepperStepQuestionSet: function & OutputSelectorFields‹function› & object = createSelector( [getMessages, (_: BpSdkStore, questionSetId: string) => questionSetId], (messages, questionSetId) => { return messages.filter((m) => m.component === MessageComponent.Answer && m.metadata.answer_id === questionSetId); } )

Stepper steps are converted into question sets on the frontend. The question_set_id is taken from the parent anchor question of the original step (which is a question group). Any messages for this step will use the parent anchor's information as the message's component.

Functions

Const getMessages

getMessages(state: BpSdkStore): IMessage[]

Get messages on current application form

Parameters:

NameTypeDescription
stateBpSdkStoreBpSdk Redux store

Returns: IMessage[]