@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.cjs CHANGED
@@ -28682,7 +28682,7 @@ const templates = [
28682
28682
  preview: "bg-gradient-to-br from-orange-50 to-red-50"
28683
28683
  }
28684
28684
  ];
28685
- const Dashboard = () => {
28685
+ const Dashboard = ({ clientId }) => {
28686
28686
  const navigate = reactRouterDom.useNavigate();
28687
28687
  const [templateIds, setTemplateId] = React.useState([]);
28688
28688
  const handleTemplateClick = (templateId) => {
@@ -28692,10 +28692,11 @@ const Dashboard = () => {
28692
28692
  };
28693
28693
  const handleNavigation = () => {
28694
28694
  const templateParam = templateIds.join(",");
28695
- navigate(`./view-report?template=${templateParam}`);
28695
+ navigate(`/clients/${clientId}/view-report?template=${templateParam}`);
28696
28696
  };
28697
28697
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white rounded-xl border border-slate-200 shadow-sm p-6 mb-8", children: [
28698
28698
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-semibold text-slate-900 mb-6", children: "Choose Your Report Template" }),
28699
+ false,
28699
28700
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6 ", children: templates.map((template) => {
28700
28701
  const getTemplateIcon = (id) => {
28701
28702
  switch (id) {
@@ -28743,7 +28744,7 @@ const Dashboard = () => {
28743
28744
  variant: "default",
28744
28745
  className: "mx-auto w-full max-w-80",
28745
28746
  onClick: () => handleNavigation(),
28746
- disabled: templateIds.length === 0,
28747
+ disabled: templateIds.length === 0 || !clientId,
28747
28748
  children: "Create Report"
28748
28749
  }
28749
28750
  ) })
@@ -30732,6 +30733,7 @@ const InsuranceHealthScore = ({ reportData }) => {
30732
30733
  ] })
30733
30734
  ] });
30734
30735
  };
30736
+ const Warning = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-center text-orange-600 text-lg", children });
30735
30737
  const ReportBuilder = ({
30736
30738
  clientData,
30737
30739
  assessmentData,
@@ -30749,12 +30751,18 @@ const ReportBuilder = ({
30749
30751
  const securityAssessment = assessmentData.securityAssessments;
30750
30752
  const insuranceHealthData = assessmentData.insuranceAssessment;
30751
30753
  const financialSimulationData = simulationData;
30754
+ const recommendationResponse = () => {
30755
+ const items = [
30756
+ showFinancialImpact && "financial impact modeling",
30757
+ showInsuranceHealthScore && "insurance readiness evaluations",
30758
+ showBreachLikelihood && "breach likelihood analysis"
30759
+ ].filter(Boolean);
30760
+ if (items.length === 0) return "";
30761
+ if (items.length === 1) return items[0];
30762
+ if (items.length === 2) return `${items[0]} and ${items[1]}`;
30763
+ return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`;
30764
+ };
30752
30765
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
30753
- !clientData.id && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-4xl mx-auto bg-white p-8 flex items-center justify-center min-h-[600px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center space-y-4", children: [
30754
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mx-auto", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "w-8 h-8 text-slate-400" }) }),
30755
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-semibold text-slate-700", children: "Please Select a Client" }),
30756
- /* @__PURE__ */ jsxRuntime.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." })
30757
- ] }) }),
30758
30766
  /* @__PURE__ */ jsxRuntime.jsx("nav", { children: /* @__PURE__ */ jsxRuntime.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) => {
30759
30767
  return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
30760
30768
  "a",
@@ -30799,7 +30807,7 @@ const ReportBuilder = ({
30799
30807
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-slate-900", children: (/* @__PURE__ */ new Date()).toLocaleDateString() })
30800
30808
  ] })
30801
30809
  ] }),
30802
- showFinancialImpact && /* @__PURE__ */ jsxRuntime.jsx(
30810
+ showFinancialImpact && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: financialSimulationData && Object.keys(financialSimulationData).length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
30803
30811
  FinancialImpact,
30804
30812
  {
30805
30813
  reportData: {
@@ -30808,22 +30816,26 @@ const ReportBuilder = ({
30808
30816
  mspInfo
30809
30817
  }
30810
30818
  }
30811
- ),
30812
- showBreachLikelihood && /* @__PURE__ */ jsxRuntime.jsx(
30819
+ ) : /* @__PURE__ */ jsxRuntime.jsx(Warning, { children: "We can't find any financial impact data, did you run an assessment?" }) }),
30820
+ showBreachLikelihood && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: securityAssessment && Object.keys(securityAssessment).length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
30813
30821
  BreachLikelihood,
30814
30822
  {
30815
30823
  reportData: { clientData, securityAssessment, mspInfo }
30816
30824
  }
30817
- ),
30818
- showInsuranceHealthScore && /* @__PURE__ */ jsxRuntime.jsx(
30825
+ ) : /* @__PURE__ */ jsxRuntime.jsx(Warning, { children: "We can't find breach likelihood assessment data, did you run one??" }) }),
30826
+ showInsuranceHealthScore && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: insuranceHealthData && Object.keys(insuranceHealthData).length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
30819
30827
  InsuranceHealthScore,
30820
30828
  {
30821
30829
  reportData: { clientData, insuranceHealthData, mspInfo }
30822
30830
  }
30823
- ),
30831
+ ) : /* @__PURE__ */ jsxRuntime.jsx(Warning, { children: "We can't find an insurance assessment. Are you sure you ran this assessment?" }) }),
30824
30832
  /* @__PURE__ */ jsxRuntime.jsxs("footer", { className: "report-page text-center pt-8 border-t border-slate-200", children: [
30825
30833
  /* @__PURE__ */ jsxRuntime.jsx("h4", { children: "Professional Recommendation" }),
30826
- /* @__PURE__ */ jsxRuntime.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." }),
30834
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-slate-500", children: [
30835
+ "This assessment uses ",
30836
+ recommendationResponse(),
30837
+ " to provide a complete view of your organization's cybersecurity risk profile."
30838
+ ] }),
30827
30839
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-slate-400 mt-2", children: [
30828
30840
  "Generated by",
30829
30841
  " ",