UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

82 lines 3.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DTMF = void 0; /** Custom Modules */ const createNodeDescriptor_1 = require("../../../createNodeDescriptor"); /** Helper Modules */ const setSessionConfig_mapper_1 = require("../mappers/setSessionConfig.mapper"); const design_1 = require("../utils/design"); const setSessionConfig_mapper_2 = require("../mappers/setSessionConfig.mapper"); const logFullConfigToDebugMode_1 = require("../../../../helper/logFullConfigToDebugMode"); exports.DTMF = (0, createNodeDescriptor_1.createNodeDescriptor)({ type: "dtmf", defaultLabel: "DTMF Collect - Config", tags: [""], appearance: { color: design_1.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: async ({ cognigy, config }) => { const { api, input } = cognigy; const { endpointType } = input; try { const payload = setSessionConfig_mapper_1.setSessionConfig.handleInput(endpointType, (0, setSessionConfig_mapper_2.voiceConfigParamsToVoiceSettings)(config, api)); await api.say(null, { _cognigy: payload, }); (0, logFullConfigToDebugMode_1.logFullConfigToDebugMode)(cognigy, config); } catch (error) { throw new Error(`Error on DTMF node. Error message: ${error.message}`); } }, }); //# sourceMappingURL=dtmf.js.map