Widget Overview

Overview

The Spot Widget (referred to as SpotWidget in code) allows you to embed Spot’s Refund Guarantee quoting experience directly in your checkout or product page. It supports single and multi-item carts, theming, callbacks, and works with any frontend environment (vanilla JS, React, Vue).

For visual reference - here's an example of our widget with basic styling options applied:

🚧

Version Notice: For the latest info and versions of the Spot Widget, visit the package page on npm.

Embed in One Script Tag

Embed with one script tag, no install required:

<div id="spot-widget"></div> <!-- Where the widget will appear -->
<script src="https://unpkg.com/@getspot/[email protected]/dist/index.umd.js"></script> // See NPM docs for latest widget version
<script>
  const widget = new SpotWidget({
    location: "#spot-widget",
    apiConfig: {
      environment: "sandbox",
      partnerId: "your-partner-id"
    },
    quoteRequestData: {
      startDate: "2025-05-01T12:00:00.000Z",
      endDate: "2025-05-05T12:00:00.000Z",
      currencyCode: "USD",
      eventType: "Skiing",
      productType: "Registration",
      productDuration: "Event",
      productPrice: 100,
      productId: "abc123",
      productName: "Test Product"
    }
  });
</script>
💡

💡 The widget automatically fetches a quote and renders the Refund Guarantee offer once retrieved.


Full Example:

This snippet includes theming and callbacks (described below) for complete visibility during testing:

<div id="spot-widget"></div>
<script src="https://unpkg.com/@getspot/[email protected]/dist/index.umd.js"></script> // See NPM docs for latest widget version
<script>
  const widget = new SpotWidget({
    location: "#spot-widget",
    apiConfig: {
      environment: "sandbox",
      partnerId: "your-partner-id"
    },
    quoteRequestData: {
      startDate: "2025-05-01T12:00:00.000Z",
      endDate: "2025-05-05T12:00:00.000Z",
      currencyCode: "USD",
      eventType: "Skiing",
      productType: "Registration",
      productDuration: "Event",
      productPrice: 100,
      productId: "abc123",
      productName: "Test Product"
    },
    theme: {
      "spot-background-color": "#f8f8f8",
      "spot-font-family": "Inter, sans-serif",
      "spot-title-font-color": "#004aad"
    },
    callbacks: {
      onQuoteRetrieved: (quote) => console.log("Quote retrieved:", quote),
      onOptIn: (data) => console.log("User opted in:", data),
      onOptOut: (data) => console.log("User opted out:", data),
      onError: (err) => console.error("Widget error:", err)
    }
  });
</script>
🚧

Always reference npm for the latest version.


Quote Request Data

quoteRequestData defines what the customer is purchasing and drives the widget’s display.

Provided by Spot during integration:

  • A sandbox partnerId
  • Pre-configured test offers
  • Guidance on what values to send for productType, productDuration, and productId

Single vs Multi-Item Carts:

quoteRequestData can be passed as either a single product or a cart with multiple items, depending on your checkout experience. The widget will automatically adjust its quote display and pricing behavior.

Single Item:

    quoteRequestData: {
      startDate: "2025-05-01T12:00:00.000Z",
      endDate: "2025-05-05T12:00:00.000Z",
      currencyCode: "USD",
      eventType: "Skiing",
      productType: "Registration",
      productDuration: "Event",
      productPrice: 100,
      productId: "abc123",
      productName: "Test Product"
    }

Multiple Items:

The widget automatically calculates combined coverage and total premium across all items.

    quoteRequestData: {
      cartInfo: {
        cartId: "cart123",
        cartName: "My Shopping Cart",
        currencyCode: "USD"
      },
      items: [
        {
          cartItemId: "item1",
          productPrice: 299,
          productType: "Pass",
          productDuration: "Daily",
          productId: "ski-pass-vail",
          productName: "Vail Ski Pass",
          participantDescription: "Adult",
          eventType: "Snow Sports",
          startDate: "2025-01-15T00:00:00Z",
          endDate: "2025-01-22T00:00:00Z"
        },
        {
          cartItemId: "item2",
          productPrice: 150,
          productType: "Trip",
          productDuration: "Trip",
          productId: "hotel-booking",
          productName: "Mountain Lodge",
          participantDescription: "2 Adults",
          eventType: "Accommodation",
          startDate: "2025-01-15T00:00:00Z",
          endDate: "2025-01-22T00:00:00Z"
        }
      ]
    }

