Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@brainfish-ai/search-widget

Package Overview
Dependencies
Maintainers
0
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brainfish-ai/search-widget

The Brainfish Widgets is a JavaScript library that provides a Help Widget and Search Bar Widget for your website. It allows your users to search for help articles and get answers to their questions without leaving your website. The widget is fully customi

  • 0.16.0-beta.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
860
decreased by-18.1%
Maintainers
0
Weekly downloads
 
Created
Source

Brainfish Widgets

The Brainfish Widgets is a JavaScript library that provides a Help Widget and Search Bar Widget for your website. It allows your users to search for help articles and get answers to their questions without leaving your website. The widget is fully customizable and can be configured to match the look and feel of your website.

It is built using SolidJS and Socket.io.

Installation

npm install @branfish-ai/search-widget

Help widget

The Brainfish.HelpWidget.initPopup() function initializes the Help Widget and takes an options object with various configuration options. Once the widget is initialized, it can be opened by clicking on a button or link on your website. The widget displays a search bar where users can enter their queries, and displays a list of relevant articles based on the query.

To use Brainfish.HelpWidget.initPopup(), you need to import the Brainfish module from the @brainfish-ai/search-widget package. Here's an example:

<script type="module">
  import Brainfish from "https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget@0.2.0/dist/web.js";

  Brainfish.HelpWidget.initPopup({
    widgetMode: "slide-over",
    apiKey: "YOUR_WIDGET_ID",
    language: 'en', // the language the search supports
    class: '', // custom css class for your own use
    defaultOpen: false,
    // the rest are optional
    autoFocus: false,
    theme: {
      textBaseColor: '#333333' // text color for the widget
      // fontFamiliy and fontSrc must be present for font customization to work
      fontFamily: 'Martian+Mono',
      fontSrc: 'https://fonts.googleapis.com/css2?family=Martian+Mono&family=Open+Sans:wght@300&display=swap',
    },
    settings: {
      suggestionsTitle: 'Suggested questions:',
      logo: {
        monotone: false,
        smaller: false,
      },
      suggestions: ["What is Brainfish?", "Shall we dance?"],
      hideFeedback: false,
      showDisclaimer: false,
      disclaimer: 'Disclaimer text',
      placeholder: 'Ask a question or type a search term here...',
      limit: 5,
      linkExternalUrl: false,
      regions: ['US', 'AU'], // optional list of regions to search
      searchByCategory: false, // optional boolean to search by category
      categorySelectionTitle: 'Select a category', // optional title for category selection
      answerNotFoundMessage: 'No answer found', // optional message to display when no answer is found
      nextBestActions: [
        {
          label: 'Contact Support',
          type: 'email',
          value: 'support@brainfi.sh',
          icon: 'EnvelopSimple',
        }
      ],
      bodyActionButtons: [],
      footerActionButtons: [],
      panelTitle: 'Help Center'
    }
  });
</script>

