UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

85 lines 3.28 kB
import { __awaiter } from "tslib"; /** Custom Modules */ import { createNodeDescriptor } from "../../../createNodeDescriptor"; /** Helper Modules */ import { nodeColor } from '../utils/design'; export const agentAssistNode = 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: nodeColor }, form: [ { type: "field", key: "activity" }, { type: "field", key: "targetParticipant" }, ], function: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () { 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" } }); } yield api.output(null, { "_cognigy": { "_voiceGateway": { "json": { activities } } } }); } }) }); //# sourceMappingURL=agentAssist.js.map