@coverdash/quotes

中文文档
0.0.81发布于 2026/09/02MITTypeScriptESM + CJS零依赖近 30 天下载 1.8万

A React component that embeds the Coverdash Insurance Experience into your application. This package provides a seamless way for partners to integrate Coverdash's insurance quoting platform into their React applications through an iframe wrapper.

原始使用文档
文档目录21 节
  1. Overview
  2. Installation
  3. Basic Usage
  4. Component Props
  5. Prefilled Data Props
  6. Event Callback Props
  7. Complete Example
  8. Development Workflow
  9. 1. Local Development
  10. 2. Adding New Props
  11. 3. Building
  12. 4. Publishing
  13. 5. File Structure
  14. Environment URLs
  15. License Requirements
  16. Security
  17. Iframe sandbox
  18. Subresource Integrity (SRI)
  19. Browser Support
  20. Contributing
  21. Support

@coverdash/quotes

A React component that embeds the Coverdash Insurance Experience into your application. This package provides a seamless way for partners to integrate Coverdash's insurance quoting platform into their React applications through an iframe wrapper.

Overview

The @coverdash/quotes component creates an iframe that loads quotes.coverdash.com with configurable parameters. It handles communication between the parent application and the embedded quote interface through postMessage events, providing callbacks for various user interactions and application state changes.

Installation

npm install @coverdash/quotes
# or
yarn add @coverdash/quotes

Basic Usage

import React from "react"
import CoverdashQuotes from "@coverdash/quotes"
import "@coverdash/quotes/lib/cjs/styles.css"

function App() {
  return (
    <div>
      <CoverdashQuotes
        env="production"
        license="your-license-key"
        styles={{ minHeight: "600px" }}
        onApplicationCreated={(applicationId) => {
          console.log("Application created:", applicationId)
        }}
        onApplicationSubmitted={(applicationId) => {
          console.log("Application submitted:", applicationId)
        }}
      />
    </div>
  )
}

Component Props

PropTypeDefaultDescription
stylesReact.CSSProperties{ minHeight: "40rem" }Custom CSS styles for the iframe container
envstring"production"Environment ("production", "uat", "staging")
allowScrollbooleantrueWhether the iframe allows scrolling
isDemobooleanfalseEnable demo mode
resetbooleantrueReset the application state
applicationSubmissionIdstring-Existing application ID to load
coverdashBackButtonbooleanfalseShow Coverdash back button
hideChatbooleanfalseHide the chat functionality
licensestring-Required - Your Coverdash license key
autoResizebooleantrueAutomatically resize iframe based on content
sourcestring-Source identifier for tracking
fakeQuotebooleanfalseUse fake quotes for testing
hideScrollbarbooleanfalseHide the scrollbar
showCobrandedPagebooleanfalseShow cobranded page
partnerTrackingIdstring-Partner tracking identifier

Prefilled Data Props

The prefilled prop accepts an object with the following optional properties:

User Information

PropertyTypeDescription
userEmailstring | nullUser's email address
userFirstNamestring | nullUser's first name
userLastNamestring | nullUser's last name
userPhonestring | nullUser's phone number

Business Information

PropertyTypeDescription
businessIdstring | nullExisting business ID
businessNamestring | nullBusiness name
legalEntityType"ASSOCIATION" | "CORPORATION" | "LLC" | "INDIVIDUAL" | "PARTNERSHIP" | "TRUST" | nullLegal entity type
businessClassificationIdstring | nullBusiness classification ID
companyTypestring | nullCompany type
policyTypestring | nullPolicy type
effectiveDatestring | nullPolicy effective date
startupIndustryIdstring | nullStartup industry ID
businessStartYearstring | nullYear business was started
yearsInBusinessnumber | nullYears in business
websitestring | nullBusiness website
totalNumberOfEmployeesnumber | nullTotal number of employees
totalAnnualRevenuenumber | nullTotal annual revenue
totalAnnualPayrollnumber | nullTotal annual payroll

Location & Mailing Address

PropertyTypeDescription
locationAddressstring | nullBusiness location address
locationAddress2string | nullBusiness location address line 2
locationCitystring | nullBusiness location city
locationStateCodestring | nullBusiness location state code
locationZipstring | nullBusiness location ZIP code
mailingAddressSameAsLocationAddressboolean | nullWhether mailing address is same as location
mailingAddressstring | nullMailing address
mailingAddress2string | nullMailing address line 2
mailingCitystring | nullMailing city
mailingStateCodestring | nullMailing state code
mailingZipstring | nullMailing ZIP code

E-commerce Specific Fields

