@cognigy/rest-api-client
Version:
Cognigy REST-Client
46 lines • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.COMPLETE_GOAL = void 0;
/* Custom modules */
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
/**
* Node name: 'completeGoal'
*
* Purpose:
* Sets a goal as complete (new name: tasks)
* @param goal the name of the goal to add to completedGoals array
*/
exports.COMPLETE_GOAL = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "completeGoal",
defaultLabel: "Complete Task",
summary: "UI__NODE_EDITOR__COMPLETE_GOAL__SUMMARY",
appearance: {
showIcon: false
},
fields: [
{
key: "goal",
type: "cognigyText",
label: "UI__NODE_EDITOR__COMPLETE_GOAL__GOAL__LABEL",
params: {
required: true
}
}
],
preview: {
key: "goal",
type: "text"
},
tags: ["analytics", "profile"],
function: async ({ cognigy, config }) => {
var _a;
const { goal } = config;
const { input, api } = cognigy;
if (goal) {
api.completeGoal(goal);
input.completedGoals.push(goal);
(_a = api.logDebugMessage) === null || _a === void 0 ? void 0 : _a.call(api, `Task: ${goal}`);
}
}
});
//# sourceMappingURL=completeGoal.js.map