Skip to content

toQuoteCards

toQuoteCards turns a QuoteSet into cards for display. The quotes screen from toScreen already includes them as cards.

const cards = toQuoteCards(quoteSet, options?)
  • quoteSet: a QuoteSet.
  • options.locale (optional): for the premium. Default "en-US".

QuoteCard[], each:

  • id: pass to session.selectQuote(id).
  • insurer.
  • premium: the annual premium as currency text, such as "$1,234.00". undefined when absent.
  • expiry: the policy expiry.
  • decision: such as "quoted", "referred" or "declined".
  • selectable: true when 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,
}),
);
}