All files / src/components/widgets/businessvalue ValueCreationWidget.tsx

69.23% Statements 72/104
67.3% Branches 70/104
81.81% Functions 18/22
69.23% Lines 72/104

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589                                                                      2x               2x     46x     46x   46x               20x   20x   20x   46x   46x   46x   20x   1x         16x 1x   1x       46x   46x   20x   1x         1x 20x 1x   20x 46x           19x                             38x                                             46x   6x   6x 6x                         2x 2x           2x                           2x 2x           2x                           2x 2x           2x                                     6x               46x         38x 38x               38x         46x           4x                             4x                         4x                       46x 46x     46x                                                                                               46x   46x 46x 46x                                         4x                                             46x   46x 46x 46x                                                   2x                             2x                             2x                       46x   46x 46x 46x                                                                                                     46x             38x                                                                                   38x       38x        
import React, { useMemo } from "react";
import { WIDGET_ICONS, WIDGET_TITLES, UI_DISPLAY_LIMITS } from "../../../constants/appConstants";
import { VALUE_CREATION_WIDGET_IDS } from "../../../constants/testIds";
import { useCIAContentService } from "../../../hooks/useCIAContentService";
import { SecurityLevel } from "../../../types/cia";
import { ValueCreationWidgetProps } from "../../../types/widget-props";
import { calculateROIEstimate } from "../../../utils/businessValueUtils";
import { calculateBusinessImpactLevel } from "../../../utils/riskUtils";
import { hasMethod, isNullish } from "../../../utils/typeGuards";
import { getWidgetAriaDescription } from "../../../utils/accessibility";
import { WidgetClasses, cn } from "../../../utils/tailwindClassHelpers";
import SecurityLevelIndicator from "../../common/SecurityLevelIndicator";
import WidgetContainer from "../../common/WidgetContainer";
import WidgetErrorBoundary from "../../common/WidgetErrorBoundary";
 
/**
 * Interface for business value metric
 */
interface BusinessValueMetric {
  category: string;
  value: string;
  description: string;
  icon?: string;
}
 
/**
 * Display value creation information for chosen security levels
 *
 * ## Business Perspective
 *
 * This widget helps stakeholders understand the business value created
 * by security investments, articulating benefits beyond just risk reduction.
 * It provides clear value statements that can be used in business cases and
 * executive communications. 💰
 */
