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

react-native-slang-flight-assistant

v0.1.9

Published

Voice enabled flight assistant for react native apps

Downloads

2

Readme

react-native-slang-flight-assistant

react-native-slang-flight-assistant

This file showcases all of SlangFlightAssistant features.

Before you begin

  • You’d need <API_KEY> and <BUDDY_ID> for this. You should’ve received this from the Slang team. If not, please ask :)

  • Install the package below in your project.

$ yarn add react-native-slang-flight-assistant

or

$ npm install react-native-slang-flight-assistant --save

Mostly automatic installation

$ react-native link react-native-slang-flight-assistant

  • Add the maven repo below to android/build.gradle file
allprojects {
    repositories {
        mavenLocal()
        (...)
 
        maven {
            url "http://maven.slanglabs.in:8080/artifactory/gradle-release"
        }

       (...)
    }
}
  • Import the voice flight assistant wrapper in the relevant file
import SlangFlightAssistant from 'react-native-slang-flight-assistant';

SlangFlightAssistant;

Usage

SlangFlightAssistant.initialize

Using the initialize api like in the example below

SlangFlightAssistant.initialize({
      requestedLocales: ['en-IN'], // possible values ['en-IN', 'hi-IN']
      buddyID: '<buddy id>',
      apiKey: '<api key>',
      flightAssistantListener: {
        onTrackStatus:  onTrackStatusFunc , 
        onAssistantError: onAssistantErrorFunc, 
      },
    });

// onTrackStatusFunc: A function that will recieve 
// the flight status once the intent resolution is complete,
// more details below.

// onAssistantErrorFunc: Notify any error that 
//the Slang Flight Assistant may encounter, 
// more details on this below.    

Important: the initialize API will will load slang in the background and the slang trigger will not show up until SlangFlightAssistant.show(); is called.

SlangFlightAssistant.show

Show Slang trigger

SlangFlightAssistant.show();

SlangFlightAssistant.hide

Hide Slang trigger

SlangFlightAssistant.hide();

flightAssistantListener

There are 2 listeners available onTrackStatus and onAssistantError

onTrackStatus

In the case where the user searches via voice the status of a flight.

Example utternace: What is the status of the flight AB1234

This function is meant to return flight information based on the user voice query.

Once a voice query returns successfully, you can do something with the flight information.

Register a callback function when src_airport, dest_airport, status_date:, flight_number, is available.


SlangFlightAssistant.initialize({
...
      flightAssistantListener: {
        onTrackStatus:  this.onTrackStatusFunc , 
       ...
      },
    });

onTrackStatusFunc = ({
        src_airport,
        dest_airport,
        status_date,
        flight_number,
}) => {

    this.setState({
        src_airport,
        dest_airport,
        status_date,
        flight_number,
    });

    // Do something else with this


  };

Note: based on what the user speaks the listener returns, an example is below.

Example: status of the flight AB1234 will return {status_date: "2020-08-17",flight_number: "1234"} src_airport and dest_airport will be undefined

onAssistantError

This notifies the app when an error occurs in the react-native-slang-flight-assistant

Example: when the assistant cannot connect to the internet

Register a callback function like below


SlangFlightAssistant.initialize({
...
      flightAssistantListener: {
        onAssistantError:  this.onAssistantErrorFunc , 
       ...
      },
    });

  onAssistantErrorFunc = ({
      description,
      type
  }) => {
    console.log(description);
    this.setState({
      error: description,
    });
    // Do somthing else
  };

The description gives you the details of the error.

The type gives an error code int value.

Analytics

SlangFlightAssistant.setUserProperties

This may be used while initialising your app to track analytics for a particular user.


    SlangFlightAssistant.setUserProperties('USER_ID', {
      foo: 'bar',
      location: 'some place else',
    });

SlangFlightAssistant.notifyNonVoiceStatusQuery

This may be used to track analytics for touch based flight status searches.


    SlangFlightAssistant.notifyNonVoiceStatusQuery({
      src_airport: 'BOM',
      dest_airport: 'DEL',
      status_date: '2020-08-08',
      flight_number: 1234,
    });
Contact

For any queries contact us [email protected]