@speechly/react-client
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -29,2 +29,6 @@ import React from 'react'; | ||
/** | ||
* Switch appId in multi-app project. | ||
*/ | ||
switchApp: (appId: string) => void; | ||
/** | ||
* Current state of the context, whether it's idle, recording or failed, etc. | ||
@@ -89,2 +93,3 @@ * It's advised to react to this to enable / disable voice functionality in your app | ||
toggleIsOn: boolean; | ||
appId?: string; | ||
startedContextPromise?: Promise<string>; | ||
@@ -115,2 +120,3 @@ segment?: SpeechSegment; | ||
readonly toggleRecording: () => Promise<void>; | ||
readonly switchApp: (appId: string) => void; | ||
render(): JSX.Element; | ||
@@ -117,0 +123,0 @@ componentDidUpdate(prevProps: SpeechProviderProps): Promise<void>; |
@@ -71,2 +71,3 @@ "use strict"; | ||
}); }); }, | ||
switchApp: function () { }, | ||
speechState: types_1.SpeechState.Idle, | ||
@@ -104,7 +105,7 @@ }); | ||
_this.startContext = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var _a, client, clientState, startedContextPromise, _b; | ||
var _a, client, clientState, appId, startedContextPromise, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
_a = this.state, client = _a.client, clientState = _a.clientState; | ||
_a = this.state, client = _a.client, clientState = _a.clientState, appId = _a.appId; | ||
_b = clientState; | ||
@@ -124,3 +125,8 @@ switch (_b) { | ||
case 3: | ||
startedContextPromise = client.startContext(); | ||
if (appId !== undefined) { | ||
startedContextPromise = client.startContext(appId); | ||
} | ||
else { | ||
startedContextPromise = client.startContext(); | ||
} | ||
return [3 /*break*/, 5]; | ||
@@ -170,2 +176,5 @@ case 4: | ||
}); }; | ||
_this.switchApp = function (appId) { | ||
_this.setState({ appId: appId }); | ||
}; | ||
_this.initialiseClient = function (opts) { | ||
@@ -265,2 +274,3 @@ var _a; | ||
toggleIsOn: false, | ||
appId: undefined, | ||
startedContextPromise: undefined, | ||
@@ -271,2 +281,3 @@ }; | ||
SpeechProvider.prototype.render = function () { | ||
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; | ||
@@ -276,2 +287,3 @@ return (react_1.default.createElement(exports.SpeechContext.Provider, { value: { | ||
toggleRecording: this.toggleRecording, | ||
switchApp: function (appId) { return _this.switchApp(appId); }, | ||
speechState: recordingState, | ||
@@ -278,0 +290,0 @@ segment: segment, |
@@ -49,2 +49,6 @@ import { Client } from '@speechly/browser-client'; | ||
/** | ||
* Switch appId in multi-app project. | ||
*/ | ||
switchApp: (appId: string) => void; | ||
/** | ||
* Current state of the context, whether it's idle, recording or failed, etc. | ||
@@ -121,2 +125,3 @@ * It's advised to react to this to enable / disable voice functionality in your app | ||
readonly toggleRecording: () => Promise<void>; | ||
readonly switchApp: (appId: string) => void; | ||
render(): JSX.Element; | ||
@@ -152,2 +157,3 @@ componentDidUpdate(prevProps: SpeechProviderProps): Promise<void>; | ||
toggleIsOn: boolean; | ||
appId?: string; | ||
startedContextPromise?: Promise<string>; | ||
@@ -154,0 +160,0 @@ segment?: SpeechSegment; |
{ | ||
"name": "@speechly/react-client", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "React client for Speechly SLU API", | ||
@@ -39,3 +39,3 @@ "private": false, | ||
"dependencies": { | ||
"@speechly/browser-client": "^1.0.6" | ||
"@speechly/browser-client": "^1.0.9" | ||
}, | ||
@@ -42,0 +42,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
51693
948