@cognigy/rest-api-client
Version:
Cognigy REST-Client
52 lines • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SET_STATE = void 0;
/* Custom modules */
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
/**
* Node name: 'setState'
*
* Purpose:
* Sets the current state
*/
exports.SET_STATE = (0, createNodeDescriptor_1.createNodeDescriptor)({
type: "setState",
defaultLabel: "Set State",
summary: "UI__NODE_EDITOR__SET_STATE__SUMMARY",
appearance: {
showIcon: false
},
fields: [
{
key: "state",
type: "state",
label: "UI__NODE_EDITOR__SET_STATE__STATE__LABEL",
},
{
key: "text",
type: "cognigyText",
label: "UI__NODE_EDITOR__SET_STATE__TEXT__LABEL"
},
{
key: "data",
type: "json",
label: "UI__NODE_EDITOR__SET_STATE__DATA__LABEL"
}
],
preview: {
key: "state",
type: "text",
},
tags: ["logic"],
function: async ({ cognigy, config }) => {
const { state, text, data } = config;
const { input, api } = cognigy;
api.setState(state);
input.state = state;
api.logDebugMessage(`UI__DEBUG_MODE__SET_STATE__MESSAGE ${state}`);
if (text || data) {
api.think(text, data);
}
}
});
//# sourceMappingURL=setState.js.map