realTimeEligibility/index
@boldpenguin/sdk-redux › Globals › "realTimeEligibility/index"
Index
Variables
- QuoteRequestIncompleteQuestionSet
- QuoteRequestNotOptedIn
- getAllRTECarriers
- getCoverageTypeAnswer
- getCoverageTypes
- getEligibleRTECarriers
- getIneligibleRTECarriers
- selectAllQuotes
- selectEligibleAdditionalMarketCarriersWithProducts
- selectIncompleteCarrierQuestionSetsAsQuoteRequests
- selectOfflineEligibleCarriersAsQuoteRequests
- selectOptInRequiredCarriers
Functions
Variables
Const
QuoteRequestIncompleteQuestionSet
• QuoteRequestIncompleteQuestionSet: QuoteRequestRequestTypes = 'incomplete_question_set' as QuoteRequestRequestTypes
Const
QuoteRequestNotOptedIn
• QuoteRequestNotOptedIn: QuoteRequestRequestTypes = 'not_opted_in' as QuoteRequestRequestTypes
Const
getAllRTECarriers
• getAllRTECarriers: function & OutputSelectorFields‹function› & object = createSelector([selectApplicationState], (appState) => appState.form.real_time_eligibility.carriers || [])
Const
getCoverageTypeAnswer
• getCoverageTypeAnswer: function & OutputSelectorFields‹function› & object = createSelector([getQuestionSets], (questionSets) => findAnswersByQuestionCode( questionSets.flatMap((qs) => qs.answers), 'coverage_type', ), )
Const
getCoverageTypes
• getCoverageTypes: function & OutputSelectorFields‹function› & object = createSelector([getCoverageTypeAnswer], (answers) => { const value = !answers.length ? null : extractValue(answers[0]);
//equalize output to always be an array of strings return Array.isArray(value) ? value : value ? [value] : []; })
Const
getEligibleRTECarriers
• getEligibleRTECarriers: function & OutputSelectorFields‹function› & object = createSelector([getAllRTECarriers], (carriers) => carriers.filter((c) => c.eligible))
Const
getIneligibleRTECarriers
• getIneligibleRTECarriers: function & OutputSelectorFields‹function› & object = createSelector([getAllRTECarriers], (carriers) => carriers.filter((c) => !c.eligible))
Const
selectAllQuotes
• selectAllQuotes: function & OutputSelectorFields‹function› & object = createSelector( getQuotes, selectIncompleteCarrierQuestionSetsAsQuoteRequests, selectOptInRequiredCarriers, selectOfflineEligibleCarriersAsQuoteRequests, (onlineQuotes, incompleteQuestionSetQuotes, additionalMarketCarriers, offlineQuotes) => [ ...(onlineQuotes || []), ...(incompleteQuestionSetQuotes || []), ...(additionalMarketCarriers || []), ...(offlineQuotes || []), ], )
Const
selectEligibleAdditionalMarketCarriersWithProducts
• selectEligibleAdditionalMarketCarriersWithProducts: function & OutputSelectorFields‹function› & object = createSelector( getEligibleCarriersWithProducts, (carriers: ICarrierWithProducts[]) => carriers.filter((carrier) => isAdditionalMarketCarrier(carrier.labels)), )
Const
selectIncompleteCarrierQuestionSetsAsQuoteRequests
• selectIncompleteCarrierQuestionSetsAsQuoteRequests: function & OutputSelectorFields‹function› & object = createSelector( getIncompleteQuestionSets, getEligibleOnlineCarriersWithProducts, (questionSets: IApplicationFormQuestionSet[], eligibleCarriers: ICarrierWithProducts[]): IQuoteRequest[] => questionSets.reduce((acc: IQuoteRequest[], qs: IApplicationFormQuestionSet) => { const carrier = eligibleCarriers.find((c) => c.id === qs.question_set.tenant_id); return [...acc, ...(carrier ? [getEligibleCarrierAsQuoteRequest(carrier, QuoteRequestIncompleteQuestionSet, null)] : [])]; }, []), )
Selects all carrier question sets that are incomplete and transforms them into the shape of IQuoteRequest[];
Const
selectOfflineEligibleCarriersAsQuoteRequests
• selectOfflineEligibleCarriersAsQuoteRequests: function & OutputSelectorFields‹function› & object = createSelector( getEligibleOfflineCarriersProducts, getEligibleOnlineCarriersProducts, (offlineCarriersProducts: IQuoteableCarriersProduct[], onlineCarriersProducts: IQuoteableCarriersProduct[]): IQuoteRequest[] => offlineCarriersProducts // Removes offline products where an online equivalent is present. // This might eventually move down as a selector from SDK. .filter((cp) => !onlineCarriersProducts.some((ocp) => ocp.carrier.id === cp.carrier.id && ocp.product.id === cp.product.id)) .map((cp) => { const quote = { active: true, annual_price: '', application_form_id: cp.application_form_id, bindable: true, calls_to_action: [], carrier: cp.carrier, consumer_selected: true, coverage: { disclaimer: '', limit_and_deductible: [], limit_and_deductible_default: [], }, created_at: new Date().toISOString(), customizable: false, downpayment: '', effective_date: null, expired: false, finished_at: new Date().toISOString(), focused: false, id: cp.carriers_product_id, monthly_price: '', number_of_installments: 0, online: false, order: 0, owner_id: '', permitted_to_bind: true, preferred: false, price_details: { fees: [], new_total_premium: '', taxes: [], term: '', }, products: [{ ...cp.product, from_name: null }], quote_number: '', recommended: false, request_status: QuoteRequestRequestTypes.referral, retrieve_url: '', semiannual_price: '', selected: false, started_at: new Date().toISOString(), surcharge: 0, tenant_id: '', translated_messages: [], updated_at: new Date().toISOString(), actions: [], attachments: [], supplier_code: null, supplier_name: null, supplier_logo_url: null, supplier_logo_url_full: null, };
return {
...quote,
quotes: [quote],
};
}),
)
Const
selectOptInRequiredCarriers
• selectOptInRequiredCarriers: function & OutputSelectorFields‹function› & object = createSelector( selectEligibleAdditionalMarketCarriersWithProducts, getQuestionSets, (eligibleCarriers, questionSets: IApplicationFormQuestionSet[]) => eligibleCarriers .filter((carrier) => showPreOptInEligibleCarrier(carrier, questionSets)) .map((carrier) => getEligibleCarrierAsQuoteRequest(carrier, QuoteRequestNotOptedIn)), )
Functions
Const
getEligibleCarrierAsQuoteRequest
▸ getEligibleCarrierAsQuoteRequest(eligibleCarrier
: ICarrierWithProducts, requestStatus
: QuoteRequestRequestTypes, order
: number | null): IQuoteRequest
util
Maps an eligible carrier to the shape of a quote request
Parameters:
Name | Type | Default | Description |
---|---|---|---|
eligibleCarrier | ICarrierWithProducts | - | ICarrierWithProducts |
requestStatus | QuoteRequestRequestTypes | - | - |
order | number | null | 0 | - |
Returns: IQuoteRequest
IQuoteRequest
Const
isAdditionalMarketCarrier
▸ isAdditionalMarketCarrier(labels
: CarrierLabel[]): boolean
Both "isAdditionalMarketCarrier" and "isOptInQuoteFlowCarrier" are replacing the functionality that was handled in "isAdditionalMarketCarrier". The purpose of breaking the two out is to support different carrier who want to be "opt in" without showing in "Additional Markets". Both function have backward support for "NON_ADMITTED". Doing this insures Pathpoint continues to work.
isadditionalmarketcarrier
should be used when determining if a carrier should be displayed in the "Addition Markets" section in the UI.
isoptinquoteflowcarrier
should be used when determining if a carrier should go through the "opt in" carrier workflow.
Parameters:
Name | Type | Default |
---|---|---|
labels | CarrierLabel[] | [] |
Returns: boolean
Const
requiresOptIn
▸ requiresOptIn(carrier?
: ICarrier | ICarrierWithProducts): boolean
Determines if a carrier requires user opt-in
Parameters:
Name | Type | Description |
---|---|---|
carrier? | ICarrier | ICarrierWithProducts | ICarrier |
Returns: boolean
Returns true if opt_in_required is true, else false
Const
showPreOptInEligibleCarrier
▸ showPreOptInEligibleCarrier(carrier
: ICarrier, questionSets
: IApplicationFormQuestionSet[]): boolean
util
Determines if the pending eligible carrier should be displayed
Parameters:
Name | Type | Description |
---|---|---|
carrier | ICarrier | Eligible carrier for the application form |
questionSets | IApplicationFormQuestionSet[] | Question sets for the application form |
Returns: boolean
Returns true if the carrier requires opt-in and its question set does not exist on the application form