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 | 1x 1x 1x 1x 1x 1x 1x 1x 37x 37x 37x 37x 37x 37x 37x 37x 29x 29x 29x 29x 29x 37x 37x 37x 37x 9x 9x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 111x 111x 27x 27x 111x 111x 37x 4x 4x 4x 4x 37x 29x 29x 29x 29x 29x 33x 4x 4x 4x 4x 4x 4x 4x 111x 37x 2x 2x 2x 2x 37x 32x 32x 32x 32x 32x 35x 3x 3x 3x 3x 3x 3x 3x 111x 37x 2x 2x 2x 2x 37x 30x 30x 30x 30x 30x 35x 5x 5x 5x 5x 5x 5x 5x 111x 111x 111x 111x 37x 37x 37x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 28x 37x 1x 37x 2x 37x 25x 37x 37x 37x 37x 37x 37x 37x 37x 37x 9x 9x 37x 37x 2x 37x 3x 37x 31x 37x 1x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 222x 222x 222x 222x 222x 222x 222x 222x 222x 222x 222x 222x 222x 222x 222x 222x 222x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 111x 111x 111x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 112x 112x 112x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 114x 114x 114x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 222x 222x 222x 222x 222x 222x 222x 1x | import React, { useMemo } from "react"; import { WIDGET_ICONS, WIDGET_TITLES } from "../../../constants/appConstants"; import { useCIAContentService } from "../../../hooks/useCIAContentService"; import { SecurityLevel } from "../../../types/cia"; import { isNullish } from "../../../utils/typeGuards"; import { calculateOverallSecurityLevel } from "../../../utils/securityLevelUtils"; import SecurityLevelIndicator from "../../common/SecurityLevelIndicator"; import WidgetContainer from "../../common/WidgetContainer"; /** * Props for ValueCreationWidget component */ export interface ValueCreationWidgetProps { /** * Selected availability level */ availabilityLevel: SecurityLevel; /** * Selected integrity level */ integrityLevel: SecurityLevel; /** * Selected confidentiality level */ confidentialityLevel: SecurityLevel; /** * Optional CSS class name */ className?: string; /** * Optional test ID for testing */ testId?: string; } /** * 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", }) => { // Get CIA content service for value creation data const { ciaContentService, error, isLoading } = useCIAContentService(); // Calculate overall security level const securityScore = useMemo(() => { return calculateOverallSecurityLevel( availabilityLevel, integrityLevel, confidentialityLevel ); }, [availabilityLevel, integrityLevel, confidentialityLevel]); // Get business value metrics with fallback implementation const valueMetrics = useMemo((): BusinessValueMetric[] => { try { if (!isNullish(ciaContentService)) { // Check if the service has getBusinessValueMetrics method if (typeof (ciaContentService as any).getBusinessValueMetrics === "function") { const metrics = (ciaContentService as any).getBusinessValueMetrics( availabilityLevel, integrityLevel, confidentialityLevel ); if (Array.isArray(metrics) && metrics.length > 0) { return metrics; } } } // Fallback metrics if service doesn't provide them return generateFallbackValueMetrics( availabilityLevel, integrityLevel, confidentialityLevel, securityScore ); } catch (err) { console.error("Error retrieving business value metrics:", err); return generateFallbackValueMetrics( availabilityLevel, integrityLevel, confidentialityLevel, securityScore ); } }, [ ciaContentService, availabilityLevel, integrityLevel, confidentialityLevel, securityScore, ]); // 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 if (typeof (ciaContentService as any).getComponentValueStatements === "function") { const statements = (ciaContentService as any).getComponentValueStatements( component, level ); if (Array.isArray(statements) && statements.length > 0) { return statements; } } } // Fallback value statements switch (component) { case "availability": if (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": if (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": if (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 { if (!isNullish(ciaContentService)) { // Check if the service has getROIEstimate method if (typeof (ciaContentService as any).getROIEstimate === "function") { const roi = (ciaContentService as any).getROIEstimate( availabilityLevel, integrityLevel, confidentialityLevel ); if (!isNullish(roi)) { return roi; } } } // Fallback ROI based on security score switch (securityScore) { case "None": return { value: "0%", description: "No measurable return on investment" }; case "Low": return { value: "50-100%", description: "Basic return, primarily through risk avoidance" }; case "Moderate": return { value: "150-200%", description: "Balanced return through operational improvements and risk reduction" }; case "High": return { value: "200-300%", description: "Strong return through business enablement and risk management" }; case "Very High": return { value: "300-500%", description: "Premium return through competitive advantage and comprehensive protection" }; default: return { value: "Unknown", description: "Unable to calculate ROI" }; } } 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 (typeof (ciaContentService as any).getBusinessValueSummary === "function") { const summary = (ciaContentService as any).getBusinessValueSummary( availabilityLevel, integrityLevel, confidentialityLevel ); if (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, ]); return ( <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-4"> {/* Overview section */} <div className="mb-6"> <div className="p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg mb-4"> <p className="text-sm" data-testid="value-creation-summary"> {getBusinessValueSummary()} </p> </div> <div className="flex justify-between items-center mb-4"> <h3 className="text-lg font-medium">Overall Value Profile</h3> <div className="flex items-center"> <span className="mr-2 text-sm text-gray-600 dark:text-gray-400"> Security Level: </span> <SecurityLevelIndicator level={securityScore} size="md" /> </div> </div> {/* ROI estimate */} <div className="p-4 bg-green-50 dark:bg-green-900 dark:bg-opacity-20 rounded-lg mb-4"> <div className="flex items-center justify-between"> <div> <h4 className="font-medium text-green-700 dark:text-green-300"> Estimated Return on Investment </h4> <p className="text-sm text-green-600 dark:text-green-400 mt-1"> {roiEstimate.description} </p> </div> <div className="text-2xl font-bold text-green-600 dark:text-green-400" data-testid="roi-value"> {roiEstimate.value} </div> </div> </div> {/* Business value metrics grid */} <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4" data-testid="value-metrics-grid"> {valueMetrics.map((metric, index) => ( <div key={index} className="p-3 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700" data-testid={`value-metric-${index}`} > <div className="flex items-center mb-2"> <span className="text-xl mr-2 text-blue-500"> {metric.icon || "📈"} </span> <h4 className="font-medium">{metric.category}</h4> </div> <div className="text-lg font-bold text-blue-600 dark:text-blue-400 mb-1"> {metric.value} </div> <p className="text-sm text-gray-600 dark:text-gray-400"> {metric.description} </p> </div> ))} </div> </div> {/* Component-specific value sections */} <div className="mb-6"> <h3 className="text-lg font-medium mb-4">Component Business Value</h3> {/* Availability value */} <div className="mb-4 p-3 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded-lg" data-testid="availability-value-section"> <div className="flex items-center mb-2"> <span className="text-xl mr-2">⏱️</span> <h4 className="font-medium">Availability Value ({availabilityLevel})</h4> </div> <ul className="list-disc list-inside pl-2 text-sm text-gray-600 dark:text-gray-400"> {getComponentValueStatements("availability", availabilityLevel).map((statement, index) => ( <li key={index} className="mb-1" data-testid={`availability-value-item-${index}`}> {statement} </li> ))} </ul> </div> {/* Integrity value */} <div className="mb-4 p-3 bg-green-50 dark:bg-green-900 dark:bg-opacity-20 rounded-lg" data-testid="integrity-value-section"> <div className="flex items-center mb-2"> <span className="text-xl mr-2">✓</span> <h4 className="font-medium">Integrity Value ({integrityLevel})</h4> </div> <ul className="list-disc list-inside pl-2 text-sm text-gray-600 dark:text-gray-400"> {getComponentValueStatements("integrity", integrityLevel).map((statement, index) => ( <li key={index} className="mb-1" data-testid={`integrity-value-item-${index}`}> {statement} </li> ))} </ul> </div> {/* Confidentiality value */} <div className="p-3 bg-purple-50 dark:bg-purple-900 dark:bg-opacity-20 rounded-lg" data-testid="confidentiality-value-section"> <div className="flex items-center mb-2"> <span className="text-xl mr-2">🔒</span> <h4 className="font-medium">Confidentiality Value ({confidentialityLevel})</h4> </div> <ul className="list-disc list-inside pl-2 text-sm text-gray-600 dark:text-gray-400"> {getComponentValueStatements("confidentiality", confidentialityLevel).map((statement, index) => ( <li key={index} className="mb-1" data-testid={`confidentiality-value-item-${index}`}> {statement} </li> ))} </ul> </div> </div> {/* Business case section */} <div> <h3 className="text-lg font-medium mb-3">Security Investment Business Case</h3> <div className="p-3 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700"> <p className="text-sm text-gray-600 dark:text-gray-400 mb-3"> Use these value statements to build your business case for security investments: </p> <div className="space-y-3"> <div className="p-2 bg-blue-50 dark:bg-blue-900 dark:bg-opacity-20 rounded"> <h5 className="text-sm font-medium mb-1">Executive Summary</h5> <p className="text-sm"> Our {securityScore.toLowerCase()} security investment strategy delivers business value through improved operational reliability, data integrity, and information protection. </p> </div> <div className="p-2 bg-green-50 dark:bg-green-900 dark:bg-opacity-20 rounded"> <h5 className="text-sm font-medium mb-1">Financial Value</h5> <p className="text-sm"> 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-2 bg-purple-50 dark:bg-purple-900 dark:bg-opacity-20 rounded"> <h5 className="text-sm font-medium mb-1">Strategic Value</h5> <p className="text-sm"> 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> </div> </WidgetContainer> ); }; // Helper function to generate fallback value metrics function generateFallbackValueMetrics( availabilityLevel: SecurityLevel, integrityLevel: SecurityLevel, confidentialityLevel: SecurityLevel, overallLevel: SecurityLevel ): BusinessValueMetric[] { // Map security levels to numeric scores const levelScores: Record<SecurityLevel, number> = { None: 0, Low: 1, Moderate: 2, High: 3, "Very High": 4, }; // Calculate average score const avgScore = (levelScores[availabilityLevel] + levelScores[integrityLevel] + levelScores[confidentialityLevel]) / 3; // Generate appropriate metrics based on the average score return [ { category: "Trust Enhancement", value: getPercentageValue(avgScore, 95), description: "Increased customer and partner trust in your business", icon: "🤝", }, { category: "Operational Efficiency", value: getPercentageValue(avgScore, 40), description: "Improved operational efficiency through reliable systems", icon: "⚙️", }, { category: "Innovation Enablement", value: getPercentageValue(avgScore, 70), description: "Enhanced ability to launch new digital initiatives", icon: "💡", }, { category: "Decision Quality", value: getPercentageValue(avgScore, 60), description: "Better business decisions through reliable data", icon: "📊", }, { category: "Competitive Advantage", value: getPercentageValue(avgScore, 50), description: "Market differentiation through security capabilities", icon: "🏆", }, { category: "Risk Reduction", value: getPercentageValue(avgScore, 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; |