@cognigy/rest-api-client
Version:
Cognigy REST-Client
80 lines • 2.94 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setSessionParamsNode = void 0;
/** Custom Modules */
const createNodeDescriptor_1 = require("../../../createNodeDescriptor");
/** Helper Modules */
const design_1 = require("../utils/design");
const paramUtils_1 = require("../utils/paramUtils");
const utils_1 = require("./helper/utils");
exports.setSessionParamsNode = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "setSessionParams",
defaultLabel: "Set Session Parameters",
summary: "UI__NODE_EDITOR__SET_SESSION_PARAMS__SUMMARY",
// @ts-ignore
fields: [
{
key: "sessionParams",
label: "UI__NODE_EDITOR__SET_SESSION_PARAMS__FIELDS__SESSION_PARAMS__LABEL",
type: "json",
defaultValue: "{}",
params: {
required: true
}
}
].concat((0, paramUtils_1.getParameterFields)()),
sections: [
{
key: "advanced",
label: "UI__NODE_EDITOR__SET_SESSION_PARAMS__SECTIONS__ADVANCED__LABEL",
defaultCollapsed: true,
fields: [
"sessionParams",
]
}
].concat((0, paramUtils_1.getParamSections)()),
appearance: {
color: design_1.nodeColor
},
form: [
{ type: "section", key: "params_stt" },
{ type: "section", key: "params_tts" },
{ type: "section", key: "params_dtmf" },
{ type: "section", key: "params_bargein" },
{ type: "section", key: "params_continuousasr" },
{ type: "section", key: "params_user_timeouts" },
{ type: "section", key: "params_bot_timeouts" },
{ type: "section", key: "params_azure" },
{ type: "section", key: "params_google" },
{ type: "section", key: "advanced" },
],
function: async ({ cognigy, config, nodeId }) => {
const { api } = cognigy;
const { sessionParams } = config;
const { isFeatureAccmEnabled } = api.getEndpointSettings();
if (isFeatureAccmEnabled) {
return await api.say(null, {
_cognigy: (0, utils_1.buildPayloadAccm)("setSessionParams", config, nodeId)
});
}
let compiledParams = sessionParams || {};
(0, paramUtils_1.compileParams)(config, compiledParams);
// output the activity to the voice gateway
await api.output(null, {
"_cognigy": {
"_voiceGateway": {
"json": {
"activities": [
{
"type": "event",
"name": "config",
"sessionParams": compiledParams
}
]
}
}
}
});
}
});
//# sourceMappingURL=setSessionParams.js.map