Install the Saved Opportunities Widget as an NPM package for first-class React (and TypeScript) support. Supports authenticated access via postMessage, auto-refresh, and full CSS variable theming.
npm install @legionhandtech/lht-react-widgetsReact 17+ is a peer dependency. If your project already has React installed you're good to go.
1import { LegionSavedOpportunities } from '@legionhandtech/lht-react-widgets';
2
3function App() {
4 return (
5 <LegionSavedOpportunities
6 baseUrl="https://your-legion-domain.com"
7 authToken="your-jwt-token"
8 theme="light"
9 />
10 );
11}You can also import from the dedicated sub-path:
import { LegionSavedOpportunities } from '@legionhandtech/lht-react-widgets/saved-opportunities';| Prop | Type | Default | Description |
|---|---|---|---|
baseUrl | string | required | Base URL of your Legion deployment |
authToken | string | — | JWT / API key for authenticated access (sent via postMessage, never in URL) |
theme | "light" | "dark" | "light" | Theme preset |
width | string | "100%" | Widget width (CSS value) |
height | string | "400px" | Widget height (CSS value) |
className | string | — | CSS class applied to the outer container |
style | React.CSSProperties | — | Inline styles merged into the container |
onLoad | (detail) => void | — | Called when the widget iframe finishes loading |
onError | (message: string) => void | — | Called if the widget iframe fails to load |
All 29 theming props are optional. Here are the most commonly used ones:
| Prop | CSS Variable | Example |
|---|---|---|
savedPrimaryColor | --saved-primary-color | "#228be6" |
savedAccentColor | --saved-accent-color | "#ff6b6b" |
savedBackgroundColor | --saved-background-color | "#ffffff" |
savedTextColor | --saved-text-color | "#1a1b1e" |
savedCardBg | --saved-card-bg | "#ffffff" |
savedCardRadius | --saved-card-radius | "8px" |
savedBorderRadius | --saved-border-radius | "12px" |
savedFontFamily | --saved-font-family | "Inter, sans-serif" |
savedButtonBg | --saved-button-bg | "#228be6" |
savedButtonColor | --saved-button-color | "#ffffff" |
savedHoverScale | --saved-hover-scale | "1.02" |
savedTransitionDuration | --saved-transition-duration | "0.2s" |
See the TypeScript SavedOpportunitiesThemingProps interface for the complete list.
1import { useRef } from 'react';
2import { LegionSavedOpportunities, LegionSavedOpportunitiesHandle } from '@legionhandtech/lht-react-widgets';
3
4function App() {
5 const widgetRef = useRef<LegionSavedOpportunitiesHandle>(null);
6
7 return (
8 <>
9 <button onClick={() => widgetRef.current?.refresh()}>
10 Refresh Saved Opportunities
11 </button>
12 <LegionSavedOpportunities
13 ref={widgetRef}
14 baseUrl="https://your-legion-domain.com"
15 authToken="your-jwt-token"
16 />
17 </>
18 );
19}| Method | Description |
|---|---|
refresh() | Reloads the widget iframe |
import '@legionhandtech/lht-react-widgets/saved-opportunities-web-component';1<legion-saved-opportunities
2 api-url="https://your-legion-domain.com"
3 auth-token="your-jwt-token"
4 theme="light">
5</legion-saved-opportunities>1import type {
2 SavedOpportunitiesWidgetProps,
3 SavedOpportunitiesThemingProps,
4 LegionSavedOpportunitiesHandle,
5} from '@legionhandtech/lht-react-widgets';1<LegionSavedOpportunities
2 baseUrl="https://your-legion-domain.com"
3 authToken="your-jwt-token"
4 onLoad={(detail) => {
5 console.log(detail.widget); // "saved-opportunities"
6 console.log(detail.theme); // "light" | "dark"
7 }}
8/>1<LegionSavedOpportunities
2 baseUrl="https://your-legion-domain.com"
3 onError={(message) => console.error(message)}
4/>