UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

80 lines 2.87 kB
import { __awaiter } from "tslib"; /** Custom Modules */ import { createNodeDescriptor } from "../../../createNodeDescriptor"; /** Helper Modules */ import { setSessionConfig } from "../mappers/setSessionConfig.mapper"; import { nodeColor } from "../utils/design"; import { voiceConfigParamsToVoiceSettings } from "../mappers/setSessionConfig.mapper"; import { logFullConfigToDebugMode } from "../../../../helper/logFullConfigToDebugMode"; export const DTMF = createNodeDescriptor({ type: "dtmf", defaultLabel: "DTMF Collect - Config", tags: [""], appearance: { color: nodeColor, }, summary: "UI__NODE_EDITOR__DTMF__SUMMARY", fields: [ { key: "dtmfEnable", type: "toggle", label: "UI__NODE_EDITOR__DTMF__FIELDS__DTMF_ENABLE__LABEL", description: "UI__NODE_EDITOR__DTMF__FIELDS__DTMF_ENABLE__DESCRIPTION", defaultValue: false, }, { key: "dtmfInterDigitTimeout", type: "number", label: "UI__NODE_EDITOR__DTMF__FIELDS__DTMF_INTER_DIGIT_TIMEOUT__LABEL", description: "UI__NODE_EDITOR__DTMF__FIELDS__DTMF_INTER_DIGIT_TIMEOUT__DESCRIPTION", defaultValue: 2000, condition: { key: "dtmfEnable", value: true, }, params: { min: 0, }, }, { key: "dtmfMaxDigits", type: "number", label: "UI__NODE_EDITOR__DTMF__FIELDS__DTMF_MAX_DIGITS__LABEL", description: "UI__NODE_EDITOR__DTMF__FIELDS__DTMF_MAX_DIGITS__DESCRIPTION", defaultValue: 1, condition: { key: "dtmfEnable", value: true, }, params: { min: 1, }, }, { key: "dtmfSubmitDigit", type: "cognigyText", label: "UI__NODE_EDITOR__DTMF__FIELDS__DTMF_SUBMIT_DIGIT__LABEL", description: "UI__NODE_EDITOR__DTMF__FIELDS__DTMF_SUBMIT_DIGIT__DESCRIPTION", defaultValue: "#", condition: { key: "dtmfEnable", value: true, }, }, ], function: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () { const { api, input } = cognigy; const { endpointType } = input; try { const payload = setSessionConfig.handleInput(endpointType, voiceConfigParamsToVoiceSettings(config, api)); yield api.say(null, { _cognigy: payload, }); logFullConfigToDebugMode(cognigy, config); } catch (error) { throw new Error(`Error on DTMF node. Error message: ${error.message}`); } }), }); //# sourceMappingURL=dtmf.js.map