@threatcaptain/tc-reports 0.2.7 → 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
  ) })
@@ -28751,7 +28752,7 @@ const Dashboard = () => {
28751
28752
  };
28752
28753
  const BreachLikelihood = ({ reportData }) => {
28753
28754
  var _a;
28754
- const { clientData, securityAssessment, user } = reportData;
28755
+ const { clientData, securityAssessment, mspInfo } = reportData;
28755
28756
  const calculateBreachLikelihood = (protectionLevel) => {
28756
28757
  if ((securityAssessment == null ? void 0 : securityAssessment.overall_breach_likelihood) !== null && (securityAssessment == null ? void 0 : securityAssessment.overall_breach_likelihood) !== void 0) {
28757
28758
  return Math.round(securityAssessment.overall_breach_likelihood);
@@ -29282,7 +29283,14 @@ const BreachLikelihood = ({ reportData }) => {
29282
29283
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-lg mb-4", children: [
29283
29284
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Contact:" }),
29284
29285
  " ",
29285
- (user == null ? void 0 : user.email) || "contact@company.com"
29286
+ (mspInfo == null ? void 0 : mspInfo.contact_email) ? /* @__PURE__ */ jsxRuntime.jsx(
29287
+ "a",
29288
+ {
29289
+ href: `mailto:${mspInfo == null ? void 0 : mspInfo.contact_email}`,
29290
+ className: "underline",
29291
+ children: mspInfo == null ? void 0 : mspInfo.contact_email
29292
+ }
29293
+ ) : "contact@company.com"
29286
29294
  ] }),
29287
29295
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm opacity-80", children: "Every day you wait is another day criminals could strike. Every protection you add makes your business safer." })
29288
29296
  ] })
@@ -29611,7 +29619,7 @@ const UnifiedCostBreakdownChart = ({
29611
29619
  };
29612
29620
  const FinancialImpact = ({ reportData }) => {
29613
29621
  var _a;
29614
- const { clientData, simulationData, user } = reportData;
29622
+ const { clientData, simulationData, mspInfo } = reportData;
29615
29623
  const { industry } = clientData;
29616
29624
  const displayExecutiveSummary = () => {
29617
29625
  if (clientData.executiveSummary) return clientData.executiveSummary;
@@ -30034,7 +30042,7 @@ const FinancialImpact = ({ reportData }) => {
30034
30042
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-slate-600 mb-4", children: "Let's discuss these findings and develop a customized cybersecurity roadmap for your organization." }),
30035
30043
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-slate-600", children: [
30036
30044
  "Contact us at: ",
30037
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-slate-900", children: (user == null ? void 0 : user.email) || /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red", fontWeight: "bold" }, children: "NEEDS MSP EMAIL ADDRESS" }) })
30045
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-slate-900", children: (mspInfo == null ? void 0 : mspInfo.contact_email) ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: `mailto:${mspInfo == null ? void 0 : mspInfo.contact_email}`, className: "underline", children: mspInfo == null ? void 0 : mspInfo.contact_email }) : "contact@company.com" })
30038
30046
  ] })
30039
30047
  ] })
30040
30048
  ] }),
@@ -30725,12 +30733,12 @@ const InsuranceHealthScore = ({ reportData }) => {
30725
30733
  ] })
30726
30734
  ] });
30727
30735
  };