<brainfish-popup-help-widget></brainfish-popup-help-widget>
OptionTypeRequiredDefault ValueDescription
apiKeystringYes""Your Brainfish API key.
languagestringYes"en"The language the search supports.
widgetModestringYes"slide-over"The mode of the widget. Can be "slide-over" or "popup".
autoFocusbooleanNofalseWhether the search input should be focused automatically.
classstringNo""A custom CSS class for your own use.
defaultOpenbooleanNofalseWhether the widget should be open by default.
settings.bodyActionButtonsobject[]No[]A list of action buttons displayed in the middle of the help widget. Same format as nextBestActions.
settings.disclaimerstringNo""The text for the disclaimer section.
settings.footerActionButtonsobject[]No[]A list of action buttons displayed at the bottom of the help widget. Same format as nextBestActions.
settings.hideFeedbackbooleanNofalseWhether to hide the feedback section.
settings.limitnumberNo5The number of articles to fetch.
settings.linkExternalUrlbooleanNofalseWhether to open results in a new window.
settings.logo.monotonebooleanNofalseWhether to make the bottom Brainfish logo grayscale.
settings.logo.smallerbooleanNofalseWhether to make the Brainfish logo smaller.
settings.nextBestActionsobject[]No[]A list of buttons displayed after the answer is displayed. Each button is an object with label, type, value, and icon properties. The icon property can be a valid Phosphor icon name or a URL to an icon.
settings.panelTitlestringNo"Help Center"The title for the Help Widget panel.
settings.placeholderstringNo"Ask a question or type a search term here..."The placeholder text for the search input.
settings.showDisclaimerbooleanNofalseWhether to show the disclaimer section.
settings.suggestionsstring[]No[]A list of suggested queries.
settings.suggestionsTitlestringNo"Suggested questions:"The title for the suggested questions section.
settings.answerNotFoundMessagestringNo"No answer found"The message to display when no answer is found.
settings.regionsstring[]No[]A list of regions to search.
settings.searchByCategorybooleanNofalseWhether to search by category.
settings.categorySelectionTitlestringNo"Select a category"The title for the category selection section.
theme.fontFamilystringNo""The font family for the widget.
theme.fontSrcstringNo""The font source for the widget.
theme.textBaseColorstringNo'#333333'The text color for the widget.

Search widget

Brainfish.SearchWidget is a JavaScript library that provides a Search Bar widget for your website. It allows your users to search for articles and get answers to their questions without leaving your website. The widget is fully customizable and can be configured to match the look and feel of your website.

The Brainfish.SearchWidget.initStandard() function initializes the search widget and takes an options object with various configuration options. Once the widget is initialized, it can be opened by clicking on a button or link on your website. The widget displays a search bar where users can enter their queries, and displays a list of relevant articles based on the query.

Directly in your HTML

<script type="module">
  import Brainfish from 'https://cdn.jsdelivr.net/npm/@brainfish-ai/search-widget/dist/web.js'

  Brainfish.SearchWidget.initStandard({
    widgetType: 'Search|Help' // Search for search widget, Help for Help widget
    apiKey: 'YOUR_WIDGET_ID',
    // the rest are optional
    theme: {
      input: '<button>Custom input button</button>' // optional custom input button
      textBaseColor: '#333333' // text color for the widget
      // fontFamiliy and fontSrc must be present for font customization to work
      fontFamily: 'Martian+Mono',
      fontSrc: 'https://fonts.googleapis.com/css2?family=Martian+Mono&family=Open+Sans:wght@300&display=swap',
    },
    settings: {
      suggestionsTitle: 'Suggested questions:',
      logo: {
        monotone: false, // makes the bottom brainfish logo grayscale
        smaller: false, // makes the brainfish logo smaller
      },
      suggestions: ["What is Brainfish?", "Shall we dance?"], // list of suggested queries
      hideFeedback: false,
      showDisclaimer: false,
      disclaimer: 'Disclaimer text',
      placeholder: 'Ask a question or type a search term here...',
      limit: 5, // number of articles to fetch
      linkExternalUrl: false, // opens results in new window when true
      nextBestActions: [ // buttons displayed after answer displayed
        {
          label: 'Contact Support',
          type: 'email',
          value: 'support@brainfi.sh',
          icon: 'EnvelopSimple', // valid Phosphor icon name - https://github.com/aguilera51284/phosphor-react/blob/master/src/index.jsx or url to icon
        }
      ],
      bodyActionButtons: [ // action buttons displayed in the middle of the help widget
        // same as nextBestActions
      ],
      footerActionButtons: [ // action buttons displayed at the bottom of the help widget
        // same as nextBestActions
      ],
      buttonText: 'Help & Support' // standard version only with custom button
      panelTitle: 'Help Center' // Help Widget panel title
    }
  })
</script>

// put this inside a container that has width and height
<brainfish-search-widget style="width: 100%; height: 600px; "></brainfish-search-widget>

FAQs

Package last updated on 15 Nov 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc