@spottoai/common-ui
v1.0.2-6
Published
Shared React components for SpottoAI
Readme
@spottoai/common-ui
Shared React components for SpottoAI
Installation
npm install @spottoai/common-uiUsage
import { RecommendationOutlook } from '@spottoai/common-ui';
function App() {
return <RecommendationOutlook />;
}API URL Configuration
This library uses build-time environment variables to configure the API URL. Set one of the following environment variables in your project:
Environment Variables
# .env file - choose one of these:
SPOTTO_API_URL=https://api.your-domain.com
VITE_API_URL=https://api.your-domain.com
API_URL=https://api.your-domain.comPriority Order
The library uses the following priority order for API URL configuration:
SPOTTO_API_URL(highest priority)VITE_API_URL(medium priority)API_URL(low priority)- Empty string (no default fallback)
Examples
For a React application:
# .env file
SPOTTO_API_URL=https://api.spotto.aiFor a Chrome extension:
# .env file
SPOTTO_API_URL=https://api.spotto.aiFor development:
# .env file
SPOTTO_API_URL=http://localhost:8787Components
RecommendationOutlook
A comprehensive recommendation management component with filtering, categorization, and feedback capabilities.
import { RecommendationOutlook } from '@spottoai/common-ui';
<RecommendationOutlook
recommendations={recommendations}
recommendationStates={recommendationStates}
onSaveStates={handleSaveStates}
currentUser={currentUser}
companyUsers={companyUsers}
feedbackUrl="https://api.your-domain.com/feedback"
authToken="Bearer your-jwt-token"
/>;Props
recommendations: Array of recommendation objectsrecommendationStates: Array of recommendation state objectsonSaveStates: Function to save recommendation statescurrentUser: Current user informationcompanyUsers: Array of company usersfeedbackUrl: Required - URL for submitting feedback (e.g., "https://api.your-domain.com/feedback")authToken: Optional - Authentication token for feedback submission (e.g., "Bearer your-jwt-token")
Development
npm install
npm run build
npm run devLicense
MIT