const ValueCreationWidget: React.FC<ValueCreationWidgetProps> = ({
  availabilityLevel,
  integrityLevel,
  confidentialityLevel,
  className = "",
  testId = VALUE_CREATION_WIDGET_IDS.root,
}) => {
  // Get CIA content service for value creation data
  const { ciaContentService, error, isLoading } = useCIAContentService();
 
  // State for collapsible sections - start collapsed for compact design
  const [expandedSection, setExpandedSection] = React.useState<string | null>(null);
 
  // Calculate overall security level
  const securityScore = useMemo(() => {
    // Use riskUtils instead of local calculation
    return calculateBusinessImpactLevel(
      availabilityLevel,
      integrityLevel,
      confidentialityLevel
    );
  }, [availabilityLevel, integrityLevel, confidentialityLevel]);
 
  // Convert security score to SecurityLevel for component compatibility
  const securityScoreAsLevel = useMemo((): SecurityLevel => {
    // Convert the string returned by calculateBusinessImpactLevel to SecurityLevel type
    switch (securityScore) {
      case "Minimal":
        return "None";
      case "Low":
        return "Low";
      case "Moderate":
        return "Moderate";
      case "High":
        return "High";
      case "Very High":
        return "Very High";
      default:
        return "Moderate"; // Default fallback
    }
  }, [securityScore]);
 
  // Create a numeric impact level for percentage calculations
  const impactLevelNumeric = useMemo((): number => {
    switch (securityScore) {
      case "Minimal":
        return 1;
      case "Low":
        return 2;
      case "Moderate":
        return 3;
      case "High":
        return 4;
      case "Very High":
        return 5;
      default:
        return 3; // Default fallback
    }
  }, [securityScore]);
 
  // Get business value metrics with fallback implementation
  const valueMetrics = useMemo((): BusinessValueMetric[] => {
    try {
      Eif (!isNullish(ciaContentService)) {
        // Check if the service has getBusinessValueMetrics method
        if (hasMethod(ciaContentService, "getBusinessValueMetrics")) {
          const metrics = ciaContentService.getBusinessValueMetrics(
            availabilityLevel,
            integrityLevel,
            confidentialityLevel
          );
 
          Iif (Array.isArray(metrics) && metrics.length > 0) {
            return metrics;
          }
        }
      }
 
      // Fallback metrics if service doesn't provide them
      return generateFallbackValueMetrics(
        availabilityLevel,
        integrityLevel,
        confidentialityLevel,
        impactLevelNumeric
      );
    } catch (err) {
      console.error("Error retrieving business value metrics:", err);
      return generateFallbackValueMetrics(
        availabilityLevel,
        integrityLevel,
        confidentialityLevel,
        impactLevelNumeric
      );
    }
  }, [
    ciaContentService,
    availabilityLevel,
    integrityLevel,
    confidentialityLevel,
    impactLevelNumeric,
  ]);
 
  // Get component-specific value statements
  const getComponentValueStatements = (
    component: "availability" | "integrity" | "confidentiality",
    level: SecurityLevel
  ): string[] => {
    try {
      if (!isNullish(ciaContentService)) {
        // Check if the service has getComponentValueStatements method
        Eif (hasMethod(ciaContentService, "getComponentValueStatements")) {
          const statements =
            ciaContentService.getComponentValueStatements(component, level);
 
          Eif (Array.isArray(statements) && statements.length > 0) {
            return statements;
          }
        }
      }
 
      // Fallback value statements
      switch (component) {
        case "availability":
          Iif (level === "None" || level === "Low") {
            return [
              "Basic operational continuity",
              "Minimal protection against service disruptions",
            ];
          } else if (level === "Moderate") {
            return [
              "Predictable system access and reliable operations",
              "Improved user satisfaction through consistent service delivery",
              "Enhanced operational efficiency with reduced downtime",
            ];
          } else {
            return [
              "Near-continuous operations even during adverse events",
              "Competitive advantage through superior service reliability",
              "Protected revenue streams with minimal service interruptions",
              "Maintained customer trust through consistent service delivery",
            ];
          }
 
        case "integrity":
          Iif (level === "None" || level === "Low") {
            return [
              "Basic data consistency",
              "Minimal protection against data errors",
            ];
          } else if (level === "Moderate") {
            return [
              "Trustworthy data for operational and strategic decisions",
              "Reduced costs from data errors and reconciliation efforts",
              "Improved compliance posture with accurate record-keeping",
            ];
          } else {
            return [
              "Data you can stake your business reputation on",
              "Enhanced business intelligence through high-quality data",
              "Reduced fraud risk with validated transactions",
              "Defensible audit trail for regulatory scrutiny",
            ];
          }
 
        case "confidentiality":
          Iif (level === "None" || level === "Low") {
            return [
              "Basic information protection",
              "Minimal safeguards for sensitive data",
            ];
          } else if (level === "Moderate") {
            return [
              "Protected intellectual property and business secrets",
              "Reduced risk of data breaches and associated costs",
              "Enhanced customer and partner trust in data handling",
            ];
          } else {
            return [
              "Secured competitive advantage through protected innovations",
              "Strengthened customer trust with demonstrable privacy controls",
              "Reputation as a secure business partner",
              "Reduced breach-related costs and regulatory penalties",
            ];
          }
 
        default:
          return ["No value statements available"];
      }
    } catch (err) {
      console.error(`Error retrieving ${component} value statements:`, err);
      return [`Unable to retrieve ${component} value statements`];
    }
  };
 
  // Get ROI estimates based on security levels
  const getROIEstimate = (): { value: string; description: string } => {
    try {
      // Use the centralized utility function for consistent ROI calculation
      const roiEstimate = calculateROIEstimate(
        availabilityLevel,
        integrityLevel,
        confidentialityLevel
      );
 
      return {
        value: roiEstimate.value ?? "Unable to calculate", // Ensure value is a string
        description: roiEstimate.description,
      };
    } catch (err) {
      console.error("Error calculating ROI estimate:", err);
      return {
        value: "Unable to calculate",
        description: "ROI estimation error",
      };
    }
  };
 
  // Get the business value summary text
  const getBusinessValueSummary = (): string => {
    try {
      if (!isNullish(ciaContentService)) {
        // Check if the service has getBusinessValueSummary method
        if (hasMethod(ciaContentService, "getBusinessValueSummary")) {
          const summary = ciaContentService.getBusinessValueSummary(
            availabilityLevel,
            integrityLevel,
            confidentialityLevel
          );
 
          Iif (typeof summary === "string" && summary) {
            return summary;
          }
        }
      }
 
      // Fallback summary based on security score
      switch (securityScore) {
        case "None":
          return "Minimal security investments provide basic operational capabilities but limited business value.";
        case "Low":
          return "Basic security controls enable fundamental business operations with modest protection against common threats.";
        case "Moderate":
          return "Balanced security investments deliver operational stability, data reliability, and reasonable protection that enable business growth.";
        case "High":
          return "Strategic security investments create significant business value through enhanced reliability, data integrity, and protected information assets.";
        case "Very High":
          return "Premium security investments establish market-leading capabilities and competitive advantages through exceptional reliability, data quality, and information protection.";
        default:
          return "Security investments can deliver business value through improved operations, enhanced decision-making, and protected information assets.";
      }
    } catch (err) {
      console.error("Error generating business value summary:", err);
      return "Security investments can deliver business value beyond just risk reduction.";
    }
  };
 
  // Get the ROI estimate
  const roiEstimate = useMemo(
    () => getROIEstimate(),
    [
      ciaContentService,
      availabilityLevel,
      integrityLevel,
      confidentialityLevel,
      securityScore,
    ]
  );
 
  // Toggle section expansion
  const toggleSection = (section: string): void => {
    setExpandedSection(expandedSection === section ? null : section);
  };
 
  return (
    <WidgetErrorBoundary widgetName="Value Creation">
      <WidgetContainer
        title={WIDGET_TITLES.VALUE_CREATION || "Business Value Creation"}
        icon={WIDGET_ICONS.VALUE_CREATION || "💰"}
        className={className}
        testId={testId}
        isLoading={isLoading}
        error={error}
      >
      <div 
        className="p-md"
        role="region"
        aria-label={getWidgetAriaDescription(
          "Business Value Creation",
          "Business value and return on investment created by security investments"
        )}
      >
        {/* Summary cards at top - Compact 3-column grid (responsive) */}
        <section className="grid grid-cols-1 sm:grid-cols-3 gap-sm mb-md" aria-label="Summary metrics">
          <div className="p-sm bg-success-light/10 dark:bg-success-dark/20 rounded-md border border-success-light/30 dark:border-success-dark/30">
            <div className="text-caption text-success-dark dark:text-success-light font-medium mb-xs">ROI</div>
            <div className="text-heading font-bold text-success-dark dark:text-success-light" data-testid={VALUE_CREATION_WIDGET_IDS.value('roi')}>
              {roiEstimate.value}
            </div>
            <div className="text-caption text-success-dark/70 dark:text-success-light/70">{roiEstimate.description}</div>
          </div>
          <div className="p-sm bg-info-light/10 dark:bg-info-dark/20 rounded-md border border-info-light/30 dark:border-info-dark/30">
            <div className="text-caption text-info-dark dark:text-info-light font-medium mb-xs">Security Level</div>
            <div className="flex items-center">
              <SecurityLevelIndicator level={securityScoreAsLevel} size="sm" />
              <span className="text-body-lg font-bold text-info-dark dark:text-info-light ml-xs">{securityScore}</span>
            </div>
          </div>
          <div className="p-sm bg-primary-light/10 dark:bg-primary-dark/20 rounded-md border border-primary-light/30 dark:border-primary-dark/30">
            <div className="text-caption text-primary-dark dark:text-primary-light font-medium mb-xs">Value Metrics</div>
            <div className="text-heading font-bold text-primary-dark dark:text-primary-light">
              {valueMetrics.length}
            </div>
            <div className="text-caption text-primary-dark/70 dark:text-primary-light/70">Categories</div>
          </div>
        </section>
 
        {/* Collapsible sections */}
        {/* Value Overview */}
        <div className="mb-sm">
          <button
            type="button"
            onClick={() => toggleSection("summary")}
            onKeyDown={(e) => {
              Eif (e.key === 'Enter' || e.key === ' ') {
                e.preventDefault();
                toggleSection("summary");
              }
            }}
            className="w-full p-sm bg-neutral-light/5 dark:bg-neutral-dark/10 rounded-md border border-neutral-light/20 dark:border-neutral-dark/20 flex justify-between items-center hover:bg-neutral-light/10 dark:hover:bg-neutral-dark/15 transition-colors"
            aria-expanded={expandedSection === "summary"}
            aria-controls="value-overview-content"
            aria-label="Toggle Value Overview section"
          >
            <span className="text-body-lg font-medium"><span aria-hidden="true">📊</span> Value Overview</span>
            <span className="text-body" aria-hidden="true">{expandedSection === "summary" ? "▼" : "▶"}</span>
          </button>
          {expandedSection === "summary" && (
            <div
              id="value-overview-content"
              className="p-sm mt-xs bg-info-light/5 dark:bg-info-dark/10 rounded-md border border-info-light/20 dark:border-info-dark/20"
            >
              <p className="text-body text-neutral-dark dark:text-neutral-light mb-sm" data-testid={VALUE_CREATION_WIDGET_IDS.label('summary')}>
                {getBusinessValueSummary()}
              </p>
              <div className="grid grid-cols-1 sm:grid-cols-2 gap-xs">
                {valueMetrics.slice(0, UI_DISPLAY_LIMITS.MAX_PREVIEW_METRICS).map((metric, index) => (
                  <div key={index} className="p-xs bg-white/50 dark:bg-gray-800/50 rounded">
                    <div className="flex items-center mb-xs">
                      <span className="mr-xs" aria-hidden="true">{metric.icon || "📈"}</span>
                      <span className="text-caption font-medium">{metric.category}</span>
                    </div>
                    <div className="text-body font-bold text-info-dark dark:text-info-light">{metric.value}</div>
                  </div>
                ))}
              </div>
              {valueMetrics.length > UI_DISPLAY_LIMITS.MAX_PREVIEW_METRICS && (
                <div className="text-caption text-neutral-dark/70 dark:text-neutral-light/70 mt-xs text-center">
                  + {valueMetrics.length - UI_DISPLAY_LIMITS.MAX_PREVIEW_METRICS} more metric
                  {valueMetrics.length - UI_DISPLAY_LIMITS.MAX_PREVIEW_METRICS !== 1 ? "s" : ""}
                </div>
              )}
            </div>
          )}
        </div>
 
        {/* Component Value - Collapsible */}
        <div className="mb-sm">
          <button
            type="button"
            onClick={() => toggleSection("components")}
            onKeyDown={(e) => {
              Eif (e.key === 'Enter' || e.key === ' ') {
                e.preventDefault();
                toggleSection("components");
              }
            }}
            className="w-full p-sm bg-neutral-light/5 dark:bg-neutral-dark/10 rounded-md border border-neutral-light/20 dark:border-neutral-dark/20 flex justify-between items-center hover:bg-neutral-light/10 dark:hover:bg-neutral-dark/15 transition-colors"
            aria-expanded={expandedSection === "components"}
            aria-controls="component-value-content"
            aria-label="Toggle Component Business Value section"
          >
            <span className="text-body-lg font-medium"><span aria-hidden="true">🔒</span> Component Business Value</span>
            <span className="text-body" aria-hidden="true">{expandedSection === "components" ? "▼" : "▶"}</span>
          </button>
          {expandedSection === "components" && (
            <div
              id="component-value-content"
              className="p-sm mt-xs bg-neutral-light/5 dark:bg-neutral-dark/10 rounded-md border border-neutral-light/20 dark:border-neutral-dark/20 space-y-sm"
            >
              {/* Confidentiality */}
              <div className="p-xs bg-primary-light/10 dark:bg-primary-dark/20 rounded">
                <div className="flex items-center mb-xs">
                  <span className="mr-xs" aria-hidden="true">🔒</span>
                  <span className="text-body font-medium text-primary-dark dark:text-primary-light">
                    Confidentiality ({confidentialityLevel})
                  </span>
                </div>
                <ul className="text-caption text-neutral-dark dark:text-neutral-light space-y-xs pl-sm">
                  {getComponentValueStatements("confidentiality", confidentialityLevel).map((statement, index) => (
                    <li key={index} data-testid={`confidentiality-value-item-${index}`}>• {statement}</li>
                  ))}
                </ul>
              </div>
 
              {/* Integrity */}
              <div className="p-xs bg-success-light/10 dark:bg-success-dark/20 rounded">
                <div className="flex items-center mb-xs">
                  <span className="mr-xs" aria-hidden="true">✓</span>
                  <span className="text-body font-medium text-success-dark dark:text-success-light">
                    Integrity ({integrityLevel})
                  </span>
                </div>
                <ul className="text-caption text-neutral-dark dark:text-neutral-light space-y-xs pl-sm">
                  {getComponentValueStatements("integrity", integrityLevel).map((statement, index) => (
                    <li key={index} data-testid={`integrity-value-item-${index}`}>• {statement}</li>
                  ))}
                </ul>
              </div>
 
              {/* Availability */}
              <div className="p-xs bg-info-light/10 dark:bg-info-dark/20 rounded">
                <div className="flex items-center mb-xs">
                  <span className="mr-xs" aria-hidden="true">⏱️</span>
                  <span className="text-body font-medium text-info-dark dark:text-info-light">
                    Availability ({availabilityLevel})
                  </span>
                </div>
                <ul className="text-caption text-neutral-dark dark:text-neutral-light space-y-xs pl-sm">
                  {getComponentValueStatements("availability", availabilityLevel).map((statement, index) => (
                    <li key={index} data-testid={`availability-value-item-${index}`}>• {statement}</li>
                  ))}
                </ul>
              </div>
            </div>
          )}
        </div>
 
        {/* Business Case - Collapsible */}
        <div className="mb-sm">
          <button
            type="button"
            onClick={() => toggleSection("business-case")}
            onKeyDown={(e) => {
              Eif (e.key === 'Enter' || e.key === ' ') {
                e.preventDefault();
                toggleSection("business-case");
              }
            }}
            className="w-full p-sm bg-neutral-light/5 dark:bg-neutral-dark/10 rounded-md border border-neutral-light/20 dark:border-neutral-dark/20 flex justify-between items-center hover:bg-neutral-light/10 dark:hover:bg-neutral-dark/15 transition-colors"
            aria-expanded={expandedSection === "business-case"}
            aria-controls="business-case-content"
            aria-label="Toggle Investment Business Case section"
          >
            <span className="text-body-lg font-medium"><span aria-hidden="true">💼</span> Investment Business Case</span>
            <span className="text-body" aria-hidden="true">{expandedSection === "business-case" ? "▼" : "▶"}</span>
          </button>
          {expandedSection === "business-case" && (
            <div
              id="business-case-content"
              className="p-sm mt-xs bg-neutral-light/5 dark:bg-neutral-dark/10 rounded-md border border-neutral-light/20 dark:border-neutral-dark/20 space-y-xs"
            >
              <div className="p-xs bg-info-light/10 dark:bg-info-dark/20 rounded">
                <h5 className="text-caption font-medium mb-xs">Executive Summary</h5>
                <p className="text-caption">
                  Our {securityScore.toLowerCase()} security investment strategy delivers business value through improved operational reliability, data integrity, and information protection.
                </p>
              </div>
              <div className="p-xs bg-success-light/10 dark:bg-success-dark/20 rounded">
                <h5 className="text-caption font-medium mb-xs">Financial Value</h5>
                <p className="text-caption">
                  With an estimated ROI of {roiEstimate.value}, our security investments provide strong financial returns through risk reduction, operational improvements, and business enablement.
                </p>
              </div>
              <div className="p-xs bg-primary-light/10 dark:bg-primary-dark/20 rounded">
                <h5 className="text-caption font-medium mb-xs">Strategic Value</h5>
                <p className="text-caption">
                  Beyond direct financial returns, our security program creates strategic value by enabling digital initiatives, protecting our brand, and building customer trust.
                </p>
              </div>
            </div>
          )}
        </div>
      </div>
    </WidgetContainer>
    </WidgetErrorBoundary>
  );
};
 