Installation Options

CDN (UMD)

This format is useful for quick integration into any HTML page.

<script src="https://unpkg.com/@getspot/[email protected]/dist/index.umd.js"></script> // See NPM docs for latest widget version
<div id="spot-widget"></div>
<script>
  const spotWidget = new SpotWidget({
    location: "#spot-widget",
    apiConfig: {
      environment: "sandbox",
      partnerId: "your-partner-id",
    },
    quoteRequestData: {},
    // Other configuration options...
  });
</script>

ES Module Format (for modern JavaScript projects)

For modern JS projects that use bundlers like Webpack, Rollup, or Vite, use this format .

<script type="module">
  import SpotWidget from "https://unpkg.com/@getspot/[email protected]/dist/spot-widget.es.js";  // See NPM docs for latest widget version

  const spotWidget = new SpotWidget({
    location: "#spot-widget",
    apiConfig: {
      environment: "sandbox",
      partnerId: "your-partner-id",
    },
    quoteRequestData: {},
    // Other configuration options...
  });
</script>

If using one of the framework-specific packages, the script URLs will look like:

https://unpkg.com/@getspot/[email protected]/dist/index.umd.js
https://unpkg.com/@getspot/[email protected]/dist/spot-widget-vue2.umd.js
https://unpkg.com/@getspot/[email protected]/dist/spot-widget-vue.umd.js

NPM

To install the Spot Widget via npm, run:

npm install @getspot/spot-widget

If you want to install the widget for a specific framework, you can use one of the following:

npm install @getspot/spot-widget-react
npm install @getspot/spot-widget-vue2
npm install @getspot/spot-widget-vue

Framework Options

The Spot Widget is currently available in React, Vue 2, and Vue 3. Additional frameworks can be provided upon request. These framework-specific builds expose the same core Quoting API, wrapped for each framework’s component model.

import React, { useEffect } from 'react';
import SpotWidget from '@getspot/spot-widget-react';

function App() {
  return (
    <div className="App">
      <h1>Testing Spot Widget</h1>
      <SpotWidget
        apiConfig={{
          environment: "sandbox",
          partnerId: "your-partner-id",
        }}
        quoteRequestData={{
          eventType: "",
          // other request fields
        }}
        // other props
      />
    </div>
  );
}

export default App;
<template>
  <div>
    <SpotWidget 
      :apiConfig="{
        environment: 'sandbox',
        partnerId: 'your-partner-id'
      }"
      :quoteRequestData="{
        eventType: ''
        // other fields
      }"
      :callbacks="{}"
    />    
  </div>
</template>

<script>
import SpotWidget from "@getspot/spot-widget-vue2";

export default {
  name: "Vue2SpotWidget",
  components: {
    SpotWidget
  }
};
</script>
<template>
  <div>
    <SpotWidget 
      :apiConfig="{
        environment: 'sandbox',
        partnerId: 'your-partner-id'
      }"
      :quoteRequestData="{
        eventType: '',
        // other fields
      }"
      :callbacks="{}"
    />
  </div>
</template>

<script>
import SpotWidget from "@getspot/spot-widget-vue";

export default {
  name: "VueSpotWidget",
  components: {
    SpotWidget
  }
};
</script>

Configuration Options

Widget Options

KeyTypeDescriptionDefaultRequired
locationstringHTMLElementCSS selector or DOM element where the widget should be mounted"body"
showTablebooleanWhether to show the payout schedule tabletrue
logoPositionstringDetermines where the "Powered by Spot" logo is positioned. Accepted values are bottom-right or top-rightbottom-right
optInSelectedbooleanIf true, the "yes" option is selected by defaultfalse
statestringCustomer's 2-letter US state code (e.g., "TX"). Only applies to Pass/Trip offers — ignored for Registration. When provided, hides the state selector and passes the value through to downstream calls. When omitted on a Pass/Trip offer, a state selector is shown automatically above the yes/no radio buttons, and those buttons are disabled until the customer makes a selection.
apiConfigobjectConfiguration for the quote API. See apiConfig table below
quoteRequestDataobjectData used to generate a quote. See quoteRequestData tables below.
callbacksobjectEvent handlers. See Callbacks table below{}
themeobjectCSS custom properties to override the default theme. See Theming table below{}

apiConfig Parameters

