SaaS Agreement Legal Compliance Checker
Paste Your SaaS Agreement
Select Compliance Modules to Check
Analysis Report
No compliance modules selected. Go back to select modules and run the analysis.
`; return; } let reportHtml = ``;
reportHtml += `
`;
this.dom.reportArea.innerHTML = reportHtml;
},
createComplianceItem(label, isCompliant) {
const icon = isCompliant
? ``
: ``;
const textClass = isCompliant ? 'text-gray-800' : 'text-gray-800 font-semibold';
return `
SaaS Agreement Compliance Report
`; this.selectedModules.forEach(key => { const module = this.complianceModules[key]; reportHtml += `${module.title}
`; module.checks.forEach(check => { const isCompliant = check.keyword.test(this.agreementText); reportHtml += this.createComplianceItem(check.label, isCompliant); }); }); reportHtml += `
${icon}
${label}: ${isCompliant ? 'Detected' : 'Not Detected'}
`;
},
// --- ACTIONS ---
toggleModule(key, isChecked) {
if (isChecked) {
this.selectedModules.add(key);
} else {
this.selectedModules.delete(key);
}
},
// --- NAVIGATION ---
changeTab(tabIndex) {
if (tabIndex > this.currentTab) {
if (this.currentTab === 0 && this.agreementText.trim() === '') {
alert("Please paste the agreement text to continue.");
return;
}
if (this.currentTab === 1 && this.selectedModules.size === 0) {
alert("Please select at least one compliance module.");
return;
}
}
if (tabIndex === 2) {
this.renderReport();
}
this.dom.tabButtons[this.currentTab].classList.remove('active');
this.dom.tabContents[this.currentTab].classList.remove('active');
this.currentTab = tabIndex;
this.dom.tabButtons[this.currentTab].classList.add('active');
this.dom.tabContents[this.currentTab].classList.add('active');
this.updateNavButtons();
},
navigateTabs(direction) {
const newTab = direction === 'next' ? this.currentTab + 1 : this.currentTab - 1;
if (newTab >= 0 && newTab < this.dom.tabButtons.length) {
this.changeTab(newTab);
}
},
updateNavButtons() {
this.dom.prevBtn.style.visibility = this.currentTab === 0 ? 'hidden' : 'visible';
this.dom.nextBtn.textContent = this.currentTab === this.dom.tabButtons.length - 2 ? 'Analyze' : 'Next';
this.dom.nextBtn.style.visibility = this.currentTab === this.dom.tabButtons.length - 1 ? 'hidden' : 'visible';
},
// --- PDF GENERATION ---
generatePdf() {
const { jsPDF } = window.jspdf;
const content = document.getElementById('pdf-content');
if (!content) {
alert("Report content not found. Please run analysis first.");
return;
}
html2canvas(content, { scale: 2 }).then(canvas => {
const imgData = canvas.toDataURL('image/png');
const pdf = new jsPDF({ orientation: 'portrait', unit: 'px', format: 'a4' });
const pdfWidth = pdf.internal.pageSize.getWidth();
const pdfHeight = pdf.internal.pageSize.getHeight();
const imgWidth = canvas.width;
const imgHeight = canvas.height;
const ratio = imgWidth / imgHeight;
let finalImgWidth = pdfWidth - 40;
let finalImgHeight = finalImgWidth / ratio;
pdf.addImage(imgData, 'PNG', 20, 20, finalImgWidth, finalImgHeight);
pdf.save('SaaS-Compliance-Report.pdf');
});
},
};
window.app = {
changeTab: app.changeTab.bind(app),
navigateTabs: app.navigateTabs.bind(app),
toggleModule: app.toggleModule.bind(app),
};
app.init();
});
