UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

50 lines 1.34 kB
import { __awaiter } from "tslib"; /* Custom modules */ import { createNodeDescriptor } from "../../createNodeDescriptor"; /** * Node name: 'setState' * * Purpose: * Sets the current state */ export const SET_STATE = 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: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () { 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