@tixae-labs/web-sdk
Version:
Javascript Web SDK for doing WebRTC AI Voice Calls with TIXAE Agents.
25 lines (24 loc) • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCookieValue = getCookieValue;
exports.downloadCSV = downloadCSV;
function getCookieValue(name) {
// Build a regex that matches either start-of-string or a semicolon,
// followed by space(s), then the cookie name, equals sign,
// and finally, everything up to the next semicolon.
const re = new RegExp('(?:^|; )' + encodeURIComponent(name) + '=([^;]*)');
const match = document.cookie.match(re);
// If found, decode and return. Otherwise, return null.
return match ? decodeURIComponent(match[1]) : null;
}
function downloadCSV(csv, filename) {
const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.setAttribute("href", url);
link.setAttribute("download", filename);
link.style.visibility = "hidden";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}