UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

53 lines 2.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const identityAssistTemplate = ({ widgetLayout = "horizontal", imageShape = "round", imageUrl, customer, customerData, fontSize, profileFontSize, keyValueFontSize, showProfileImage, profileImageSize }) => { const imageClass = imageShape === "round" ? "rounded-full" : "rounded-none"; let layoutClass = ""; let marginClass = ""; let textClass = ""; let imageHTML = ""; let customerDataHTML = ""; layoutClass += widgetLayout === "horizontal" ? "" : "flex-col"; marginClass = widgetLayout === "horizontal" ? "ml-2" : ""; imageHTML = ` <div class="mt-6 flex justify-center"> <img class="${profileImageSize} object-cover ${marginClass} ${imageClass}" src="${imageUrl || "https://cdn-icons-png.flaticon.com/512/149/149071.png"}" alt="User Avatar" /> </div> `; if (widgetLayout === "horizontal") { textClass = "flex-grow"; } for (const [key, value] of Object.entries(customerData)) { customerDataHTML += `<p class="mt-1 ${keyValueFontSize} text-gray-500">${key}: ${value}</p>`; } return ` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>User Profile</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" /> </head> <body> <div class="flex h-screen items-center justify-center bg-gray-100"> <div class="h-full w-full rounded-lg bg-white shadow-md overflow-hidden"> <div class="flex h-full ${layoutClass}"> ${showProfileImage ? imageHTML : ''} <div class="mt-2 pl-4 pt-4 pb-4 flex flex-col h-full break-all overflow-hidden ${textClass}"> <div class="${fontSize} pl-4 font-semibold uppercase tracking-wide text-indigo-500">User Profile</div> <div class="mt-2 pl-4 ${profileFontSize} font-semibold"> ${customer} </div> <div class="flex-grow overflow-auto p-4 h-full break-words"> ${customerDataHTML} </div> </div> </div> </div> </div> </body> </html>`; }; exports.default = identityAssistTemplate; //# sourceMappingURL=identityAssistTemplate.js.map