@jargon/jovo-plugin
Version:
A Jovo Framework plugin for the Jargon SDK
61 lines • 2.48 kB
JavaScript
;
/*
* Copyright 2019 Jargon, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
class JJ {
constructor(jovo, rm) {
this.jovo = jovo;
this.rm = rm;
}
tell(speech) {
return __awaiter(this, void 0, void 0, function* () {
let s = yield this.rm.render(speech);
this.jovo.tell(s);
});
}
ask(speech, repromptSpeech) {
return __awaiter(this, void 0, void 0, function* () {
let s;
let rs = undefined;
if (repromptSpeech) {
[s, rs] = yield this.rm.renderBatch([speech, repromptSpeech]);
}
else {
s = yield this.rm.render(speech);
}
this.jovo.ask(s, rs);
});
}
showSimpleCard(title, content) {
return __awaiter(this, void 0, void 0, function* () {
let [t, c] = yield this.rm.renderBatch([title, content]);
this.jovo.showSimpleCard(t, c);
});
}
showImageCard(title, content, imageUrl) {
return __awaiter(this, void 0, void 0, function* () {
let [t, c] = yield this.rm.renderBatch([title, content]);
this.jovo.showImageCard(t, c, imageUrl);
});
}
}
exports.JJ = JJ;
//# sourceMappingURL=index.js.map