@threatcaptain/tc-reports 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -28664,7 +28664,7 @@ const templates = [
28664
28664
  preview: "bg-gradient-to-br from-orange-50 to-red-50"
28665
28665
  }
28666
28666
  ];
28667
- const Dashboard = () => {
28667
+ const Dashboard = ({ clientId }) => {
28668
28668
  const navigate = useNavigate();
28669
28669
  const [templateIds, setTemplateId] = useState([]);
28670
28670
  const handleTemplateClick = (templateId) => {
@@ -28674,10 +28674,11 @@ const Dashboard = () => {
28674
28674
  };
28675
28675
  const handleNavigation = () => {
28676
28676
  const templateParam = templateIds.join(",");
28677
- navigate(`./view-report?template=${templateParam}`);
28677
+ navigate(`/clients/${clientId}/view-report?template=${templateParam}`);
28678
28678
  };
28679
28679
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl border border-slate-200 shadow-sm p-6 mb-8", children: [
28680
28680
  /* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-slate-900 mb-6", children: "Choose Your Report Template" }),
28681
+ false,
28681
28682
  /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6 ", children: templates.map((template) => {
28682
28683
  const getTemplateIcon = (id) => {
28683
28684
  switch (id) {
@@ -28725,7 +28726,7 @@ const Dashboard = () => {
28725
28726
  variant: "default",
28726
28727
  className: "mx-auto w-full max-w-80",
28727
28728
  onClick: () => handleNavigation(),
28728
- disabled: templateIds.length === 0,
28729
+ disabled: templateIds.length === 0 || !clientId,
28729
28730
  children: "Create Report"
28730
28731
  }
28731
28732
  ) })
@@ -30714,6 +30715,7 @@ const InsuranceHealthScore = ({ reportData }) => {
30714
30715
  ] })
30715
30716
  ] });
30716
30717
  };
30718
+ const Warning = ({ children }) => /* @__PURE__ */ jsx("h4", { className: "text-center text-orange-600 text-lg", children });
30717
30719
  const ReportBuilder = ({
30718
30720
  clientData,
30719
30721
  assessmentData,
@@ -30731,12 +30733,18 @@ const ReportBuilder = ({
30731
30733
  const securityAssessment = assessmentData.securityAssessments;
30732
30734
  const insuranceHealthData = assessmentData.insuranceAssessment;
30733
30735
  const financialSimulationData = simulationData;
30736
+ const recommendationResponse = () => {
30737
+ const items = [
30738
+ showFinancialImpact && "financial impact modeling",
30739
+ showInsuranceHealthScore && "insurance readiness evaluations",
30740
+ showBreachLikelihood && "breach likelihood analysis"
30741
+ ].filter(Boolean);
30742
+ if (items.length === 0) return "";
30743
+ if (items.length === 1) return items[0];
30744
+ if (items.length === 2) return `${items[0]} and ${items[1]}`;
30745
+ return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`;
30746
+ };
30734
30747
  return /* @__PURE__ */ jsxs(Fragment, { children: [
30735
- !clientData.id && /* @__PURE__ */ jsx("div", { className: "max-w-4xl mx-auto bg-white p-8 flex items-center justify-center min-h-[600px]", children: /* @__PURE__ */ jsxs("div", { className: "text-center space-y-4", children: [
30736
- /* @__PURE__ */ jsx("div", { className: "w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mx-auto", children: /* @__PURE__ */ jsx(FileText, { className: "w-8 h-8 text-slate-400" }) }),
30737
- /* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold text-slate-700", children: "Please Select a Client" }),
30738
- /* @__PURE__ */ jsx("p", { className: "text-slate-500 max-w-md", children: "Choose a client from the dropdown above to generate and preview their cyber financial impact analysis report." })
30739
- ] }) }),
30740
30748
  /* @__PURE__ */ jsx("nav", { children: /* @__PURE__ */ jsx("ul", { className: "report-toc max-w-4xl mx-auto bg-white p-4 flex space-x-4 overflow-x-auto", children: !!(templateArray.length > 1) && templateArray.map((item) => {
30741
30749
  return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
30742
30750
  "a",
@@ -30781,7 +30789,7 @@ const ReportBuilder = ({
30781
30789
  /* @__PURE__ */ jsx("span", { className: "text-slate-900", children: (/* @__PURE__ */ new Date()).toLocaleDateString() })
30782
30790
  ] })
30783
30791
  ] }),
30784
- showFinancialImpact && /* @__PURE__ */ jsx(
30792
+ showFinancialImpact && /* @__PURE__ */ jsx(Fragment, { children: financialSimulationData && Object.keys(financialSimulationData).length > 0 ? /* @__PURE__ */ jsx(
30785
30793
  FinancialImpact,
30786
30794
  {
30787
30795
  reportData: {
@@ -30790,22 +30798,26 @@ const ReportBuilder = ({
30790
30798
  mspInfo
30791
30799
  }
30792
30800
  }
30793
- ),
30794
- showBreachLikelihood && /* @__PURE__ */ jsx(
30801
+ ) : /* @__PURE__ */ jsx(Warning, { children: "We can't find any financial impact data, did you run an assessment?" }) }),
30802
+ showBreachLikelihood && /* @__PURE__ */ jsx(Fragment, { children: securityAssessment && Object.keys(securityAssessment).length > 0 ? /* @__PURE__ */ jsx(
30795
30803
  BreachLikelihood,
30796
30804
  {
30797
30805
  reportData: { clientData, securityAssessment, mspInfo }
30798
30806
  }
30799
- ),
30800
- showInsuranceHealthScore && /* @__PURE__ */ jsx(
30807
+ ) : /* @__PURE__ */ jsx(Warning, { children: "We can't find breach likelihood assessment data, did you run one??" }) }),
30808
+ showInsuranceHealthScore && /* @__PURE__ */ jsx(Fragment, { children: insuranceHealthData && Object.keys(insuranceHealthData).length > 0 ? /* @__PURE__ */ jsx(
30801
30809
  InsuranceHealthScore,
30802
30810
  {
30803
30811
  reportData: { clientData, insuranceHealthData, mspInfo }
30804
30812
  }
30805
- ),
30813
+ ) : /* @__PURE__ */ jsx(Warning, { children: "We can't find an insurance assessment. Are you sure you ran this assessment?" }) }),
30806
30814
  /* @__PURE__ */ jsxs("footer", { className: "report-page text-center pt-8 border-t border-slate-200", children: [
30807
30815
  /* @__PURE__ */ jsx("h4", { children: "Professional Recommendation" }),
30808
- /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500", children: "This assessment combines financial impact modeling, insurance readiness evaluation, and breach likelihood analysis to provide a complete view of your organization's cybersecurity risk profile." }),
30816
+ /* @__PURE__ */ jsxs("p", { className: "text-sm text-slate-500", children: [
30817
+ "This assessment uses ",
30818
+ recommendationResponse(),
30819
+ " to provide a complete view of your organization's cybersecurity risk profile."
30820
+ ] }),
30809
30821
  /* @__PURE__ */ jsxs("p", { className: "text-xs text-slate-400 mt-2", children: [
30810
30822
  "Generated by",
30811
30823
  " ",