@viswa-test/test-citation 0.0.241 → 0.0.243
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/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +2 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -0
- package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js.map +1 -0
- package/dist/cjs/service/redlineService.js +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +2 -0
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -0
- package/dist/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.module.css.js +1 -1
- package/dist/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js.map +1 -0
- package/dist/service/redlineService.js +1 -1
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +8 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts +2 -1
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts +3 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +311 -1689
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts +10 -1
- package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts +2398 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.d.ts +9 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts +14 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts +10 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts +30 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/index.d.ts +4 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/index.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts +2 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts.map +1 -0
- package/dist/types/src/service/redlineService.d.ts +6 -0
- package/dist/types/src/service/redlineService.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),t=require("react"),n=require("./ToneToggle.js");require("../CognitiveComponents/CitationComponent.module.css.js");var o=require("../icons/cognitiveBrain.svg.js"),l=require("../icons/aiMagic.svg.js"),r=require("@mui/material"),s=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),d=require("../../../../../service/redlineService.js"),a=require("../../ai-reasoning/AiReasonMarkdownWrapper.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=c(t);const x=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],g=({toneIndex:i,configs:t=x})=>{const n=Math.min(i,t.length-1),{color:o,angle:l,arcD:r}=t[n]||t[1]||t[0],s=(l-90)*Math.PI/180,d=11+9*Math.cos(s),a=13+9*Math.sin(s);return e.jsxs("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e.jsx("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:r,stroke:o,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:"11",y1:"13",x2:d,y2:a,stroke:o,strokeWidth:"2",strokeLinecap:"round"})]})},u=({type:i,customStyles:t={}})=>{const n={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...t},o=n[i]||n.Medium;return e.jsx("div",{style:o,children:i})},h=["Lenient","Balanced","Aggressive"],v={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},m={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},y={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},f={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},j={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},w={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},S={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},b={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},C={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},k={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},I={display:"flex",gap:8,marginBottom:18},T={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},B={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},A={borderTop:"0.5px solid #eee",padding:"14px 0px"},E={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},R={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},W={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},D={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},F={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},z={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},L={display:"flex",padding:"4px 8px",alignItems:"center",gap:"4px",borderRadius:"var(--chip-border-radius, 16px)",border:"1px solid var(--Primitive-Gray-300, #d0d5dd)",flex:"0 1 auto",minWidth:0},M={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},H={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0},_=t.memo(function({onAssignClick:i,onOpenCognitive:t,cognitiveIconSmall:n,cognitiveTootipTitle:o,historyIconSmall:l,onHistoryClick:r,historyTootipTitle:s}){const d="20px";return e.jsxs("div",{style:{...H,minWidth:"200px"},children:[e.jsxs("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:i,children:[e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"})]})}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),t&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>t(e),children:[n&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:n}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o})]}),r&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>r(e),children:[l&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:l}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s})]})]})}),O=t.memo(function({onAssignClick:i,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d}){const[a,c]=t.useState(!1);return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsx("button",{onClick:()=>c(!a),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"1"}),e.jsx("circle",{cx:"12",cy:"5",r:"1"}),e.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),a&&e.jsx(_,{onAssignClick:i?()=>{c(!1),i&&i()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d})]})}),q=t.memo(function({users:i,onClick:t}){const n=i.length;return e.jsxs("div",{onClick:t,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[e.jsx("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==i?void 0:i[0].length)>9?(null==i?void 0:i[0].slice(0,9))+"...":null==i?void 0:i[0]}),n>1&&e.jsxs("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",n-1]})]})}),P=t.memo(function({steps:i}){if(!(null==i?void 0:i.length))return null;const t=i.length>=3;return e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:t?"6px 8px":"8px 10px",background:"#F8FAFC",gap:t?4:8,overflow:"hidden"},children:i.map((n,o)=>{const l=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(o),r=o===i.length-1;return e.jsxs(p.default.Fragment,{children:[e.jsxs("div",{title:n.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:t?4:6,overflow:"hidden"},children:[(s=n.status,"approved"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):"rejected"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m15 9-6 6"}),e.jsx("path",{d:"m9 9 6 6"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),e.jsx("span",{style:{minWidth:0,color:"#475569",fontSize:t?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.label}),n.initials&&e.jsx("span",{style:{width:t?20:22,height:t?20:22,minWidth:t?20:22,borderRadius:"50%",background:l.bg,color:l.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:t?9:10,fontWeight:700,lineHeight:1},children:n.initials})]}),!r&&e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"18",height:t?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:t?14:18},children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})]},n.id);var s})})})});var N=t.memo(function({onClose:c,aiReason:p,onActionTrigger:H,onIterate:_,initialTone:N,onRegenerate:$,labels:V={},toneLevelsConfig:U=h,toneColorsConfig:G=v,dialConfigs:K=x,actions:X,disableAllActions:J=!1,customStyles:Q={},severityChipStyles:Y={},customIcons:Z={},onOpenCognitive:ee,onHistoryClick:ie,historyIconSmall:te,historyTootipTitle:ne,showTone:oe=!0,cognitiveSectionStyle:le={},cognitiveScoreBadgeStyle:re={},cognitiveScoreTextStyle:se={},cognitiveStyles:de={},cognitiveClassNames:ae={},cognitiveTitle:ce="Cognitive Integrity",cognitiveTootipTitle:pe="Cognitive Decisioning",cognitiveLeftIcon:xe,cognitiveIconSmall:ge,showCognitiveRightArrow:ue=!0,isStreaming:he,onAssignClick:ve,assignedUsers:me,onReviewUsersClick:ye,redlineId:fe,aiReasonId:je,displayVariant:we="default",reviewTitle:Se,reviewSubtitle:be,reviewStatusIcon:Ce=e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-hourglass-icon lucide-hourglass",children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:ke=[],showReviewProgress:Ie=!1,showOriginalText:Te=!1,originalText:Be,originalTextHeader:Ae="Original text",hideSummaryText:Ee=!1,hideSeverityChip:Re=!1}){var We,De,Fe,ze,Le,Me,He,_e,Oe,qe,Pe,Ne,$e,Ve,Ue,Ge,Ke,Xe,Je,Qe;let Ye=U.findIndex(e=>e===N);-1===Ye&&(Ye=1);const[Ze,ei]=t.useState(!0),[ii,ti]=t.useState(!1),[ni,oi]=t.useState(!1),[li,ri]=t.useState(Ye),[si]=t.useState(Ye),[di,ai]=t.useState(!0),ci="review"===we,pi=U[li],xi=G[pi]||"#BA7517",gi=li!==si,ui=[{id:"iterate",icon:Z.iterateIcon||e.jsx(i.PenLine,{size:16,color:"#64748B"}),label:V.btnIterate||"Iterate",color:"#64748B",onClick:_},{id:"accept",icon:Z.acceptIcon||e.jsx(i.CheckCircle,{size:16,color:"#10B981"}),label:V.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:Z.rejectIcon||e.jsx(i.XCircle,{size:16,color:"#DC2626"}),label:V.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:hi,redlineConfig:vi,updateRedlineDataParent:mi}=s.useRequirementAI(),yi=X||ui;return e.jsxs("div",{onClick:e=>{e.stopPropagation()},style:{...m,...null===(We=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===We?void 0:We.root},children:[e.jsxs("div",{style:{...y,...null===(De=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===De?void 0:De.header,marginBottom:ci?14:ni?"16px":"12px",...ci&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[ci?e.jsxs("div",{style:{minWidth:0,flex:"1 1 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:Ce||Z.summaryIcon||"⏳"}),e.jsx("span",{children:Se||"Redline In Review"})]}),e.jsx("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:be||(null===(Fe=null==p?void 0:p.redlining_details)||void 0===Fe?void 0:Fe.redline_title)})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{children:Z.summaryIcon||e.jsx(i.Info,{size:16,color:"#E24B4A"})}),e.jsx("span",{style:{...f,...null===(ze=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===ze?void 0:ze.title},children:V.summaryHeader||"Summary"})]}),me&&me.length>0&&e.jsx(q,{users:me,onClick:e=>{e.stopPropagation(),null==ye||ye()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ve||ee||ie)&&e.jsx(O,{onAssignClick:ve,onOpenCognitive:ee,cognitiveIconSmall:ge,cognitiveTootipTitle:pe,historyIconSmall:te,onHistoryClick:ie,historyTootipTitle:ne}),e.jsx("button",{onClick:c,style:{...B,...null===(Le=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Le?void 0:Le.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),ci&&Ie&&ke.length>0&&e.jsx(P,{steps:ke}),!Ee&&!ci&&e.jsx(e.Fragment,{children:e.jsx(r.Tooltip,{title:null===(Me=null==p?void 0:p.redlining_details)||void 0===Me?void 0:Me.redline_title,children:e.jsx("p",{style:{...j,...null===(He=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===He?void 0:He.bodyText},children:null===(_e=null==p?void 0:p.redlining_details)||void 0===_e?void 0:_e.redline_title})})}),e.jsx("p",{style:{...w,...null===(Oe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.summary},children:null===(qe=null==p?void 0:p.redlining_details)||void 0===qe?void 0:qe.redline_summary}),e.jsxs("div",{style:{...S,...null===(Pe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.impactContainer},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>ei(!Ze),style:{...C,...null===(Ne=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ne?void 0:Ne.impactToggle},children:[e.jsx("span",{style:{...k,...null===($e=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===$e?void 0:$e.impactToggleLabel},children:V.impactHeader||"Impact"}),e.jsx("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ze?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#E24B4A"})})]}),e.jsx(u,{type:(null==p?void 0:p.severity)||"Medium",customStyles:Y})]}),Ze&&e.jsx(e.Fragment,{children:e.jsx("div",{style:{...b,...null===(Ve=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ve?void 0:Ve.impactText},children:e.jsx(a.AiReasonMarkdownWrapper,{message:`${null!==(Ge=null===(Ue=null==p?void 0:p.redlining_details)||void 0===Ue?void 0:Ue.redline_impact)&&void 0!==Ge?Ge:V.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Ke=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Ke?void 0:Ke.impactMarkdown})})})]}),ci&&Te&&e.jsxs("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e.jsxs("button",{onClick:()=>ai(e=>!e),style:{background:"none",border:"none",padding:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",color:"#1E293B",fontSize:21,fontWeight:600},children:[e.jsx("span",{children:Ae}),e.jsx(i.ChevronDown,{size:18,color:"#1E293B",style:{transform:di?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),di&&e.jsxs("div",{style:{marginTop:10,border:"1px solid #CBD5E1",borderRadius:12,padding:"16px 20px",background:"#F8FAFC",color:"#475569",fontSize:20,lineHeight:1.7,fontStyle:"italic",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.08)"},children:["“",Be||"","”"]})]}),e.jsx("div",{style:{...I,...null===(Xe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.actionContainer},children:yi.map(i=>{var t,n;const o=J||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e.jsxs("button",{style:{...T,...null===(n=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtn,color:i.color,...i.style,...l},onClick:o?void 0:async()=>{var e,t;if(i.useLabel)try{await(null===(e=i.onClick)||void 0===e?void 0:e.call(i))}finally{await(async e=>{var i,t,n;null==H||H({status:"loading",action:e,metadata:{redlineId:fe,aiReasonId:je}});try{const{updated_reqai:o}=await d.resolveRedline({documentId:hi,userEmail:null==vi?void 0:vi.userEmail,userName:null==vi?void 0:vi.userName,redlineId:null!==(i=null==p?void 0:p.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==vi?void 0:vi.baseApiUrl,redlineConfigId:null!==(t=null==vi?void 0:vi.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==vi?void 0:vi.token)&&void 0!==n?n:"");await(null==mi?void 0:mi(o)),null==H||H({status:"success",action:e,metadata:{redlineId:fe,aiReasonId:je}})}catch(i){null==H||H({status:"failed",action:e,metadata:{redlineId:fe,aiReasonId:je}})}})(i.id.toLowerCase())}else await(null===(t=i.onClick)||void 0===t?void 0:t.call(i))},disabled:o,children:[i.icon,i.label]},i.id)})}),oe&&e.jsxs("div",{style:{...A,...null===(Je=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Je?void 0:Je.toneContainer},children:[e.jsxs("button",{onClick:()=>ti(!ii),style:{...E,...null===(Qe=null==Q?void 0:Q.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.toneToggleBtn},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(g,{toneIndex:li,configs:K}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:V.toneHeader||"Redline Tone"})]}),e.jsx("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ii?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#111"})})]}),ii&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:V.toneDescription||"Controls how assertively AI is redlining"}),e.jsx(n.ToneToggle,{isDirty:gi,onToneChange:e=>{ri(e)},toneColor:xi,toneIndex:li,onClickRegenerate:()=>null==$?void 0:$(pi),toneLabels:U,isStreaming:he,aiReason:p})]})]}),ee&&e.jsxs("div",{className:null==ae?void 0:ae.section,onClick:e=>{e.stopPropagation(),ee&&ee(e)},style:{...R,...null==de?void 0:de.section,...le},children:[e.jsxs("div",{className:null==ae?void 0:ae.headerLeft,style:{...W,...null==de?void 0:de.headerLeft},children:[e.jsx("span",{className:null==ae?void 0:ae.titleIcon,style:{...D,...null==de?void 0:de.titleIcon},children:null!=xe?xe:e.jsx(o.ReactComponent,{})}),e.jsx("div",{className:null==ae?void 0:ae.cognitiveTitle,style:{...F,...null==de?void 0:de.cognitiveTitle},children:ce})]}),e.jsxs("div",{className:null==ae?void 0:ae.headerRight,style:{...z,...null==de?void 0:de.headerRight},children:[void 0!==(null==p?void 0:p.relevance_score)&&null!==(null==p?void 0:p.relevance_score)?e.jsxs("span",{className:null==ae?void 0:ae.scoreBadge,style:{...L,...null==de?void 0:de.scoreBadge,...re},children:[e.jsx(l.ReactComponent,{}),e.jsxs("span",{className:null==ae?void 0:ae.scoreText,style:{...M,...null==de?void 0:de.scoreText,...se},children:[Math.round(Number(p.relevance_score)),"%"]})]}):null,ue&&e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(i.ChevronRight,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var t,n,o,l;if(e.displayVariant!==i.displayVariant)return!1;if(e.reviewTitle!==i.reviewTitle)return!1;if(e.reviewSubtitle!==i.reviewSubtitle)return!1;if(e.showReviewProgress!==i.showReviewProgress)return!1;if(e.showOriginalText!==i.showOriginalText)return!1;if(e.originalText!==i.originalText)return!1;if(e.hideSummaryText!==i.hideSummaryText)return!1;if(e.hideSeverityChip!==i.hideSeverityChip)return!1;if((null!==(n=null===(t=e.reviewSteps)||void 0===t?void 0:t.length)&&void 0!==n?n:0)!==(null!==(l=null===(o=i.reviewSteps)||void 0===o?void 0:o.length)&&void 0!==l?l:0))return!1;if(e.reviewSteps&&i.reviewSteps){if(e.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|")!==i.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|"))return!1}return!0});exports.AssignMenu=_,exports.DisplayUsers=q,exports.KebabMenu=O,exports.default=N;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),t=require("react"),n=require("./ToneToggle.js");require("../CognitiveComponents/CitationComponent.module.css.js");var o=require("../icons/cognitiveBrain.svg.js"),l=require("../icons/aiMagic.svg.js"),r=require("@mui/material"),s=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),d=require("../../../../../service/redlineService.js"),a=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),c=require("../cws/CwsEvent.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=p(t);const g=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],u=({toneIndex:i,configs:t=g})=>{const n=Math.min(i,t.length-1),{color:o,angle:l,arcD:r}=t[n]||t[1]||t[0],s=(l-90)*Math.PI/180,d=11+9*Math.cos(s),a=13+9*Math.sin(s);return e.jsxs("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e.jsx("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("path",{d:r,stroke:o,strokeWidth:"2.5",strokeLinecap:"round"}),e.jsx("line",{x1:"11",y1:"13",x2:d,y2:a,stroke:o,strokeWidth:"2",strokeLinecap:"round"})]})},v=({type:i,customStyles:t={}})=>{const n={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...t},o=n[i]||n.Medium;return e.jsx("div",{style:o,children:i})},h=["Lenient","Balanced","Aggressive"],m={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},y={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},f={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},j={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},w={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},S={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},b={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},C={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},k={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},I={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},T={display:"flex",gap:8,marginBottom:18},B={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},A={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},E={borderTop:"0.5px solid #eee",padding:"14px 0px"},R={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},W={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},D={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},F={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},z={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},L={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},M={display:"flex",padding:"4px 8px",alignItems:"center",gap:"4px",borderRadius:"var(--chip-border-radius, 16px)",border:"1px solid var(--Primitive-Gray-300, #d0d5dd)",flex:"0 1 auto",minWidth:0},H={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},_={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0},q=t.memo(function({onAssignClick:i,onOpenCognitive:t,cognitiveIconSmall:n,cognitiveTootipTitle:o,historyIconSmall:l,onHistoryClick:r,historyTootipTitle:s}){const d="20px";return e.jsxs("div",{style:{..._,minWidth:"200px"},children:[e.jsxs("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:i,children:[e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"})]})}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),t&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>t(e),children:[n&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:n}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o})]}),r&&e.jsxs("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>r(e),children:[l&&e.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:d,height:d,flexShrink:0},children:l}),e.jsx("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s})]})]})}),O=t.memo(function({onAssignClick:i,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d}){const[a,c]=t.useState(!1);return e.jsxs("div",{style:{position:"relative",display:"flex"},children:[e.jsx("button",{onClick:()=>c(!a),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"1"}),e.jsx("circle",{cx:"12",cy:"5",r:"1"}),e.jsx("circle",{cx:"12",cy:"19",r:"1"})]})}),a&&e.jsx(q,{onAssignClick:i?()=>{c(!1),i&&i()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:s,historyTootipTitle:d})]})}),N=t.memo(function({users:i,onClick:t}){const n=i.length;return e.jsxs("div",{onClick:t,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[e.jsx("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==i?void 0:i[0].length)>9?(null==i?void 0:i[0].slice(0,9))+"...":null==i?void 0:i[0]}),n>1&&e.jsxs("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",n-1]})]})}),P=t.memo(function({steps:i}){if(!(null==i?void 0:i.length))return null;const t=i.length>=3;return e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:t?"6px 8px":"8px 10px",background:"#F8FAFC",gap:t?4:8,overflow:"hidden"},children:i.map((n,o)=>{const l=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(o),r=o===i.length-1;return e.jsxs(x.default.Fragment,{children:[e.jsxs("div",{title:n.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:t?4:6,overflow:"hidden"},children:[(s=n.status,"approved"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):"rejected"===s?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m15 9-6 6"}),e.jsx("path",{d:"m9 9 6 6"})]}):e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"16",height:t?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),e.jsx("span",{style:{minWidth:0,color:"#475569",fontSize:t?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.label}),n.initials&&e.jsx("span",{style:{width:t?20:22,height:t?20:22,minWidth:t?20:22,borderRadius:"50%",background:l.bg,color:l.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:t?9:10,fontWeight:700,lineHeight:1},children:n.initials})]}),!r&&e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t?"14":"18",height:t?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:t?14:18},children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})]},n.id);var s})})})});var $=t.memo(function({onClose:p,aiReason:x,onActionTrigger:_,onIterate:q,initialTone:$,onRegenerate:V,labels:U={},toneLevelsConfig:G=h,toneColorsConfig:K=m,dialConfigs:X=g,actions:J,disableAllActions:Q=!1,customStyles:Y={},severityChipStyles:Z={},customIcons:ee={},onOpenCognitive:ie,onHistoryClick:te,historyIconSmall:ne,historyTootipTitle:oe,showTone:le=!0,cognitiveSectionStyle:re={},cognitiveScoreBadgeStyle:se={},cognitiveScoreTextStyle:de={},cognitiveStyles:ae={},cognitiveClassNames:ce={},cognitiveTitle:pe="Cognitive Integrity",cognitiveTootipTitle:xe="Cognitive Decisioning",cognitiveLeftIcon:ge,cognitiveIconSmall:ue,showCognitiveRightArrow:ve=!0,isStreaming:he,onAssignClick:me,assignedUsers:ye,onReviewUsersClick:fe,redlineId:je,aiReasonId:we,displayVariant:Se="default",reviewTitle:be,reviewSubtitle:Ce,reviewStatusIcon:ke=e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-hourglass-icon lucide-hourglass",children:[e.jsx("path",{d:"M5 22h14"}),e.jsx("path",{d:"M5 2h14"}),e.jsx("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),e.jsx("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:Ie=[],showReviewProgress:Te=!1,showOriginalText:Be=!1,originalText:Ae,originalTextHeader:Ee="Original text",hideSummaryText:Re=!1,hideSeverityChip:We=!1}){var De,Fe,ze,Le,Me,He,_e,qe,Oe,Ne,Pe,$e,Ve,Ue,Ge,Ke,Xe,Je,Qe,Ye;let Ze=G.findIndex(e=>e===$);-1===Ze&&(Ze=1);const[ei,ii]=t.useState(!0),[ti,ni]=t.useState(!1),[oi,li]=t.useState(!1),[ri,si]=t.useState(Ze),[di]=t.useState(Ze),[ai,ci]=t.useState(!0),pi="review"===Se,xi=G[ri],gi=K[xi]||"#BA7517",ui=ri!==di,vi=[{id:"iterate",icon:ee.iterateIcon||e.jsx(i.PenLine,{size:16,color:"#64748B"}),label:U.btnIterate||"Iterate",color:"#64748B",onClick:q},{id:"accept",icon:ee.acceptIcon||e.jsx(i.CheckCircle,{size:16,color:"#10B981"}),label:U.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:ee.rejectIcon||e.jsx(i.XCircle,{size:16,color:"#DC2626"}),label:U.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:hi,redlineConfig:mi,updateRedlineDataParent:yi}=s.useRequirementAI(),fi=J||vi;return e.jsxs("div",{onClick:e=>{e.stopPropagation()},style:{...y,...null===(De=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===De?void 0:De.root},children:[e.jsxs("div",{style:{...f,...null===(Fe=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Fe?void 0:Fe.header,marginBottom:pi?14:oi?"16px":"12px",...pi&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[pi?e.jsxs("div",{style:{minWidth:0,flex:"1 1 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:ke||ee.summaryIcon||"⏳"}),e.jsx("span",{children:be||"Redline In Review"})]}),e.jsx("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Ce||(null===(ze=null==x?void 0:x.redlining_details)||void 0===ze?void 0:ze.redline_title)})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{children:ee.summaryIcon||e.jsx(i.Info,{size:16,color:"#E24B4A"})}),e.jsx("span",{style:{...j,...null===(Le=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Le?void 0:Le.title},children:U.summaryHeader||"Summary"})]}),ye&&ye.length>0&&e.jsx(N,{users:ye,onClick:e=>{e.stopPropagation(),null==fe||fe()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(me||ie||te)&&e.jsx(O,{onAssignClick:me,onOpenCognitive:ie,cognitiveIconSmall:ue,cognitiveTootipTitle:xe,historyIconSmall:ne,onHistoryClick:te,historyTootipTitle:oe}),e.jsx("button",{onClick:p,style:{...A,...null===(Me=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Me?void 0:Me.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),pi&&Te&&Ie.length>0&&e.jsx(P,{steps:Ie}),!Re&&!pi&&e.jsx(e.Fragment,{children:e.jsx(r.Tooltip,{title:null===(He=null==x?void 0:x.redlining_details)||void 0===He?void 0:He.redline_title,children:e.jsx("p",{style:{...w,...null===(_e=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===_e?void 0:_e.bodyText},children:null===(qe=null==x?void 0:x.redlining_details)||void 0===qe?void 0:qe.redline_title})})}),e.jsx("p",{style:{...S,...null===(Oe=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.summary},children:null===(Ne=null==x?void 0:x.redlining_details)||void 0===Ne?void 0:Ne.redline_summary}),e.jsxs("div",{style:{...b,...null===(Pe=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.impactContainer},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>ii(!ei),style:{...k,...null===($e=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===$e?void 0:$e.impactToggle},children:[e.jsx("span",{style:{...I,...null===(Ve=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Ve?void 0:Ve.impactToggleLabel},children:U.impactHeader||"Impact"}),e.jsx("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ei?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#E24B4A"})})]}),e.jsx(v,{type:(null==x?void 0:x.severity)||"Medium",customStyles:Z})]}),ei&&e.jsx(e.Fragment,{children:e.jsx("div",{style:{...C,...null===(Ue=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Ue?void 0:Ue.impactText},children:e.jsx(a.AiReasonMarkdownWrapper,{message:`${null!==(Ke=null===(Ge=null==x?void 0:x.redlining_details)||void 0===Ge?void 0:Ge.redline_impact)&&void 0!==Ke?Ke:U.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Xe=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.impactMarkdown})})})]}),pi&&Be&&e.jsxs("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e.jsxs("button",{onClick:()=>ci(e=>!e),style:{background:"none",border:"none",padding:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",color:"#1E293B",fontSize:21,fontWeight:600},children:[e.jsx("span",{children:Ee}),e.jsx(i.ChevronDown,{size:18,color:"#1E293B",style:{transform:ai?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),ai&&e.jsxs("div",{style:{marginTop:10,border:"1px solid #CBD5E1",borderRadius:12,padding:"16px 20px",background:"#F8FAFC",color:"#475569",fontSize:20,lineHeight:1.7,fontStyle:"italic",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.08)"},children:["“",Ae||"","”"]})]}),e.jsx("div",{style:{...T,...null===(Je=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Je?void 0:Je.actionContainer},children:fi.map(i=>{var t,n;const o=Q||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e.jsxs("button",{style:{...B,...null===(n=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtn,color:i.color,...i.style,...l},onClick:o?void 0:async()=>{var e,t;if(i.useLabel)try{await(null===(e=i.onClick)||void 0===e?void 0:e.call(i))}finally{await(async e=>{var i,t,n,o,l,r;null==_||_({status:"loading",action:e,metadata:{redlineId:je,aiReasonId:we}});try{const{updated_reqai:s}=await d.resolveRedline({documentId:hi,userEmail:null==mi?void 0:mi.userEmail,userName:null==mi?void 0:mi.userName,redlineId:null!==(i=null==x?void 0:x.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==mi?void 0:mi.baseApiUrl,redlineConfigId:null!==(t=null==mi?void 0:mi.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==mi?void 0:mi.token)&&void 0!==n?n:"");await(null==yi?void 0:yi(s)),c.default.emit(`redline-edit:${hi}:${null===(r=null===(l=null===(o=null==s?void 0:s.artifactData)||void 0===o?void 0:o.userStorySnapshot)||void 0===l?void 0:l[0])||void 0===r?void 0:r.artifactId}`,{updatedBy:null==mi?void 0:mi.userName}),null==_||_({status:"success",action:e,metadata:{redlineId:je,aiReasonId:we}})}catch(i){null==_||_({status:"failed",action:e,metadata:{redlineId:je,aiReasonId:we}})}})(i.id.toLowerCase())}else await(null===(t=i.onClick)||void 0===t?void 0:t.call(i))},disabled:o,children:[i.icon,i.label]},i.id)})}),le&&e.jsxs("div",{style:{...E,...null===(Qe=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.toneContainer},children:[e.jsxs("button",{onClick:()=>ni(!ti),style:{...R,...null===(Ye=null==Y?void 0:Y.DeviationSummaryStyles)||void 0===Ye?void 0:Ye.toneToggleBtn},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(u,{toneIndex:ri,configs:X}),e.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:U.toneHeader||"Redline Tone"})]}),e.jsx("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ti?"rotate(180deg)":"rotate(0deg)"},children:e.jsx(i.ChevronDown,{size:16,color:"#111"})})]}),ti&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:U.toneDescription||"Controls how assertively AI is redlining"}),e.jsx(n.ToneToggle,{isDirty:ui,onToneChange:e=>{si(e)},toneColor:gi,toneIndex:ri,onClickRegenerate:()=>null==V?void 0:V(xi),toneLabels:G,isStreaming:he,aiReason:x})]})]}),ie&&e.jsxs("div",{className:null==ce?void 0:ce.section,onClick:e=>{e.stopPropagation(),ie&&ie(e)},style:{...W,...null==ae?void 0:ae.section,...re},children:[e.jsxs("div",{className:null==ce?void 0:ce.headerLeft,style:{...D,...null==ae?void 0:ae.headerLeft},children:[e.jsx("span",{className:null==ce?void 0:ce.titleIcon,style:{...F,...null==ae?void 0:ae.titleIcon},children:null!=ge?ge:e.jsx(o.ReactComponent,{})}),e.jsx("div",{className:null==ce?void 0:ce.cognitiveTitle,style:{...z,...null==ae?void 0:ae.cognitiveTitle},children:pe})]}),e.jsxs("div",{className:null==ce?void 0:ce.headerRight,style:{...L,...null==ae?void 0:ae.headerRight},children:[void 0!==(null==x?void 0:x.relevance_score)&&null!==(null==x?void 0:x.relevance_score)?e.jsxs("span",{className:null==ce?void 0:ce.scoreBadge,style:{...M,...null==ae?void 0:ae.scoreBadge,...se},children:[e.jsx(l.ReactComponent,{}),e.jsxs("span",{className:null==ce?void 0:ce.scoreText,style:{...H,...null==ae?void 0:ae.scoreText,...de},children:[Math.round(Number(x.relevance_score)),"%"]})]}):null,ve&&e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(i.ChevronRight,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var t,n,o,l;if(e.displayVariant!==i.displayVariant)return!1;if(e.reviewTitle!==i.reviewTitle)return!1;if(e.reviewSubtitle!==i.reviewSubtitle)return!1;if(e.showReviewProgress!==i.showReviewProgress)return!1;if(e.showOriginalText!==i.showOriginalText)return!1;if(e.originalText!==i.originalText)return!1;if(e.hideSummaryText!==i.hideSummaryText)return!1;if(e.hideSeverityChip!==i.hideSeverityChip)return!1;if((null!==(n=null===(t=e.reviewSteps)||void 0===t?void 0:t.length)&&void 0!==n?n:0)!==(null!==(l=null===(o=i.reviewSteps)||void 0===o?void 0:o.length)&&void 0!==l?l:0))return!1;if(e.reviewSteps&&i.reviewSteps){if(e.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|")!==i.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|"))return!1}return!0});exports.AssignMenu=q,exports.DisplayUsers=N,exports.KebabMenu=O,exports.default=$;
|
|
2
2
|
//# sourceMappingURL=DeviationSummary.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("./IterateComponent.js");exports.default=function({onBack:o,onApply:n,historicalClausesData:i=[],isLoadingHistory:s,headerTitle:l="Historical Recommendations",customStyles:a={}}){const d={...r.styles,...a},c=({clause:r})=>{const[
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("./IterateComponent.js");exports.default=function({onBack:o,onApply:n,historicalClausesData:i=[],isLoadingHistory:s,headerTitle:l="Historical Recommendations",customStyles:a={}}){const d={...r.styles,...a},c=({clause:r,index:o})=>{const[i,s]=t.useState(!1),[l,a]=t.useState(!1),[c,p]=t.useState(!1),x=t.useRef(null),[u,f]=t.useState(!1),h=r.title||r.filename,g=r.content||r.excerpt||"",b=((e=0)=>e>=80?{bg:"#dcfce7",text:"#166534",border:"#bbf7d0"}:e>=50?{bg:"#fef9c3",text:"#854d0e",border:"#fef08a"}:{bg:"#fee2e2",text:"#991b1b",border:"#fecaca"})(r.relevance_score),y=c&&h,v=0===o;return t.useEffect(()=>{const e=x.current;if(!e)return;const t=()=>{i||f(e.scrollHeight>e.clientHeight)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[g,i]),e.jsxs("div",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{...d.clauseCard,display:"flex",flexDirection:"column",gap:6,textAlign:"left",backgroundColor:l?"#f8fafc":"#fff",borderColor:l?"#cbd5e1":"#dde5f0",transition:"all 0.2s ease"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",gap:"8px"},children:[e.jsxs("div",{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{position:"relative",flex:1,minWidth:0},children:[e.jsx("p",{style:{...d.clauseFilename,margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:"100%",cursor:"default"},children:h}),y&&e.jsx("div",{style:{position:"absolute",top:v?"100%":"auto",bottom:v?"auto":"100%",marginTop:v?"6px":"0px",marginBottom:v?"0px":"6px",left:0,backgroundColor:"#1E293B",color:"#fff",padding:"6px 10px",borderRadius:"6px",fontSize:"12px",fontWeight:400,zIndex:50,boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",whiteSpace:"normal",wordBreak:"break-word",width:"max-content",maxWidth:"220px",pointerEvents:"none",lineHeight:1.4},children:h})]}),void 0!==r.relevance_score&&e.jsxs("div",{style:{fontSize:11,fontWeight:600,padding:"2px 8px",borderRadius:12,border:`1px solid ${b.border}`,backgroundColor:b.bg,color:b.text,whiteSpace:"nowrap",flexShrink:0},children:[r.relevance_score,"% Match"]})]}),e.jsxs("div",{ref:x,onClick:e=>e.stopPropagation(),style:{...d.clauseExcerpt,margin:0,display:i?"block":"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:i?"unset":3,overflowY:i?"auto":"hidden",overflowX:"hidden",maxHeight:i?"100px":"none",paddingRight:i?"4px":"0px",cursor:"auto"},children:['"',g,'"']}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginTop:"4px"},children:[e.jsx("div",{children:(u||i)&&e.jsx("span",{onClick:e=>{e.stopPropagation(),i&&x.current&&(x.current.scrollTop=0),s(!i)},style:{fontSize:12,color:"#2563EB",fontWeight:500,cursor:"pointer"},children:i?"View Less":"...View More"})}),e.jsx("button",{onClick:()=>null==n?void 0:n({type:"history",value:r}),style:{backgroundColor:"#F8FAFC",color:"#0F172A",border:"1px solid #CBD5E1",borderRadius:"6px",padding:"4px 12px",fontSize:"12px",fontWeight:500,cursor:"pointer",transition:"all 0.2s ease",boxShadow:"0 1px 2px rgba(0,0,0,0.05)"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#F1F5F9",e.currentTarget.style.borderColor="#94A3B8"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#F8FAFC",e.currentTarget.style.borderColor="#CBD5E1"},children:"Proceed"})]})]})};return e.jsxs("div",{style:d.card,children:[e.jsxs("div",{style:d.header,children:[e.jsx("button",{onClick:o,style:d.backBtn,"aria-label":"Go back",children:"‹"}),e.jsx("span",{style:d.headerTitle,children:l})]}),e.jsx("div",{style:{...d.body,paddingTop:12,paddingBottom:16},children:s?e.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"8px",color:"#64748B",fontSize:13},children:[e.jsx("style",{children:"\n @keyframes iterateSpinner {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "}),e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"iterateSpinner 1s linear infinite"},children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),"Fetching recommendations..."]}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,maxHeight:"40vh",overflowY:"auto",paddingRight:"4px"},children:[null==i?void 0:i.map((t,r)=>e.jsx(c,{clause:t,index:r},t.id)),(!i||0===i.length)&&e.jsx("p",{style:{fontSize:12,color:"#aaa",textAlign:"center",padding:"12px 0"},children:"No clauses found"})]})})]})};
|
|
2
2
|
//# sourceMappingURL=HistoryMenu.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("lucide-react"),l=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),n=require("../../../../../service/redlineService.js"),d=require("../cws/CwsEvent.js");require("react");const t={popup:{width:400,background:"#fff",borderRadius:12,overflow:"hidden",boxShadow:"0 10px 30px rgba(0,0,0,0.15)",fontFamily:"Inter, sans-serif"},actionBtnDisabled:{opacity:.5,cursor:"not-allowed",pointerEvents:"none"},header:{background:"#dfe7f8",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 14px"},title:{fontSize:14,fontWeight:600,color:"#313949"},closeButton:{border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"#616b7d"},content:{padding:"16px 22px"},labelRow:{display:"flex",alignItems:"center",gap:10,marginBottom:8},labelIcon:{fontSize:18},label:{fontSize:14,color:"#7b8495"},editorInfo:{fontSize:14,fontWeight:500,color:"#313949"},divider:{margin:"14px 0",height:1,background:"#e5e7eb"},actions:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:15},resolveActions:{display:"flex",justifyContent:"space-between",gap:15,alignItems:"center"},actionBtn:{border:"1px solid #d5dbe8",background:"#fff",borderRadius:10,padding:"8px",fontSize:14,cursor:"pointer",display:"flex",alignItems:"center",gap:10,color:"#596275"}};exports.default=function({onClose:o,editorInfo:r,headerText:a,btnsConfig:s,labelText:c,onActionTrigger:u,aiReason:v=null}){var p,f;const{redlineDcoumentId:x,redlineConfig:b,updateRedlineDataParent:g}=l.useRequirementAI(),y=async e=>{var i,l,t,o,r,a,s;null==u||u({status:"loading",action:e,metadata:{redlineId:null==v?void 0:v.redline_id,aiReasonId:null==v?void 0:v.id}});try{const{updated_reqai:c}=await n.resolveRedline({documentId:x,userEmail:null==b?void 0:b.userEmail,userName:null==b?void 0:b.userName,redlineId:null!==(i=null==v?void 0:v.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==b?void 0:b.baseApiUrl,redlineConfigId:null!==(l=null==b?void 0:b.redlineConfigId)&&void 0!==l?l:""},null!==(t=null==b?void 0:b.token)&&void 0!==t?t:"");await(null==g?void 0:g(c)),null===(o=d.default.emit)||void 0===o||o.call(d.default,`redline-edit:${x}:${null===(s=null===(a=null===(r=null==c?void 0:c.artifactData)||void 0===r?void 0:r.userStorySnapshot)||void 0===a?void 0:a[0])||void 0===s?void 0:s.artifactId}`,{updatedBy:null==b?void 0:b.userName}),null==u||u({status:"success",action:e,metadata:{redlineId:null==v?void 0:v.redline_id,aiReasonId:null==v?void 0:v.id}})}catch(i){null==u||u({status:"failed",action:e,metadata:{redlineId:null==v?void 0:v.redline_id,aiReasonId:null==v?void 0:v.id}})}};return e.jsxs("div",{style:t.popup,children:[e.jsxs("div",{style:t.header,children:[e.jsx("span",{style:t.title,children:a||"Manually Edited"}),e.jsx("button",{onClick:o,style:t.closeButton,"aria-label":"Close",children:"✕"})]}),e.jsxs("div",{style:t.content,children:[e.jsxs("div",{style:t.labelRow,children:[e.jsx(i.UserPen,{}),e.jsx("span",{style:t.label,children:c||"Edited By"})]}),e.jsx("div",{style:t.editorInfo,children:r}),e.jsx("div",{style:t.divider}),e.jsxs("div",{style:t.actions,children:[null==s?void 0:s.map(i=>e.jsxs("button",{style:{...t.actionBtn,...i.style||{}},onClick:e=>i.onClick(e,{redlineId:null==v?void 0:v.redline_id,id:null==v?void 0:v.id}),children:[i.icon," ",i.text]})),!("accepted"===(null===(p=null==v?void 0:v.redlining_details)||void 0===p?void 0:p.status)||"rejected"===(null===(f=null==v?void 0:v.redlining_details)||void 0===f?void 0:f.status))&&e.jsxs("div",{style:t.resolveActions,children:[e.jsxs("button",{style:{...t.actionBtn,...(null==v?void 0:v.resolving)?t.actionBtnDisabled:{}},disabled:null==v?void 0:v.resolving,onClick:()=>y("accept"),children:[e.jsx(i.CheckCircle,{size:16,color:"#10B981"})," ","Adopt"]}),e.jsxs("button",{style:{...t.actionBtn,...(null==v?void 0:v.resolving)?t.actionBtnDisabled:{}},onClick:()=>y("reject"),disabled:null==v?void 0:v.resolving,children:[e.jsx(i.XCircle,{size:16,color:"#DC2626"})," ","Reject"]})]})]})]})]})};
|
|
2
2
|
//# sourceMappingURL=ManualEditPopup.js.map
|
package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lucide-react"),i=require("react"),o=require("./PopupDefaults.js"),n=require("@mui/material"),r=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),s=require("./DeviationSummary.js"),l=require("../../../../../service/redlineService.js"),a=require("../../RequirementAIWrapper/RequirementAIWrapper.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(i);function x(e){const t=new Date(e);if(isNaN(t.getTime()))return e;return new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}).replace(" AM","AM").replace(" PM","PM")}const h=()=>e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e.jsx("circle",{cx:"11",cy:"11",r:"10",stroke:"#22c55e",strokeWidth:"2",fill:"#f0fdf4"}),e.jsx("path",{d:"M6.5 11.5l3 3 6-6",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),u=()=>e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e.jsx("circle",{cx:"11",cy:"11",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"#fff1f2"}),e.jsx("path",{d:"M7.5 7.5l7 7M14.5 7.5l-7 7",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}),p=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#94a3b8",strokeWidth:"1.8",strokeLinecap:"round"})}),g=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e.jsx("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M11 8.5l1.5 1.5 2.5-2.5",stroke:"#22c55e",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),f=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e.jsx("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M11.5 8l3 3m0-3l-3 3",stroke:"#ef4444",strokeWidth:"1.4",strokeLinecap:"round"})]}),j=({open:t})=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",style:{transform:t?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.25s ease"},children:e.jsx("path",{d:"M4.5 11.25L9 6.75l4.5 4.5",stroke:"#64748b",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),b=({color:t="#3b82f6"})=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M1.5 8A6.5 6.5 0 1 0 4 3.2",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M1.5 3.5v4h4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 5v3.5l2 1.5",stroke:t,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),k=()=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M13.5 8a5.5 5.5 0 1 0-1.6 3.9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M13.5 13v-4.5H9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),v=()=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M2 8h12M10 4l4 4-4 4",stroke:"#64748b",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M4 5l-2 3 2 3",stroke:"#64748b",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]});function y({title:t,open:i,onToggle:o,children:n}){return e.jsxs("div",{children:[e.jsxs("div",{onClick:o,style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none",padding:"2px 0"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:t}),e.jsx(j,{open:i})]}),e.jsx("div",{style:{maxHeight:i?100:0,opacity:i?1:0,transition:"max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s"},children:i&&e.jsx(e.Fragment,{children:n})})]})}function m({icon:t,label:i,onClick:o,customStyle:n={},disabled:r=!1,disabledStyle:s={}}){const l={display:"flex",alignItems:"center",gap:10,padding:"8px",background:"#f8fafc",border:"1.5px solid #e2e8f0",borderRadius:10,cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:600,color:"#475569",fontFamily:"inherit",transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s",whiteSpace:"nowrap",opacity:r?.5:1,...n,...r?s:{}};return e.jsxs("button",{onClick:r?void 0:o,disabled:r,style:l,onMouseEnter:e=>{r||(e.currentTarget.style.background="#f1f5f9",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.07)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="#f8fafc",e.currentTarget.style.transform="",e.currentTarget.style.boxShadow="")},children:[t,i]})}function w({steps:i}){if(!(null==i?void 0:i.length))return null;const o=i.length>=3;return e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:o?"6px 8px":"8px 10px",background:"#F8FAFC",gap:o?4:8,overflow:"hidden"},children:i.map((n,r)=>{const s=(e=>{const t=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return t[e%t.length]})(r),l=r===i.length-1;return e.jsxs(c.default.Fragment,{children:[e.jsxs("span",{title:n.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:o?4:6,overflow:"hidden"},children:[(a=n.status,"approved"===a?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"16",height:o?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):"rejected"===a?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"16",height:o?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m15 9-6 6"}),e.jsx("path",{d:"m9 9 6 6"})]}):e.jsx(t.Hourglass,{size:o?14:16,color:"#F59E0B",style:{flexShrink:0}})),e.jsx("span",{style:{minWidth:0,color:"#475569",fontSize:o?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.label}),n.initials&&e.jsx("span",{style:{width:o?20:22,height:o?20:22,minWidth:o?20:22,borderRadius:"50%",background:s.bg,color:s.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:o?9:10,fontWeight:700,lineHeight:1},children:n.initials})]}),!l&&e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"18",height:o?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:o?14:18},children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})]},n.id);var a})})})}exports.ApprovedIcon=h,exports.ChevronIcon=j,exports.CloseIcon=p,exports.HistoryIcon=b,exports.IterateIcon=v,exports.RedlineCard=function({status:d,onClose:c,impactText:j,secondText:C,actionTakenByName:I,actionTakenAtTime:B="NA",onHistory:S,onIterate:R,onActionTrigger:L,disableAllActions:T=!1,impactTitle:W="Impact",customConfigs:A={},customStyles:M={},secondaryTitle:D,onAssignClick:F,onReviewUsersClick:E,assignedUsers:z,redlineId:H,aiReasonId:U,cognitiveIconSmall:q,cognitiveTootipTitle:N="Cognitive Decisioning",historyIconSmall:O,onHistoryClick:P,historyTootipTitle:$,onOpenCognitive:_,displayVariant:V="default",reviewTitle:K,reviewSubtitle:Y,reviewStatusIcon:G=e.jsx(t.Hourglass,{size:18}),reviewSteps:J=[],showReviewProgress:Q=!1,showOriginalText:X=!1,originalText:Z,originalTextHeader:ee="Original text",hideMeta:te=!1}){const[ie,oe]=i.useState(!0),[ne,re]=i.useState(!0),[se,le]=i.useState(!1);i.useState(!1);const[ae,de]=i.useState(!0),ce="review"===V||"review"===d,{redlineDcoumentId:xe,redlineConfig:he,updateRedlineDataParent:ue}=a.useRequirementAI(),pe={headerBg:"#f0fdf4",headerBorder:"#dcfce7",titleColor:"#166534",label:"Redline Approved",metaLabel:"Approved By",UserIcon:e.jsx(g,{}),StatusIcon:e.jsx(h,{}),secondTitle:"Original text",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!0,actions:[{icon:e.jsx(b,{}),label:"History",onClick:S},{icon:e.jsx(t.Undo2,{size:17}),label:"Revert",useLabel:!0},{icon:e.jsx(v,{}),label:"Iterate",onClick:R}],fallbackText:"No original text available"},ge={headerBg:"#fff1f2",headerBorder:"#fecdd3",titleColor:"#991b1b",label:"Redline Rejected",metaLabel:"Rejected By",UserIcon:e.jsx(f,{}),StatusIcon:e.jsx(u,{}),secondTitle:"Rejected Recommendation",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!1,actions:[{icon:e.jsx(b,{color:"#3b82f6"}),label:"History",onClick:S},{icon:e.jsx(k,{}),label:"Reinstate",useLabel:!0},{icon:e.jsx(v,{}),label:"Iterate",onClick:R}],fallbackText:"No rejected recommendation available"},fe={headerBg:"#E2E8F0",headerBorder:"none",titleColor:"#1E293B",label:"Redline Reverted",metaLabel:"Reverted By",UserIcon:e.jsx(g,{}),StatusIcon:e.jsx(t.Undo2,{size:17}),secondTitle:"Reverted redline",secondBg:"#F9FAFB",secondBorder:"#D0D5DD",impactBox:!1,actions:[{icon:e.jsx(b,{}),label:"History",onClick:S},{icon:e.jsx(v,{}),label:"Iterate",onClick:R}],fallbackText:"No reverted redline available"},je={headerBg:"#F8FAFC",headerBorder:"#E2E8F0",titleColor:"#1E293B",label:K||"Redline In Review",metaLabel:"Current Status",UserIcon:e.jsx(t.Hourglass,{size:16,color:"#94A3B8"}),StatusIcon:G,secondTitle:ee,secondBg:"#F8FAFC",secondBorder:"#CBD5E1",impactBox:!0,actions:[{icon:e.jsx(b,{}),label:"History",onClick:S},{icon:e.jsx(h,{}),label:"Approve",action:"accept",useLabel:!0},{icon:e.jsx(u,{}),label:"Reject",action:"reject",useLabel:!0},{icon:e.jsx(v,{}),label:"Iterate",onClick:R}],fallbackText:"No original text available"};let be;be=ce?je:"accepted"===d?pe:"rejected"===d?ge:fe;const ke={...be,...A[d]||{}},ve=ce&&Y||D;return e.jsxs("div",{style:{...o.default.RedlineCardDefaults.root,animation:se?"slideOut 0.26s cubic-bezier(0.4,0,1,1) forwards":o.default.RedlineCardDefaults.root.animation,...M.root},children:[e.jsxs("div",{style:{...o.default.RedlineCardDefaults.header,background:ke.headerBg,borderBottom:`1.5px solid ${ke.headerBorder}`,...M.header},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:ke.StatusIcon}),e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:15,fontWeight:700,color:ke.titleColor,letterSpacing:"-0.01em"},children:ke.label}),e.jsx(n.Tooltip,{title:ve,children:e.jsx("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",fontSize:12,color:"gray"},children:ve})})]}),z&&z.length>0&&e.jsx(s.DisplayUsers,{users:z,onClick:e=>{e.stopPropagation(),null==E||E()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(F||_||P)&&e.jsx(s.KebabMenu,{onAssignClick:F,onOpenCognitive:_,cognitiveIconSmall:q,cognitiveTootipTitle:N,historyIconSmall:O,onHistoryClick:P,historyTootipTitle:$}),e.jsx("button",{onClick:()=>{le(!0),c()},style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,display:"flex",alignItems:"center"},children:e.jsx(p,{})})]})]}),ce&&Q&&J.length>0&&e.jsx("div",{style:{padding:"10px 14px 0"},children:e.jsx(w,{steps:J})}),e.jsxs("div",{style:{...o.default.RedlineCardDefaults.body,...M.body},children:[!ce&&!te&&e.jsxs("div",{style:{...o.default.RedlineCardDefaults.meta,...M.meta},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:5},children:[ke.UserIcon,e.jsx("span",{style:{fontSize:12.5,color:"#94a3b8",fontWeight:500},children:ke.metaLabel})]}),e.jsxs("div",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:[e.jsx(n.Tooltip,{title:I,children:e.jsx("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:I})}),e.jsx("span",{children:x(B)})]})]}),!ce&&!te&&e.jsx("div",{style:{...o.default.RedlineCardDefaults.divider,...M.divider}}),e.jsx(y,{title:W,open:ie,onToggle:()=>oe(e=>!e),children:e.jsx("div",{style:{...o.default.RedlineCardDefaults.impactText,...M.impactText},children:e.jsx(r.AiReasonMarkdownWrapper,{message:`${j||""} [View chat](chat_citation$all)`,customStyles:M.impactMarkdown})})}),e.jsx("div",{style:{...o.default.RedlineCardDefaults.divider,...M.divider}}),e.jsx(y,{title:ce&&X?ee:ke.secondTitle,open:ce&&X?ae:ne,onToggle:()=>{ce&&X?de(e=>!e):re(e=>!e)},children:(ce&&X?Z:C)?e.jsx("div",{style:{...o.default.RedlineCardDefaults.secondSection,background:ke.secondBg,border:`1.5px solid ${ke.secondBorder}`,...M.secondSection},children:ce&&X?Z:C}):e.jsxs("div",{style:{...o.default.RedlineCardDefaults.fallbackSectionStyle,...M.fallbackSectionStyle},children:[ke.fallbackText," "]})}),e.jsx("div",{style:{...o.default.RedlineCardDefaults.actionsContainer,...M.actionsContainer},children:ke.actions.map(t=>e.jsx(m,{icon:t.icon,label:t.label,onClick:()=>{var e;t.useLabel?(async e=>{var t,i;null==L||L({status:"loading",action:e,metadata:{redlineId:H,aiReasonId:U}});try{const{updated_reqai:o}=await l.resolveRedline({documentId:xe,userEmail:null==he?void 0:he.userEmail,userName:null==he?void 0:he.userName,redlineId:null!=H?H:"",action:e,baseApiUrl:null==he?void 0:he.baseApiUrl,redlineConfigId:null!==(t=null==he?void 0:he.redlineConfigId)&&void 0!==t?t:""},null!==(i=null==he?void 0:he.token)&&void 0!==i?i:"");await(null==ue?void 0:ue(o)),null==L||L({status:"success",action:e,metadata:{redlineId:H,aiReasonId:U}})}catch(t){null==L||L({status:"failed",action:e,metadata:{redlineId:H,aiReasonId:U}})}})((t.action||t.label).toLowerCase()):null===(e=t.onClick)||void 0===e||e.call(t)},customStyle:{...t.style,...M.actionBtn},disabled:T||t.disabled,disabledStyle:M.actionBtnDisabled},t.label))})]})]})},exports.ReinstateIcon=k,exports.RejectedIcon=u,exports.UserApprovedIcon=g,exports.UserRejectedIcon=f,exports.formatDate=x;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lucide-react"),i=require("react"),o=require("./PopupDefaults.js"),n=require("@mui/material"),r=require("../../ai-reasoning/AiReasonMarkdownWrapper.js"),s=require("./DeviationSummary.js"),l=require("../../../../../service/redlineService.js"),a=require("../../RequirementAIWrapper/RequirementAIWrapper.js"),d=require("../cws/CwsEvent.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=c(i);function h(e){const t=new Date(e);if(isNaN(t.getTime()))return e;return new Date(e).toLocaleString("en-US",{month:"2-digit",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0}).replace(" AM","AM").replace(" PM","PM")}const u=()=>e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e.jsx("circle",{cx:"11",cy:"11",r:"10",stroke:"#22c55e",strokeWidth:"2",fill:"#f0fdf4"}),e.jsx("path",{d:"M6.5 11.5l3 3 6-6",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),p=()=>e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:[e.jsx("circle",{cx:"11",cy:"11",r:"10",stroke:"#ef4444",strokeWidth:"2",fill:"#fff1f2"}),e.jsx("path",{d:"M7.5 7.5l7 7M14.5 7.5l-7 7",stroke:"#ef4444",strokeWidth:"2",strokeLinecap:"round"})]}),f=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#94a3b8",strokeWidth:"1.8",strokeLinecap:"round"})}),g=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e.jsx("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M11 8.5l1.5 1.5 2.5-2.5",stroke:"#22c55e",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),j=()=>e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("circle",{cx:"6.5",cy:"5.5",r:"2.5",stroke:"#94a3b8",strokeWidth:"1.4"}),e.jsx("path",{d:"M1.5 13.5c0-3.038 2.462-5.5 5-5.5s5 2.462 5 5.5",stroke:"#94a3b8",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("path",{d:"M11.5 8l3 3m0-3l-3 3",stroke:"#ef4444",strokeWidth:"1.4",strokeLinecap:"round"})]}),v=({open:t})=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",style:{transform:t?"rotate(0deg)":"rotate(180deg)",transition:"transform 0.25s ease"},children:e.jsx("path",{d:"M4.5 11.25L9 6.75l4.5 4.5",stroke:"#64748b",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),b=({color:t="#3b82f6"})=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M1.5 8A6.5 6.5 0 1 0 4 3.2",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M1.5 3.5v4h4",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 5v3.5l2 1.5",stroke:t,strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),k=()=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M13.5 8a5.5 5.5 0 1 0-1.6 3.9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M13.5 13v-4.5H9",stroke:"#3b82f6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),y=()=>e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",children:[e.jsx("path",{d:"M2 8h12M10 4l4 4-4 4",stroke:"#64748b",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M4 5l-2 3 2 3",stroke:"#64748b",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]});function m({title:t,open:i,onToggle:o,children:n}){return e.jsxs("div",{children:[e.jsxs("div",{onClick:o,style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",userSelect:"none",padding:"2px 0"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:t}),e.jsx(v,{open:i})]}),e.jsx("div",{style:{maxHeight:i?100:0,opacity:i?1:0,transition:"max-height 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.25s"},children:i&&e.jsx(e.Fragment,{children:n})})]})}function w({icon:t,label:i,onClick:o,customStyle:n={},disabled:r=!1,disabledStyle:s={}}){const l={display:"flex",alignItems:"center",gap:10,padding:"8px",background:"#f8fafc",border:"1.5px solid #e2e8f0",borderRadius:10,cursor:r?"not-allowed":"pointer",fontSize:"12px",fontWeight:600,color:"#475569",fontFamily:"inherit",transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s",whiteSpace:"nowrap",opacity:r?.5:1,...n,...r?s:{}};return e.jsxs("button",{onClick:r?void 0:o,disabled:r,style:l,onMouseEnter:e=>{r||(e.currentTarget.style.background="#f1f5f9",e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.07)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="#f8fafc",e.currentTarget.style.transform="",e.currentTarget.style.boxShadow="")},children:[t,i]})}function C({steps:i}){if(!(null==i?void 0:i.length))return null;const o=i.length>=3;return e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:e.jsx("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:o?"6px 8px":"8px 10px",background:"#F8FAFC",gap:o?4:8,overflow:"hidden"},children:i.map((n,r)=>{const s=(e=>{const t=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return t[e%t.length]})(r),l=r===i.length-1;return e.jsxs(x.default.Fragment,{children:[e.jsxs("span",{title:n.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:o?4:6,overflow:"hidden"},children:[(a=n.status,"approved"===a?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"16",height:o?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}):"rejected"===a?e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"16",height:o?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m15 9-6 6"}),e.jsx("path",{d:"m9 9 6 6"})]}):e.jsx(t.Hourglass,{size:o?14:16,color:"#F59E0B",style:{flexShrink:0}})),e.jsx("span",{style:{minWidth:0,color:"#475569",fontSize:o?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.label}),n.initials&&e.jsx("span",{style:{width:o?20:22,height:o?20:22,minWidth:o?20:22,borderRadius:"50%",background:s.bg,color:s.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:o?9:10,fontWeight:700,lineHeight:1},children:n.initials})]}),!l&&e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:o?"14":"18",height:o?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:o?14:18},children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"m12 5 7 7-7 7"})]})]},n.id);var a})})})}exports.ApprovedIcon=u,exports.ChevronIcon=v,exports.CloseIcon=f,exports.HistoryIcon=b,exports.IterateIcon=y,exports.RedlineCard=function({status:c,onClose:x,impactText:v,secondText:I,actionTakenByName:B,actionTakenAtTime:S="NA",onHistory:R,onIterate:L,onActionTrigger:T,disableAllActions:W=!1,impactTitle:A="Impact",customConfigs:M={},customStyles:D={},secondaryTitle:F,onAssignClick:E,onReviewUsersClick:z,assignedUsers:H,redlineId:U,aiReasonId:q,cognitiveIconSmall:N,cognitiveTootipTitle:O="Cognitive Decisioning",historyIconSmall:P,onHistoryClick:$,historyTootipTitle:_,onOpenCognitive:V,displayVariant:K="default",reviewTitle:Y,reviewSubtitle:G,reviewStatusIcon:J=e.jsx(t.Hourglass,{size:18}),reviewSteps:Q=[],showReviewProgress:X=!1,showOriginalText:Z=!1,originalText:ee,originalTextHeader:te="Original text",hideMeta:ie=!1}){const[oe,ne]=i.useState(!0),[re,se]=i.useState(!0),[le,ae]=i.useState(!1);i.useState(!1);const[de,ce]=i.useState(!0),xe="review"===K||"review"===c,{redlineDcoumentId:he,redlineConfig:ue,updateRedlineDataParent:pe}=a.useRequirementAI(),fe={headerBg:"#f0fdf4",headerBorder:"#dcfce7",titleColor:"#166534",label:"Redline Approved",metaLabel:"Approved By",UserIcon:e.jsx(g,{}),StatusIcon:e.jsx(u,{}),secondTitle:"Original text",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!0,actions:[{icon:e.jsx(b,{}),label:"History",onClick:R},{icon:e.jsx(t.Undo2,{size:17}),label:"Revert",useLabel:!0},{icon:e.jsx(y,{}),label:"Iterate",onClick:L}],fallbackText:"No original text available"},ge={headerBg:"#fff1f2",headerBorder:"#fecdd3",titleColor:"#991b1b",label:"Redline Rejected",metaLabel:"Rejected By",UserIcon:e.jsx(j,{}),StatusIcon:e.jsx(p,{}),secondTitle:"Rejected Recommendation",secondBg:"#f8fafc",secondBorder:"#e2e8f0",impactBox:!1,actions:[{icon:e.jsx(b,{color:"#3b82f6"}),label:"History",onClick:R},{icon:e.jsx(k,{}),label:"Reinstate",useLabel:!0},{icon:e.jsx(y,{}),label:"Iterate",onClick:L}],fallbackText:"No rejected recommendation available"},je={headerBg:"#E2E8F0",headerBorder:"none",titleColor:"#1E293B",label:"Redline Reverted",metaLabel:"Reverted By",UserIcon:e.jsx(g,{}),StatusIcon:e.jsx(t.Undo2,{size:17}),secondTitle:"Reverted redline",secondBg:"#F9FAFB",secondBorder:"#D0D5DD",impactBox:!1,actions:[{icon:e.jsx(b,{}),label:"History",onClick:R},{icon:e.jsx(y,{}),label:"Iterate",onClick:L}],fallbackText:"No reverted redline available"},ve={headerBg:"#F8FAFC",headerBorder:"#E2E8F0",titleColor:"#1E293B",label:Y||"Redline In Review",metaLabel:"Current Status",UserIcon:e.jsx(t.Hourglass,{size:16,color:"#94A3B8"}),StatusIcon:J,secondTitle:te,secondBg:"#F8FAFC",secondBorder:"#CBD5E1",impactBox:!0,actions:[{icon:e.jsx(b,{}),label:"History",onClick:R},{icon:e.jsx(u,{}),label:"Approve",action:"accept",useLabel:!0},{icon:e.jsx(p,{}),label:"Reject",action:"reject",useLabel:!0},{icon:e.jsx(y,{}),label:"Iterate",onClick:L}],fallbackText:"No original text available"};let be;be=xe?ve:"accepted"===c?fe:"rejected"===c?ge:je;const ke={...be,...M[c]||{}},ye=xe&&G||F;return e.jsxs("div",{style:{...o.default.RedlineCardDefaults.root,animation:le?"slideOut 0.26s cubic-bezier(0.4,0,1,1) forwards":o.default.RedlineCardDefaults.root.animation,...D.root},children:[e.jsxs("div",{style:{...o.default.RedlineCardDefaults.header,background:ke.headerBg,borderBottom:`1.5px solid ${ke.headerBorder}`,...D.header},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:ke.StatusIcon}),e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:15,fontWeight:700,color:ke.titleColor,letterSpacing:"-0.01em"},children:ke.label}),e.jsx(n.Tooltip,{title:ye,children:e.jsx("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden",fontSize:12,color:"gray"},children:ye})})]}),H&&H.length>0&&e.jsx(s.DisplayUsers,{users:H,onClick:e=>{e.stopPropagation(),null==z||z()}})]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(E||V||$)&&e.jsx(s.KebabMenu,{onAssignClick:E,onOpenCognitive:V,cognitiveIconSmall:N,cognitiveTootipTitle:O,historyIconSmall:P,onHistoryClick:$,historyTootipTitle:_}),e.jsx("button",{onClick:()=>{ae(!0),x()},style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:6,display:"flex",alignItems:"center"},children:e.jsx(f,{})})]})]}),xe&&X&&Q.length>0&&e.jsx("div",{style:{padding:"10px 14px 0"},children:e.jsx(C,{steps:Q})}),e.jsxs("div",{style:{...o.default.RedlineCardDefaults.body,...D.body},children:[!xe&&!ie&&e.jsxs("div",{style:{...o.default.RedlineCardDefaults.meta,...D.meta},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:5},children:[ke.UserIcon,e.jsx("span",{style:{fontSize:12.5,color:"#94a3b8",fontWeight:500},children:ke.metaLabel})]}),e.jsxs("div",{style:{fontSize:14,fontWeight:700,color:"#1e293b",letterSpacing:"-0.01em"},children:[e.jsx(n.Tooltip,{title:B,children:e.jsx("span",{style:{display:"-webkit-box",WebkitLineClamp:1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:B})}),e.jsx("span",{children:h(S)})]})]}),!xe&&!ie&&e.jsx("div",{style:{...o.default.RedlineCardDefaults.divider,...D.divider}}),e.jsx(m,{title:A,open:oe,onToggle:()=>ne(e=>!e),children:e.jsx("div",{style:{...o.default.RedlineCardDefaults.impactText,...D.impactText},children:e.jsx(r.AiReasonMarkdownWrapper,{message:`${v||""} [View chat](chat_citation$all)`,customStyles:D.impactMarkdown})})}),e.jsx("div",{style:{...o.default.RedlineCardDefaults.divider,...D.divider}}),e.jsx(m,{title:xe&&Z?te:ke.secondTitle,open:xe&&Z?de:re,onToggle:()=>{xe&&Z?ce(e=>!e):se(e=>!e)},children:(xe&&Z?ee:I)?e.jsx("div",{style:{...o.default.RedlineCardDefaults.secondSection,background:ke.secondBg,border:`1.5px solid ${ke.secondBorder}`,...D.secondSection},children:xe&&Z?ee:I}):e.jsxs("div",{style:{...o.default.RedlineCardDefaults.fallbackSectionStyle,...D.fallbackSectionStyle},children:[ke.fallbackText," "]})}),e.jsx("div",{style:{...o.default.RedlineCardDefaults.actionsContainer,...D.actionsContainer},children:ke.actions.map(t=>e.jsx(w,{icon:t.icon,label:t.label,onClick:()=>{var e;t.useLabel?(async e=>{var t,i,o,n,r,s;null==T||T({status:"loading",action:e,metadata:{redlineId:U,aiReasonId:q}});try{const{updated_reqai:a}=await l.resolveRedline({documentId:he,userEmail:null==ue?void 0:ue.userEmail,userName:null==ue?void 0:ue.userName,redlineId:null!=U?U:"",action:e,baseApiUrl:null==ue?void 0:ue.baseApiUrl,redlineConfigId:null!==(t=null==ue?void 0:ue.redlineConfigId)&&void 0!==t?t:""},null!==(i=null==ue?void 0:ue.token)&&void 0!==i?i:"");await(null==pe?void 0:pe(a)),null===(o=d.default.emit)||void 0===o||o.call(d.default,`redline-edit:${he}:${null===(s=null===(r=null===(n=null==a?void 0:a.artifactData)||void 0===n?void 0:n.userStorySnapshot)||void 0===r?void 0:r[0])||void 0===s?void 0:s.artifactId}`,{updatedBy:null==ue?void 0:ue.userName}),null==T||T({status:"success",action:e,metadata:{redlineId:U,aiReasonId:q}})}catch(t){null==T||T({status:"failed",action:e,metadata:{redlineId:U,aiReasonId:q}})}})((t.action||t.label).toLowerCase()):null===(e=t.onClick)||void 0===e||e.call(t)},customStyle:{...t.style,...D.actionBtn},disabled:W||t.disabled,disabledStyle:D.actionBtnDisabled},t.label))})]})]})},exports.ReinstateIcon=k,exports.RejectedIcon=p,exports.UserApprovedIcon=g,exports.UserRejectedIcon=j,exports.formatDate=h;
|
|
2
2
|
//# sourceMappingURL=RedlineStatusCard.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("lucide-react");exports.default=function({children:n,onRefresh:o,onCancel:t}){return e.jsxs("div",{style:{width:360,background:"#fff",borderRadius:12,border:"1px solid #e5e7eb",boxShadow:"0 10px 30px rgba(0, 0, 0, 0.12)",padding:12,fontFamily:"Inter"},children:[t&&e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx("button",{onClick:t,style:{border:"none",background:"transparent",cursor:"pointer",fontSize:15,color:"#6b7280"},children:e.jsx(r.X,{})})}),e.jsx("div",{style:{fontSize:14,color:"#374151",lineHeight:1.6,marginBottom:5},children:n}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:o&&e.jsx("button",{onClick:o,style:{padding:"8px",borderRadius:8,border:"none",background:"#2563eb",color:"#fff",cursor:"pointer",fontSize:16},children:"Refresh"})})]})};
|
|
2
|
+
//# sourceMappingURL=RedlineToast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedlineToast.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("lucide-react"),n=require("showdown"),o=require("@mui/material"),i=require("../../icons/Illustration.svg.js"),s=require("uuid"),a=require("./UserStoryCard.module.css.js"),r=require("../../utils/helpers.js"),d=require("../../utils/user-story.utils.js"),u=require("../../shared/AtomicButton.js"),c=require("../RichTextEditor/RichTextEditor.js"),v=require("../userstory-with-citation/UserStoryWithCitation.js"),p=require("../RequirementAIWrapper/RequirementAIWrapper.js"),f=require("../story-screen/BigEnoughPanel.js"),m=require("./TitleEditor/TitleEditor.js"),h=require("../../../../service/redlineService.js"),y=require("./ClinicalTrialSection.js"),S=require("../story-screen/CompletionPanel.js"),g=require("../../icons/CDIcon.js");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=C(n);const I={[p.SectionStatus.WAITING]:"WAITING TO GENERATE",[p.SectionStatus.IN_PROGRESS]:"IN PROGRESS",[p.SectionStatus.GENERATED]:"GENERATED",[p.SectionStatus.FAILED]:"FAILED",[p.SectionStatus.GENERATE]:"GENERATE",[p.SectionStatus.APPROVED]:"APPROVED"};function j(t){const n=[],i=/<learned>(.*?)<\/learned>/g;let a,r=0,d=0;for(;null!==(a=i.exec(t));){const[,u]=a,c=a.index;c>r&&n.push(e.jsx("span",{children:t.slice(r,c)},"text-pre-"+d++)),n.push(e.jsx(o.Tooltip,{title:u,placement:"top",children:e.jsx(l.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})},`tooltip-${s.v4()}`)),r=i.lastIndex}return r<(null==t?void 0:t.length)&&n.push(e.jsx("span",{children:t.slice(r)},"text-post-"+d++)),n}function b(e,t,l){var n;if(!e)return{};if(t)return{...e.parentConfig};const o={...e.childConfig};return l&&(null===(n=e.subFeatureOverrides)||void 0===n?void 0:n[l])?{...o,...e.subFeatureOverrides[l]}:o}const w=({displayName:t})=>{var n;const{customStyles:o}=p.useRequirementAI(),i=null===(n=null==o?void 0:o.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return e.jsxs("div",{className:a.default.displayName,style:null==i?void 0:i.wrapper,children:[e.jsx(l.Bookmark,{className:a.default.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e.jsxs("span",{style:null==i?void 0:i.label,children:[t,":"]})]})},N=({isUserStoryCurrentlyUpdated:n,artifactId:C,artifactTitleId:E,parentUserStory:D,currentUserStory:B,onUserStoryChange:A,parentIndex:T,currentIndex:k,enableDownload:U,isDiffEditReviewMode:P,showUserStoryDiff:R,handleDownloadUserStory:M,handleOpenSendDialog:_,updateUserStoryArtifact:q,selectedArtifactId:L,isDisplayHighlightControl:F,elementDisplayConfig:W,_resolvedConfig:O,showWrapper:z=!1,defaultExpanded:V,actionItemsConfig:G,onDelete:$,contextVariant:H,expandedSubFeatures:Q,showDisplayName:Y=!0,allowTitleEdit:X=!0,showConfidenceScore:Z=!0,showBorderTop:J=!0,sectionStatusConfig:K,showCompletionPanel:ee=!1,completionPanelConfig:te,showAddSectionButton:le=!1,disableEditPlan:ne=!1,useMuiTooltip:oe=!1,approveButtonConfig:ie,editButtonConfig:se,CDNeededInChip:ae,blockNumber:re,showWaitingIconInChip:de,showAssignSection:ue=!1,disableAssignSection:ce=!1,onAssignSectionClick:ve})=>{var pe,fe,me,he,ye,Se,ge,Ce,xe,Ie,je,be,we,Ne,Ee,De,Be,Ae,Te,ke,Ue,Pe,Re,Me;const{isLoadingSectionData:_e=!1,onLoadSectionData:qe,status:Le,onStatusClick:Fe,completedCount:We,totalCount:Oe,isNoDataAvailable:ze=!1}=null!=K?K:{},{searchQueryList:Ve,citations:Ge,customStyles:$e,onEditBlocked:He,redlineDcoumentId:Qe,redlineConfig:Ye,customSectionConfig:Xe,updateRedlineDataParent:Ze,aiReasoning:Je}=p.useRequirementAI(),Ke=null==$e?void 0:$e.userStoryCardStyles,et=null==Ke?void 0:Ke.customSectionEditButton,tt=null==Ke?void 0:Ke.statusStyles,lt=null===(pe=null==$e?void 0:$e.userStoryCardStyles)||void 0===pe?void 0:pe.userStoryEditStyles,nt=null===(fe=null==$e?void 0:$e.userStoryScreenStyles)||void 0===fe?void 0:fe.userStoryContentStyles,ot=null==Ke?void 0:Ke.progressHeaderStyles,it=null==Ke?void 0:Ke.clinicalTrialSectionStyles,st=null==Ke?void 0:Ke.CompletionStyles,at=null==Ke?void 0:Ke.noDataStyles,rt=null==Ke?void 0:Ke.approveButtonStyles,dt=null!==(he=null===(me=null==Xe?void 0:Xe.shouldRender)||void 0===me?void 0:me.call(Xe,B))&&void 0!==he&&he,ut=null===(ye=null==Xe?void 0:Xe.getValue)||void 0===ye?void 0:ye.call(Xe,B),ct=null!==(ge=null===(Se=null==Xe?void 0:Xe.getFields)||void 0===Se?void 0:Se.call(Xe,B))&&void 0!==ge?ge:[],vt=null!==(Ce=null==Xe?void 0:Xe.isEditDisabled)&&void 0!==Ce&&Ce,pt=null!==(Ie=null===(xe=null==Xe?void 0:Xe.isSaving)||void 0===xe?void 0:xe.call(Xe,B))&&void 0!==Ie&&Ie,ft=(mt=null!==(je=B.completion_percentage)&&void 0!==je?je:0,ht=st,mt>=80?null==ht?void 0:ht.highCompletion:mt>=50?null==ht?void 0:ht.mediumCompletion:null==ht?void 0:ht.lowCompletion);var mt,ht;const yt={[p.SectionStatus.WAITING]:null==tt?void 0:tt.waiting,[p.SectionStatus.IN_PROGRESS]:null==tt?void 0:tt.inProgress,[p.SectionStatus.GENERATED]:null==tt?void 0:tt.generated,[p.SectionStatus.FAILED]:null==tt?void 0:tt.failed,[p.SectionStatus.GENERATE]:null==tt?void 0:tt.generate,[p.SectionStatus.APPROVED]:null==tt?void 0:tt.approved},[St,gt]=t.useState({...structuredClone(B),value:r.formatMarkdown(B.value)||""}),[Ct,xt]=t.useState({userStory:!!B.isDefaultEdit}),[It,jt]=t.useState(!1),[bt,wt]=t.useState(!1),[Nt,Et]=t.useState(null),[Dt,Bt]=t.useState(null),{userStory:At,customIcons:Tt}=p.useRequirementAI(),[kt,Ut]=t.useState(null!=V?V:""===T||L===B.artifactId||!!B.isDefaultOpen),[Pt,Rt]=t.useState(!1),[Mt,_t]=t.useState(null),[qt,Lt]=t.useState(null),[Ft,Wt]=t.useState(!1),Ot=t.useRef(null),zt=t.useRef(null),[Vt,Gt]=t.useState(!1),[$t,Ht]=t.useState(!1),Qt=t.useRef(null),[Yt,Xt]=t.useState(!1),[Zt,Jt]=t.useState(B.value);t.useEffect(()=>{n&&Ut(n)},[n]),t.useEffect(()=>{gt({...structuredClone(B),value:r.formatMarkdown(B.value)||""})},[B]),t.useEffect(()=>{Ve.length>0?Ut(!0):void 0===V&&L&&Ut(L===B.artifactId)},[Ve,L,B.artifactId]),t.useEffect(()=>{Q&&Q.length>0&&Ut(Q.includes(B.artifactId)||""===T||L===B.artifactId||!!B.isDefaultOpen)},[Q]);const Kt=()=>{_t(null)},el=()=>{Lt(null)},tl=()=>{kt&&Ct.userStory&&zt.current&&!zt.current.requestClose()||Ut(e=>!e)},ll=async()=>{var e,t;try{"userStory"==="userStory"&&(A(St),console.log("I am changing RTE editor values",St)),await(null===(e=null==se?void 0:se.onSaveEditedSection)||void 0===e?void 0:e.call(se,St)),await q(Ge,At,C,null===(t=Qt.current)||void 0===t?void 0:t.signal)}finally{}};const nl=null!=(null==B?void 0:B.big_enough)&&!Number.isNaN(B.big_enough)&&!!(null==B?void 0:B.big_enough_decision_factors),ol=null!==(be=null==B?void 0:B.completion_percentage)&&void 0!==be?be:0,il=!!(null==B?void 0:B.completion_decision_factors),sl=""===T,al=null!=O?O:b(W,sl),rl=!P&&!R;t.useEffect(()=>{if(!Dt)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${Dt}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[Dt]),t.useEffect(()=>{B.isDefaultEdit&&xt(e=>({...e,userStory:!0}))},[B.isDefaultEdit]),console.log("block number in userstory card ",re),console.log("[TESTING-CURRENT-USER-STORY] \n",B,"\n[TESTING-USER-STORY] \n",At);return t.useEffect(()=>Jt(B.value),[B.value]),e.jsxs("div",{className:a.default.card,"data-block-id":"user-story-card-wrapper-"+re,style:null==Ke?void 0:Ke.cardStyle,id:`story-card-${B.title}`,"data-expanded":kt,children:[e.jsxs("div",{className:a.default.titleSection,style:null==Ke?void 0:Ke.titleSection,children:[e.jsxs("div",{className:a.default.titleRow,style:null==Ke?void 0:Ke.titleRow,onClick:tl,children:[e.jsxs("div",{className:a.default.titleLeft,style:null==Ke?void 0:Ke.titleLeft,onMouseEnter:()=>Gt(!0),onMouseLeave:()=>Gt(!1),children:[Y&&e.jsx(w,{displayName:E}),It&&rl?e.jsx(m.InlineTitleEditor,{title:B.title,onSave:e=>(async(e,t)=>{var l;try{let n={...B};B.artifactId===t?n.title=e:n.sub_features=(null===(l=B.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],gt(n),A(n),jt(!1)}catch(e){console.error("Failed to save title",e)}})(e,B.artifactId),onCancel:()=>{jt(!1)},inputStyle:null==lt?void 0:lt.inlineTitleInput,confirmButtonStyle:null==lt?void 0:lt.inlineTitleConfirm,cancelButtonStyle:null==lt?void 0:lt.inlineTitleCancel},"inline-title-editor"):e.jsxs("div",{className:a.default.storyTitleWrapper,children:[e.jsx(o.Tooltip,{title:j(B.title),arrow:!0,children:e.jsx("h2",{title:oe?void 0:B.title,className:a.default.storyTitle,style:null==Ke?void 0:Ke.storyTitle,children:j(B.title)},B.artifactId)}),ee&&(il?e.jsx(S.CompletionPanel,{customIcons:null==Tt?void 0:Tt.userStoryIcons,customStyles:null==Ke?void 0:Ke.aiReasoningCitaionStyles,currentUserStory:B,panelStyles:null==Ke?void 0:Ke.CompletionStyles,onToggleStateChange:Ht,completionPanelConfig:te,children:e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==st?void 0:st.badge,...ft},children:[e.jsxs("span",{children:[ol,"% Completed"]}),e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(g.default,{color:"currentColor"})}),$t?e.jsx(l.ChevronUp,{size:14,style:null==st?void 0:st.chevronStyle}):e.jsx(l.ChevronDown,{size:14,style:null==st?void 0:st.chevronStyle})]})}):e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==st?void 0:st.badge,...ft},children:e.jsxs("span",{children:[ol,"% Completed"]})})),X&&e.jsx("button",{type:"button",className:a.default.titleEditButton,style:null==lt?void 0:lt.titleEditButton,onClick:e=>{e.stopPropagation(),jt(!0),kt||Ut(!0)},"aria-label":"Edit title",title:"Edit title",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})})})]})]}),(Le||void 0!==We&&void 0!==Oe)&&e.jsxs("div",{className:a.default.statusContainer,children:[void 0!==We&&void 0!==Oe&&e.jsxs("div",{className:a.default.completedBadge,children:["Completed: ",We,"/",Oe]}),Le&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==Fe||Fe()},onMouseEnter:()=>Xt(!0),onMouseLeave:()=>Xt(!1),className:a.default.statusButton,style:{...null===(we=yt[Le])||void 0===we?void 0:we.default,...Yt&&(null===(Ne=yt[Le])||void 0===Ne?void 0:Ne.hover)},children:I[Le]})]}),e.jsxs("div",{className:a.default.titleActions,style:null==Ke?void 0:Ke.titleActions,onClick:e=>e.stopPropagation(),children:[(al.showProgressPercentage||al.showGapBox)&&z&&e.jsxs("div",{className:a.default.progressHeader,style:null==ot?void 0:ot.wrapper,children:[al.showProgressPercentage&&e.jsxs("div",{className:a.default.progressPercentage,style:null==ot?void 0:ot.percentage,children:[null!==(De=null!==(Ee=null==B?void 0:B.confidenceScore)&&void 0!==Ee?Ee:null==al?void 0:al.confidenceValue)&&void 0!==De?De:"0","%"]}),al.showGapBox&&e.jsxs("div",{className:a.default.gapBox,style:null==ot?void 0:ot.gapBox,children:[null!==(Ae=null!==(Be=null==B?void 0:B.gapValue)&&void 0!==Be?Be:null==al?void 0:al.gapBoxValue)&&void 0!==Ae?Ae:"2"," ","Gaps"]})]}),nl&&e.jsx(f.BigEnoughPanel,{customIcons:null==Tt?void 0:Tt.userStoryIcons,customStyles:null==Ke?void 0:Ke.aiReasoningCitaionStyles,currentUserStory:B,panelStyles:null==Ke?void 0:Ke.BigEnoughStyles}),ue&&e.jsx("button",{type:"button",className:a.default.iconButton,style:null==Ke?void 0:Ke.iconButton,disabled:ce,onClick:e=>{e.stopPropagation(),null==ve||ve(B)},"aria-label":"Assign section users",title:"Assign section users",children:e.jsx(l.Users,{size:16})}),!Ct.userStory&&e.jsxs(e.Fragment,{children:[!1!==(null==al?void 0:al.showShareButton)&&e.jsx("button",{className:a.default.iconButton,style:null==Ke?void 0:Ke.iconButton,onClick:e=>{_t(e.currentTarget)},children:e.jsx(l.ExternalLink,{size:16})}),e.jsxs(o.Menu,{id:"user-story-share-menu",anchorEl:Mt,open:!!Mt,onClose:()=>_t(null),style:null==Ke?void 0:Ke.userStoryShareMenu,children:[U&&e.jsx(o.MenuItem,{style:null==Ke?void 0:Ke.userStoryMenuItem,onClick:async()=>{Rt(!0),M&&(await Promise.all([M("pdf"),M("doc")]),Rt(!1))},children:e.jsxs("div",{ref:Ot,className:a.default.menuItemContent,style:null==Ke?void 0:Ke.menuItemContent,children:[e.jsx(l.Download,{size:16,color:null==Ke?void 0:Ke.menuIconColor}),e.jsx("p",{style:null==Ke?void 0:Ke.menuLabel,children:"Download"})]})}),e.jsx(o.MenuItem,{style:null==Ke?void 0:Ke.userStoryMenuItem,onClick:async()=>{let e=B;D&&(e={...B,value:`${d.replaceTitleSection(null==D?void 0:D.value,B.title)} \n${B.value}`}),null==_||_(!0,[e],B.artifactId),Kt()},children:e.jsxs("div",{style:null==Ke?void 0:Ke.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Share2,{size:16,color:null==Ke?void 0:Ke.menuIconColor}),e.jsx("p",{style:null==Ke?void 0:Ke.menuLabel,children:"Send"})]})}),e.jsx(o.MenuItem,{style:null==Ke?void 0:Ke.userStoryMenuItem,onClick:async()=>{const e=(new x.default.Converter).makeHtml(r.formatMarkdown(B.value)||B.value),t=function(e){const t=(new x.default.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(r.formatMarkdown(B.value)||B.value),l=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([l]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{Kt()}},children:e.jsxs("div",{style:null==Ke?void 0:Ke.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Copy,{size:16,color:null==Ke?void 0:Ke.menuIconColor}),e.jsx("p",{style:null==Ke?void 0:Ke.menuLabel,children:"Copy"})]})})]})]}),!Ft&&Ct.userStory&&kt?e.jsx(u.default,{type:"outline",children:"Cancel",style:null==Ke?void 0:Ke.cancelButton,onClick:()=>{var e;null===(e=Qt.current)||void 0===e||e.abort(),xt(e=>({...e,userStory:!1}))}}):e.jsx(e.Fragment,{}),Ct.userStory&&kt?e.jsx(u.default,{type:"fill",children:Ft?e.jsxs("span",{className:a.default.savingSpinner,style:null==Ke?void 0:Ke.savingSpinner,children:[e.jsx(l.LoaderCircle,{className:a.default.spinAnimation,style:null==Ke?void 0:Ke.spinAnimation}),e.jsx("span",{children:"Saving..."})]}):"Save",isDisable:Ft,style:Ft?null==Ke?void 0:Ke.savingButton:null==Ke?void 0:Ke.saveButton,onClick:async()=>{Wt(!0),await ll();let e=await(async()=>{var e,t,l,n,o;let i=St.value;console.log("[V] valueToUpdate before",i),i=i.replace(/<invisible\s+id="([^"]+)"\s*><\/invisible>/gi,"\x3c!-- $1 --\x3e"),console.log("[V] valueToUpdate after",i);try{if(null==Ye?void 0:Ye.callUpdateDocument){const{updated_reqai:s}=await h.updateRedlineDocument({documentId:Qe,sectionId:B.artifactId,baseApiUrl:null==Ye?void 0:Ye.baseApiUrl,updatedContent:i,userEmail:Ye.userEmail,userName:Ye.userName,redlineConfigId:null!==(e=Ye.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==Ye?void 0:Ye.token)&&void 0!==t?t:"");i=null===(o=null===(n=null===(l=null==s?void 0:s.artifactData)||void 0===l?void 0:l.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===o?void 0:o.value,await(null==Ze?void 0:Ze(s))}}catch(e){console.error("failed to update redline document",e),i=Zt}return i=i.replace(/<!--\s*([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\s*-->/gi,'<invisible id="$1"></invisible>'),i})();const t={...St,value:e};A({...t,isDefaultEdit:!1}),Jt(t.value),xt(e=>({...e,userStory:!1})),Wt(!1)}}):!P&&!R&&!ne&&kt&&!1!==(null==al?void 0:al.showEditButton)&&e.jsx("button",{className:a.default.iconButton,style:null==Ke?void 0:Ke.editButton,onClick:()=>xt(e=>({...e,userStory:!0})),children:e.jsx(l.PencilIcon,{color:null==Ke?void 0:Ke.pencilIconColor,size:16})}),le&&sl&&kt&&!P&&!R&&!1!==(null==al?void 0:al.showEditButton)&&e.jsxs("button",{type:"button",className:a.default.addSectionButton,style:null==lt?void 0:lt.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=B.sub_features)||void 0===t?void 0:t.length)&&void 0!==l?l:0)+1,i={artifactId:s.v4(),title:`New Section ${o}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a={...B,sub_features:[...null!==(n=B.sub_features)&&void 0!==n?n:[],i]};gt(a),A(a),Ut(!0),Bt(i.title)},"aria-label":"Add section",title:"Add section",children:[e.jsx(l.Plus,{size:14}),e.jsx("span",{className:a.default.addSectionLabel,children:"Add Section"})]}),!sl&&!P&&!ne&&!R&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==$||$()},className:a.default.iconButton,style:null==lt?void 0:lt.deleteButton,"aria-label":"Delete section",title:"Delete section",children:e.jsx(l.Trash2,{size:16})}),dt&&e.jsx("button",{type:"button",className:a.default.iconButton,style:null==et?void 0:et.button,disabled:vt,onClick:e=>{if(e.stopPropagation(),bt)return Et(null),void wt(!1);Et(structuredClone(null!=ut?ut:{})),Ut(!0),wt(!0)},children:bt?e.jsx(l.X,{size:16,color:null==Ke?void 0:Ke.pencilIconColor,style:null==et?void 0:et.cancelIcon}):e.jsx(l.PencilIcon,{size:16,color:null==Ke?void 0:Ke.pencilIconColor,style:null==et?void 0:et.editIcon})}),(null==al?void 0:al.actionItemsButton)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:a.default.actionItemBtn,style:null==Ke?void 0:Ke.actionItemBtn,onClick:e=>{e.stopPropagation(),Lt(e.currentTarget)},children:e.jsx(l.Ellipsis,{})}),e.jsx(o.Menu,{id:"user-story-action-menu",anchorEl:qt,open:!!qt,onClose:el,style:null==Ke?void 0:Ke.userStoryShareMenu,children:null==G?void 0:G.items.map((t,l)=>e.jsx(o.MenuItem,{style:null==Ke?void 0:Ke.userStoryMenuItem,onClick:()=>{t.onclick(B),el()},children:e.jsxs("div",{className:a.default.menuItemContent,style:{...null==Ke?void 0:Ke.menuItemContent,...!t.isActive&&{cursor:"not-allowed",opacity:.5}},children:[e.jsx("span",{className:a.default.menuItemIcon,style:null==Ke?void 0:Ke.menuItemIcon,children:t.icon}),e.jsx("p",{style:null==Ke?void 0:Ke.menuLabel,children:t.name}),e.jsx("span",{className:a.default.menuItemRight,style:null==Ke?void 0:Ke.menuItemRight})]})},`action-item-${l}-${t.name}`))})]}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),tl()},style:null==Ke?void 0:Ke.chevronButton,className:a.default.chevronButton,children:kt?e.jsx(l.ChevronUp,{className:a.default.chevronIcon,color:null==Ke?void 0:Ke.chevronIconColor}):e.jsx(l.ChevronDown,{className:a.default.chevronIcon,color:null==Ke?void 0:Ke.chevronIconColor})})]})]}),e.jsx("div",{className:a.default.divider,style:null==Ke?void 0:Ke.dividerStyle})]}),kt&&e.jsx("div",{className:a.default.cardContent,style:{...null==Ke?void 0:Ke.cardContentStyle,borderTop:J?"1px solid #E5E5E5":"none"},children:_e?e.jsxs("div",{className:a.default.loadingContainer,children:[e.jsx("div",{className:a.default.loadingIconWrapper,children:e.jsx(l.Hourglass,{size:28,color:"#5B3DF5",className:a.default.spinAnimation})}),e.jsxs("div",{children:[e.jsx("h3",{className:a.default.loadingTitle,children:"Section generation in progress.."}),e.jsx("p",{className:a.default.loadingSubtitle,children:"This may take a few minutes"})]}),e.jsx("button",{type:"button",onClick:()=>null==qe?void 0:qe(),className:a.default.viewStatusButton,children:"View Status"})]}):ze?e.jsxs("div",{className:a.default.noDataContainer,style:null==at?void 0:at.container,children:[e.jsx("img",{src:i.default,alt:"No data available",className:a.default.noDataIllustration,style:null==at?void 0:at.illustration}),e.jsx("h3",{className:a.default.noDataTitle,style:null==at?void 0:at.title,children:"No Data Available for This Section"}),e.jsx("p",{className:a.default.noDataSubtitle,style:null==at?void 0:at.subtitle,children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."})]}):e.jsxs("div",{className:a.default.contentInner,style:null==Ke?void 0:Ke.contentInner,children:[e.jsxs("div",{className:a.default.descriptionSection,style:null==Ke?void 0:Ke.descriptionSection,children:[e.jsx("div",{className:a.default.justifyBetween,style:null==Ke?void 0:Ke.justifyBetween}),Ct.userStory?e.jsx(c.default,{ref:zt,minHeight:"100%",height:"100%",type:"string",value:r.formatMarkdown(Zt)||"",handleUpdateState:(e,t)=>{const l=d.postprocessUserStoryAfterEdit(r.indentMarkdown(t));gt(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:Ct.userStory?"edit":"readOnly",onEditBlocked:He,onSaveUnsavedChanges:async()=>{await ll(),Ut(!1)},onDiscardUnsavedChanges:()=>{gt({...structuredClone(B),value:r.formatMarkdown(B.value)||""}),xt(e=>({...e,userStory:!1})),Ut(!1)},isSavingUnsavedChanges:Ft}):dt?e.jsx(y.default,{styles:it,fields:ct,readonly:!bt,isSaving:pt,value:null!==(Te=null!=Nt?Nt:ut)&&void 0!==Te?Te:{},onChange:Et,onSave:async()=>{var e;Nt&&(await(null===(e=null==Xe?void 0:Xe.onSave)||void 0===e?void 0:e.call(Xe,B,Nt)),Et(null),wt(!1))},onCancel:()=>{Et(null),wt(!1)}}):e.jsxs(e.Fragment,{children:[e.jsx(v.default,{showUserStoryDiff:R,isParent:""===T,message:r.formatMarkdown(B.value)||"",artifactId:B.artifactId,customStyles:nt,isDisplayHighlightControl:F,contextVariant:H,showConfidenceScore:Z,CDNeededInChip:ae,blockId:re,showWaitingIconInChip:de}),(ie||se)&&e.jsxs("div",{className:a.default.actionButtonsContainer,style:null==rt?void 0:rt.container,children:[se&&!Ct.userStory&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:a.default.actionButton,style:null==rt?void 0:rt.button,disabled:se.disabled||se.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=se.onClick)||void 0===t||t.call(se),xt(e=>({...e,userStory:!0})),Ut(!0)},children:se.isLoading?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:16,className:a.default.actionButtonSpinner,style:null==rt?void 0:rt.icon}),e.jsx("span",{style:null==rt?void 0:rt.text,children:null!==(ke=se.label)&&void 0!==ke?ke:"Edit"})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.PencilIcon,{size:16,style:null==rt?void 0:rt.icon}),e.jsx("span",{style:null==rt?void 0:rt.text,children:null!==(Ue=se.label)&&void 0!==Ue?Ue:"Edit"})]})}),ie&&e.jsx("span",{className:a.default.actionButtonDivider})]}),ie&&e.jsx("button",{type:"button",className:a.default.actionButton,style:null==rt?void 0:rt.button,disabled:ie.disabled||ie.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=ie.onClick)||void 0===t||t.call(ie)},children:ie.isLoading?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:16,className:a.default.actionButtonSpinner,style:null==rt?void 0:rt.icon}),e.jsx("span",{style:null==rt?void 0:rt.text,children:null!==(Pe=ie.label)&&void 0!==Pe?Pe:"Approve"})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Check,{size:16,style:null==rt?void 0:rt.icon}),e.jsx("span",{style:null==rt?void 0:rt.text,children:null!==(Re=ie.label)&&void 0!==Re?Re:"Approve"})]})})]})]})]}),null===(Me=St.sub_features)||void 0===Me?void 0:Me.map((t,l)=>{console.log("UserStoryCardWrapper: sub",t);const o=b(W,!1,t.artifactId);return e.jsx(N,{artifactId:C,isUserStoryCurrentlyUpdated:n,artifactTitleId:`${E}-${String.fromCharCode(65+l)}`,parentUserStory:B,parentIndex:`${T}${T&&"."}${k}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:t,onUserStoryChange:e=>((e,t)=>{const l=[...B.sub_features||[]];l[e]=t,A({...B,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:P,showUserStoryDiff:R,updateUserStoryArtifact:q,handleDownloadUserStory:M,handleOpenSendDialog:_,isDisplayHighlightControl:F,elementDisplayConfig:W,_resolvedConfig:o,actionItemsConfig:G,onDelete:()=>(e=>{const t=(B.sub_features||[]).filter((t,l)=>l!==e),l={...B,sub_features:t};gt(l),A(l)})(l),expandedSubFeatures:Q,disableEditPlan:ne,useMuiTooltip:oe,blockNumber:t.blockNumber,showAssignSection:ue,onAssignSectionClick:ve},t.artifactId)})]})})]})};exports.StoryCard=N,exports.UserStoryCardWrapper=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:f,isDisplayHighlightControl:m,elementDisplayConfig:y,showWrapper:S,actionItemsConfig:g,contextVariant:C,showDisplayName:x,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:w,defaultExpanded:E,showCompletionPanel:D=!1,completionPanelConfig:B,showAddSectionButton:A=!1,disableEditPlan:T=!1,useMuiTooltip:k=!1,approveButtonConfig:U,editButtonConfig:P,CDNeededInChip:R,showWaitingIconInChip:M,setRedlineDocumentIdParent:_,showAssignSection:q,onAssignSectionClick:L,disableAssignSection:F})=>{const{userStory:W,setUserStory:O,customStyles:z,searchQueryList:V,currentHighlightIndex:G,setCurrentHighlightIndex:$,segmentComponentConfig:H,sectionStatusConfig:Q,redlineConfig:Y,setRedlineDocumentId:X}=p.useRequirementAI(),Z=null==z?void 0:z.userStoryCardStyles,J=0===G,K=G===V.length-1;return t.useEffect(()=>{if(!(null==Y?void 0:Y.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await h.getRedlineDocumentId({baseApiUrl:Y.documentBaseApiUrl||"",comparisonId:Y.documentComparisonId||""});if(t)X(t);else{const{document_id:t}=await h.createRedlineDocument({baseApiUrl:Y.baseApiUrl,changelogConfigId:Y.changelogConfigId,comparisonId:Y.documentComparisonId,artifactId:Y.artifactId,inputData:Y.inputData,redlineConfigId:Y.redlineConfigId,userEmail:Y.userEmail,userName:Y.userName},null!==(e=null==Y?void 0:Y.token)&&void 0!==e?e:"");t&&(X(t),null==_||_(t))}})()},[]),e.jsxs("div",{className:a.default.userStoryCardWrapper,style:m?{...null==Z?void 0:Z.userStoryCardWrapper,position:"relative"}:null==Z?void 0:Z.userStoryCardWrapper,children:[m&&e.jsx(e.Fragment,{children:V.length>0&&e.jsx("div",{className:a.default.wrapper,children:e.jsx("div",{className:a.default.highlightNavigation,children:e.jsxs("div",{className:a.default.navigationContainer,children:[e.jsxs("span",{className:a.default.navCounter,children:[G+1," of ",V.length]}),e.jsxs("div",{className:a.default.navButtons,children:[e.jsx("button",{onClick:()=>{G>0&&$(e=>e-1)},className:a.default.navButton,disabled:J,children:e.jsx(l.ChevronUpIcon,{size:20,className:a.default.navIcon})}),e.jsx("button",{onClick:()=>{G<V.length-1&&$(e=>e+1)},className:a.default.navButton,disabled:K,children:e.jsx(l.ChevronDownIcon,{size:20,className:a.default.navIcon})})]})]})})})}),W.map((t,l)=>{console.log("UserStoryCardWrapper: userstory",t);const a=b(y,!0);return e.jsx(N,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:t,onUserStoryChange:e=>{O(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:f,isDisplayHighlightControl:m,elementDisplayConfig:y,_resolvedConfig:a,showWrapper:S,defaultExpanded:E,actionItemsConfig:g,contextVariant:C,showDisplayName:x,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:w,sectionStatusConfig:Q,showCompletionPanel:D,completionPanelConfig:B,showAddSectionButton:A,disableEditPlan:T,useMuiTooltip:k,approveButtonConfig:U,CDNeededInChip:R,editButtonConfig:P,showWaitingIconInChip:M,showAssignSection:q,disableAssignSection:F,onAssignSectionClick:L},t.artifactId)})]})},exports.default=N,exports.replaceLearnedTagsWithInfo=j;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("lucide-react"),n=require("showdown"),o=require("@mui/material"),i=require("../../icons/Illustration.svg.js"),s=require("uuid"),a=require("./UserStoryCard.module.css.js"),r=require("../../utils/helpers.js"),d=require("../../utils/user-story.utils.js"),u=require("../../shared/AtomicButton.js"),c=require("../RichTextEditor/RichTextEditor.js"),v=require("../userstory-with-citation/UserStoryWithCitation.js"),p=require("../RequirementAIWrapper/RequirementAIWrapper.js"),f=require("../story-screen/BigEnoughPanel.js"),h=require("./TitleEditor/TitleEditor.js"),m=require("../../../../service/redlineService.js"),y=require("./ClinicalTrialSection.js"),S=require("../story-screen/CompletionPanel.js"),g=require("../../icons/CDIcon.js"),C=require("./cws/CwsEvent.js"),x=require("./cws/useCwsEvent.js"),I=require("react-hot-toast"),j=require("./Popups/RedlineToast.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var w=b(n),N=b(I);const E={[p.SectionStatus.WAITING]:"WAITING TO GENERATE",[p.SectionStatus.IN_PROGRESS]:"IN PROGRESS",[p.SectionStatus.GENERATED]:"GENERATED",[p.SectionStatus.FAILED]:"FAILED",[p.SectionStatus.GENERATE]:"GENERATE",[p.SectionStatus.APPROVED]:"APPROVED"};function D(t){const n=[],i=/<learned>(.*?)<\/learned>/g;let a,r=0,d=0;for(;null!==(a=i.exec(t));){const[,u]=a,c=a.index;c>r&&n.push(e.jsx("span",{children:t.slice(r,c)},"text-pre-"+d++)),n.push(e.jsx(o.Tooltip,{title:u,placement:"top",children:e.jsx(l.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})},`tooltip-${s.v4()}`)),r=i.lastIndex}return r<(null==t?void 0:t.length)&&n.push(e.jsx("span",{children:t.slice(r)},"text-post-"+d++)),n}function B(e,t,l){var n;if(!e)return{};if(t)return{...e.parentConfig};const o={...e.childConfig};return l&&(null===(n=e.subFeatureOverrides)||void 0===n?void 0:n[l])?{...o,...e.subFeatureOverrides[l]}:o}const T=({displayName:t})=>{var n;const{customStyles:o}=p.useRequirementAI(),i=null===(n=null==o?void 0:o.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return e.jsxs("div",{className:a.default.displayName,style:null==i?void 0:i.wrapper,children:[e.jsx(l.Bookmark,{className:a.default.displayNameIcon,style:null==i?void 0:i.displayNameIcon}),e.jsxs("span",{style:null==i?void 0:i.label,children:[t,":"]})]})},A=({isUserStoryCurrentlyUpdated:n,artifactId:I,artifactTitleId:b,parentUserStory:k,currentUserStory:U,onUserStoryChange:R,parentIndex:P,currentIndex:M,enableDownload:q,isDiffEditReviewMode:_,showUserStoryDiff:L,handleDownloadUserStory:W,handleOpenSendDialog:F,updateUserStoryArtifact:O,selectedArtifactId:$,isDisplayHighlightControl:z,elementDisplayConfig:V,_resolvedConfig:G,showWrapper:H=!1,defaultExpanded:Y,actionItemsConfig:Q,onDelete:X,contextVariant:Z,expandedSubFeatures:J,showDisplayName:K=!0,allowTitleEdit:ee=!0,showConfidenceScore:te=!0,showBorderTop:le=!0,sectionStatusConfig:ne,showCompletionPanel:oe=!1,completionPanelConfig:ie,showAddSectionButton:se=!1,disableEditPlan:ae=!1,useMuiTooltip:re=!1,approveButtonConfig:de,editButtonConfig:ue,CDNeededInChip:ce,blockNumber:ve,showWaitingIconInChip:pe,showAssignSection:fe=!1,disableAssignSection:he=!1,onAssignSectionClick:me})=>{var ye,Se,ge,Ce,xe,Ie,je,be,we,Ne,Ee,De,Be,Te,Ae,ke,Ue,Re,Pe,Me,qe,_e,Le,We;const{isLoadingSectionData:Fe=!1,onLoadSectionData:Oe,status:$e,onStatusClick:ze,completedCount:Ve,totalCount:Ge,isNoDataAvailable:He=!1}=null!=ne?ne:{},{searchQueryList:Ye,citations:Qe,customStyles:Xe,onEditBlocked:Ze,redlineDcoumentId:Je,redlineConfig:Ke,customSectionConfig:et,updateRedlineDataParent:tt,aiReasoning:lt,redlineCollaborativeConfig:nt}=p.useRequirementAI(),ot=null==Xe?void 0:Xe.userStoryCardStyles,it=null==ot?void 0:ot.customSectionEditButton,st=null==ot?void 0:ot.statusStyles,at=null===(ye=null==Xe?void 0:Xe.userStoryCardStyles)||void 0===ye?void 0:ye.userStoryEditStyles,rt=null===(Se=null==Xe?void 0:Xe.userStoryScreenStyles)||void 0===Se?void 0:Se.userStoryContentStyles,dt=null==ot?void 0:ot.progressHeaderStyles,ut=null==ot?void 0:ot.clinicalTrialSectionStyles,ct=null==ot?void 0:ot.CompletionStyles,vt=null==ot?void 0:ot.noDataStyles,pt=null==ot?void 0:ot.approveButtonStyles,ft=null!==(Ce=null===(ge=null==et?void 0:et.shouldRender)||void 0===ge?void 0:ge.call(et,U))&&void 0!==Ce&&Ce,ht=null===(xe=null==et?void 0:et.getValue)||void 0===xe?void 0:xe.call(et,U),mt=null!==(je=null===(Ie=null==et?void 0:et.getFields)||void 0===Ie?void 0:Ie.call(et,U))&&void 0!==je?je:[],yt=null!==(be=null==et?void 0:et.isEditDisabled)&&void 0!==be&&be,St=null!==(Ne=null===(we=null==et?void 0:et.isSaving)||void 0===we?void 0:we.call(et,U))&&void 0!==Ne&&Ne,gt=(Ct=null!==(Ee=U.completion_percentage)&&void 0!==Ee?Ee:0,xt=ct,Ct>=80?null==xt?void 0:xt.highCompletion:Ct>=50?null==xt?void 0:xt.mediumCompletion:null==xt?void 0:xt.lowCompletion);var Ct,xt;const It={[p.SectionStatus.WAITING]:null==st?void 0:st.waiting,[p.SectionStatus.IN_PROGRESS]:null==st?void 0:st.inProgress,[p.SectionStatus.GENERATED]:null==st?void 0:st.generated,[p.SectionStatus.FAILED]:null==st?void 0:st.failed,[p.SectionStatus.GENERATE]:null==st?void 0:st.generate,[p.SectionStatus.APPROVED]:null==st?void 0:st.approved},[jt,bt]=t.useState({...structuredClone(U),value:r.formatMarkdown(U.value)||""}),[wt,Nt]=t.useState({userStory:!!U.isDefaultEdit}),[Et,Dt]=t.useState(!1),[Bt,Tt]=t.useState(!1),[At,kt]=t.useState(null),[Ut,Rt]=t.useState(null),{userStory:Pt,customIcons:Mt}=p.useRequirementAI(),[qt,_t]=t.useState(null!=Y?Y:""===P||$===U.artifactId||!!U.isDefaultOpen),[Lt,Wt]=t.useState(!1),[Ft,Ot]=t.useState(null),[$t,zt]=t.useState(null),[Vt,Gt]=t.useState(!1),Ht=t.useRef(null),Yt=t.useRef(null),[Qt,Xt]=t.useState(!1),[Zt,Jt]=t.useState(!1),Kt=t.useRef(null),[el,tl]=t.useState(!1),[ll,nl]=t.useState(U.value);t.useEffect(()=>{n&&_t(n)},[n]),t.useEffect(()=>{bt({...structuredClone(U),value:r.formatMarkdown(U.value)||""})},[U]),t.useEffect(()=>{Ye.length>0?_t(!0):void 0===Y&&$&&_t($===U.artifactId)},[Ye,$,U.artifactId]),t.useEffect(()=>{J&&J.length>0&&_t(J.includes(U.artifactId)||""===P||$===U.artifactId||!!U.isDefaultOpen)},[J]);const ol=()=>{Ot(null)},il=()=>{zt(null)},sl=()=>{qt&&wt.userStory&&Yt.current&&!Yt.current.requestClose()||_t(e=>!e)},al=async()=>{var e,t;try{"userStory"==="userStory"&&(R(jt),console.log("I am changing RTE editor values",jt)),await(null===(e=null==ue?void 0:ue.onSaveEditedSection)||void 0===e?void 0:e.call(ue,jt)),await O(Qe,Pt,I,null===(t=Kt.current)||void 0===t?void 0:t.signal)}finally{}};const rl=null!=(null==U?void 0:U.big_enough)&&!Number.isNaN(U.big_enough)&&!!(null==U?void 0:U.big_enough_decision_factors),dl=null!==(De=null==U?void 0:U.completion_percentage)&&void 0!==De?De:0,ul=!!(null==U?void 0:U.completion_decision_factors),cl=""===P,vl=null!=G?G:B(V,cl),pl=!_&&!L;t.useEffect(()=>{if(!Ut)return;const e=setTimeout(()=>{const e=document.getElementById(`story-card-${Ut}`);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},100);return()=>clearTimeout(e)},[Ut]);const[fl,hl]=t.useState(0),[ml,yl]=t.useState(!1),Sl=async()=>{var e,t;let l=!0;if(yl(e=>(l=!e,!0)),l){let l;hl(e=>(l=e,e));try{const{updated_reqai:n}=await m.fetchRedlineDocumentSection({documentId:Je,sectionId:U.artifactId,baseApiUrl:null==Ke?void 0:Ke.baseApiUrl,redlineConfigId:null!==(e=null==Ke?void 0:Ke.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==Ke?void 0:Ke.token)&&void 0!==t?t:"");await(null==tt?void 0:tt(n)),hl(e=>l===e?0:1)}catch(e){}yl(!1)}};t.useEffect(()=>{U.isDefaultEdit&&Nt(e=>({...e,userStory:!0}))},[U.isDefaultEdit]),console.log("block number in userstory card ",ve),console.log("[TESTING-CURRENT-USER-STORY] \n",U,"\n[TESTING-USER-STORY] \n",Pt),x.default(`redline-edit:${Je}:${U.artifactId}`,async({updatedBy:t})=>{var l;null===(l=Kt.current)||void 0===l||l.abort(),hl(e=>e+1),Nt(l=>l.userStory?(N.default.custom(l=>e.jsxs(j.default,{onCancel:()=>N.default.dismiss(l.id),onRefresh:()=>{N.default.dismiss(l.id),Sl()},children:["This ",e.jsx("span",{style:{fontWeight:600},children:U.title})," section has been updated by ",e.jsx("span",{style:{fontWeight:600},children:t})," while you were editing. Please refresh to view the latest version."]}),{duration:1e4,toasterId:p.ToasterId}),{...Pt,userStory:!1}):(Sl().then(()=>{N.default.custom(l=>e.jsxs(j.default,{onCancel:()=>N.default.dismiss(l.id),children:[e.jsx("span",{style:{fontWeight:600},children:U.title})," updated,",e.jsx("br",{}),t," saved changes. Your unsaved edits are untouched."]}),{duration:1e4,toasterId:p.ToasterId})}),l))});return t.useEffect(()=>nl(U.value),[U.value]),e.jsxs("div",{className:a.default.card,"data-block-id":"user-story-card-wrapper-"+ve,style:null==ot?void 0:ot.cardStyle,id:`story-card-${U.title}`,"data-expanded":qt,children:[e.jsxs("div",{className:a.default.titleSection,style:null==ot?void 0:ot.titleSection,children:[e.jsxs("div",{className:a.default.titleRow,style:null==ot?void 0:ot.titleRow,onClick:sl,children:[e.jsxs("div",{className:a.default.titleLeft,style:null==ot?void 0:ot.titleLeft,onMouseEnter:()=>Xt(!0),onMouseLeave:()=>Xt(!1),children:[K&&e.jsx(T,{displayName:b}),Et&&pl?e.jsx(h.InlineTitleEditor,{title:U.title,onSave:e=>(async(e,t)=>{var l;try{let n={...U};U.artifactId===t?n.title=e:n.sub_features=(null===(l=U.sub_features)||void 0===l?void 0:l.map(l=>l.artifactId===t?{...l,title:e}:l))||[],bt(n),R(n),Dt(!1)}catch(e){console.error("Failed to save title",e)}})(e,U.artifactId),onCancel:()=>{Dt(!1)},inputStyle:null==at?void 0:at.inlineTitleInput,confirmButtonStyle:null==at?void 0:at.inlineTitleConfirm,cancelButtonStyle:null==at?void 0:at.inlineTitleCancel},"inline-title-editor"):e.jsxs("div",{className:a.default.storyTitleWrapper,children:[e.jsx(o.Tooltip,{title:D(U.title),arrow:!0,children:e.jsx("h2",{title:re?void 0:U.title,className:a.default.storyTitle,style:null==ot?void 0:ot.storyTitle,children:D(U.title)},U.artifactId)}),oe&&(ul?e.jsx(S.CompletionPanel,{customIcons:null==Mt?void 0:Mt.userStoryIcons,customStyles:null==ot?void 0:ot.aiReasoningCitaionStyles,currentUserStory:U,panelStyles:null==ot?void 0:ot.CompletionStyles,onToggleStateChange:Jt,completionPanelConfig:ie,children:e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==ct?void 0:ct.badge,...gt},children:[e.jsxs("span",{children:[dl,"% Completed"]}),e.jsx("span",{style:{display:"flex",alignItems:"center"},children:e.jsx(g.default,{color:"currentColor"})}),Zt?e.jsx(l.ChevronUp,{size:14,style:null==ct?void 0:ct.chevronStyle}):e.jsx(l.ChevronDown,{size:14,style:null==ct?void 0:ct.chevronStyle})]})}):e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:"4px",...null==ct?void 0:ct.badge,...gt},children:e.jsxs("span",{children:[dl,"% Completed"]})})),ee&&e.jsx("button",{type:"button",className:a.default.titleEditButton,style:null==at?void 0:at.titleEditButton,onClick:e=>{e.stopPropagation(),Dt(!0),qt||_t(!0)},"aria-label":"Edit title",title:"Edit title",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M8.99998 14.9992H15.75M2.25 14.9992H3.50591C3.87279 14.9992 4.05624 14.9992 4.22887 14.9577C4.38192 14.921 4.52824 14.8604 4.66245 14.7782C4.81382 14.6854 4.94354 14.5557 5.20296 14.2962L14.625 4.87419C15.2463 4.25287 15.2463 3.24551 14.625 2.62419C14.0037 2.00287 12.9963 2.00287 12.375 2.62419L2.95295 12.0462C2.69352 12.3057 2.5638 12.4354 2.47104 12.5868C2.3888 12.721 2.32819 12.8673 2.29145 13.0203C2.25 13.193 2.25 13.3764 2.25 13.7433V14.9992Z",stroke:"#94A3B8","stroke-width":"1.54286","stroke-linecap":"round","stroke-linejoin":"round"})})})]})]}),($e||void 0!==Ve&&void 0!==Ge)&&e.jsxs("div",{className:a.default.statusContainer,children:[void 0!==Ve&&void 0!==Ge&&e.jsxs("div",{className:a.default.completedBadge,children:["Completed: ",Ve,"/",Ge]}),$e&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==ze||ze()},onMouseEnter:()=>tl(!0),onMouseLeave:()=>tl(!1),className:a.default.statusButton,style:{...null===(Be=It[$e])||void 0===Be?void 0:Be.default,...el&&(null===(Te=It[$e])||void 0===Te?void 0:Te.hover)},children:E[$e]})]}),e.jsxs("div",{className:a.default.titleActions,style:null==ot?void 0:ot.titleActions,onClick:e=>e.stopPropagation(),children:[(vl.showProgressPercentage||vl.showGapBox)&&H&&e.jsxs("div",{className:a.default.progressHeader,style:null==dt?void 0:dt.wrapper,children:[vl.showProgressPercentage&&e.jsxs("div",{className:a.default.progressPercentage,style:null==dt?void 0:dt.percentage,children:[null!==(ke=null!==(Ae=null==U?void 0:U.confidenceScore)&&void 0!==Ae?Ae:null==vl?void 0:vl.confidenceValue)&&void 0!==ke?ke:"0","%"]}),vl.showGapBox&&e.jsxs("div",{className:a.default.gapBox,style:null==dt?void 0:dt.gapBox,children:[null!==(Re=null!==(Ue=null==U?void 0:U.gapValue)&&void 0!==Ue?Ue:null==vl?void 0:vl.gapBoxValue)&&void 0!==Re?Re:"2"," ","Gaps"]})]}),rl&&e.jsx(f.BigEnoughPanel,{customIcons:null==Mt?void 0:Mt.userStoryIcons,customStyles:null==ot?void 0:ot.aiReasoningCitaionStyles,currentUserStory:U,panelStyles:null==ot?void 0:ot.BigEnoughStyles}),fe&&e.jsx("button",{type:"button",className:a.default.iconButton,style:null==ot?void 0:ot.iconButton,disabled:he,onClick:e=>{e.stopPropagation(),null==me||me(U)},"aria-label":"Assign section users",title:"Assign section users",children:e.jsx(l.Users,{size:16})}),!wt.userStory&&e.jsxs(e.Fragment,{children:[!1!==(null==vl?void 0:vl.showShareButton)&&e.jsx("button",{className:a.default.iconButton,style:null==ot?void 0:ot.iconButton,onClick:e=>{Ot(e.currentTarget)},children:e.jsx(l.ExternalLink,{size:16})}),e.jsxs(o.Menu,{id:"user-story-share-menu",anchorEl:Ft,open:!!Ft,onClose:()=>Ot(null),style:null==ot?void 0:ot.userStoryShareMenu,children:[q&&e.jsx(o.MenuItem,{style:null==ot?void 0:ot.userStoryMenuItem,onClick:async()=>{Wt(!0),W&&(await Promise.all([W("pdf"),W("doc")]),Wt(!1))},children:e.jsxs("div",{ref:Ht,className:a.default.menuItemContent,style:null==ot?void 0:ot.menuItemContent,children:[e.jsx(l.Download,{size:16,color:null==ot?void 0:ot.menuIconColor}),e.jsx("p",{style:null==ot?void 0:ot.menuLabel,children:"Download"})]})}),e.jsx(o.MenuItem,{style:null==ot?void 0:ot.userStoryMenuItem,onClick:async()=>{let e=U;k&&(e={...U,value:`${d.replaceTitleSection(null==k?void 0:k.value,U.title)} \n${U.value}`}),null==F||F(!0,[e],U.artifactId),ol()},children:e.jsxs("div",{style:null==ot?void 0:ot.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Share2,{size:16,color:null==ot?void 0:ot.menuIconColor}),e.jsx("p",{style:null==ot?void 0:ot.menuLabel,children:"Send"})]})}),e.jsx(o.MenuItem,{style:null==ot?void 0:ot.userStoryMenuItem,onClick:async()=>{const e=(new w.default.Converter).makeHtml(r.formatMarkdown(U.value)||U.value),t=function(e){const t=(new w.default.Converter).makeHtml(e),l=document.createElement("div");return l.innerHTML=t,l.textContent||l.innerText||""}(r.formatMarkdown(U.value)||U.value),l=new ClipboardItem({"text/plain":new Blob([t],{type:"text/plain"}),"text/html":new Blob([e],{type:"text/html"})});try{await navigator.clipboard.write([l]),console.log("Copied User Story")}catch(e){console.error("Failed to copy user story:",e)}finally{ol()}},children:e.jsxs("div",{style:null==ot?void 0:ot.menuItemContent,className:a.default.menuItemContentPadded,children:[e.jsx(l.Copy,{size:16,color:null==ot?void 0:ot.menuIconColor}),e.jsx("p",{style:null==ot?void 0:ot.menuLabel,children:"Copy"})]})})]})]}),!Vt&&wt.userStory&&qt?e.jsx(u.default,{type:"outline",children:"Cancel",style:null==ot?void 0:ot.cancelButton,onClick:()=>{var e;null===(e=Kt.current)||void 0===e||e.abort(),Nt(e=>({...e,userStory:!1}))}}):e.jsx(e.Fragment,{}),wt.userStory&&qt?e.jsx(u.default,{type:"fill",children:Vt?e.jsxs("span",{className:a.default.savingSpinner,style:null==ot?void 0:ot.savingSpinner,children:[e.jsx(l.LoaderCircle,{className:a.default.spinAnimation,style:null==ot?void 0:ot.spinAnimation}),e.jsx("span",{children:"Saving..."})]}):"Save",isDisable:Vt,style:Vt?null==ot?void 0:ot.savingButton:null==ot?void 0:ot.saveButton,onClick:async()=>{Gt(!0),await al();let e=await(async()=>{var e,t,l,n,o,i,s,a;let r=jt.value;console.log("[V] valueToUpdate before",r),r=r.replace(/<invisible\s+id="([^"]+)"\s*><\/invisible>/gi,"\x3c!-- $1 --\x3e"),console.log("[V] valueToUpdate after",r);try{if(null==Ke?void 0:Ke.callUpdateDocument){const{updated_reqai:d}=await m.updateRedlineDocument({documentId:Je,sectionId:U.artifactId,baseApiUrl:null==Ke?void 0:Ke.baseApiUrl,updatedContent:r,userEmail:Ke.userEmail,userName:Ke.userName,redlineConfigId:null!==(e=Ke.redlineConfigId)&&void 0!==e?e:""},null!==(t=null==Ke?void 0:Ke.token)&&void 0!==t?t:"");r=null===(o=null===(n=null===(l=null==d?void 0:d.artifactData)||void 0===l?void 0:l.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===o?void 0:o.value,await(null==tt?void 0:tt(d)),C.default.emit(`redline-edit:${Je}:${null===(a=null===(s=null===(i=null==d?void 0:d.artifactData)||void 0===i?void 0:i.userStorySnapshot)||void 0===s?void 0:s[0])||void 0===a?void 0:a.artifactId}`,{updatedBy:null==Ke?void 0:Ke.userName})}}catch(e){console.error("failed to update redline document",e),r=ll}return r=r.replace(/<!--\s*([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\s*-->/gi,'<invisible id="$1"></invisible>'),r})();const t={...jt,value:e};R({...t,isDefaultEdit:!1}),nl(t.value),Nt(e=>({...e,userStory:!1})),Gt(!1)}}):!fl&&!_&&!L&&!ae&&qt&&!1!==(null==vl?void 0:vl.showEditButton)&&e.jsx("button",{className:a.default.iconButton,style:null==ot?void 0:ot.editButton,onClick:()=>Nt(e=>({...e,userStory:!0})),children:e.jsx(l.PencilIcon,{color:null==ot?void 0:ot.pencilIconColor,size:16})}),(null==nt?void 0:nt.initiateCollaborativeFlow)&&!!fl&&e.jsx(o.Tooltip,{title:"Fetch latest section",children:e.jsx(l.RefreshCw,{color:ml?"#d3d3d3":"black",onClick:Sl})}),se&&cl&&qt&&!_&&!L&&!1!==(null==vl?void 0:vl.showEditButton)&&e.jsxs("button",{type:"button",className:a.default.addSectionButton,style:null==at?void 0:at.addSectionButton,onClick:e=>{var t,l,n;e.stopPropagation();const o=(null!==(l=null===(t=U.sub_features)||void 0===t?void 0:t.length)&&void 0!==l?l:0)+1,i={artifactId:s.v4(),title:`New Section ${o}`,value:"Please add details for this section.",section:"subfeature",isDefaultOpen:!0},a={...U,sub_features:[...null!==(n=U.sub_features)&&void 0!==n?n:[],i]};bt(a),R(a),_t(!0),Rt(i.title)},"aria-label":"Add section",title:"Add section",children:[e.jsx(l.Plus,{size:14}),e.jsx("span",{className:a.default.addSectionLabel,children:"Add Section"})]}),!cl&&!_&&!ae&&!L&&e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),null==X||X()},className:a.default.iconButton,style:null==at?void 0:at.deleteButton,"aria-label":"Delete section",title:"Delete section",children:e.jsx(l.Trash2,{size:16})}),ft&&e.jsx("button",{type:"button",className:a.default.iconButton,style:null==it?void 0:it.button,disabled:yt,onClick:e=>{if(e.stopPropagation(),Bt)return kt(null),void Tt(!1);kt(structuredClone(null!=ht?ht:{})),_t(!0),Tt(!0)},children:Bt?e.jsx(l.X,{size:16,color:null==ot?void 0:ot.pencilIconColor,style:null==it?void 0:it.cancelIcon}):e.jsx(l.PencilIcon,{size:16,color:null==ot?void 0:ot.pencilIconColor,style:null==it?void 0:it.editIcon})}),(null==vl?void 0:vl.actionItemsButton)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:a.default.actionItemBtn,style:null==ot?void 0:ot.actionItemBtn,onClick:e=>{e.stopPropagation(),zt(e.currentTarget)},children:e.jsx(l.Ellipsis,{})}),e.jsx(o.Menu,{id:"user-story-action-menu",anchorEl:$t,open:!!$t,onClose:il,style:null==ot?void 0:ot.userStoryShareMenu,children:null==Q?void 0:Q.items.map((t,l)=>e.jsx(o.MenuItem,{style:null==ot?void 0:ot.userStoryMenuItem,onClick:()=>{t.onclick(U),il()},children:e.jsxs("div",{className:a.default.menuItemContent,style:{...null==ot?void 0:ot.menuItemContent,...!t.isActive&&{cursor:"not-allowed",opacity:.5}},children:[e.jsx("span",{className:a.default.menuItemIcon,style:null==ot?void 0:ot.menuItemIcon,children:t.icon}),e.jsx("p",{style:null==ot?void 0:ot.menuLabel,children:t.name}),e.jsx("span",{className:a.default.menuItemRight,style:null==ot?void 0:ot.menuItemRight})]})},`action-item-${l}-${t.name}`))})]}),e.jsx("button",{type:"button",onClick:e=>{e.stopPropagation(),sl()},style:null==ot?void 0:ot.chevronButton,className:a.default.chevronButton,children:qt?e.jsx(l.ChevronUp,{className:a.default.chevronIcon,color:null==ot?void 0:ot.chevronIconColor}):e.jsx(l.ChevronDown,{className:a.default.chevronIcon,color:null==ot?void 0:ot.chevronIconColor})})]})]}),e.jsx("div",{className:a.default.divider,style:null==ot?void 0:ot.dividerStyle})]}),qt&&e.jsx("div",{className:a.default.cardContent,style:{...null==ot?void 0:ot.cardContentStyle,borderTop:le?"1px solid #E5E5E5":"none"},children:Fe?e.jsxs("div",{className:a.default.loadingContainer,children:[e.jsx("div",{className:a.default.loadingIconWrapper,children:e.jsx(l.Hourglass,{size:28,color:"#5B3DF5",className:a.default.spinAnimation})}),e.jsxs("div",{children:[e.jsx("h3",{className:a.default.loadingTitle,children:"Section generation in progress.."}),e.jsx("p",{className:a.default.loadingSubtitle,children:"This may take a few minutes"})]}),e.jsx("button",{type:"button",onClick:()=>null==Oe?void 0:Oe(),className:a.default.viewStatusButton,children:"View Status"})]}):He?e.jsxs("div",{className:a.default.noDataContainer,style:null==vt?void 0:vt.container,children:[e.jsx("img",{src:i.default,alt:"No data available",className:a.default.noDataIllustration,style:null==vt?void 0:vt.illustration}),e.jsx("h3",{className:a.default.noDataTitle,style:null==vt?void 0:vt.title,children:"No Data Available for This Section"}),e.jsx("p",{className:a.default.noDataSubtitle,style:null==vt?void 0:vt.subtitle,children:"We couldn't find data for this section yet. Upload the required document from the Documents tab to generate content."})]}):e.jsxs("div",{className:a.default.contentInner,style:null==ot?void 0:ot.contentInner,children:[e.jsxs("div",{className:a.default.descriptionSection,style:null==ot?void 0:ot.descriptionSection,children:[e.jsx("div",{className:a.default.justifyBetween,style:null==ot?void 0:ot.justifyBetween}),wt.userStory?e.jsx(c.default,{ref:Yt,minHeight:"100%",height:"100%",type:"string",value:r.formatMarkdown(ll)||"",handleUpdateState:(e,t)=>{const l=d.postprocessUserStoryAfterEdit(r.indentMarkdown(t));bt(e=>({...e,value:l||""}))},doNotShowBorderInViewMode:!1,onBlur:()=>{},mode:wt.userStory?"edit":"readOnly",onEditBlocked:Ze,onSaveUnsavedChanges:async()=>{await al(),_t(!1)},onDiscardUnsavedChanges:()=>{bt({...structuredClone(U),value:r.formatMarkdown(U.value)||""}),Nt(e=>({...e,userStory:!1})),_t(!1)},isSavingUnsavedChanges:Vt}):ft?e.jsx(y.default,{styles:ut,fields:mt,readonly:!Bt,isSaving:St,value:null!==(Pe=null!=At?At:ht)&&void 0!==Pe?Pe:{},onChange:kt,onSave:async()=>{var e;At&&(await(null===(e=null==et?void 0:et.onSave)||void 0===e?void 0:e.call(et,U,At)),kt(null),Tt(!1))},onCancel:()=>{kt(null),Tt(!1)}}):e.jsxs(e.Fragment,{children:[e.jsx(v.default,{showUserStoryDiff:L,isParent:""===P,message:r.formatMarkdown(U.value)||"",artifactId:U.artifactId,customStyles:rt,isDisplayHighlightControl:z,contextVariant:Z,showConfidenceScore:te,CDNeededInChip:ce,blockId:ve,showWaitingIconInChip:pe}),(de||ue)&&e.jsxs("div",{className:a.default.actionButtonsContainer,style:null==pt?void 0:pt.container,children:[ue&&!wt.userStory&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:a.default.actionButton,style:null==pt?void 0:pt.button,disabled:ue.disabled||ue.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=ue.onClick)||void 0===t||t.call(ue),Nt(e=>({...e,userStory:!0})),_t(!0)},children:ue.isLoading?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:16,className:a.default.actionButtonSpinner,style:null==pt?void 0:pt.icon}),e.jsx("span",{style:null==pt?void 0:pt.text,children:null!==(Me=ue.label)&&void 0!==Me?Me:"Edit"})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.PencilIcon,{size:16,style:null==pt?void 0:pt.icon}),e.jsx("span",{style:null==pt?void 0:pt.text,children:null!==(qe=ue.label)&&void 0!==qe?qe:"Edit"})]})}),de&&e.jsx("span",{className:a.default.actionButtonDivider})]}),de&&e.jsx("button",{type:"button",className:a.default.actionButton,style:null==pt?void 0:pt.button,disabled:de.disabled||de.isLoading,onClick:e=>{var t;e.stopPropagation(),null===(t=de.onClick)||void 0===t||t.call(de)},children:de.isLoading?e.jsxs(e.Fragment,{children:[e.jsx(l.LoaderCircle,{size:16,className:a.default.actionButtonSpinner,style:null==pt?void 0:pt.icon}),e.jsx("span",{style:null==pt?void 0:pt.text,children:null!==(_e=de.label)&&void 0!==_e?_e:"Approve"})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Check,{size:16,style:null==pt?void 0:pt.icon}),e.jsx("span",{style:null==pt?void 0:pt.text,children:null!==(Le=de.label)&&void 0!==Le?Le:"Approve"})]})})]})]})]}),null===(We=jt.sub_features)||void 0===We?void 0:We.map((t,l)=>{console.log("UserStoryCardWrapper: sub",t);const o=B(V,!1,t.artifactId);return e.jsx(A,{artifactId:I,isUserStoryCurrentlyUpdated:n,artifactTitleId:`${b}-${String.fromCharCode(65+l)}`,parentUserStory:U,parentIndex:`${P}${P&&"."}${M}`,currentIndex:`${l+1}`,doNotShowBorderInViewMode:!1,currentUserStory:t,onUserStoryChange:e=>((e,t)=>{const l=[...U.sub_features||[]];l[e]=t,R({...U,sub_features:l})})(l,e),enableDownload:!0,isDiffEditReviewMode:_,showUserStoryDiff:L,updateUserStoryArtifact:O,handleDownloadUserStory:W,handleOpenSendDialog:F,isDisplayHighlightControl:z,elementDisplayConfig:V,_resolvedConfig:o,actionItemsConfig:Q,onDelete:()=>(e=>{const t=(U.sub_features||[]).filter((t,l)=>l!==e),l={...U,sub_features:t};bt(l),R(l)})(l),expandedSubFeatures:J,disableEditPlan:ae,useMuiTooltip:re,blockNumber:t.blockNumber,showAssignSection:fe,onAssignSectionClick:me},t.artifactId)})]})})]})};exports.StoryCard=A,exports.UserStoryCardWrapper=({artifactTitleIDs:n,expandedSubFeatures:o,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,isUserStoryCurrentlyUpdated:d,artifactId:u,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:f,isDisplayHighlightControl:h,elementDisplayConfig:y,showWrapper:S,actionItemsConfig:g,contextVariant:C,showDisplayName:x,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:b,defaultExpanded:w,showCompletionPanel:N=!1,completionPanelConfig:E,showAddSectionButton:D=!1,disableEditPlan:T=!1,useMuiTooltip:k=!1,approveButtonConfig:U,editButtonConfig:R,CDNeededInChip:P,showWaitingIconInChip:M,setRedlineDocumentIdParent:q,showAssignSection:_,onAssignSectionClick:L,disableAssignSection:W})=>{const{userStory:F,setUserStory:O,customStyles:$,searchQueryList:z,currentHighlightIndex:V,setCurrentHighlightIndex:G,segmentComponentConfig:H,sectionStatusConfig:Y,redlineConfig:Q,setRedlineDocumentId:X}=p.useRequirementAI(),Z=null==$?void 0:$.userStoryCardStyles,J=0===V,K=V===z.length-1;return t.useEffect(()=>{if(!(null==Q?void 0:Q.callCreateDocumentOnInit))return;(async()=>{var e;const{redline_document_id:t}=await m.getRedlineDocumentId({baseApiUrl:Q.documentBaseApiUrl||"",comparisonId:Q.documentComparisonId||""});if(t)X(t);else{const{document_id:t}=await m.createRedlineDocument({baseApiUrl:Q.baseApiUrl,changelogConfigId:Q.changelogConfigId,comparisonId:Q.documentComparisonId,artifactId:Q.artifactId,inputData:Q.inputData,redlineConfigId:Q.redlineConfigId,userEmail:Q.userEmail,userName:Q.userName},null!==(e=null==Q?void 0:Q.token)&&void 0!==e?e:"");t&&(X(t),null==q||q(t))}})()},[]),e.jsxs("div",{className:a.default.userStoryCardWrapper,style:h?{...null==Z?void 0:Z.userStoryCardWrapper,position:"relative"}:null==Z?void 0:Z.userStoryCardWrapper,children:[h&&e.jsx(e.Fragment,{children:z.length>0&&e.jsx("div",{className:a.default.wrapper,children:e.jsx("div",{className:a.default.highlightNavigation,children:e.jsxs("div",{className:a.default.navigationContainer,children:[e.jsxs("span",{className:a.default.navCounter,children:[V+1," of ",z.length]}),e.jsxs("div",{className:a.default.navButtons,children:[e.jsx("button",{onClick:()=>{V>0&&G(e=>e-1)},className:a.default.navButton,disabled:J,children:e.jsx(l.ChevronUpIcon,{size:20,className:a.default.navIcon})}),e.jsx("button",{onClick:()=>{V<z.length-1&&G(e=>e+1)},className:a.default.navButton,disabled:K,children:e.jsx(l.ChevronDownIcon,{size:20,className:a.default.navIcon})})]})]})})})}),F.map((t,l)=>{console.log("UserStoryCardWrapper: userstory",t);const a=B(y,!0);return e.jsx(A,{isUserStoryCurrentlyUpdated:d,artifactId:u,artifactTitleId:n[l]||"",expandedSubFeatures:o,currentUserStory:t,onUserStoryChange:e=>{O(t=>(t[l]=e,[...t]))},parentIndex:"",currentIndex:`${l+1}`,doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:i,showUserStoryDiff:s,updateUserStoryArtifact:r,handleOpenSendDialog:c,handleDownloadUserStory:v,selectedArtifactId:f,isDisplayHighlightControl:h,elementDisplayConfig:y,_resolvedConfig:a,showWrapper:S,defaultExpanded:w,actionItemsConfig:g,contextVariant:C,showDisplayName:x,allowTitleEdit:I,showConfidenceScore:j,showBorderTop:b,sectionStatusConfig:Y,showCompletionPanel:N,completionPanelConfig:E,showAddSectionButton:D,disableEditPlan:T,useMuiTooltip:k,approveButtonConfig:U,CDNeededInChip:P,editButtonConfig:R,showWaitingIconInChip:M,showAssignSection:_,disableAssignSection:W,onAssignSectionClick:L},t.artifactId)})]})},exports.default=A,exports.replaceLearnedTagsWithInfo=D;
|
|
2
2
|
//# sourceMappingURL=UserStoryCard.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./SocketManager.js");class e{static initialize(r){if("string"!=typeof r.applicationId||!r.applicationId.trim()||"string"!=typeof r.authToken||!r.authToken.trim()||"string"!=typeof r.baseUrl||!r.baseUrl.trim())return;const a=t.SocketManager.getInstance();a.getInitStatus()||(a.initialize(r),a.setListener(e.dispatch))}static dispatch(t){const r=e.handlers.get(t.type);r&&r.forEach(e=>{e(t.payload)})}static on(t,r){if("string"!=typeof t||!t.trim()||"function"!=typeof r)throw Error("invalid event or handler type");return e.handlers.has(t)||e.handlers.set(t,new Set),e.handlers.get(t).add(r),()=>e.off(t,r)}static off(t,r){if("string"!=typeof t||!t.trim()||"function"!=typeof r)throw Error("invalid event or handler type");const a=e.handlers.get(t);a&&(a.delete(r),0===a.size&&e.handlers.delete(t))}static emit(e,r){if("string"!=typeof e||!e.trim())throw Error("invalid event type");t.SocketManager.getInstance().publish(e,r)}static isInitialized(){return t.SocketManager.getInstance().getInitStatus()}static destroy(){e.handlers.clear(),t.SocketManager.getInstance().destroy()}}e.handlers=new Map,exports.default=e;
|
|
2
|
+
//# sourceMappingURL=CwsEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CwsEvent.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("./CwsEvent.js");exports.default=function({baseUrl:a,applicationId:i,children:u,authToken:n}){return r.useEffect(()=>(t.default.initialize({baseUrl:a,applicationId:i,authToken:n}),()=>{t.default.destroy()}),[n,i,a]),e.jsx(e.Fragment,{children:u})};
|
|
2
|
+
//# sourceMappingURL=CwsEventProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CwsEventProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("axios"),e=require("socket.io-client");function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=i(t);class n{constructor(){this.isInitialized=!1}static getInstance(){return n.instance||(n.instance=new n),n.instance}async initialize(t){this.isInitialized||(this.applicationId=t.applicationId,this.authToken=t.authToken,this.isInitialized=!0,this.socket=e.io(t.baseUrl,{path:"/cwsEvent/socket-cwsEvent",autoConnect:!0,reconnection:!0,transports:["websocket"],auth:{token:this.authToken}}),this.socket.on("connect",()=>{console.log("Connected:",this.socket.id),this.socket.emit("subscribe",{applicationId:this.applicationId})}),this.socket.on("message",t=>{var e;null===(e=this.listener)||void 0===e||e.call(this,t)}))}async wakeupServer(t){try{await s.default.get(t),console.log("Server wakeup successful")}catch(t){console.error("Server wakeup failed",t)}}setListener(t){this.listener=t}publish(t,e){this.socket.emit("publish",{applicationId:this.applicationId,type:t,payload:e})}disconnect(){this.socket.disconnect()}getInitStatus(){return this.isInitialized}destroy(){this.socket&&(this.socket.removeAllListeners(),this.socket.disconnect(),this.listener=void 0,this.socket=void 0,this.applicationId="",this.authToken="",this.isInitialized=!1,n.instance=void 0)}}exports.SocketManager=n;
|
|
2
|
+
//# sourceMappingURL=SocketManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketManager.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCwsEvent.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("axios"));exports.createRedlineDocument=async(e,o)=>{try{console.log("[createRedlineDocument] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/create`,{user_name:e.userName,user_email:e.userEmail,redline_config_id:e.redlineConfigId,changelog_config_id:e.changelogConfigId,artifact_id:e.artifactId,input_data:e.inputData,document_metadata:{comparison_id:e.comparisonId}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[createRedlineDocument] Response:",t),t}catch(e){console.log("[createRedlineDocument] Error:",e)}return null},exports.getRedlineDocumentId=async e=>{try{console.log("[getRedlineDocumentId] Request:",e);const{data:o}=await n.default.get(`${e.baseApiUrl}/book-finder-mode/get_comparison/${e.comparisonId}`);return console.log("[getRedlineDocumentId] Response:",o),o}catch(e){console.log("[getRedlineDocumentId] Error:",e)}return null},exports.resolveRedline=async(e,o)=>{try{console.log("[resolveRedline] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/resolve`,{document_id:e.documentId,user_name:e.userName,user_email:e.userEmail,redline_id:e.redlineId,action:e.action,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[resolveRedline] Response:",t),t}catch(e){console.log("[resolveRedline] Error:",e)}return null},exports.updateRedlineDocument=async(e,o)=>{try{console.log("[updateRedlineDocument] Request:",e);const{data:t}=await n.default.put(`${e.baseApiUrl}/redlining/update-manual`,{document_id:e.documentId,segment_id:e.sectionId,user_name:e.userName,user_email:e.userEmail,new_plain_content:e.updatedContent,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[updateRedlineDocument] Response:",t),t}catch(e){console.log("[updateRedlineDocument] Error:",e)}return null};
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var n=e(require("axios"));exports.createRedlineDocument=async(e,o)=>{try{console.log("[createRedlineDocument] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/create`,{user_name:e.userName,user_email:e.userEmail,redline_config_id:e.redlineConfigId,changelog_config_id:e.changelogConfigId,artifact_id:e.artifactId,input_data:e.inputData,document_metadata:{comparison_id:e.comparisonId}},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[createRedlineDocument] Response:",t),t}catch(e){console.log("[createRedlineDocument] Error:",e)}return null},exports.fetchRedlineDocumentSection=async(e,o)=>{try{console.log("[fetchRedlineDocumentSection] Request:",e);const{data:t}=await n.default.get(`${e.baseApiUrl}/redlining/segment/${e.documentId}/${e.sectionId}?redline_config_id=${e.redlineConfigId}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[fetchRedlineDocumentSection] Response:",t),t}catch(e){console.log("[fetchRedlineDocumentSection] Error:",e)}return null},exports.getRedlineDocumentId=async e=>{try{console.log("[getRedlineDocumentId] Request:",e);const{data:o}=await n.default.get(`${e.baseApiUrl}/book-finder-mode/get_comparison/${e.comparisonId}`);return console.log("[getRedlineDocumentId] Response:",o),o}catch(e){console.log("[getRedlineDocumentId] Error:",e)}return null},exports.resolveRedline=async(e,o)=>{try{console.log("[resolveRedline] Request:",e);const{data:t}=await n.default.post(`${e.baseApiUrl}/redlining/resolve`,{document_id:e.documentId,user_name:e.userName,user_email:e.userEmail,redline_id:e.redlineId,action:e.action,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[resolveRedline] Response:",t),t}catch(e){console.log("[resolveRedline] Error:",e)}return null},exports.updateRedlineDocument=async(e,o)=>{try{console.log("[updateRedlineDocument] Request:",e);const{data:t}=await n.default.put(`${e.baseApiUrl}/redlining/update-manual`,{document_id:e.documentId,segment_id:e.sectionId,user_name:e.userName,user_email:e.userEmail,new_plain_content:e.updatedContent,redline_config_id:e.redlineConfigId},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}});return console.log("[updateRedlineDocument] Response:",t),t}catch(e){console.log("[updateRedlineDocument] Error:",e)}return null};
|
|
2
2
|
//# sourceMappingURL=redlineService.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as i}from"tslib";import{jsxs as o,jsx as e,Fragment as n}from"react/jsx-runtime";import{ChevronUp as t,ChevronDown as l}from"lucide-react";import{useState as r,useMemo as d}from"react";import a from"./ResizableSplitPane.js";import u from"../PdfViewer/PdfViewer.js";import{DefaultFullScreenCloseIcon as s,DefaultFullScreenIcon as c}from"../../assests/svg/PdfViewerIcons.js";import p from"react-markdown";import g from"rehype-raw";import{Box as m}from"@mui/material";import{SHARED_MARKDOWN_STYLES as h}from"./CognitiveCompareConfig.js";import"react-dom";import{useCompareContext as v}from"./CompareContext.js";import{processGuidelinesMarkdown as f}from"./Guidelines/utils/processGuidelinesMarkdown.js";import"./MoreFunctionsPopup.js";import"./components/SubSectionAccordion.js";import"./components/LHSSectionRow.js";import"./components/RHSSectionRow.js";var _=function(o){var t,l,r,s,c,_,x,b=o.href,y=o.metaData,F=o.citationTitle,w=o.citationType,C=o.citationReason,P=o.isFullscreen,S=v().guidelinesData,R=function(i){try{var o=new URL(i,window.location.origin);return{citationNumber:o.searchParams.get("citationNumber"),phraseToHighlight:o.searchParams.get("phrase_to_highlight")}}catch(i){return{citationNumber:null,phraseToHighlight:null}}}(b),j=R.citationNumber,k=R.phraseToHighlight,D=j&&(null===(t=null==y?void 0:y.citations)||void 0===t?void 0:t[j])||{},T=(null===(l=null==y?void 0:y.docData)||void 0===l?void 0:l.documents)||{},H=(null===(r=null==y?void 0:y.docData)||void 0===r?void 0:r.input_index_map)||{},z=null==H?void 0:H[0],A=null==H?void 0:H[1],E=z?T[z]:null,N=A?T[A]:null,I=z?D[z]:null,V=A?D[A]:null,W=d(function(){var i,o,n,t;return I&&E?e(u,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==E?void 0:E.title,pdfUrl:null==E?void 0:E.signed_url,highlightText:[null!==(i=null==I?void 0:I.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(o=null==I?void 0:I.custom_metadata)||void 0===o?void 0:o.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(n=null==I?void 0:I.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number,null===(t=null==I?void 0:I.custom_metadata)||void 0===t?void 0:t.pdf_end_page_number]}):null},[null==E?void 0:E.title,null==E?void 0:E.signed_url,null==I?void 0:I.highlighted_text,null===(s=null==I?void 0:I.custom_metadata)||void 0===s?void 0:s.pdf_start_page_number,null===(c=null==I?void 0:I.custom_metadata)||void 0===c?void 0:c.pdf_end_page_number]),B=d(function(){var i,o,n,t;return V&&N?e(u,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==N?void 0:N.title,pdfUrl:null==N?void 0:N.signed_url,jumpToPageValue:1,highlightText:[null!==(i=null==V?void 0:V.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(o=null==V?void 0:V.custom_metadata)||void 0===o?void 0:o.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(n=null==V?void 0:V.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number,null===(t=null==V?void 0:V.custom_metadata)||void 0===t?void 0:t.pdf_end_page_number]}):null},[null==N?void 0:N.title,null==N?void 0:N.signed_url,null==V?void 0:V.highlighted_text,null===(_=null==V?void 0:V.custom_metadata)||void 0===_?void 0:_.pdf_start_page_number,null===(x=null==V?void 0:V.custom_metadata)||void 0===x?void 0:x.pdf_end_page_number]),U=d(function(){if(!W)return null;var o="rulebook_citation"===w?e(n,{children:e(m,i({sx:i(i({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},h),{overflow:"auto"})},{children:e(p,i({rehypePlugins:[g]},{children:f({guidelinesData:S,targetHighlights:[k],labelColor:"#FEF08A"})}))}))}):B;return o?e(a,{leftComponent:W,rightComponent:o,isFullscreen:P}):W},[W,B,w,P]);return j?"rulebook_citation"===w?e("div",I?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:U}):i({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:C||"Rulebook citation selected."})):["contract","clause"].includes(F)?e("div",I||V?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:U}):{children:"Missing PDF Citation. Please try again later"}):e("div",{children:"No Citation Found. Please try again later"}):null},x=function(n){var d,a,u,p=n.href,g=n.children,m=n.citationType,h=n.citationReason,v=n.metaData,f=n.chevronUpComponent,x=void 0===f?null:f,b=n.chevronDownComponent,y=void 0===b?null:b,F=n.customStyle,w=void 0===F?{}:F,C=n.defaultState,P=r(void 0!==C&&C),S=P[0],R=P[1],j=r(!1),k=j[0],D=j[1],T="string"==typeof g&&(null===(d=null==g?void 0:g.split("\n"))||void 0===d?void 0:d.length)>1?g.split("\n").join(" "):g,H="string"==typeof g?g:g[0],z=null!=x?x:function(i){var o,n;return e(t,{size:null!==(o=null==i?void 0:i.fontSize)&&void 0!==o?o:16,color:null!==(n=null==i?void 0:i.color)&&void 0!==n?n:"rgb(214, 51, 132)"})}(null!==(a=null==w?void 0:w.arrow)&&void 0!==a?a:{}),A=null!=y?y:function(i){var o,n;return e(l,{size:null!==(o=null==i?void 0:i.fontSize)&&void 0!==o?o:16,color:null!==(n=null==i?void 0:i.color)&&void 0!==n?n:"rgb(214, 51, 132)"})}(null!==(u=null==w?void 0:w.arrow)&&void 0!==u?u:{});return o("span",i({style:i({display:"inline"},w.relativeWrapper||{})},{children:[e("div",i({style:i({display:"inline",marginTop:0},w.citationButtonWrapper||{})},{children:o("button",i({type:"button",onClick:function(){return R(function(i){return!i})},style:i({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},w.citationButton||{})},{children:[e("span",{children:T}),e("span",i({style:{display:"flex",alignItems:"center"}},{children:S?z:A}))]}))})),S&&o("div",i({style:k?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"}},{children:[e("div",i({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:e("button",i({onClick:function(){D(function(i){return!i})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:e(k?s:c,{})}))})),e("div",i({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:e(_,{href:p,children:g,metaData:v,citationTitle:H,citationType:m,citationReason:h,isFullscreen:k})}))]}))]}))};export{x as default};
|
|
1
|
+
import{__assign as i,__awaiter as n,__generator as o}from"tslib";import{jsxs as t,jsx as e,Fragment as l}from"react/jsx-runtime";import{Globe as r,ChevronUp as a,ChevronDown as d,Maximize2 as u,X as c,ExternalLink as s}from"lucide-react";import{useState as v,useMemo as p,useRef as m,useEffect as h}from"react";import g from"./ResizableSplitPane.js";import f from"../PdfViewer/PdfViewer.js";import{DefaultFullScreenCloseIcon as x,DefaultFullScreenIcon as b}from"../../assests/svg/PdfViewerIcons.js";import _ from"react-markdown";import y from"rehype-raw";import{Box as C}from"@mui/material";import{SHARED_MARKDOWN_STYLES as w}from"./CognitiveCompareConfig.js";import"react-dom";import{useCompareContext as D}from"./CompareContext.js";import{processGuidelinesMarkdown as S}from"./Guidelines/utils/processGuidelinesMarkdown.js";import F from"../GptWebCitation/GptWebCitation.js";import{CitationType as T}from"../GptWebCitation/types.js";import"./MoreFunctionsPopup.js";import"./components/SubSectionAccordion.js";import"./components/LHSSectionRow.js";import"./components/RHSSectionRow.js";var I=function(i){var n,o,t;return(null===(t=null===(o=null===(n=(null==i?void 0:i.extraMetaData)||i)||void 0===n?void 0:n.aiReasoningCitation)||void 0===o?void 0:o.gpt_citation)||void 0===t?void 0:t[0])||null},P="https://dev-proposals-ai.techo.camp/utility/ca-workflow-composer-agent/get_citation",j="sai.siddhartha@techolution.com",k="672e32f7a0e8fe2e8e50bcba",N="TNV Sai Siddhartha",R=function(){var i;return"function"==typeof(null===(i=globalThis.crypto)||void 0===i?void 0:i.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var n=Math.floor(16*Math.random());return("x"===i?n:n%4+8).toString(16)})},E=function(i,n){var o=function(i){var n;return(null==i?void 0:i.payloadCitationId)||(null===(n=null==i?void 0:i.extraMetaData)||void 0===n?void 0:n.payloadCitationId)||""}(i)||n||R();return function(i,n){i&&"object"==typeof i&&(i.payloadCitationId=n,i.extraMetaData&&"object"==typeof i.extraMetaData&&(i.extraMetaData.payloadCitationId=n))}(i,o),o},M=function(t){var l,r=t.metaData,g=D().gptWebCitationConfig,f=p(function(){return function(i){return{endpoint:(null==i?void 0:i.endpoint)||P,userEmail:(null==i?void 0:i.userEmail)||j,userId:(null==i?void 0:i.userId)||k,userName:(null==i?void 0:i.userName)||N,headers:null==i?void 0:i.headers}}(g)},[g]),x=null==r?void 0:r.webGpt,b=m(null);b.current||(b.current=R());var _=p(function(){return function(i,n,o){var t,e,l=I(i),r=(null==l?void 0:l.customMetaData)||{},a=(null==r?void 0:r.value)||{},d=(null==i?void 0:i.webSearchAnswer)||{},u=(null==i?void 0:i.extraMetaData)||i||{};return{userEmail:(null==i?void 0:i.userEmail)||(null==d?void 0:d.userEmail)||(null==n?void 0:n.userEmail)||"",userId:(null==i?void 0:i.userId)||(null==d?void 0:d.userId)||(null==n?void 0:n.userId)||"",userName:(null==i?void 0:i.userName)||(null==d?void 0:d.userName)||(null==n?void 0:n.userName)||"",citationId:E(i,o),citationUrl:(null==a?void 0:a.citationUrl)||(null==d?void 0:d.citationUrl)||"",content:(null==u?void 0:u.Reasoning)||(null==d?void 0:d.enhanced_content)||"",citationType:(null==a?void 0:a.citationType)||"web",citatioNumber:null!==(e=null!==(t=null==r?void 0:r.citation_number)&&void 0!==t?t:null==l?void 0:l.citation_number)&&void 0!==e?e:Number((null==i?void 0:i.reasoningId)||0)}}(x,f,b.current||void 0)},[x,f]),y=p(function(){return I(x)},[x]),C=(null===(l=null==y?void 0:y.customMetaData)||void 0===l?void 0:l.value)||{},w=(null==x?void 0:x.extraMetaData)||x||{},S=v(),M=S[0],U=S[1],G=v("pending"),z=G[0],W=G[1],A=v(!0),H=A[0],V=A[1];h(function(){var t=!0;return n(void 0,void 0,void 0,function(){var n,e,l,r;return o(this,function(o){switch(o.label){case 0:if(!f.endpoint||!(null==_?void 0:_.citationUrl)||!(null==_?void 0:_.content))return W("error"),[2];W("pending"),o.label=1;case 1:return o.trys.push([1,4,,5]),[4,fetch(f.endpoint,{method:"POST",headers:i({"actor-id":_.userEmail,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},f.headers||{}),body:JSON.stringify(_)})];case 2:if(!(n=o.sent()).ok)throw new Error("Failed to fetch GPT web citation (".concat(n.status,")"));return[4,n.json()];case 3:return e=o.sent(),l=(null==e?void 0:e.responseData)||(null==e?void 0:e.result)||(null==e?void 0:e.data)||e,t?(U(l),W("success"),[3,5]):[2];case 4:return r=o.sent(),t?(console.error("Failed to load GPT web citation",r),W("error"),[3,5]):[2];case 5:return[2]}})}),function(){t=!1}},[_,f]);var O=p(function(){return{item:{confidence_score:Number((null==w?void 0:w.Confidence_score)||0),text:(null==C?void 0:C.paraphrase)||"Web citation reasoning",dataSource:(null==C?void 0:C.text)||(null==w?void 0:w.Reasoning)||"",paraphrase:(null==C?void 0:C.paraphrase)||""},headerTitle:"GPT Web Citation",index:Number((null==_?void 0:_.citatioNumber)||1)-1,iconsConfig:{ChevronDownIcon:d,ChevronUpIcon:a,MaximizeIcon:u,CloseIcon:c}}},[C,null==_?void 0:_.citatioNumber,w]);return e(F,{gptCitation:O,defaultCitationUrl:(null==_?void 0:_.citationUrl)||"",citationType:T.GPT_WEB,webCitationData:M,webCitationStatus:z,showWebCitation:H,onToggleCitationView:function(){return V(function(i){return!i})},iconsConfig:{MaximizeIcon:u,ExternalLinkIcon:s},isFixedHeight:!0})},U=function(n){var o,t,r,a,d,u,c,s=n.href,v=n.metaData,m=n.citationTitle,h=n.citationType,x=n.citationReason,b=n.isFullscreen,F=D().guidelinesData,T=function(i){try{var n=new URL(i,window.location.origin);return{citationNumber:n.searchParams.get("citationNumber"),phraseToHighlight:n.searchParams.get("phrase_to_highlight")}}catch(i){return{citationNumber:null,phraseToHighlight:null}}}(s),I=T.citationNumber,P=T.phraseToHighlight,j=I&&(null===(o=null==v?void 0:v.citations)||void 0===o?void 0:o[I])||{},k=(null===(t=null==v?void 0:v.docData)||void 0===t?void 0:t.documents)||{},N=(null===(r=null==v?void 0:v.docData)||void 0===r?void 0:r.input_index_map)||{},R=Object.keys((null==v?void 0:v.citations)||{}).length>0||Object.keys((null==v?void 0:v.docData)||{}).length>0,E=null==N?void 0:N[0],U=null==N?void 0:N[1],G=E?k[E]:null,z=U?k[U]:null,W=E?j[E]:null,A=U?j[U]:null,H=p(function(){var i,n,o,t;return W&&G?e(f,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==G?void 0:G.title,pdfUrl:null==G?void 0:G.signed_url,highlightText:[null!==(i=null==W?void 0:W.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(n=null==W?void 0:W.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(o=null==W?void 0:W.custom_metadata)||void 0===o?void 0:o.pdf_start_page_number,null===(t=null==W?void 0:W.custom_metadata)||void 0===t?void 0:t.pdf_end_page_number]}):null},[null==G?void 0:G.title,null==G?void 0:G.signed_url,null==W?void 0:W.highlighted_text,null===(a=null==W?void 0:W.custom_metadata)||void 0===a?void 0:a.pdf_start_page_number,null===(d=null==W?void 0:W.custom_metadata)||void 0===d?void 0:d.pdf_end_page_number]),V=p(function(){var i,n,o,t;return A&&z?e(f,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==z?void 0:z.title,pdfUrl:null==z?void 0:z.signed_url,jumpToPageValue:1,highlightText:[null!==(i=null==A?void 0:A.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(n=null==A?void 0:A.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(o=null==A?void 0:A.custom_metadata)||void 0===o?void 0:o.pdf_start_page_number,null===(t=null==A?void 0:A.custom_metadata)||void 0===t?void 0:t.pdf_end_page_number]}):null},[null==z?void 0:z.title,null==z?void 0:z.signed_url,null==A?void 0:A.highlighted_text,null===(u=null==A?void 0:A.custom_metadata)||void 0===u?void 0:u.pdf_start_page_number,null===(c=null==A?void 0:A.custom_metadata)||void 0===c?void 0:c.pdf_end_page_number]),O=p(function(){if(!H)return null;var n="rulebook_citation"===h?e(l,{children:e(C,i({sx:i(i({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},w),{overflow:"auto"})},{children:e(_,i({rehypePlugins:[y]},{children:S({guidelinesData:F,targetHighlights:[P],labelColor:"#FEF08A"})}))}))}):V;return n?e(g,{leftComponent:H,rightComponent:n,isFullscreen:b}):H},[H,V,h,b]);return(null==v?void 0:v.webGpt)&&!R?e(M,{metaData:v}):I?"rulebook_citation"===h?e("div",W?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:O}):i({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:x||"Rulebook citation selected."})):["contract","clause"].includes(m)?e("div",W||A?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:O}):{children:"Missing PDF Citation. Please try again later"}):e("div",{children:"No Citation Found. Please try again later"}):null},G=function(n){var o,l,u,c,s,p,m,h=n.href,g=n.children,f=n.citationType,_=n.citationReason,y=n.metaData,C=n.chevronUpComponent,w=void 0===C?null:C,D=n.chevronDownComponent,S=void 0===D?null:D,F=n.customStyle,T=void 0===F?{}:F,I=n.defaultState,P=v(void 0!==I&&I),j=P[0],k=P[1],N=v(!1),R=N[0],E=N[1],M="string"==typeof g&&(null===(o=null==g?void 0:g.split("\n"))||void 0===o?void 0:o.length)>1?g.split("\n").join(" "):g,G="string"==typeof g?g:g[0],z=null!=w?w:function(i){var n,o;return e(a,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(o=null==i?void 0:i.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(l=null==T?void 0:T.arrow)&&void 0!==l?l:{}),W=null!=S?S:function(i){var n,o;return e(d,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(o=null==i?void 0:i.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(u=null==T?void 0:T.arrow)&&void 0!==u?u:{});return t("span",i({style:i({display:"inline"},T.relativeWrapper||{})},{children:[e("div",i({style:i({display:"inline",marginTop:0},T.citationButtonWrapper||{})},{children:t("button",i({type:"button",onClick:function(){return k(function(i){return!i})},style:i({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:(null==y?void 0:y.webGpt)?600:700,color:(null==y?void 0:y.webGpt)?"#6D28D9":"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},T.citationButton||{})},{children:[(null==y?void 0:y.webGpt)&&e("span",i({style:{display:"inline-flex",alignItems:"center",lineHeight:0,verticalAlign:"middle"}},{children:e(r,{size:null!==(s=null===(c=T.arrow)||void 0===c?void 0:c.fontSize)&&void 0!==s?s:14,color:null!==(m=null===(p=T.arrow)||void 0===p?void 0:p.color)&&void 0!==m?m:"#6D28D9",style:{display:"block",flexShrink:0}})})),e("span",{children:M}),e("span",i({style:{display:"flex",alignItems:"center"}},{children:j?z:W}))]}))})),j&&t("div",i({style:R?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"}},{children:[e("div",i({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:e("button",i({onClick:function(){E(function(i){return!i})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:e(R?x:b,{})}))})),e("div",i({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:e(U,{href:h,children:g,metaData:y,citationTitle:G,citationType:f,citationReason:_,isFullscreen:R})}))]}))]}))};export{G as default};
|
|
2
2
|
//# sourceMappingURL=CitationAnchor.js.map
|