UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

46 lines 1.4 kB
import { __awaiter } from "tslib"; /** Custom Modules */ import { createNodeDescriptor } from "../../../createNodeDescriptor"; /** Helper Modules */ import { hangUp } from "../mappers/hangup.mapper"; import { nodeColor } from "../utils/design"; export const HANG_UP = createNodeDescriptor({ type: "hangup", defaultLabel: "Hang Up", tags: [''], preview: { key: "hangupReason", type: "text" }, appearance: { color: nodeColor }, summary: "UI__NODE_EDITOR__HANGUP__SUMMARY", fields: [ { key: "hangupReason", label: "UI__NODE_EDITOR__HANGUP__FIELDS__HANGUP_REASON__LABEL", type: "cognigyText", defaultValue: "Bot ended the call", params: { required: true } } ], function: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () { const { api, input } = cognigy; const { hangupReason } = config; const { endpointType } = input; try { const payload = hangUp.handleInput(endpointType, hangupReason, false); yield api.say(null, { _cognigy: payload }); } catch (error) { throw new Error(`Error on hangup node. Error message: ${error.message}`); } ; }) }); //# sourceMappingURL=hangup.js.map