1.0.0 • Published 2 years ago

@lifeintelligencegroup/ngx-lig-ari v1.0.0

Weekly downloads
146
License
MIT
Repository
-
Last release
2 years ago

DEMO: https://stackblitz.com/edit/angular-ngx-lig-ari-demo

APP URL: https://angular-ngx-lig-ari-demo.stackblitz.io

Features

  • AoT compilation and lazy loading compatible
  • Component inheritance
  • SystemJS/UMD rollup bundle

Dependencies

Latest version available for each version of Angular

@lifeintelligencegroup/ngx-lig-ariAngular
0.7.07.x & 6.x
0.8.08.x
0.9.09.x
0.17.28>= 10.x
0.17.29>= 11.x
0.17.30>= 12.x
0.17.31>= 13.x

Install

npm install @lifeintelligencegroup/ngx-lig-ari --save

@ionic/angular package is a required dependency for the default mobile UI/UX

npm install @ionic/angular --save

speak-tts package is a required dependency for the Text to Speech

npm install speak-tts --save

lodash-es package is a required dependency

npm install lodash-es --save

async-es package is a required dependency for the Text to Speech

npm install async-es --save

chart.js package is a required dependency for the Graphs

npm install chart.js --save

chartjs-plugin-datalabels package is a required dependency for the Graphs label

npm install chartjs-plugin-datalabels --save

@ionic-native/speech-recognition package is a required dependency for the Speech Recognition

npm install @ionic-native/speech-recognition --save

@ionic-native/text-to-speech package is a required dependency for the Text to Speech

npm install @ionic-native/speech-recognition --save

## Install on Cordova

