@cognigy/rest-api-client
Version:
Cognigy REST-Client
63 lines • 2.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.muteSpeechInputNode = void 0;
/** Custom Modules */
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
/** Helper Modules */
const design_1 = require("../utils/design");
const muteSpeechInput_mapper_1 = require("../../voice/mappers/muteSpeechInput.mapper");
const logFullConfigToDebugMode_1 = require("../../../../helper/logFullConfigToDebugMode");
const mapper = new muteSpeechInput_mapper_1.MuteSpeechInputMapper("voiceGateway2");
exports.muteSpeechInputNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "muteSpeechInput",
defaultLabel: "Mute Speech Input",
summary: "UI__NODE_EDITOR__MUTE_SPEECH_INPUT__SUMMARY",
preview: {
key: "muteSpeechInput",
type: "text"
},
appearance: {
color: design_1.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: async ({ cognigy, config }) => {
const { api } = cognigy;
try {
const payload = mapper.handleInput(config, api);
await api.say(null, {
_cognigy: payload
});
(0, logFullConfigToDebugMode_1.logFullConfigToDebugMode)(cognigy, config);
}
catch (error) {
throw new Error(`Error on mute speech input node. Error message: ${error.message}`);
}
}
});
//# sourceMappingURL=muteSpeechInput.js.map