KeyTypeDescriptionRequired
environmentstringThe environment used to fetch quotes (one of "sandbox","production")
partnerIdstringUnique partner identifier

Single Quote quoteRequestData Parameters

KeyTypeDescriptionRequired
startDatestringISO8601 date-time indicating the date and time the product starts
endDatestringISO8601 date-time indicating the date and time the product ends
currencyCodestringCurrency code (e.g., "USD")
eventTypestringType of event being sold (e.g., "Skiing Activities", "Kayaking/SUP")
productTypestringThe product type being sold (one of "Pass", "Trip", "Registration")
productDurationstringThe product duration being sold (one of "Daily", "Seasonal", "Trip", "Event")
productPricenumberTotal price of the product (e.g., 200.00)
productIdstringUnique identifier for the product
productNamestringDescription or display name for the product
cartIdstringUnique identifier for the cart session
isPartialPaymentbooleanIndicates whether this quote is for a deposit-based booking. When the user opts in and isPartialPayment is true, additional payment terms regarding the deposit-based booking will also be displayed

Batch Quote quoteRequestData Parameters

For multiple items in a single cart, use this structure:

KeyTypeDescriptionRequired
cartInfoobjectCart-level information. See cartInfo table below
itemsarrayArray of items in the cart. See items table below

cartInfo Parameters

KeyTypeDescriptionRequired
cartIdstringUnique identifier for the cart session
cartNamestringDisplay name for the cart
currencyCodestringCurrency code (e.g., "USD", "CAD", "AUD", etc)

items Parameters

KeyTypeDescriptionRequired
cartItemIdstringUnique identifier for the item within the cart
productPricenumberPrice of this specific item
productTypestringOne of "Pass", "Trip", "Registration"
productDurationstringOne of "Daily", "Seasonal", "Trip", "Event"
productIdstringUnique identifier for the product
productNamestringDisplay name for the product
participantDescriptionstringDescription of participants/product (e.g., "Adult", "GA")
eventTypestringType of event (e.g., "Skiing", "Full Marathon")
startDatestringISO8601 date-time indicating when this item starts
endDatestringISO8601 date-time indicating when this item ends

Callbacks

CallbackDescriptionCallback Data
onQuoteRetrievedQuote successfully retrievedFull quote object (see Quote Object Fields table)
onOptInUser opted in{ status: "QUOTE_ACCEPTED", quoteId: string, spotPrice: number, batchQuoteDetails?: array }
onOptOutUser opted out{ status: "QUOTE_DECLINED", quoteId: string, batchQuoteDetails?: array }
noMatchingQuoteNo matching quote found{ status: "NO_MATCHING_QUOTE", data: quoteRequestData }
onErrorWidget errors during fetch or initialization{ message: string, status?: number, responseBody?: object }

Example:

callbacks: {
  onOptIn: (data) => console.log("Opted in:", data),
  onError: (err) => console.error(err)
}

Notes:

  • onError will be triggered for any caught exceptions, such as network issues or malformed configuration.
    • The widget will fail gracefully and not render any UI.
  • For batch quotes, quoteId will contain comma-separated quote IDs (e.g., "abc123,def456")
  • batchQuoteDetails is only present for batch quotes and contains: [{ quoteId: string, productPrice: number, cartItemId: string }, ...]
  • spotPrice represents the total combined premium for all items in batch quotes
  • The widget automatically displays a "Covered Items" section listing all products for batch quotes

SelectionData Fields

FieldTypeDescription
statestring | undefinedCustomer's US state code (e.g., "TX"). Only set for Pass/Trip offers. Populated when the partner supplies a state prop, or when the user selects a state from the selector shown on Pass/Trip offers. Undefined for Registration offers, or when the selector is shown but no selection has been made yet.

Quote Object Fields

FieldTypeDescription
idstringUnique identifier for the quote
expiresAtstring ISO8601 date-time indicating when the quote expires
spotPricenumberPrice of the Refund Guarantee
currencyCodestringCurrency in which the price is denominated
communicationobjectIncludes display name, description, legal disclaimer, etc.
payoutSchedulearray of objectsRefund schedule tiers with text, percent, and amount fields

Styling & Theming

To customize the widget's appearance, provide an object mapping any of the following CSS variables (without the -- prefix).