`Text to Speech plugin` package is a required dependency for the Text to Speech
[https://github.com/vilic/cordova-plugin-tts](https://github.com/vilic/cordova-plugin-tts)

```bash
npm install @ionic-native/core

ionic cordova plugin add cordova-plugin-tts
npm install @ionic-native/text-to-speech

Supported Platform

  • Android
  • iOS
  • Windows Phone 8

Speech Recognition This plugin does speech recognition using cloud services https://github.com/pbakondy/cordova-plugin-speechrecognition

npm install @ionic-native/core

ionic cordova plugin add cordova-plugin-speechrecognition
npm install @ionic-native/speech-recognition

Supported Platform

  • Android
  • iOS

Install on Capacitor

Text to Speech plugin package is a required dependency for the Text to Speech https://github.com/vilic/cordova-plugin-tts

npm install @ionic-native/core

npm install @capacitor/core @capacitor/cli

npm install cordova-plugin-tts
npm install @ionic-native/text-to-speech
ionic cap sync

Supported Platform

  • Android
  • iOS
  • Windows Phone 8

Speech Recognition This plugin does speech recognition using cloud services https://github.com/pbakondy/cordova-plugin-speechrecognition

npm install @ionic-native/core

npm install @capacitor/core @capacitor/cli

npm install cordova-plugin-speechrecognition
npm install @ionic-native/speech-recognition
ionic cap sync

Supported Platform

  • Android
  • iOS

Setup

step 1: add NgxLigAriModule to app NgModule

import { CommonModule } from '@angular/common';

import { NgxLigAriModule } from 'ngx-lig-ari';

@NgModule({
  imports: [
    CommonModule,
    // NgxLigAriModule added
    NgxLigAriModule.forRoot({
      apiSecret: '<YOUR API SECRET KEY HERE>',
      showFab: true // default: false,
      settings: {  // doptional,
        title: '``Your App Title``',
        auth: '``Where to get the authentication``',
        theme: '``APP theme color``',
        assistantName: '``What would be the custom name of your assistant?``',
        baseUrl: "``Custom Initial message get from the Project Database``",
      },
    })
  ],
  bootstrap: [App],
  declarations: [App]
})
class MainModule {}

Setup for Ionic Native/Cordova or Capacitor

step 1: add NgxLigAriModule to app NgModule

import { CommonModule } from "@angular/common";

import { NgxLigAriModule } from "ngx-lig-ari";

import { SpeechRecognition } from "@ionic-native/speech-recognition/ngx";
import { TextToSpeech } from "@ionic-native/text-to-speech/ngx";

@NgModule({
  imports: [
    CommonModule,
    // NgxLigAriModule added
    NgxLigAriModule.forRoot({
      apiSecret: "<YOUR API SECRET KEY HERE>",
      showFab: true, // default: false
      settings: {  // doptional,
        title: '``Your App Title``',
        auth: '``Where to get the authentication``',
        theme: '``APP theme color``',
        assistantName: '``What would be the custom name of your assistant?``',
        baseUrl: "``Custom Initial message get from the Project Database``",
      },
    }),
  ],
  bootstrap: [App],
  declarations: [App],
  providers: [SpeechRecognition, TextToSpeech],
})
class MainModule {}

Use

import { NgxLigAriService } from '@lifeintelligencegroup/ngx-lig-ari';

@Component({...})
export class YourComponent {
  constructor(private ariService: NgxLigAriService) {}

  showAri() {
    this.ariService.showAri();
  }

  closeAri(){
    this.ariService.closeAri();
  }

  // OR Toggle ARI

  toggleAri(){
    this.ariService.toogleAri();
  }
}

Options

All individual options can be overridden in the global options. In addition, global options include the following options:

OptionTypeDefaultDescription
apiSecretstringnull/undefinedYour API Secret Key from LIG
showFabbooleanfalseShows Fab Button for ARI to be initialize, By default this can be clickable to show Ari Component

Setting Global Options

Pass values to NgxLigAriModule.forRoot()

// root app NgModule
imports: [
  NgxLigAriModule.forRoot({
    apiSecret: <YOUR API SECRET KEY HERE>,
    showFab: true // default: false
  }),
],

LIG Ari Service status return:

export enum AriStatus {
  /** Ari Window is Open */
  Open,
  /** Ari Window is Close */
  Close,
}

Add ngx-lig-ari as a component on the web app. By default when the Ari Fab button renders on the page, when click it triggers the showAri() method on the NgxLigAriService

import { Component, OnInit } from "@angular/core";

import {
  NgxLigAriService,
  AriStatus,
} from "@lifeintelligencegroup/ngx-lig-ari";

@Component({
  selector: "app-root",
  template: `
    <div class="main-container">
      <ngx-lig-ari></ngx-lig-ari>
    </div>
  `,
})
export class AppComponent implements OnInit {
  constructor(private ariService: NgxLigAriService) {}

  ngOnInit() {
    this.ariService.onAriStatusChange().subscribe((status: AriStatus) => {
      //  This is to check the Status of Ari Window
    });
  }

  showAri() {
    this.ariService.showAri();
  }

  closeAri() {
    this.ariService.closeAri();
  }

  checkAriStatus() {
    if (this.ariService.getCurrentAriStatus() === AriStatus.Open) {
      // Do Something here
    }
  }
}

ngx-lig-ari

This is the component that renders the ARI Window according to the device plaform.

Usage:

<ngx-lig-ari
  [buttonVertical]="'bottom'"
  [buttonHorizontal]="'end'"
  [buttonSlot]="'fixed'"
></ngx-lig-ari>

Properties:

OptionDescriptionAttributeType
buttonVerticalWhere to align the Ari Button vertically in the viewport.buttonVertical"bottom"/ "center" / "top" / undefined
buttonHorizontalWhere to align the Ari Button horizontally in the viewport.buttonHorizontal"center" / "end" / "start" / undefined
buttonEdgeIf true, the fab will display on the edge of the header if vertical is "top", and on the edge of the footer if it is "bottom". Should be used with a fixed slot.buttonEdgeboolean : Default false
buttonSlotbuttonSlot"fixed" / undefined

Functions

Show ARI Window according to Device Platform desktop or mobile

showAri()

Closes ARI Window

closeAri(): Close Ari Window or Ari Modal

Can be used to toggle an ARI Window to open or closed.

toggleAri()

SystemJS

If you are using SystemJS, you should also adjust your configuration to point to the UMD bundle.

In your SystemJS config file, map needs to tell the System loader where to look for ngx-lig-ari:

map: {
  'ngx-lig-ari': 'node_modules/ngx-lig-ari/bundles/@lifeintelligencegroup/ngx-lig-ari.umd.min.js',
}

FAQ

-

License

MIT


GitHub @scttcper  ·  Twitter @scttcper

0.18.1

2 years ago

0.18.2

2 years ago

0.18.0

2 years ago

1.0.0

2 years ago

0.17.33

2 years ago

0.17.32

2 years ago

0.17.27

2 years ago

0.17.26

2 years ago

0.17.29

2 years ago

0.17.28

2 years ago

0.17.31

2 years ago

0.17.30

2 years ago

0.17.21

2 years ago

0.17.23

2 years ago

0.17.25

2 years ago

0.17.24

2 years ago

0.17.19

2 years ago

0.17.20

2 years ago

0.17.18

3 years ago

0.17.16

3 years ago

0.17.17

3 years ago

0.17.14

3 years ago

0.17.15

3 years ago

0.17.12

3 years ago

0.17.11

3 years ago

0.17.13

3 years ago

0.17.10

3 years ago

0.17.9

3 years ago

0.17.7

3 years ago

0.17.8

3 years ago

0.17.3

3 years ago

0.17.4

3 years ago

0.17.5

3 years ago

0.17.6

3 years ago

0.17.2

3 years ago

0.17.1

3 years ago

0.17.0

3 years ago

0.16.7

3 years ago

0.16.8

3 years ago

0.16.5

3 years ago

0.16.6

3 years ago

0.16.4

3 years ago

0.16.3

3 years ago

0.16.2

3 years ago

0.16.1

3 years ago

0.16.0

3 years ago

0.15.19

3 years ago

0.15.18

3 years ago

0.15.17

3 years ago

0.15.16

3 years ago

0.15.15

3 years ago

0.15.13

3 years ago

0.15.14

3 years ago

0.15.12

3 years ago

0.15.11

3 years ago

0.15.10

3 years ago

0.15.9

3 years ago

0.15.8

3 years ago

0.15.7

3 years ago

0.15.6

3 years ago

0.15.4

3 years ago

0.15.5

3 years ago

0.15.0

3 years ago

0.15.1

3 years ago

0.15.2

3 years ago

0.15.3

3 years ago

0.14.5

3 years ago

0.14.1

3 years ago

0.14.2

3 years ago

0.14.3

3 years ago

0.14.4

3 years ago

0.13.9

3 years ago

0.13.10

3 years ago

0.14.0

3 years ago

0.13.8

3 years ago

0.13.6

3 years ago

0.13.7

3 years ago

0.13.4

3 years ago

0.13.2

3 years ago

0.13.3

3 years ago

0.13.0

3 years ago

0.13.1

3 years ago

0.12.7

3 years ago

0.12.2

3 years ago

0.12.3

3 years ago

0.12.4

3 years ago

0.12.5

3 years ago

0.12.6

3 years ago

0.12.1

3 years ago

0.12.0

3 years ago

0.11.11

3 years ago

0.11.10

3 years ago

0.11.8

3 years ago

0.11.9

3 years ago

0.11.7

3 years ago

0.11.6

3 years ago

0.11.5

3 years ago

0.11.4

3 years ago

0.11.3

3 years ago

0.11.2

3 years ago

0.11.1

3 years ago

0.11.0

3 years ago

0.10.10-beta.0

3 years ago

0.10.9-beta.0

3 years ago

0.10.8-beta.0

3 years ago

0.10.7-beta.0

3 years ago

0.10.6-beta.0

3 years ago

0.10.5-beta.0

3 years ago

0.10.4-beta.1

3 years ago

0.10.4-beta.0

3 years ago

0.10.3-beta.1

3 years ago

0.10.2-beta.0

3 years ago

0.10.1-beta.0

3 years ago

0.10.3-beta.0

3 years ago

0.10.0-beta.0

3 years ago

0.9.32-beta.0

3 years ago

0.9.31-beta.0

3 years ago

0.9.30-beta.0

3 years ago

0.9.29-beta.0

4 years ago

0.9.28-beta.0

4 years ago

0.9.27-beta.0

4 years ago

0.9.26-beta.0

4 years ago

0.9.25-beta.0

4 years ago

0.9.24-beta.0

4 years ago

0.9.23-beta.0

4 years ago

0.9.22-beta.0

4 years ago

0.9.20-beta.0

4 years ago

0.9.21-beta.0

4 years ago

0.9.19-beta.0

4 years ago

0.9.18-beta.0

4 years ago

0.9.17-beta.0

4 years ago

0.9.15-beta.1

4 years ago

0.9.16-beta.0

4 years ago

0.9.15-beta.0

4 years ago

0.9.14-beta.0

4 years ago

0.9.13-beta.0

4 years ago

0.9.12-beta.0

4 years ago

0.9.11-beta.0

4 years ago

0.9.10-beta.0

4 years ago

0.9.9-beta.0

4 years ago

0.9.8-beta.0

4 years ago

0.9.7

4 years ago

0.9.6

4 years ago

0.9.5

4 years ago

0.9.5-b

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.0.1

4 years ago

0.9.0

4 years ago