PropertyTypeDescription
ecommerceCategorystring | nullE-commerce category
sellingPlatformsstring | nullPlatforms where products are sold
manufactureOrRelabelboolean | nullWhether business manufactures or relabels products
areProductsHandcraftedboolean | nullWhether products are handcrafted
annualManufacturedUnitsnumber | nullAnnual manufactured units
importGoodsInternationallyboolean | nullWhether business imports goods internationally
manufactureOrSellListedItemsboolean | nullWhether business manufactures or sells listed items

Risk & Claims Information

PropertyTypeDescription
previousLossesboolean | nullWhether business has previous losses
previousLossAmountnumber | nullAmount of previous losses
previousLossDescriptionstring | nullDescription of previous losses
policyCancelledOrNonRenewedboolean | nullWhether policy was cancelled or non-renewed
operatedWithoutInsuranceCoverageboolean | nullWhether operated without insurance
purchasedBeforeboolean | nullWhether purchased insurance before
ownOrOperateOtherBusinessSameNameboolean | nullWhether owns/operates other business with same name
filedForBankruptcyboolean | nullWhether filed for bankruptcy
isSaasProviderboolean | nullWhether business is a SaaS provider

BOP (Business Owner's Policy) Specific Fields

PropertyTypeDescription
buildingSprinkleredboolean | nullWhether building has sprinkler system
valueOfAssetsnumber | nullValue of business assets
buildingSquareFootagenumber | nullBuilding square footage
occupiedSquareFootagenumber | nullOccupied square footage

Cyber Insurance Specific Fields

PropertyTypeDescription
domainNamesstring | nullDomain names owned by business
piiPhiboolean | nullWhether business handles PII/PHI data
piiPhiCountnumber | nullNumber of PII/PHI records
ccCustomerCountnumber | nullNumber of customers with credit cards on file
awareOfNewClaimsboolean | nullWhether aware of new claims
awareOfNewClaimsExplanationstring | nullExplanation of new claims awareness
numberOfClaimsnumber | nullNumber of claims
encryptsDataboolean | nullWhether business encrypts data
hasTechEoboolean | nullWhether has tech E&O coverage
hasEoMplboolean | nullWhether has E&O/MPL coverage
contentComplaintsboolean | nullWhether has content-related complaints
reviewsContentboolean | nullWhether reviews content before publishing
backupAndRestoreboolean | nullWhether has backup and restore procedures
dualControlboolean | nullWhether uses dual control systems
useCloudStorageboolean | nullWhether uses cloud storage

Event Callback Props

PropTypeDescription
onApplicationCreated(applicationId: string) => voidCalled when a new application is created
onChangeBusiness(businessId: string) => voidCalled when business information changes
onChangeIndustry(industry: {naics17: string, display: string}) => voidCalled when industry selection changes
onApplicationSubmitted(applicationId: string) => voidCalled when application is submitted
onBoundPolicy(bound: boolean, policyId: string) => voidCalled when policy is bound
onRejectedFreeQuotes(rejected: boolean) => voidCalled when free quotes are rejected
onClickBackToPartner(clicked: boolean) => voidCalled when back to partner button is clicked
onQuotingProgress(progress: number) => voidCalled with quoting progress updates

Complete Example

import React from "react"
import CoverdashQuotes from "@coverdash/quotes"
import "@coverdash/quotes/lib/cjs/styles.css"

function InsuranceQuotes() {
  const handleApplicationCreated = (applicationId: string) => {
    console.log("New application created:", applicationId)
    // Save to your database, analytics, etc.
  }

  const handlePolicyBound = (bound: boolean, policyId: string) => {
    if (bound) {
      console.log("Policy bound successfully:", policyId)
      // Handle successful policy binding
    }
  }

  return (
    <div className="insurance-container">
      <h1>Get Your Business Insurance Quote</h1>

      <CoverdashQuotes
        env="production"
        license="your-license-key-here"
        styles={{
          minHeight: "600px",
          maxWidth: "1200px",
          margin: "0 auto",
          borderRadius: "8px",
          boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1)",
        }}
        prefilled={{
          userEmail: "[email protected]",
          userFirstName: "John",
          userLastName: "Doe",
          businessName: "Example Business LLC",
          legalEntityType: "LLC",
          locationCity: "San Francisco",
          locationStateCode: "CA",
        }}
        onApplicationCreated={handleApplicationCreated}
        onApplicationSubmitted={(id) =>
          console.log("Application submitted:", id)
        }
        onBoundPolicy={handlePolicyBound}
        onQuotingProgress={(progress) =>
          console.log("Progress:", progress + "%")
        }
        autoResize={true}
        hideChat={false}
      />
    </div>
  )
}