VariableDescriptionDefault
spot-font-familyBase font for all textArial
spot-paddingPadding inside the widget container1.25rem
spot-background-colorBackground color of the widget#ffffff
spot-font-colorDefault text color#000000
spot-border-radiusBorder radius for the widget container0.5rem

Title and Description

VariableDescriptionDefault
spot-title-font-sizeFont size of the title1.25rem
spot-title-font-weightFont weight of the title700
spot-title-paddingPadding below the title0 0 1.25rem 0
spot-title-font-colorTitle text colorvar(--spot-font-color)
spot-title-font-familyTitle fontvar(--spot-font-family)
spot-description-font-sizeFont size of the description0.875rem
spot-description-font-weightFont weight of the description400
spot-description-paddingPadding below the description0 0 0.5rem 0
spot-description-font-colorDescription text colorvar(--spot-font-color)
spot-description-font-familyDescription fontvar(--spot-font-family)

Bullet List

VariableDescriptionDefault
spot-bullets-font-sizeFont size of bullets0.875rem
spot-bullets-font-weightFont weight of bullets400
spot-bullets-font-colorBullet text colorvar(--spot-font-color)
spot-bullets-font-familyBullet fontvar(--spot-font-family)
spot-bullets-paddingPadding around bullet list0.3125rem

Payout Table

VariableDescriptionDefault
spot-table-border-radiusBorder radius of the table0.625rem
spot-table-header-font-sizeFont size of table headers0.875rem
spot-table-header-font-weightFont weight of table headers700
spot-table-header-font-colorTable header text colorvar(--spot-font-color)
spot-table-header-font-familyTable header fontvar(--spot-font-family)
spot-table-header-paddingPadding in table headers0 0.5rem 0.625rem
spot-table-cell-font-sizeFont size of table cells0.815rem
spot-table-cell-font-weightFont weight of table cells400
spot-table-cell-font-colorTable cell text colorvar(--spot-font-color)
spot-table-cell-font-familyTable cell fontvar(--spot-font-family)
spot-table-cell-paddingPadding in table cells0 0.625rem

Radio Options

VariableDescriptionDefault
spot-radio-borderRadio border color#000000
spot-radio-border-radiusRadio button shape0.625rem
spot-radio-checked-backgroundBackground color when checked#000000
spot-radio-text-font-sizeFont size for radio labels0.875rem
spot-radio-text-font-weightFont weight for radio labels400
spot-radio-text-font-colorRadio label colorvar(--spot-font-color)
spot-radio-text-font-familyFont for radio labelsvar(--spot-font-family)
spot-radio-text-paddingPadding in radio options0.625rem
spot-radio-selection-backgroundBackground of selected option#f4f4f4
spot-radio-selection-border-radiusBorder radius of selection0.625rem
spot-radio-selection-paddingPadding of selection area0.625rem

"Recommended" Tag

VariableDescriptionDefault
spot-recommended-tag-backgroundBackground color#000000
spot-recommended-tag-font-colorText color#ffffff
spot-recommended-tag-font-sizeFont size0.875rem
spot-recommended-tag-font-weightFont weight700
spot-recommended-tag-paddingPadding0.25rem 0.5rem
spot-recommended-tag-border-radiusBorder radius0.5rem

Error Message

VariableDescriptionDefault
spot-selection-error-font-colorText color for errors#ff0000
spot-selection-error-font-sizeFont size0.875rem
spot-selection-error-paddingPadding0.5rem

Terms and Links

VariableDescriptionDefault
spot-terms-font-sizeFont size for terms text0.75rem
spot-terms-font-weightFont weight400
spot-terms-font-colorColor#636569
spot-terms-font-familyFontvar(--spot-font-family)
spot-terms-paddingPadding0
spot-terms-link-text-decorationLink decorationunderline
spot-terms-link-font-sizeFont size0.75rem
spot-terms-link-font-weightFont weight400
spot-terms-link-font-colorLink color#636569
spot-terms-link-font-familyFont for linksvar(--spot-font-family)
spot-terms-link-paddingPadding0

Utility Methods

These methods are available on the widget instance after initialization:

MethodDescription
getSelection()Returns current selection – for ex:
{ selection: string, quoteId: string, spotPrice: number, state?: string, status: string}
validateSelection()Validates whether a selection has been made and if it's valid. Displays an error message ("Please make a selection") otherwise
destroy()Destroys the widget, cleans up any event listeners or references


Did this page help you?