@cognigy/rest-api-client
Version:
Cognigy REST-Client
46 lines • 1.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const agentAssistTranslator_helper_1 = require("../helpers/agentAssistTranslator.helper");
const stylesPartial_1 = require("./stylesPartial");
const sentimentAnalysisTemplate = ({ sentiment, fontSize, input, }) => {
const mapSentimentToColor = {
positive: "bg-positive",
negative: "bg-negative",
neutral: "bg-neutral",
};
let currentSentiment = sentiment === null || sentiment === void 0 ? void 0 : sentiment.toLowerCase();
if (currentSentiment) {
Object.keys(mapSentimentToColor).forEach((key) => {
if (currentSentiment.includes(key)) {
currentSentiment = key;
}
});
}
const translatedSentiment = (0, agentAssistTranslator_helper_1.agentAssistTranslator)({
key: currentSentiment,
input,
});
return `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Positive Box</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
<style>
${stylesPartial_1.default}
</style>
</head>
<body>
<div class="flex h-screen justify-center bg-gray-100 rounded-lg">
<div class="flex flex-1 items-center justify-center overflow-hidden rounded-lg ${mapSentimentToColor[currentSentiment]} shadow-md">
<span class="${fontSize} font-semibold text-white">${translatedSentiment}</span>
</div>
</div>
</body>
</html>
`;
};
exports.default = sentimentAnalysisTemplate;
//# sourceMappingURL=sentimentAnalysisTemplate.js.map