UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

193 lines 6.26 kB
import { __awaiter } from "tslib"; /* Custom modules */ import { createNodeDescriptor } from "../../createNodeDescriptor"; import { buildCognigyWhisperAssistResponse } from "./utils"; /** * Node name: 'assistInfo' * * Purpose: * Sends an info summary to the live agent */ export const ASSIST_INFO = createNodeDescriptor({ type: "assistInfo", defaultLabel: "Agent Assist Card", summary: "UI__NODE_EDITOR__ASSIST_INFO__SUMMARY", appearance: { showIcon: false, }, fields: [ { key: "cardType", type: "select", label: "UI__NODE_EDITOR__ASSIST_INFO__CARD_TYPE__LABEL", defaultValue: "basic", params: { options: [ { label: "UI__NODE_EDITOR__ASSIST_INFO__CARD_TYPE__BASIC__LABEL", value: "basic" }, { label: "UI__NODE_EDITOR__ASSIST_INFO__CARD_TYPE__SUGGESTED__LABEL", value: "suggested" }, { label: "UI__NODE_EDITOR__ASSIST_INFO__CARD_TYPE__TABLE__LABEL", value: "table" }, { label: "UI__NODE_EDITOR__ASSIST_INFO__CARD_TYPE__CUSTOM__LABEL", value: "custom" }, ] } }, { key: "title", type: "cognigyText", label: "UI__NODE_EDITOR__ASSIST_INFO__TITLE__LABEL", description: "UI__NODE_EDITOR__ASSIST_INFO__TITLE__DESCRIPTION", defaultValue: "", params: { required: true }, condition: { key: "cardType", value: "custom", negate: true }, }, { key: "subtitle", type: "cognigyText", label: "UI__NODE_EDITOR__ASSIST_INFO__SUBTITLE__LABEL", description: "UI__NODE_EDITOR__ASSIST_INFO__SUBTITLE__DESCRIPTION", defaultValue: "", params: { required: true }, condition: { key: "cardType", value: "custom", negate: true }, }, { key: "body", type: "cognigyText", label: "UI__NODE_EDITOR__ASSIST_INFO__BODY__LABEL", description: "UI__NODE_EDITOR__ASSIST_INFO__BODY__DESCRIPTION", defaultValue: "", params: { required: true, multiline: true, rows: 3, maxRows: 5 }, condition: { key: "cardType", value: "basic" } }, { key: "basicImage", type: "cognigyText", label: "UI__NODE_EDITOR__ASSIST_INFO__IMAGE__LABEL", description: "UI__NODE_EDITOR__ASSIST_INFO__IMAGE__DESCRIPTION", defaultValue: "", condition: { key: "cardType", value: "basic" } }, { key: "basicActionTitle", type: "cognigyText", label: "UI__NODE_EDITOR__ASSIST_INFO__ACTION_TITLE__LABEL", description: "UI__NODE_EDITOR__ASSIST_INFO__ACTION_TITLE__DESCRIPTION", defaultValue: "", condition: { key: "cardType", value: "basic" } }, { key: "basicActionUrl", type: "cognigyText", label: "UI__NODE_EDITOR__ASSIST_INFO__ACTION_URL__LABEL", description: "UI__NODE_EDITOR__ASSIST_INFO__ACTION_URL__DESCRIPTION", defaultValue: "", condition: { key: "cardType", value: "basic" } }, { key: "body", type: "cognigyText", label: "UI__NODE_EDITOR__ASSIST_INFO__BODY__SUGGESTED__LABEL", description: "UI__NODE_EDITOR__ASSIST_INFO__BODY__SUGGESTED__DESCRIPTION", defaultValue: "", params: { required: true, multiline: true, rows: 3, maxRows: 5 }, condition: { key: "cardType", value: "suggested" } }, { key: "suggestedActionTitles", type: "cognigyTextArray", label: "UI__NODE_EDITOR__ASSIST_INFO__SUGGESTED_ACTION_TITLES__LABEL", description: "UI__NODE_EDITOR__ASSIST_INFO__SUGGESTED_ACTION_TITLES__DESCRIPTION", condition: { key: "cardType", value: "suggested" } }, { key: "tableFacts", type: "keyValuePairs", label: "UI__NODE_EDITOR__ASSIST_INFO__TABLE_FACTS__LABEL", description: "UI__NODE_EDITOR__ASSIST_INFO__TABLE_FACTS__DESCRIPTION", defaultValue: "{}", params: { required: true }, condition: { key: "cardType", value: "table" } }, { key: "customJson", type: "json", label: "UI__NODE_EDITOR__ASSIST_INFO__CUSTOM_JSON__LABEL", defaultValue: JSON.stringify({ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "type": "AdaptiveCard", "version": "1.5", "body": [] }, null, 4), condition: { key: "cardType", value: "custom" } }, ], tags: ["basic", "message"], preview: { key: "title", type: "text", }, function: ({ cognigy, config }) => __awaiter(void 0, void 0, void 0, function* () { const { api } = cognigy; const dataResponse = buildCognigyWhisperAssistResponse(config); yield api.say("", dataResponse); }), }); //# sourceMappingURL=assistInfo.js.map