Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@yoast/ai-insights-client

Package Overview
Dependencies
Maintainers
6
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yoast/ai-insights-client

A React component library for AI-powered brand analysis and insights

latest
npmnpm
Version
1.4.76
Version published
Weekly downloads
750
-12.18%
Maintainers
6
Weekly downloads
 
Created
Source

AI Insights Client

A React component library for AI-powered brand analysis and insights. This library provides a complete interface for brand analysis including setup wizard, analysis results, and settings management.

Installation

npm install ai-insights-client
# or
yarn add ai-insights-client

Peer Dependencies

This library requires the following peer dependencies to be installed in your project:

npm install react react-dom @yoast/ui-library

Note: React Router is bundled with this library to avoid version conflicts. You don't need to install it separately.

Basic Usage

Simple Embedded Component

import { AIInsightsClient } from 'ai-insights-client';
import 'ai-insights-client/dist/style.css';

function App() {
  return (
    <div className="my-app">
      <h1>My Application</h1>
      <AIInsightsClient
        routerType="memory"
        initialRoute="/"
        className="ai-insights-container"
      />
    </div>
  );
}

export default App;

With Custom Router Integration

import { BrowserRouter, Route, Routes } from 'react-router-dom';
import { AIInsightsClient } from 'ai-insights-client';
import 'ai-insights-client/dist/style.css';

function App() {
  return (
    <BrowserRouter>
      <Routes>
        <Route
          path="/insights/*"
          element={
            <AIInsightsClient routerType="memory" initialRoute="/setup" />
          }
        />
        <Route path="/" element={<HomePage />} />
      </Routes>
    </BrowserRouter>
  );
}

Component Props

AIInsightsClient

PropTypeDefaultDescription
routerType'browser' | 'hash' | 'memory''memory'Router type to use
initialRoutestring'/'Initial route when using memory router
isRtlbooleanfalseWhether the UI should be rendered in RTL mode
classNamestringundefinedOptional CSS class name for the root container
styleReact.CSSPropertiesundefinedOptional inline styles for the root container

Router Types

  • memory (recommended for embedding): Uses React Router's MemoryRouter, which doesn't change the browser URL. Perfect for embedding in other applications.
  • browser: Uses BrowserRouter for standalone applications with clean URLs.
  • hash: Uses HashRouter for applications that need hash-based routing.

Available Routes

  • / - Brand Analysis dashboard
  • /setup - Setup wizard
  • /setup/brand-summary - Brand summary step
  • /setup/:brandId/queries - Query selection step
  • /setup/:brandId/analysis - Analysis step
  • /settings - Settings page
  • /query-history - Query history
  • /brand-list - Brand list

Advanced Usage

Using Individual Components

import {
  BrandAnalysisProvider,
  Layout,
  BrandAnalysis,
} from 'ai-insights-client';

function CustomApp() {
  return (
    <BrandAnalysisProvider>
      <Layout>
        <BrandAnalysis />
      </Layout>
    </BrandAnalysisProvider>
  );
}

Using Context Hooks

import {
  BrandAnalysisProvider,
  useBrandAnalysisData,
  useBrandAnalysisMutations,
} from 'ai-insights-client';

function CustomComponent() {
  const { brandId } = useBrandAnalysisData();
  const { setBrandId } = useBrandAnalysisMutations();

  return (
    <div>
      <h2>Current Brand ID: {brandId}</h2>
      <button onClick={() => setBrandId('new-brand-id')}>Set Brand ID</button>
    </div>
  );
}

function App() {
  return (
    <BrandAnalysisProvider>
      <CustomComponent />
    </BrandAnalysisProvider>
  );
}

Styling

The component comes with pre-built CSS that should be imported:

import 'ai-insights-client/dist/style.css';

The component uses Tailwind CSS with the yst- prefix. If you're using Tailwind in your project, you may need to configure your build to include the component's styles or import the CSS file as shown above.

TypeScript Support

This library is built with TypeScript and includes full type definitions. All components and hooks are fully typed for the best development experience.

import type { AIInsightsClientProps, BrandAnalysisData } from 'ai-insights-client';

Contributing

[Add your contributing guidelines here]

License

MIT

Keywords

react

FAQs

Package last updated on 17 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts