Skip to content

Commit

Permalink
Alan libraries and package version were updated
Browse files Browse the repository at this point in the history
  • Loading branch information
annmirosh committed Jun 2, 2020
1 parent 9acf008 commit 3508593
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 32 deletions.
59 changes: 38 additions & 21 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@

# Alan Web SDK

[Alan Platform](https://alan.app/)[Alan Studio](https://studio.alan.app/register)[Docs](https://alan.app/docs)[FAQ](https://alan.app/docs/usage/additional/faq)
[Blog](https://alan.app/blog/)[Twitter](https://twitter.com/alanvoiceai)

[![npm](https://img.shields.io/npm/v/@alan-ai/alan-sdk-web.svg)](https://www.npmjs.com/package/@alan-ai/alan-sdk-web)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/alan-ai/alan-sdk-web)](https://github.com/alan-ai/alan-sdk-web/releases)

Add a voice assistant to your application. With no or minimal changes to the existing UI.

## How to start:

1. [Sign up for Alan Studio](https://studio.alan.app/register) to build and test voice scripts in JavaScript.
2. Use the Alan Web SDK to embed the Alan button to your application or page. For details, see [Alan AI documentation]( https://alan.app/docs/client-api/web/web-api).

Check out our [demo](https://alan-ai.github.io/alan-sdk-web/).

## Have questions?

If you have any questions or if something is missing in the documentation, please [contact us](mailto:[email protected]), or tweet us [@alanvoiceai](https://twitter.com/alanvoiceai). We love hearing from you!)

# Alan Web SDK

[Alan Platform](https://alan.app/)[Alan Studio](https://studio.alan.app/register)[Docs](https://alan.app/docs)[FAQ](https://alan.app/docs/usage/additional/faq)
[Blog](https://alan.app/blog/)[Twitter](https://twitter.com/alanvoiceai)

[![npm](https://img.shields.io/npm/v/@alan-ai/alan-sdk-web.svg)](https://www.npmjs.com/package/@alan-ai/alan-sdk-web)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/alan-ai/alan-sdk-web)](https://github.com/alan-ai/alan-sdk-web/releases)

Add a voice assistant to your application. With no or minimal changes to the existing UI.

## How to start:

1. [Sign up for Alan Studio](https://studio.alan.app/register) to build and test voice scripts in JavaScript.
2. Use the Alan Web SDK to embed the Alan button to your application or page. For details, see [Alan AI documentation]( https://alan.app/docs/client-api/web/web-api).

Check out our [demo](https://alan-ai.github.io/alan-sdk-web/).

## Downloads

* [Alan package](https://www.npmjs.com/package/@alan-ai/alan-sdk-web)
* [Alan Web SDK releases](https://github.com/alan-ai/alan-sdk-web/releases)

## Example apps

In the [Examples](https://github.com/alan-ai/alan-sdk-web/tree/master/examples) folder, find example web apps created with:

* React
* Angular
* Vue
* Ember
* Electron

To install and launch an app, follow the instructions in the README file inside the app folder. Then press the Alan button and ask: "What is Alan Web SDK for?" or "What can I do here?" (for the Order Drinks app).

## Have questions?

If you have any questions or if something is missing in the documentation, please [contact us](mailto:[email protected]), or tweet us [@alanvoiceai](https://twitter.com/alanvoiceai). We love hearing from you!)
31 changes: 22 additions & 9 deletions dist/alan_lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ function alanBtn(options) {
var OFFLINE = 'offline';
var LOW_VOLUME = 'lowVolume';
var PERMISSION_DENIED = 'permissionDenied';
var MIC_BLOCKED_MSG = 'Access to the microphone was blocked. Please allow it to use Alan';

// Set default state for btn
var state = DISCONNECTED;
Expand Down Expand Up @@ -1320,12 +1321,8 @@ function alanBtn(options) {
keyFrames += getStyleSheetMarker() + '.shadow-appear { opacity: 1 !important; }\n';
keyFrames += getStyleSheetMarker() + '.shadow-disappear { opacity: 0 !important; transition: all .1s linear !important; }';

keyFrames += getStyleSheetMarker(true) + '.alan-btn-disconnected .alanBtn { pointer-events:none;}';

keyFrames += getStyleSheetMarker(true) + '.alan-btn-offline .alanBtn { pointer-events:none;}';
keyFrames += getStyleSheetMarker(true) + '.alan-btn-offline .alanBtn-bg-default { background-image: linear-gradient(122deg,rgb(78,98,126),rgb(91,116,145));}';

keyFrames += getStyleSheetMarker(true) + '.alan-btn-permission-denied .alanBtn { pointer-events:none;}';
keyFrames += getStyleSheetMarker(true) + '.alan-btn-permission-denied .alanBtn .alanBtn-bg-default { background-image: linear-gradient(122deg,rgb(78,98,126),rgb(91,116,145));}';

keyFrames += getStyleSheetMarker() + '.alan-btn-low-volume canvas { opacity: .0 !important; }';
Expand Down Expand Up @@ -1752,16 +1749,19 @@ function alanBtn(options) {
hoverShowHintTimeoutId = setTimeout(function () {
showHints();
}, 500);
} else if(state === PERMISSION_DENIED){
showInfo(MIC_BLOCKED_MSG);
}
}

function onBtnMouseLeave() {
var diff;
if (state === DEFAULT) {
clearTimeout(hoverShowHintTimeoutId);
hoverHideHintTimeoutId = setTimeout(function () {
hideHints();
}, 600);
} else if(state === PERMISSION_DENIED){
hideInfo();
}
}

Expand Down Expand Up @@ -1826,7 +1826,7 @@ function alanBtn(options) {
}
}

function hideRecognisedText() {
function hideRecognisedText(delay) {
// console.info('hideRecognisedText');

if (isMobile()) {
Expand All @@ -1843,7 +1843,7 @@ function alanBtn(options) {
textHolderTextWrapper.innerHTML = '';
textHolder.classList.remove('alanBtn-text-holder-long');
textHolder.classList.remove('alanBtn-text-holder-super-long');
}, 810);
}, delay || 810);
}
}

Expand Down Expand Up @@ -1898,6 +1898,14 @@ function alanBtn(options) {
hideRecognisedText();
}

function showInfo(text) {
showRecognisedText(null, text);
}

function hideInfo() {
hideRecognisedText(200);
}

function closeHint(event) {
var clickedEl = event.target;

Expand Down Expand Up @@ -2128,13 +2136,17 @@ function alanBtn(options) {

function playSoundOn() {
if (!soundOnAudioDoesNotExist) {
soundOnAudio.play();
soundOnAudio.play().catch(() => {
console.log("No activation sound, because the user didn't interact with the button");
});
}
}

function playSoundOff() {
if (!soundOffAudioDoesNotExist) {
soundOffAudio.play();
soundOffAudio.play().catch(() => {
console.log("No deactivation sound, because the user didn't interact with the button");
});
}
}

Expand Down Expand Up @@ -2322,6 +2334,7 @@ function alanBtn(options) {
}
if (newState === PERMISSION_DENIED) {
rootEl.classList.add("alan-btn-permission-denied");
showInfo(MIC_BLOCKED_MSG);
}
micIcon.style.opacity = 0;
micTriangleIcon.style.opacity = 0;
Expand Down
2 changes: 1 addition & 1 deletion dist/alan_lib.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alan-ai/alan-sdk-web",
"version": "1.1.6",
"version": "1.1.7",
"description": "Alan Web SDK: a lightweight JavaScript library for adding a voice experience to your website or web application",
"keywords": [
"alan sdk web",
Expand Down

0 comments on commit 3508593

Please sign in to comment.