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

@sdifi/webchat

v0.3.0

Published

This is the webchat widget for the SDiFI project. It requires a working instance of a [Masdif](https://github.com/sdifi/masdif/) server.

Downloads

1

Readme

SDiFI Webchat

This is the webchat widget for the SDiFI project. It requires a working instance of a Masdif server.

In development. Expect breakage.

Usage

The Webchat widget is published both as a React component and a standalone UMD bundle.

React component

To use the component in your project add it as a dependency:

yarn add @sdifi/webchat

The react and react-dom packages are peer dependencies, so if you don't already have those add them as dependencies in your project:

yarn add react react-dom

Example usage:

import * as React from 'react';
import { createRoot } from 'react-dom/client';
import Chat from '@sdifi/webchat';

const App = () => {
  return (
    <div>
      <Chat serverAddress="http://localhost:8080" title="Jóakim" subtitle="Aðalönd" />
    </div>
  );
};

const root = createRoot(document.getElementById('root')!);
root.render(<App />);

Standalone UMD bundle

<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <div id="root"></div>
    <script src="https://cdn.jsdelivr.net/npm/@sdifi/[email protected]/dist/webchat.umd.production.min.js"></script>
    <script>
    window.onload = () => {
      Webchat.init("root", {
        serverAddress: "http://localhost:8080",
        title: "Jóakim",
        subtitle: "Aðalönd",
      });
    }
    </script>
  </body>
</html>

Speech input

Currently the speech recognition input is provided by a direct client side connection to the gRPC-Web service at speech.tiro.is and final results are POSTed as text messages to the conversation. The server address is not configurable, as the plan is to add ASR to Masdif. We use grpc-nice-web with TypeScript code generated by ts-proto. The code is generated from the Protobuf definitions in Tiro Speech Core and rarely change, so the generated code is committed to version control.

Development workflow

  1. Have a running Masdif server.
  2. yarn install
  3. yarn start &
  4. cd example && yarn install && yarn start
  5. Go look at http://localhost:1234 hot reload while editing the code

To just build minified (and not minified) bundles do:

yarn build

This will create TypeScript typedefs, a CommonJS (dist/webchat.cjs.production.min.js), ESM (dist/webchat.esm.js) and a standalone UMD bundle (dist/webchat.umd.production.min.js).

Publishing new versions

  1. Update the version field in package.json. Try to follow semver.
  2. git add package.json && git commit -m "Update version to X.Y.Z" && git tag -a vX.Y.Z
  3. yarn install
  4. yarn publish --access public --new-version X.Y.Z

Things todo

  • [x] Send and receive text messages
  • [x] Style components
  • [x] Receive images
  • [x] Receive buttons
  • [x] Send button/quick_replies actions back
  • [x] Play audio replies
  • [x] Speech input
  • [ ] User settings
  • [ ] Keep track of read/unread status of responses
  • [ ] Tooltip for responses when closed
  • [ ] Speech input through Masdif
  • [x] Disable when Masdif is unhealthy
  • [ ] Tests
  • [ ] Make themeable (see styled-components ThemeProvider)

License

See LICENSE.