npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fireraven-ai/secure-chatbot

v0.1.0

Published

## What is it?

Downloads

5

Readme

Fireraven Secure Chatbot

What is it?

The Fireraven Secure Chatbot is the component which enables to seemlessly interact with the Fireraven Guardrails, making interactions with your Chatbot behave in a predictable manner.

How to use

The component library is only available as an ESM bundled component exposing a single component, the FireravenSecureChatbot. This component uses React which needs to be available in the browser.

As a React Component

In order to import the Fireraven Secure ChatBot in a React project, it must first be added to the project's package.json file.

# Using yarn
yarn add @fireraven-ai/secure-chatbot

# Using npm
npm install @fireraven-ai/secure-chatbot

The module can then be imported in any page as follows. The component has a fixed positioning, making it's placement only relevant as it will be rendered at the same time as the component importing it. The styles must be imported seperatly from the component.

import { FireravenSecureChatbot } from "@fireraven-ai/secure-chatbot";
import '@fireraven-ai/secure-chatbot/dist/style.css'

And use the component while providing the correct props. The component is built using typescript, so typing is available out-of-the-box. The only mandatory prop is the clientID, without which the component can't operate.

<FireravenSecureChatbot
  clientId: string // The clientID associated with the Chatbot used to answer messages
  conversationURL?: string // The API endpoint used to create a conversation. Defaults to the fireraven.ai api
  messageURL?: string // The API endpoint used to save a message. Defaults to the fireraven.ai api
  answerURL?: string // The API endpoint used to answer a message. Defaults to the fireraven.ai api
  title?: string; // The title which would be displayed on the top bar
  welcomeMessage?: string // The welcome message which should be displayed when opening the Chatbot. This text can be styled as markdown. 
  tooltipMessage?: string // The tooltip show left of the ChatBot start button
  image?: string // The image shown on the ChatBot start button
/>

Note

The component accesses the browser's document object, making it impossible to use in a SSR environment like NextJS. The component needs to be loaded only on the client-side by using dynamic import or another method of you choosing. Here is an example in NextJS. This is only required if the component where the Chatbot is imported is a server rendered component.

const FireravenSecureChatbot = dynamic(
  async () => {
    const { FireravenSecureChatbot } = await import(
      "@fireraven-ai/secure-chatbot"
    );
    return FireravenSecureChatbot;
  },
  { ssr: false }
);

export default function Index() {
  return (
    <FireravenSecureChatbot
      // Insert needed props
    />
  );
}

Direct in HTML file usage

In order the use the Fireraven Secure ChatBot directly in an HTML file, you must use the following structure including the stylesheet which is imported at the top. This is an ES Module and should work in every modern browsers.

<head>
  <!-- Include the stylesheet -->
  <link rel="stylesheet" href="https://unpkg.com/@fireraven-ai/secure-chatbot/dist/style.css" />

  <!-- Import the dependencies which can be simply imported from CDNs -->
  <script type="importmap">
    {
      "imports": {
        "react": "https://esm.sh/react",
        "react/jsx-runtime": "https://esm.sh/react/jsx-runtime",
        "react-dom": "https://esm.sh/react-dom",
        "@fireraven-ai/secure-chatbot": "https://unpkg.com/@fireraven-ai/secure-chatbot"
      }
    }
  </script>
  <!-- Import and setup the component -->
  <script type="module">
    import React from "react";
    import ReactDOM from "react-dom";
    import { FireravenSecureChatbot } from "@fireraven-ai/secure-chatbot";

    // Create the component and configure the parameters
    const client = React.createElement(FireravenSecureChatbot);
    client.props = {
      clientId: "<The ClientID of your Chatbot>",
      // Other props as specified in the React Component mentionned above
    };

    // Place the component in the page
    ReactDOM.render(client, document.getElementById("root"));
  </script>
</head>

<body>
  <!-- Include a div with an id where the component will be placed -->
  <div id="root"></div>
</body>

Dependencies

The library is dependant on React. You have to provide you own version for this component to work.