@speechly/react-client
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -33,2 +33,6 @@ import React from 'react'; | ||
/** | ||
* Current appId in multi-app project. | ||
*/ | ||
appId?: string; | ||
/** | ||
* Current state of the context, whether it's idle, recording or failed, etc. | ||
@@ -35,0 +39,0 @@ * It's advised to react to this to enable / disable voice functionality in your app |
@@ -174,3 +174,10 @@ "use strict"; | ||
_this.switchApp = function (appId) { | ||
var clientState = _this.state.clientState; | ||
_this.setState({ appId: appId }); | ||
if (clientState === browser_client_1.ClientState.Recording) { | ||
_this.stopContext().then(function (_) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { | ||
return [2 /*return*/, this.startContext()]; | ||
}); }); }) | ||
.catch(function (_) { throw Error('Cannot stop context'); }); | ||
} | ||
}; | ||
@@ -278,3 +285,3 @@ _this.initialiseClient = function (opts) { | ||
var _this = this; | ||
var _a = this.state, recordingState = _a.recordingState, segment = _a.segment, tentativeTranscript = _a.tentativeTranscript, transcript = _a.transcript, tentativeEntities = _a.tentativeEntities, entity = _a.entity, tentativeIntent = _a.tentativeIntent, intent = _a.intent; | ||
var _a = this.state, appId = _a.appId, recordingState = _a.recordingState, segment = _a.segment, tentativeTranscript = _a.tentativeTranscript, transcript = _a.transcript, tentativeEntities = _a.tentativeEntities, entity = _a.entity, tentativeIntent = _a.tentativeIntent, intent = _a.intent; | ||
return (react_1.default.createElement(exports.SpeechContext.Provider, { value: { | ||
@@ -284,2 +291,3 @@ initialise: this.initialiseAudio, | ||
switchApp: function (appId) { return _this.switchApp(appId); }, | ||
appId: appId, | ||
speechState: recordingState, | ||
@@ -286,0 +294,0 @@ segment: segment, |
@@ -53,2 +53,6 @@ import { Client } from '@speechly/browser-client'; | ||
/** | ||
* Current appId in multi-app project. | ||
*/ | ||
appId?: string; | ||
/** | ||
* Current state of the context, whether it's idle, recording or failed, etc. | ||
@@ -55,0 +59,0 @@ * It's advised to react to this to enable / disable voice functionality in your app |
{ | ||
"name": "@speechly/react-client", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "React client for Speechly SLU API", | ||
@@ -5,0 +5,0 @@ "private": false, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52687
965