30736
+ const Warning = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-center text-orange-600 text-lg", children });
30728
30737
  const ReportBuilder = ({
30729
30738
  clientData,
30730
30739
  assessmentData,
30731
30740
  simulationData,
30732
- mspCompanyName,
30733
- user
30741
+ mspInfo
30734
30742
  }) => {
30735
30743
  const [searchParams] = reactRouterDom.useSearchParams();
30736
30744
  const reportTemplate = searchParams.get("template");
@@ -30743,12 +30751,18 @@ const ReportBuilder = ({
30743
30751
  const securityAssessment = assessmentData.securityAssessments;
30744
30752
  const insuranceHealthData = assessmentData.insuranceAssessment;
30745
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
+ };
30746
30765
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
30747
- !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: [
30748
- /* @__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" }) }),
30749
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-semibold text-slate-700", children: "Please Select a Client" }),
30750
- /* @__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." })
30751
- ] }) }),
30752
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) => {
30753
30767
  return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
30754
30768
  "a",
@@ -30767,10 +30781,10 @@ const ReportBuilder = ({
30767
30781
  id: "print-report",
30768
30782
  className: "report-wrapper max-w-4xl mx-auto bg-white p-8 space-y-8",
30769
30783
  children: [
30770
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto w-20 h-20 bg-slate-200 rounded-lg flex items-center justify-center", children: clientData.logo ? /* @__PURE__ */ jsxRuntime.jsx(
30784
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto w-20 h-20 bg-slate-200 rounded-lg flex items-center justify-center", children: mspInfo.company_logo ? /* @__PURE__ */ jsxRuntime.jsx(
30771
30785
  "img",
30772
30786
  {
30773
- src: clientData.logo,
30787
+ src: mspInfo.company_logo,
30774
30788
  alt: "MSP Logo",
30775
30789
  className: "w-full h-full object-contain rounded-lg"
30776
30790
  }
@@ -30786,42 +30800,46 @@ const ReportBuilder = ({
30786
30800
  ] }),
30787
30801
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
30788
30802
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-slate-700", children: "Prepared By:" }),
30789
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-slate-900", children: mspCompanyName || /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red", fontWeight: "bold" }, children: "NEEDS ACTUAL MSP NAME" }) })
30803
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-slate-900", children: mspInfo.company_name || /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red", fontWeight: "bold" }, children: "NEEDS ACTUAL MSP NAME" }) })
30790
30804
  ] }),
30791
30805
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
30792
30806
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-slate-700", children: "Assessment Date:" }),
30793
30807
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-slate-900", children: (/* @__PURE__ */ new Date()).toLocaleDateString() })
30794
30808
  ] })
30795
30809
  ] }),
30796
- showFinancialImpact && /* @__PURE__ */ jsxRuntime.jsx(
30810
+ showFinancialImpact && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: financialSimulationData && Object.keys(financialSimulationData).length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
30797
30811
  FinancialImpact,
30798
30812
  {
30799
30813
  reportData: {
30800
30814
  clientData,
30801
30815
  simulationData: financialSimulationData,
30802
- user
30816
+ mspInfo
30803
30817
  }
30804
30818
  }
30805
- ),
30806
- 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(
30807
30821
  BreachLikelihood,
30808
30822
  {
30809
- reportData: { clientData, securityAssessment, user }
30823
+ reportData: { clientData, securityAssessment, mspInfo }
30810
30824
  }
30811
- ),
30812
- 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(
30813
30827
  InsuranceHealthScore,
30814
30828
  {
30815
- reportData: { clientData, insuranceHealthData }
30829
+ reportData: { clientData, insuranceHealthData, mspInfo }
30816
30830
  }
30817
- ),
30831
+ ) : /* @__PURE__ */ jsxRuntime.jsx(Warning, { children: "We can't find an insurance assessment. Are you sure you ran this assessment?" }) }),
30818
30832
  /* @__PURE__ */ jsxRuntime.jsxs("footer", { className: "report-page text-center pt-8 border-t border-slate-200", children: [
30819
30833
  /* @__PURE__ */ jsxRuntime.jsx("h4", { children: "Professional Recommendation" }),
30820
- /* @__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
+ ] }),
30821
30839
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-slate-400 mt-2", children: [
30822
30840
  "Generated by",
30823
30841
  " ",
30824
- mspCompanyName ? mspCompanyName : /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red", fontWeight: "bold" }, children: "NEEDS ACTUAL MSP NAME" }),
30842
+ mspInfo.company_name ? mspInfo.company_name : /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "red", fontWeight: "bold" }, children: "NEEDS ACTUAL MSP NAME" }),
30825
30843
  " on ",
30826
30844
  (/* @__PURE__ */ new Date()).toLocaleDateString()
30827
30845
  ] })