@cognigy/rest-api-client
Version:
Cognigy REST-Client
195 lines • 6.31 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ASSIST_INFO = void 0;
/* Custom modules */
const createNodeDescriptor_1 = require("../../createNodeDescriptor");
const utils_1 = require("./utils");
/**
* Node name: 'assistInfo'
*
* Purpose:
* Sends an info summary to the live agent
*/
exports.ASSIST_INFO = (0, createNodeDescriptor_1.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: async ({ cognigy, config }) => {
const { api } = cognigy;
const dataResponse = (0, utils_1.buildCognigyWhisperAssistResponse)(config);
await api.say("", dataResponse);
},
});
//# sourceMappingURL=assistInfo.js.map