// Helper function to generate fallback value metrics - refactored to use riskUtils
function generateFallbackValueMetrics(
  availabilityLevel: SecurityLevel,
  integrityLevel: SecurityLevel,
  confidentialityLevel: SecurityLevel,
  overallLevel: number
): BusinessValueMetric[] {
  // Import calculateBusinessImpactLevel from riskUtils instead of recalculating here
  const impactLevel = calculateBusinessImpactLevel(
    availabilityLevel,
    integrityLevel,
    confidentialityLevel
  );
 
  // Use the impact level to generate appropriate metrics
  return [
    {
      category: "Trust Enhancement",
      value: getPercentageValue(overallLevel, 95),
      description: "Increased customer and partner trust in your business",
      icon: "🤝",
    },
    {
      category: "Operational Efficiency",
      value: getPercentageValue(overallLevel, 40),
      description: "Improved operational efficiency through reliable systems",
      icon: "⚙️",
    },
    {
      category: "Innovation Enablement",
      value: getPercentageValue(overallLevel, 70),
      description: "Enhanced ability to launch new digital initiatives",
      icon: "💡",
    },
    {
      category: "Decision Quality",
      value: getPercentageValue(overallLevel, 60),
      description: "Better business decisions through reliable data",
      icon: "📊",
    },
    {
      category: "Competitive Advantage",
      value: getPercentageValue(overallLevel, 50),
      description: "Market differentiation through security capabilities",
      icon: "🏆",
    },
    {
      category: "Risk Reduction",
      value: getPercentageValue(overallLevel, 80),
      description: "Reduced likelihood of business disruptions",
      icon: "🛡️",
    },
  ];
}
 
// Helper to generate a reasonable percentage based on security score
function getPercentageValue(score: number, baseValue: number): string {
  const percentage = Math.min(
    95,
    Math.max(5, Math.round(baseValue * (0.3 + score * 0.2)))
  );
  return `${percentage}%`;
}
 
export default ValueCreationWidget;