toQuoteCards
toQuoteCards turns a QuoteSet into cards for display. The quotes screen from toScreen already includes them as cards.
const cards = toQuoteCards(quoteSet, options?)Reference
Section titled “Reference”toQuoteCards(quoteSet, options?)
Section titled “toQuoteCards(quoteSet, options?)”Parameters
Section titled “Parameters”quoteSet: aQuoteSet.options.locale(optional): for the premium. Default"en-US".
Returns
Section titled “Returns”QuoteCard[], each:
id: pass tosession.selectQuote(id).insurer.premium: the annual premium as currency text, such as"$1,234.00".undefinedwhen absent.expiry: the policy expiry.decision: such as"quoted","referred"or"declined".selectable:truewhen the server allows selecting this quote.
for (const card of screen.cards) { list.append( QuoteCard({ title: card.insurer, price: card.premium ?? 'Price on request', action: card.selectable ? () => session.selectQuote(card.id) : undefined, }), );}