Event-driven host control
Recommended for SPA routing and business logic. Listen for selectedPlan and run your host function.
Travel Insured Web Component
Embed quote product cards with secure BFF-backed data loading, optional stylesheet injection, CSS variable theming, and selectedPlan event emission for host-controlled actions.
Recommended for SPA routing and business logic. Listen for selectedPlan and run your host function.
Use button-url with placeholders or buy-now-url for simple integrations without host-side handlers.
Use CSS variables for quick visual changes and optional custom stylesheet injection from allowlisted origins.
Functions are not passed through HTML attributes. Attach an event listener for selectedPlan and run your host logic there. The selectedPlan contract includes contractVersion and is emitted as bubbling/composed. The host default checkout base URL comes from NEXT_PUBLIC_TII_CHECKOUT_BASE_URL and explicit URL attributes remain the override path when a partner supplies a custom destination.
const defaultCheckoutBaseUrl =
process.env.NEXT_PUBLIC_TII_CHECKOUT_BASE_URL?.trim() || "http://localhost:3001";
const card = document.querySelector("product-quote-card");
card.addEventListener("selectedPlan", (event) => {
const { quoteId, productCode, totalPrice } = event.detail;
const checkoutUrl = defaultCheckoutBaseUrl.replace(//$/, "") +
"/quote/" + encodeURIComponent(quoteId) + "/payment";
// host function: route, modal, analytics, API side-effects
console.log('selected productCode', productCode, 'totalPrice', totalPrice);
router.push(checkoutUrl);
});card.addEventListener("coverageChanged", (event) => {
const { coverageType, checked, totalPrice, source } = event.detail;
// optional host-side parity behavior for add-ons and derived pricing UI
});To apply partner-owned styling at runtime, set custom-stylesheet-url and optionally custom-stylesheet-allowed-origins. Same-origin stylesheets are always allowed.
<product-quote-card enable-internal-navigation="false" custom-stylesheet-url="https://cdn.partner.com/product-card-theme.css" custom-stylesheet-allowed-origins="https://cdn.partner.com" ></product-quote-card>
Use CSS variables for lightweight theming without replacing the full stylesheet.
--quote-card-font-family--quote-card-title-size--quote-card-body-size--quote-card-price-size--quote-card-button-bg--quote-card-button-hover-bg--quote-card-button-color--quote-card-button-border--quote-card-button-padding--quote-card-button-width--quote-card-button-margin--quote-card-button-display--quote-card-button-align-items--quote-card-button-justify-content--quote-card-button-font-size--quote-card-button-font-weight--quote-card-button-line-height--quote-card-button-letter-spacing--quote-card-button-text-transform--quote-card-button-shadow--quote-card-button-hover-shadow--quote-card-button-transition--quote-card-button-focus-outline--quote-card-button-focus-offset--quote-card-button-radius--quote-card-button-min-height--quote-card-actions-display--quote-card-actions-justify-content--quote-card-bg--quote-card-text-color--quote-card-header-color--quote-card-muted-color--quote-card-price-color--quote-card-link-color--quote-card-border-color--quote-card-divider-color--quote-card-surface-color--quote-card-surface-hover-color--quote-card-border-radius--quote-card-shadow--quote-card-width--quote-card-min-height--quote-card-header-min-height--quote-card-section-min-height--quote-card-padding--quote-card-gap--quote-card-modal-overlay-bg--quote-card-modal-overlay-padding--quote-card-modal-z-index--quote-card-modal-width--quote-card-modal-max-height--quote-card-modal-padding--quote-card-modal-shadow--quote-card-modal-close-color--quote-card-modal-close-size--quote-card-modal-title-size--quote-card-modal-title-weight--quote-card-modal-header-gap--quote-card-modal-body-gap--quote-card-modal-tab-gap--quote-card-modal-tab-padding--quote-card-modal-tab-size--quote-card-modal-tab-weight--quote-card-modal-tab-active-color--quote-card-modal-tab-border-width--quote-card-modal-section-gap--quote-card-modal-item-bg--quote-card-modal-item-hover-bg--quote-card-modal-item-radius--quote-card-modal-item-padding--quote-card-modal-item-shadow--quote-card-modal-summary-size--quote-card-modal-summary-weight--quote-card-modal-tooltip-size--quote-card-modal-tooltip-color--quote-card-modal-done-button-width--quote-card-modal-done-button-align