@cognigy/rest-api-client
Version:
Cognigy REST-Client
87 lines • 3.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.agentAssistNode = void 0;
/** Custom Modules */
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
/** Helper Modules */
const design_1 = require("../utils/design");
exports.agentAssistNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "agentAssist",
defaultLabel: "Agent Assist",
summary: "UI__NODE_EDITOR__AGENT_ASSIST__SUMMARY",
preview: {
key: "activity",
type: "text"
},
fields: [
{
key: "activity",
label: "UI__NODE_EDITOR__AGENT_ASSIST__FIELDS__ACTIVITY__LABEL",
type: "select",
description: "UI__NODE_EDITOR__AGENT_ASSIST__FIELDS__ACTIVITY__DESCRIPTION",
defaultValue: "startRecognition",
params: {
options: [
{ value: "startRecognition", label: "UI__NODE_EDITOR__AGENT_ASSIST__FIELDS__ACTIVITY__OPTIONS__START_RECOGNITION" },
{ value: "stopRecognition", label: "UI__NODE_EDITOR__AGENT_ASSIST__FIELDS__ACTIVITY__OPTIONS__STOP_RECOGNITION" },
]
}
},
{
key: "targetParticipant",
label: "UI__NODE_EDITOR__AGENT_ASSIST__FIELDS__TARGET_PARTICIPANT__LABEL",
type: "select",
description: "UI__NODE_EDITOR__AGENT_ASSIST__FIELDS__TARGET_PARTICIPANT__DESCRIPTION",
defaultValue: "both",
params: {
options: [
{ value: "both", label: "UI__NODE_EDITOR__AGENT_ASSIST__FIELDS__TARGET_PARTICIPANT__OPTIONS__BOTH" },
{ value: "caller", label: "UI__NODE_EDITOR__AGENT_ASSIST__FIELDS__TARGET_PARTICIPANT__OPTIONS__CALLER" },
{ value: "callee", label: "UI__NODE_EDITOR__AGENT_ASSIST__FIELDS__TARGET_PARTICIPANT__OPTIONS__CALLEE" },
]
}
},
],
appearance: {
color: design_1.nodeColor
},
form: [
{ type: "field", key: "activity" },
{ type: "field", key: "targetParticipant" },
],
function: async ({ cognigy, config }) => {
const { api } = cognigy;
const { activity, targetParticipant } = config;
if (activity && targetParticipant) {
let activities = [];
if (targetParticipant === "both" || targetParticipant === "caller") {
activities.push({
"type": "event",
"name": activity,
"activityParams": {
"targetParticipant": "caller"
}
});
}
if (targetParticipant === "both" || targetParticipant === "callee") {
activities.push({
"type": "event",
"name": activity,
"activityParams": {
"targetParticipant": "callee"
}
});
}
await api.output(null, {
"_cognigy": {
"_voiceGateway": {
"json": {
activities
}
}
}
});
}
}
});
//# sourceMappingURL=agentAssist.js.map