UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

51 lines 1.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ADD_MEMORY = void 0; /* Custom modules */ const createNodeDescriptor_1 = require("../../createNodeDescriptor"); exports.ADD_MEMORY = (0, createNodeDescriptor_1.createNodeDescriptor)({ type: "addMemory", defaultLabel: "Add Memory", summary: "UI__NODE_EDITOR__ADD_MEMORY__SUMMARY", appearance: { showIcon: false }, fields: [ { key: "memory", type: "cognigyText", label: "UI__NODE_EDITOR__ADD_MEMORY__MEMORY__LABEL", description: "UI__NODE_EDITOR__ADD_MEMORY__MEMORY__DESCRIPTION", params: { required: true }, }, ], preview: { key: "memory", type: "text" }, tags: ["analytics", "profile"], function: async ({ cognigy, config }) => { var _a, _b; const { memory: memoryText } = config; const { api } = cognigy; if (memoryText !== undefined && memoryText !== null && memoryText !== "") { let memoryToAdd; if (typeof memoryText === 'string') { memoryToAdd = memoryText; } else if (typeof memoryText === 'object') { // Convert object to JSON string memoryToAdd = JSON.stringify(memoryText); } else { // Convert other types (number, boolean, etc.) to string memoryToAdd = String(memoryText); } await ((_a = api.addContactMemory) === null || _a === void 0 ? void 0 : _a.call(api, memoryToAdd)); (_b = api.logDebugMessage) === null || _b === void 0 ? void 0 : _b.call(api, `UI__DEBUG_MODE__ADD_MEMORY__MESSAGE\n'${memoryToAdd}'`); } } }); //# sourceMappingURL=addMemory.js.map