@cognigy/rest-api-client
Version:
Cognigy REST-Client
51 lines • 1.77 kB
JavaScript
import { __awaiter } from "tslib";
/** Custom Modules */
import { createNodeDescriptor } from "../../../createNodeDescriptor";
/** Helper Modules */
import { nodeColor } from '../utils/design';
import { MuteSpeechInputMapper } from "../mappers/muteSpeechInput.mapper";
const mapper = new MuteSpeechInputMapper();
export const MUTE_SPEECH_INPUT = createNodeDescriptor({
type: "muteSpeechInput",
defaultLabel: "Mute Speech Input",
tags: [''],
summary: "UI__NODE_EDITOR__MUTE_SPEECH_INPUT__SUMMARY",
preview: {
key: "muteSpeechInput",
type: "text"
},
appearance: {
color: nodeColor
},
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
},
],
form: [
{ type: "field", key: "muteSpeechInput" },
],
function: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () {
const { api, input } = cognigy;
const { endpointType } = input;
try {
mapper.endpointType = endpointType;
const payload = mapper.handleInput(config, api);
yield api.say(null, {
_cognigy: payload
});
api.logDebugMessage(`UI__DEBUG_MODE__MUTE_SPEECH__MESSAGE ${config.muteSpeechInput}`);
}
catch (error) {
throw new Error(`Error in muteSpeechInput node. Error message: ${error.message}`);
}
})
});
//# sourceMappingURL=muteSpeechInput.js.map