UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

52 lines 1.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DISABLE_SLOT_FILLERS = void 0; /* Custom modules */ const createNodeDescriptor_1 = require("../../createNodeDescriptor"); /** * Node name: 'disableSlotFillers' * * Purpose: * Disables slot fillers */ exports.DISABLE_SLOT_FILLERS = (0, createNodeDescriptor_1.createNodeDescriptor)({ type: "disableSlotFillers", defaultLabel: "Disable Slot Fillers", summary: "UI__NODE_EDITOR__DISABLE_SLOT_FILLERS__SUMMARY", appearance: { showIcon: false }, fields: [ { key: "slotFillersToDisable", type: "slotFillerArray", label: "UI__NODE_EDITOR__DISABLE_SLOT_FILLERS__SLOT_FILLERS_TO_DISABLE__LABEL", description: "UI__NODE_EDITOR__DISABLE_SLOT_FILLERS__SLOT_FILLERS_TO_DISABLE__DESCRIPTION" }, { key: "reset", type: "toggle", label: "UI__NODE_EDITOR__DISABLE_SLOT_FILLERS__RESET__LABEL", } ], tags: ["ai", "nlu"], function: async ({ cognigy, config }) => { const { slotFillersToDisable, reset } = config; const { api, flowReferenceId } = cognigy; let slotFillers = api.getSystemContext("slotFillers"); if (slotFillers) { if (reset) { slotFillers[flowReferenceId] = []; } else { slotFillers[flowReferenceId] = slotFillers[flowReferenceId] && slotFillers[flowReferenceId].filter(filler => slotFillersToDisable.indexOf(filler) === -1); } } else { slotFillers = {}; slotFillers[flowReferenceId] = []; } api.setSystemContext("slotFillers", slotFillers); } }); //# sourceMappingURL=disableSlotFillers.js.map