@cognigy/rest-api-client
Version:
Cognigy REST-Client
44 lines • 1.28 kB
JavaScript
import { __awaiter } from "tslib";
/* Custom modules */
import { createNodeDescriptor } from "../../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
*/
export const COMPLETE_GOAL = 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: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () {
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