@cognigy/rest-api-client
Version:
Cognigy REST-Client
61 lines • 2.18 kB
JavaScript
import { __awaiter } from "tslib";
/** Custom Modules */
import { createNodeDescriptor } from "../../../createNodeDescriptor";
/** Helper Modules */
import { nodeColor } from '../utils/design';
import { MuteSpeechInputMapper } from "../../voice/mappers/muteSpeechInput.mapper";
import { logFullConfigToDebugMode } from "../../../../helper/logFullConfigToDebugMode";
const mapper = new MuteSpeechInputMapper("voiceGateway2");
export const muteSpeechInputNode = createNodeDescriptor({
type: "muteSpeechInput",
defaultLabel: "Mute Speech Input",
summary: "UI__NODE_EDITOR__MUTE_SPEECH_INPUT__SUMMARY",
preview: {
key: "muteSpeechInput",
type: "text"
},
appearance: {
color: nodeColor
},
tags: ["voice"],
fields: [
{
key: "muteSpeechInput",
label: "UI__NODE_EDITOR__MUTE_SPEECH_INPUT__FIELDS__MUTE_SPEECH_INPUT__LABEL",
description: "UI__NODE_EDITOR__MUTE_SPEECH_INPUT__FIELDS__MUTE_SPEECH_INPUT__DESCRIPTION",
type: "toggle",
params: {
required: true
},
defaultValue: false
},
{
key: "muteDtmfInput",
label: "UI__NODE_EDITOR__MUTE_SPEECH_INPUT__FIELDS__MUTE_DTMF_INPUT__LABEL",
description: "UI__NODE_EDITOR__MUTE_SPEECH_INPUT__FIELDS__MUTE_DTMF_INPUT__DESCRIPTION",
type: "toggle",
params: {
required: true
},
defaultValue: false
},
],
form: [
{ type: "field", key: "muteSpeechInput" },
{ type: "field", key: "muteDtmfInput" },
],
function: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () {
const { api } = cognigy;
try {
const payload = mapper.handleInput(config, api);
yield api.say(null, {
_cognigy: payload
});
logFullConfigToDebugMode(cognigy, config);
}
catch (error) {
throw new Error(`Error on mute speech input node. Error message: ${error.message}`);
}
})
});
//# sourceMappingURL=muteSpeechInput.js.map