@e-llm-studio/federated-dashboard-components 2.2.9-rca-test-13 → 2.2.9-rca-test-15
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/ExecutiveDashboard/ExecutiveDashboardWrapper.js +1 -1
- package/dist/ExecutiveDashboard/api/insightsApi.js +1 -1
- package/dist/ExecutiveDashboard/components/DashboardDateFilter/DashboardDateFilter.js +1 -1
- package/dist/ExecutiveDashboard/components/DashboardHeader/DashboardHeader.js +1 -1
- package/dist/ExecutiveDashboard/components/ExecutiveDashboard.js +1 -1
- package/dist/ExecutiveDashboard/components/Graph/LineChart.js +1 -1
- package/dist/ExecutiveDashboard/components/Graph/axisDomain.js +2 -0
- package/dist/ExecutiveDashboard/components/Graph/axisDomain.js.map +1 -0
- package/dist/ExecutiveDashboard/components/Insights/AgCharts.js +1 -1
- package/dist/ExecutiveDashboard/components/Insights/AgReport.js +1 -1
- package/dist/ExecutiveDashboard/components/Insights/DecisionAdvantageCard.js +1 -1
- package/dist/ExecutiveDashboard/components/Insights/DrillLevel.js +1 -1
- package/dist/ExecutiveDashboard/components/Insights/DrillTable.js +1 -1
- package/dist/ExecutiveDashboard/components/Insights/InsightsContext.js +1 -1
- package/dist/ExecutiveDashboard/components/Insights/KpiChart.js +2 -0
- package/dist/ExecutiveDashboard/components/Insights/KpiChart.js.map +1 -0
- package/dist/ExecutiveDashboard/components/Insights/L1Report.js +1 -1
- package/dist/ExecutiveDashboard/components/Insights/RowDetail.js +1 -1
- package/dist/ExecutiveDashboard/components/Insights/agPrimitives.js +1 -1
- package/dist/ExecutiveDashboard/components/Insights/insightsFormat.js +2 -0
- package/dist/ExecutiveDashboard/components/Insights/insightsFormat.js.map +1 -0
- package/dist/ExecutiveDashboard/components/Insights/insightsUtils.js +1 -1
- package/dist/ExecutiveDashboard/components/RcaDecisionComponent/RcaDecisionComponent.js +1 -1
- package/dist/cjs/ExecutiveDashboard/ExecutiveDashboardWrapper.js +1 -1
- package/dist/cjs/ExecutiveDashboard/api/insightsApi.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/DashboardDateFilter/DashboardDateFilter.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/DashboardHeader/DashboardHeader.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/ExecutiveDashboard.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Graph/LineChart.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Graph/axisDomain.js +2 -0
- package/dist/cjs/ExecutiveDashboard/components/Graph/axisDomain.js.map +1 -0
- package/dist/cjs/ExecutiveDashboard/components/Insights/AgCharts.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Insights/AgReport.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Insights/DecisionAdvantageCard.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Insights/DrillLevel.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Insights/DrillTable.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Insights/InsightsContext.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Insights/KpiChart.js +2 -0
- package/dist/cjs/ExecutiveDashboard/components/Insights/KpiChart.js.map +1 -0
- package/dist/cjs/ExecutiveDashboard/components/Insights/L1Report.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Insights/RowDetail.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Insights/agPrimitives.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/Insights/insightsFormat.js +2 -0
- package/dist/cjs/ExecutiveDashboard/components/Insights/insightsFormat.js.map +1 -0
- package/dist/cjs/ExecutiveDashboard/components/Insights/insightsUtils.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/RcaDecisionComponent/RcaDecisionComponent.js +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/ExecutiveDashboard/ExecutiveDashboardWrapper.d.ts +1 -1
- package/dist/types/ExecutiveDashboard/ExecutiveDashboardWrapper.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/TestExecutiveDashboard.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/api/insightsApi.d.ts +2 -0
- package/dist/types/ExecutiveDashboard/api/insightsApi.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/DashboardDateFilter/DashboardDateFilter.d.ts +3 -1
- package/dist/types/ExecutiveDashboard/components/DashboardDateFilter/DashboardDateFilter.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/DashboardHeader/DashboardHeader.d.ts +8 -1
- package/dist/types/ExecutiveDashboard/components/DashboardHeader/DashboardHeader.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/ExecutiveDashboard.d.ts +3 -1
- package/dist/types/ExecutiveDashboard/components/ExecutiveDashboard.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Graph/LineChart.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Graph/axisDomain.d.ts +24 -0
- package/dist/types/ExecutiveDashboard/components/Graph/axisDomain.d.ts.map +1 -0
- package/dist/types/ExecutiveDashboard/components/Graph/types.d.ts +22 -0
- package/dist/types/ExecutiveDashboard/components/Graph/types.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Insights/AgCharts.d.ts +5 -1
- package/dist/types/ExecutiveDashboard/components/Insights/AgCharts.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Insights/AgReport.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Insights/DecisionAdvantageCard.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Insights/DrillTable.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Insights/InsightsContext.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Insights/KpiChart.d.ts +90 -0
- package/dist/types/ExecutiveDashboard/components/Insights/KpiChart.d.ts.map +1 -0
- package/dist/types/ExecutiveDashboard/components/Insights/L1Report.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Insights/agPrimitives.d.ts +10 -2
- package/dist/types/ExecutiveDashboard/components/Insights/agPrimitives.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Insights/insightsContextCore.d.ts +9 -1
- package/dist/types/ExecutiveDashboard/components/Insights/insightsContextCore.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/Insights/insightsFormat.d.ts +49 -0
- package/dist/types/ExecutiveDashboard/components/Insights/insightsFormat.d.ts.map +1 -0
- package/dist/types/ExecutiveDashboard/components/Insights/insightsUtils.d.ts +10 -4
- package/dist/types/ExecutiveDashboard/components/Insights/insightsUtils.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/RcaDecisionComponent/RcaDecisionComponent.d.ts +1 -1
- package/dist/types/ExecutiveDashboard/components/RcaDecisionComponent/RcaDecisionComponent.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/RcaDecisionComponent/types.d.ts +11 -0
- package/dist/types/ExecutiveDashboard/components/RcaDecisionComponent/types.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/types/index.d.ts +14 -0
- package/dist/types/ExecutiveDashboard/types/index.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/types/insights.d.ts +112 -0
- package/dist/types/ExecutiveDashboard/types/insights.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react"),n=require("../../api/insightsApi.js"),r=require("./agPrimitives.js"),i=require("./insightsFormat.js"),o=require("./insightsContextCore.js");var a=function(e){var t=e?new Date("".concat(e.slice(0,10),"T00:00:00")).getDay():1;return 0===t||6===t?"vs previous weekend day":"vs previous working day"},l=function(e){var t=e.slice(0,10).split("-").map(Number),n=t[0],r=t[1],i=t[2];return new Date(n,(r||1)-1,i||1)};function s(e){if(null==e?void 0:e.label)return e.label;if(!(null==e?void 0:e.start)||!(null==e?void 0:e.end))return"";var t=l(e.start),n=l(e.end),r=function(e){return e.getDate()},i=function(e){return e.toLocaleString("en-GB",{month:"short"})};return e.start===e.end?"".concat(r(n)," ").concat(i(n)," ").concat(n.getFullYear()):t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()?"".concat(r(t),"–").concat(r(n)," ").concat(i(n)," ").concat(n.getFullYear()):t.getFullYear()===n.getFullYear()?"".concat(r(t)," ").concat(i(t)," – ").concat(r(n)," ").concat(i(n)," ").concat(n.getFullYear()):"".concat(r(t)," ").concat(i(t)," ").concat(t.getFullYear()," – ").concat(r(n)," ").concat(i(n)," ").concat(n.getFullYear())}var u={spike:"Spike",drop:"Drop",fast_mover:"Fast mover",slow_mover:"Slow mover",new_entity:"New",dormant_entity:"Went quiet",recovered:"Recovered",stable:"Stable"};var d="insights:open-entity-report";var c=function(e,t){return Array.from(new Set(e.map(function(e){return(null!=e?e:"").trim()}).filter(Boolean))).slice(0,t)};exports.averageLabel=i.averageLabel,exports.averageLineLabel=i.averageLineLabel,exports.averageShort=i.averageShort,exports.formatAxisFigure=i.formatAxisFigure,exports.formatFigure=i.formatFigure,exports.longPeriod=i.longPeriod,exports.periodWordsOf=i.periodWordsOf,exports.rootCauseTag=i.rootCauseTag,exports.shortPeriod=i.shortPeriod,exports.OPEN_INSIGHTS_ENTITY_REPORT=d,exports.formatPeriod=s,exports.formatReportDate=function(e){return(null==e?void 0:e.label)?e.label:(null==e?void 0:e.end)?s({start:e.end,end:e.end}):""},exports.formatValue=function(e){return null!=e&&Number.isFinite(e)?String(e):"—"},exports.insightTabItems=function(e){var t,n;return(null!==(n=null===(t=null==e?void 0:e.tabs)||void 0===t?void 0:t.items)&&void 0!==n?n:[]).filter(function(e){return e&&"string"==typeof e.entityKey&&e.entityKey})},exports.isInsightsOn=function(e){var t=null==e?void 0:e.enabled;return!0===t||"string"==typeof t&&["true","yes","y","1"].includes(t.trim().toLowerCase())},exports.movementLabel=function(e){var t;return e?null!==(t=u[e])&&void 0!==t?t:e.replace(/_/g," "):""},exports.periodName=function(e,t){if(!t||"day"===t||!e)return"today";var n=i.longPeriod(e,t);return"month"===t?n.split(" ")[0]:n},exports.previousDayLabel=a,exports.previousPeriodLabel=function(e,t){return t&&"day"!==t?"vs previous ".concat(t):a(e)},exports.reportDecisioning=function(t,n){var r,i,o,a,l;if(!t||"generated"!==t.status)return null;var s=e.__spreadArray(e.__spreadArray([],null!==(r=t.rootCause)&&void 0!==r?r:[],!0),null!==(i=t.nextSteps)&&void 0!==i?i:[],!0).map(function(e){return e.decisioning}).filter(Boolean),u=c(s.flatMap(function(e){var t;return null!==(t=e.decisionMakingFactors)&&void 0!==t?t:[]}),3),d=c(s.flatMap(function(e){var t;return null!==(t=e.gapsInDecision)&&void 0!==t?t:[]}),4);return u.length||d.length||null!=t.score?{explanation:null!=n?n:(null===(o=t.summary)||void 0===o?void 0:o.body)||(null===(a=s[0])||void 0===a?void 0:a.explanation)||void 0,decisionMakingFactors:u,gapsInDecision:d,score:null!==(l=t.score)&&void 0!==l?l:void 0}:null},exports.sentimentColor=function(e,t){return void 0===t&&(t="up"),"up"!==e&&"down"!==e?"#d97706":e===t?"#16a34a":"#dc2626"},exports.shortDay=function(e){var t=String(e);return/^\d{4}-\d{2}-\d{2}/.test(t)?"".concat(t.slice(5,7),"/").concat(t.slice(8,10)):t},exports.summaryCardConfig=function(e){var t=null==e?void 0:e.summaryCard;return t&&!1!==t.enabled?t:null},exports.toRcaItems=function(e,n,o){return(null!=e?e:[]).map(function(e){var a,l,s,u,d,c,v,g,p,f,m,y;return{id:e.id,tag:i.rootCauseTag(e.tag,o),title:i.rootCauseTitle(e.content,e.links),detail:null!==(l=null===(a=e.decisioning)||void 0===a?void 0:a.explanation)&&void 0!==l?l:void 0,content:(null===(s=e.links)||void 0===s?void 0:s.length)&&n?t.createElement(r.VerdictSentence,{text:e.content,arrowsFollowVerdict:!0,renderText:r.linkedText(e.links,n)}):/^(Good|Bad) news\s*[-–—]|[↑↓]/.test(e.content)?t.createElement(r.VerdictSentence,{text:e.content,arrowsFollowVerdict:!0}):e.content,decisioning:e.decisioning?{explanation:null!==(u=e.decisioning.explanation)&&void 0!==u?u:void 0,decisionMakingFactors:(null!==(d=e.decisioning.decisionMakingFactors)&&void 0!==d?d:[]).slice(0,3),gapsInDecision:null!==(c=e.decisioning.gapsInDecision)&&void 0!==c?c:[],score:null!==(v=e.decisioning.score)&&void 0!==v?v:void 0,evidence:e.decisioning.evidence?{label:e.decisioning.evidence.label,title:null!==(g=e.decisioning.evidence.title)&&void 0!==g?g:void 0,description:null!==(p=e.decisioning.evidence.description)&&void 0!==p?p:void 0,items:null!==(f=e.decisioning.evidence.items)&&void 0!==f?f:[],highlight:null!==(m=e.decisioning.evidence.highlight)&&void 0!==m?m:void 0,footer:null!==(y=e.decisioning.evidence.footer)&&void 0!==y?y:void 0}:void 0}:void 0}})},exports.useInsightsFetch=function(n,r,i){var o=t.useState({loading:Boolean(n),identityKey:i}),a=o[0],l=o[1],s=t.useState(0),u=s[0],d=s[1],c=t.useRef(n);c.current=n,t.useEffect(function(){var t=c.current;if(t){var n=new AbortController;return l(function(e){return{data:e.identityKey===i?e.data:void 0,loading:!0,identityKey:i}}),t(n.signal).then(function(e){n.signal.aborted||l({data:e,loading:!1,identityKey:i})}).catch(function(e){n.signal.aborted||"AbortError"===(null==e?void 0:e.name)||l({error:e,loading:!1,identityKey:i})}),function(){return n.abort()}}l(function(t){return e.__assign(e.__assign({},t),{data:t.identityKey===i?t.data:void 0,error:void 0,loading:!1,identityKey:i})})},e.__spreadArray(e.__spreadArray([],r,!0),[u,i],!1));var v=void 0===i||a.identityKey===i;return e.__assign(e.__assign({},a),{data:v?a.data:void 0,error:v?a.error:void 0,loading:v?a.loading:Boolean(n),reload:function(){return d(function(e){return e+1})},updateData:function(t){return l(function(n){return e.__assign(e.__assign({},n),{data:t(n.identityKey===i?n.data:void 0),identityKey:i})})}})},exports.useJob=function(r,i,o){var a=this,l=t.useState({status:null,error:null}),s=l[0],u=l[1],d=t.useRef(o);return d.current=o,t.useEffect(function(){if(r&&i){var t,o=!1,l=function(){return e.__awaiter(a,void 0,void 0,function(){var a,s,c;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,n.fetchInsightsJob(i,r)];case 1:return a=e.sent(),o?[2]:(u({status:a.status,error:"failed"===a.status?a.error||"The job failed.":null}),"succeeded"===a.status?null===(c=d.current)||void 0===c||c.call(d,a.reportId):"failed"!==a.status&&(t=setTimeout(l,4e3)),[3,3]);case 2:return s=e.sent(),o||u({status:"failed",error:s.message||"The job couldn't be checked."}),[3,3];case 3:return[2]}})})};return l(),function(){o=!0,clearTimeout(t)}}u({status:null,error:null})},[r,i]),s},exports.useOpenRow=function(){var t=this,r=o.useInsights();return function(i){return e.__awaiter(t,void 0,void 0,function(){var t,o,a,l;return e.__generator(this,function(e){switch(e.label){case 0:if(!r)return[2];if(t=new CustomEvent(d,{detail:i,cancelable:!0}),window.dispatchEvent(t),t.defaultPrevented)return[3,4];if(!(o=r.headlineKpi))return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,n.fetchRowReport(r.api,i.nodeKey,{kpiId:o,dataDay:i.dataDay||n.toIsoDay(r.range.endDate)})];case 2:return a=e.sent(),(null===(l=a.report)||void 0===l?void 0:l.reportId)&&r.openReport({reportId:a.report.reportId,title:i.label}),[3,4];case 3:return e.sent(),[3,4];case 4:return[2]}})})}},exports.viewerFromToken=function(e){var t,n,r;try{var i=null==e?void 0:e.replace(/^bearer\s+/i,"").split(".")[1];if(!i)return{email:null,isAdmin:!1};var o=JSON.parse(decodeURIComponent(escape(atob(i.replace(/-/g,"+").replace(/_/g,"/"))))),a=[].concat(null!==(t=o.rolename)&&void 0!==t?t:[],null!==(n=o.role)&&void 0!==n?n:[],null!==(r=o.roles)&&void 0!==r?r:[]).map(String);return{email:o.email||o.sub||null,isAdmin:a.some(function(e){return"cw-admin"===e||/ Admin$/.test(e)})}}catch(e){return{email:null,isAdmin:!1}}};
|
|
2
2
|
//# sourceMappingURL=insightsUtils.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),i=require("react"),s=require("lucide-react"),a=require("../../../assets/icons/cognitive_desicioning_icon_brain.svg.js"),c=function(e){return void 0===e&&(e=0),Math.max(0,Math.min(100,Math.round(e)))};function r(i){var s=i.text.split(/(\*\*[^*]+\*\*|`[^`]+`)/g);return n.jsx(n.Fragment,{children:s.map(function(i,s){return/^\*\*[^*]+\*\*$/.test(i)?n.jsx("strong",e.__assign({className:"rca-decision__strong"},{children:i.slice(2,-2)}),s):/^`[^`]+`$/.test(i)?n.jsx("code",e.__assign({className:"rca-decision__code"},{children:i.slice(1,-1)}),s):i})})}function t(i){var c=i.open,r=i.onToggle,t=i.label,o=void 0===t?"cognitive decisioning":t;return n.jsxs("button",e.__assign({type:"button",className:"rca-decision__reasoning-trigger","aria-label":"".concat(c?"Hide":"Show"," ").concat(o),"aria-expanded":c,onClick:r},{children:[n.jsx("img",{src:a.default,alt:""}),c?n.jsx(s.ChevronUp,{"aria-hidden":"true"}):n.jsx(s.ChevronDown,{"aria-hidden":"true"})]}))}function o(r){var t,o,d=r.decisioning,_=i.useState(!1),u=_[0],h=_[1],g=c(d.score),x=null!==(t=d.decisionMakingFactors)&&void 0!==t?t:[],j=null!==(o=d.gapsInDecision)&&void 0!==o?o:[];return n.jsxs("div",e.__assign({className:"rca-decision__reasoning"},{children:[d.explanation?n.jsxs("section",e.__assign({className:"rca-decision__explanation"},{children:[n.jsx("h3",{children:"Explanation"}),n.jsx("div",{children:d.explanation})]})):null,n.jsxs("section",e.__assign({className:"rca-decision__cognitive"},{children:[n.jsxs("button",e.__assign({type:"button",className:"rca-decision__cognitive-toggle","aria-expanded":u,onClick:function(){return h(function(e){return!e})}},{children:[n.jsxs("span",e.__assign({className:"rca-decision__cognitive-title"},{children:[n.jsx("img",{src:a.default,alt:""}),"Cognitive Decisioning AI"]})),n.jsxs("span",e.__assign({className:"rca-decision__score"},{children:[n.jsx(s.Sparkles,{"aria-hidden":"true"}),g,"%"]})),u?n.jsx(s.ChevronUp,{"aria-hidden":"true"}):n.jsx(s.ChevronDown,{"aria-hidden":"true"})]})),u?n.jsxs("div",e.__assign({className:"rca-decision__cognitive-body"},{children:[n.jsx(l,{icon:n.jsx(s.Lightbulb,{"aria-hidden":"true"}),title:"Decision Making Factors",items:x,evidence:d.evidence}),n.jsx(l,{icon:n.jsx(s.Search,{"aria-hidden":"true"}),title:"Gaps in Decision",items:j.length?j:["No gaps identified"]})]})):null]}))]}))}function l(a){var c=a.icon,r=a.title,t=a.items,o=a.evidence,l=i.useState(!1),_=l[0],u=l[1];return t.length?n.jsxs("div",e.__assign({className:"rca-decision__reasoning-section"},{children:[n.jsxs("h4",{children:[n.jsx("span",e.__assign({className:"rca-decision__subsection-icon"},{children:c})),r]}),n.jsx("ol",{children:t.map(function(i,a){return n.jsxs("li",{children:[i,0===a&&o?n.jsxs(n.Fragment,{children:[n.jsxs("button",e.__assign({type:"button",className:"rca-decision__evidence-trigger","aria-expanded":_,onClick:function(){return u(function(e){return!e})}},{children:[n.jsx(s.Sparkles,{"aria-hidden":"true"}),o.label,_?n.jsx(s.ChevronUp,{"aria-hidden":"true"}):n.jsx(s.ChevronDown,{"aria-hidden":"true"})]})),_?n.jsx(d,{evidence:o,onClose:function(){return u(!1)}}):null]}):null]},"".concat(r,"-").concat(a))})})]})):null}function d(i){var a,c,r=i.evidence,t=i.onClose,o=function(e){if(!r.highlight||"string"!=typeof e)return e;var i=e.indexOf(r.highlight);return i<0?e:n.jsxs(n.Fragment,{children:[e.slice(0,i),n.jsx("mark",{children:r.highlight}),e.slice(i+r.highlight.length)]})};return n.jsxs("div",e.__assign({className:"rca-decision__evidence-detail"},{children:[n.jsxs("button",e.__assign({type:"button",className:"rca-decision__evidence-header",onClick:t},{children:[n.jsx("span",{children:null!==(a=r.title)&&void 0!==a?a:r.label}),n.jsx(s.ChevronUp,{"aria-hidden":"true"})]})),n.jsxs("div",e.__assign({className:"rca-decision__evidence-body"},{children:[r.description?n.jsx("p",{children:r.description}):null,null===(c=r.items)||void 0===c?void 0:c.map(function(e,i){return n.jsx("p",{children:o(e)},i)})]})),r.footer?n.jsx("div",e.__assign({className:"rca-decision__evidence-footer"},{children:r.footer})):null]}))}function _(a){var c=a.title,l=a.items,d=a.tone,_=a.icon,u=a.layout,h=void 0===u?"list":u,g=i.useState(null),x=g[0],j=g[1],m=i.useState(function(){return new Set}),v=m[0],p=m[1],N=i.useState(!1),f=N[0],b=N[1],y=i.useId(),C=f?l:l.slice(0,3),w="cards"===h;return n.jsxs("section",e.__assign({className:"rca-decision__section"},{children:[n.jsxs("h2",{children:[n.jsx("span",e.__assign({className:"rca-decision__section-icon rca-decision__section-icon--".concat(d)},{children:_})),c]}),n.jsx("ol",e.__assign({className:"rca-decision__items".concat(w?" rca-decision__items--cards":""),id:y},{children:C.map(function(i,a){var c,l,_,u=null!==(c=i.id)&&void 0!==c?c:"".concat(d,"-").concat(a),h=x===u;if(w){var g=v.has(u),m=i.tag?n.jsx("span",e.__assign({className:"rca-decision__tag rca-decision__tag--".concat(null!==(l=i.tag.tone)&&void 0!==l?l:"neutral")},{children:i.tag.label})):null;return n.jsxs("li",e.__assign({className:"rca-decision__card"},{children:[i.title?n.jsxs("div",e.__assign({className:"rca-decision__card-head"},{children:[n.jsxs("span",e.__assign({className:"rca-decision__card-title"},{children:[a+1,". ",i.title]})),m]})):null,n.jsxs("div",e.__assign({className:"rca-decision__item-row"},{children:[i.title?null:m,i.title?null:n.jsxs("span",e.__assign({className:"rca-decision__card-number"},{children:[a+1,". "]})),n.jsx("div",e.__assign({className:"rca-decision__item-content"},{children:"string"==typeof i.content?n.jsx(r,{text:i.content}):i.content})),i.decisioning?n.jsx(t,{open:h,onToggle:function(){return j(h?null:u)}}):null]})),i.detail?n.jsxs("button",e.__assign({type:"button",className:"rca-decision__view-more","aria-expanded":g,onClick:function(){return e=u,p(function(n){var i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i});var e}},{children:[g?"View Less":"View More",g?n.jsx(s.ChevronUp,{"aria-hidden":"true"}):n.jsx(s.ChevronDown,{"aria-hidden":"true"})]})):null,g&&i.detail?n.jsx("p",e.__assign({className:"rca-decision__card-detail"},{children:i.detail})):null,h&&i.decisioning?n.jsx(o,{decisioning:i.decisioning}):null]}),u)}return n.jsxs("li",{children:[n.jsxs("div",e.__assign({className:"rca-decision__item-row"},{children:[i.tag?n.jsx("span",e.__assign({className:"rca-decision__tag rca-decision__tag--".concat(null!==(_=i.tag.tone)&&void 0!==_?_:"neutral")},{children:i.tag.label})):null,n.jsx("div",e.__assign({className:"rca-decision__item-content"},{children:"string"==typeof i.content?n.jsx(r,{text:i.content}):i.content})),i.decisioning?n.jsx(t,{open:h,onToggle:function(){return j(h?null:u)}}):null]})),h&&i.decisioning?n.jsx(o,{decisioning:i.decisioning}):null]},u)})})),l.length>3?n.jsxs("button",e.__assign({type:"button",className:"rca-decision__see-more","aria-controls":y,"aria-expanded":f,onClick:function(){b(!f),j(null)}},{children:[f?"See Less":"See More (".concat(l.length-3,")"),f?n.jsx(s.ChevronUp,{"aria-hidden":"true"}):n.jsx(s.ChevronDown,{"aria-hidden":"true"})]})):null]}))}function u(a){var r=a.title,l=void 0===r?"Decision Advantage":r,d=a.score,u=a.summary,h=a.footer,g=a.evidenceNote,x=a.notice,j=a.headerActions,m=a.afterSections,v=a.decisioning,p=a.rootCause,N=a.rootCauseLayout,f=void 0===N?"list":N,b=a.nextSteps,y=a.width,C=a.maxWidth,w=a.height,S=a.className,k=void 0===S?"":S,D=i.useState(!1),M=D[0],U=D[1];return n.jsxs("article",e.__assign({className:"rca-decision ".concat(void 0!==w?"rca-decision--fixed-height":""," ").concat(k).trim(),style:{width:y,height:w,maxWidth:null!=C?C:y?"none":void 0}},{children:[n.jsxs("header",e.__assign({className:"rca-decision__header"},{children:[n.jsx("span",{children:l}),n.jsxs("span",e.__assign({className:"rca-decision__header-end"},{children:[j,v?n.jsx(t,{open:M,onToggle:function(){return U(function(e){return!e})},label:"how the AI reached this report"}):null,null!=d?n.jsxs("span",e.__assign({className:"rca-decision__header-score"},{children:[n.jsx(s.Sparkles,{"aria-hidden":"true"}),c(d),"%"]})):null]}))]})),n.jsxs("div",e.__assign({className:"rca-decision__body"},{children:[x?n.jsx("div",e.__assign({className:"rca-decision__notice"},{children:x})):null,M&&v?n.jsx("div",e.__assign({className:"rca-decision__header-reasoning"},{children:n.jsx(o,{decisioning:v})})):null,u&&(u.headline||u.body)?n.jsxs("section",e.__assign({className:"rca-decision__summary"},{children:[u.eyebrow?n.jsx("span",e.__assign({className:"rca-decision__eyebrow"},{children:u.eyebrow})):null,u.headline?n.jsx("h2",e.__assign({className:"rca-decision__headline"},{children:u.headline})):null,u.body?n.jsx("p",e.__assign({className:"rca-decision__summary-body"},{children:u.body})):null,g?n.jsx("p",e.__assign({className:"rca-decision__evidence-note"},{children:g})):null]})):g?n.jsx("p",e.__assign({className:"rca-decision__evidence-note"},{children:g})):null,p.length?n.jsx(_,{title:"Root Cause",items:p,tone:"root-cause",icon:n.jsx(s.Search,{"aria-hidden":"true"}),layout:f}):null,b.length?n.jsx(_,{title:"Next Steps",items:b,tone:"next-steps",icon:n.jsx(s.CheckCircle2,{"aria-hidden":"true"})}):null,m,h?n.jsx("p",e.__assign({className:"rca-decision__footer"},{children:h})):null]}))]}))}exports.RcaDecisionComponent=u,exports.ReasoningPanel=o,exports.ReasoningTrigger=t,exports.default=u;
|
|
2
2
|
//# sourceMappingURL=RcaDecisionComponent.js.map
|