export default InsuranceQuotes

Development Workflow

When contributing to this project, follow these steps:

1. Local Development

  • Make changes to example/src/components/Main.tsx and example/src/App.tsx for easy testing
  • Run the example app locally to test your changes:
    cd example
    yarn install
    yarn start
    

2. Adding New Props

  • Update example/src/components/Main.tsx with new prop logic
  • Important: Also update src/index.tsx to include any new props in the component interface and pass them through to the Main component

3. Building

  • The build process copies Main.tsx from the example to the main project:
    yarn build
    
  • This runs the scripts defined in package.json:
    • copy-files: Copies components from example to src
    • build:esm & build:cjs: Compiles TypeScript
    • build:css: Processes CSS with Tailwind

4. Publishing

  1. Commit your changes
  2. Update the version:
    npm version patch  # This updates package.json and creates a commit
    
  3. Push changes to the repository
  4. Manually run the GitLab pipeline to publish the new version to NPM

5. File Structure

quotes_npm/
├── example/                 # Test/development app
│   ├── src/
│   │   ├── components/
│   │   │   └── Main.tsx    # Main component (source of truth)
│   │   └── App.tsx         # Example usage
├── src/
│   ├── components/
│   │   └── Main.tsx        # Copied from example during build
│   └── index.tsx           # Package entry point
├── lib/                    # Built output (generated)
└── package.json

Environment URLs

The component loads different URLs based on the env prop:

  • production: https://quotes.coverdash.com
  • uat: https://quotes.uat.coverdash.com
  • staging: https://quotes.staging.coverdash.com

License Requirements

A valid license key is required to use this component. Contact Coverdash at https://www.coverdash.com/partner to obtain your license.

Security

Iframe sandbox

The embed iframe uses a restrictive sandbox attribute:

allow-scripts allow-forms allow-same-origin allow-popups

allow-top-navigation and allow-popups-to-escape-sandbox are intentionally omitted so a compromised iframe cannot navigate the parent tab or break out of the sandbox via popups. allow-popups remains enabled for payment and carrier flows that open new windows from the embedded app.

Subresource Integrity (SRI)

SRI is src-level, not iframe-level. Browsers verify integrity on each <script src="..."> or <link href="..."> in the document that loads the resource. The parent page cannot attach SRI to scripts inside the iframe; those attributes must be set in the HTML served by quotes.coverdash.com (the Next.js quotes app).

The hosted quotes app currently serves application bundles from same-origin /_next/static/... (hashes change every deploy; SRI belongs in that app’s build pipeline). No runtime .js files from cdn.coverdash.com were found in the quotes app at the time of this change. Third-party scripts loaded there (for example Intercom, Google Translate, unpkg) require per-URL integrity and crossOrigin="anonymous" on their <script> tags in the quotes repo, not in this npm wrapper.

Browser Support

This component works in all modern browsers that support:

  • ES6+ JavaScript features
  • PostMessage API
  • Iframe embedding

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes following the development workflow above
  4. Test thoroughly using the example app
  5. Submit a pull request

Support

For technical support or questions about integration, please contact the Coverdash team or visit https://www.coverdash.com/partner.

版本与发布记录

@coverdash/quotes 共发布 50 个版本,首次发布于 2022/10/07;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.0.81latest2026/09/022 个月前
0.0.802026/07/163 个月前
0.0.792026/06/254 个月前
0.0.782026/06/055 个月前
0.0.772026/02/278 个月前
0.0.762026/01/149 个月前

关于 @coverdash/quotes 的常见问题

@coverdash/quotes 是什么?

A React component that embeds the Coverdash Insurance Experience into your application. This package provides a seamless way for partners to integrate Coverdash's insurance quoting platform into their React applications through an iframe wrapper.

如何安装 @coverdash/quotes?

在项目目录运行 npm install @coverdash/quotes,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^16.0.0 || ^17.0.0 || ^18.0.0)、react-dom(^16.0.0 || ^17.0.0 || ^18.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@coverdash/quotes 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@coverdash/quotes 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@coverdash/quotes 可以商用吗?

@coverdash/quotes 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@coverdash/quotes 的下载量有多少?

根据 npm 官方下载统计,@coverdash/quotes 在 2026/10/11 – 2026/11/09 这 30 天内被下载 17,862 次,日均约 595 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@coverdash/quotes 还在维护吗?

最新版本 0.0.81 发布于 2026/09/02(2 个月前);至今共发布 50 个版本,其中过去 12 个月发布了 7 个;首次发布于 2022/10/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。