@e-llm-studio/instant-learning 0.1.1-alpha.71 → 0.1.1-alpha.72
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/IL-OTJ/ILOTJ.js +1 -1
- package/dist/cjs/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.js +2 -0
- package/dist/cjs/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.js.map +1 -0
- package/dist/cjs/features/LearningManagement/components/CreateRuleSetLegacyModal.js +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/features/IL-OTJ/ILOTJ.js +1 -1
- package/dist/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.js +2 -0
- package/dist/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.js.map +1 -0
- package/dist/features/LearningManagement/components/CreateRuleSetLegacyModal.js +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/types/src/features/IL-OTJ/ILOTJ.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.d.ts +56 -0
- package/dist/types/src/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/components/CreateRuleSetLegacyModal.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/InstantLearningModal.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as n,jsxs as o}from"react/jsx-runtime";import{Dialog as t,DialogContent as i,Box as a}from"@mui/material";import s,{useState as r,useEffect as l,useCallback as d}from"react";import
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as n,jsxs as o}from"react/jsx-runtime";import{Dialog as t,DialogContent as i,Box as a}from"@mui/material";import s,{useState as r,useEffect as l,useCallback as d}from"react";import u from"./_components/ChatComponents/ChatComponent.js";import c from"./_components/ILPopup.js";import m from"./_components/VariantLoadingOverlay.js";import h from"./_components/templates/RuleComparison/RuleComparison.js";import g from"./_components/templates/RuleComparison/AgentComposerRuleComparison.js";import p from"./_components/ChatComponents/NormalChat.js";import{useLearningTemplateStore as f}from"../LearningManagement/store/useLearningTemplateStore.js";import C from"./_components/templates/RuleComparison/RuleComparisonNew.js";var v=function(v){var S=v.open,x=v.chatAssistantName,b=v.organizationName,k=v.baseUrl,w=v.baseWebsocketUrl,M=v.closeFunction,y=v.ThinkingBulbIconComponent,R=v.customSections,I=v.customMetaData,V=v.chatTitle,T=void 0===V?"Instant Learning On-The-Job":V,F=v.formTitle,A=void 0===F?"Instant Learning On-The-Job Form":F,L=v.onSave,D=v.headerMessageHandlers,W=v.aiResponse,E=v.setAIResponse,B=v.width,P=void 0===B?"90vw":B,z=v.height,N=void 0===z?"90vh":z,O=v.sendMessageInChat,j=void 0===O?"":O,U=v.setSendMessageInChat,_=v.validateCustom,J=v.onResetChat,q=v.template,H=v.templateProps,G=v.initialChatMessage,X=v.setCitations,Y=v.isLoading,K=void 0!==Y&&Y,Q=v.isLocked,Z=void 0!==Q&&Q,$=v.saveButtonConfig,ee=void 0===$?{label:"Save Learning",loadingLabel:"Saving Learning..."}:$,ne=v.saveButtonColor,oe=v.saveWithoutValBtnConfig,te=void 0===oe?{label:"Save Without Validation",loadingLabel:"Saving Without Validation..."}:oe,ie=v.textareaPlaceholder,ae=v.setCurrentRequestId,se=v.showSavedMessage,re=void 0!==se&&se,le=v.savedMessage,de=void 0===le?"Thank you teacher for teaching me, your learning has been saved successfully.":le,ue=v.isError,ce=void 0!==ue&&ue,me=v.errorMessage,he=void 0===me?"I'm sorry, I couldn't save your changes. Please try again.":me,ge=v.isSaving,pe=void 0!==ge&&ge,fe=v.isAiStreaming,Ce=v.setIsAiStreaming,ve=v.showConfirmReset,Se=void 0!==ve&&ve,xe=v.setShowConfirmReset,be=v.confirmReset,ke=v.isLoadingVariants,we=v.isFormDirty,Me=v.onResetRequest,ye=v.mainText,Re=void 0===ye?"Adding a variant":ye,Ie=v.subText,Ve=void 0===Ie?"This may take a moment as we update the learning with the new variant.":Ie,Te=v.showComparison,Fe=void 0!==Te&&Te,Ae=v.setShowComparison,Le=v.showAgentComposerRuleComparison,De=void 0!==Le&&Le,We=v.setShowAgentComposerRuleComparison,Ee=v.isFetchingComparison,Be=v.handleOpenComparison,Pe=v.proposedRule,ze=v.variants,Ne=v.onAddAsVariant,Oe=v.isCopyEnabled,je=v.showSaveWithoutValidation,Ue=void 0!==je&&je,_e=v.onSaveWithoutValidation,Je=v.onComparisonLinkClick,qe=v.targetComparisonVariantId,He=v.highlightedComparisonField,Ge=v.onSubmitFeedback,Xe=v.isUseNormalChat,Ye=void 0!==Xe&&Xe,Ke=v.userDetails,Qe=v.handleGlobalClickCapture,Ze=v.isGlobalEditActive,$e=v.socketTimeOutInMilliSeconds,en=v.initialDraftMessage,nn=v.onValidateSession,on=r(S),tn=on[0],an=on[1],sn=r(!1);sn[0];var rn=sn[1],ln=r(!1),dn=ln[0],un=ln[1],cn=r(!1),mn=cn[0];cn[1];var hn=r(45),gn=hn[0],pn=hn[1],fn=r("right"),Cn=fn[0],vn=fn[1],Sn=s.useRef(Cn),xn=r(!1),bn=xn[0],kn=xn[1],wn=r(0),Mn=wn[0],yn=wn[1],Rn=r(40),In=Rn[0],Vn=Rn[1],Tn=f.getState().backwardCompatibility;l(function(){Sn.current=Cn},[Cn]),l(function(){an(S)},[S]);var Fn=d(function(e){e.preventDefault(),kn(!0),yn(e.clientX),Vn(gn)},[gn]),An=d(function(e){if(bn){var n=document.querySelector("[data-dialog-content]");if(n){var o=n.getBoundingClientRect(),t=(e.clientX-Mn)/o.width*100,i=Math.max(20,Math.min(80,In+t));pn(i),i>In&&vn("right"),i<In&&vn("left")}}},[bn,Mn,In]),Ln=d(function(){kn(!1)},[]);l(function(){if(bn)return document.addEventListener("mousemove",An),document.addEventListener("mouseup",Ln),function(){document.removeEventListener("mousemove",An),document.removeEventListener("mouseup",Ln)}},[bn,An,Ln]);var Dn=function(e,n){Z&&"backdropClick"===n||("escapeKeyDown"!==n&&"manualClose"!==n||!(null==we?void 0:we())?(an(!1),M()):null==Me||Me())},Wn=d(function(e){pn(function(n){var o;if("number"==typeof e)return e>n&&vn("right"),e<n&&vn("left"),e;var t=Sn.current,i=null!==(o={20:30,30:"left"===t?20:50,50:"left"===t?30:75,75:"left"===t?50:100,100:75}[n])&&void 0!==o?o:40;return 100===i&&vn("left"),20===i&&vn("right"),i})},[]),En=d(function(){Be&&(Wn(30),Be())},[Wn,Be]);return n(t,e({open:tn,onClose:Dn,maxWidth:!1,fullWidth:!0,PaperProps:{sx:{width:P,height:N,display:"flex",flexDirection:"column",padding:0,margin:0,maxWidth:"100vw",borderRadius:"10px"}}},{children:o(i,e({"data-dialog-content":!0,onClickCapture:Qe,sx:{flex:1,overflow:"hidden",display:"flex",flexDirection:"row",gap:0,padding:0,fontFamily:'"Plus Jakarta Sans", sans-serif',"& *":{fontFamily:'"Plus Jakarta Sans", sans-serif !important'}}},{children:[n(a,e({sx:{width:"".concat(gn,"%"),maxWidth:"".concat(gn,"%"),transition:bn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",bgcolor:"#ffffff",p:0,display:0===gn?"none":"flex",flexDirection:"column"}},{children:Ye?n(p,{chatAssistantName:x,organizationName:b,baseUrl:k,baseWebsocketUrl:w,setIsNewChatClicked:rn,ThinkingBulbIconComponent:y,isFormSaveClicked:dn,setIsFormSavedClicked:un,onResetLearningData:function(){},sendMessageInChat:j,setSendMessageInChat:U,isFormValidating:mn,chatTitle:T,customMetaData:I,headerMessageHandlers:D,aiResponse:W,setAIResponse:E,onResetChat:J,initialChatMessage:G,onSave:L,chatSize:gn,movingTowards:Cn,setChatSize:Wn,setCitations:X,textareaPlaceholder:ie,setCurrentRequestId:ae,showSavedMessage:re,savedMessage:de,isError:ce,errorMessage:he,isSaving:pe,onStreamingStateChange:Ce,onViewComparison:En,isCopyEnabled:Oe,onComparisonLinkClick:Je,onSubmitFeedback:Ge}):n(u,{chatAssistantName:x,organizationName:b,baseUrl:k,baseWebsocketUrl:w,setIsNewChatClicked:rn,ThinkingBulbIconComponent:y,isFormSaveClicked:dn,setIsFormSavedClicked:un,onResetLearningData:function(){},sendMessageInChat:j,setSendMessageInChat:U,isFormValidating:mn,chatTitle:T,customMetaData:I,headerMessageHandlers:D,aiResponse:W,setAIResponse:E,onResetChat:J,initialChatMessage:G,onSave:L,chatSize:gn,movingTowards:Cn,setChatSize:Wn,setCitations:X,textareaPlaceholder:ie,setCurrentRequestId:ae,showSavedMessage:re,savedMessage:de,isError:ce,errorMessage:he,isSaving:pe,onStreamingStateChange:Ce,onViewComparison:En,isCopyEnabled:Oe,onComparisonLinkClick:Je,onSubmitFeedback:Ge,userDetails:Ke,isGlobalEditActive:Ze,socketTimeOutInMilliSeconds:$e,initialDraftMessage:en,onValidateSession:nn,onCloseSessionModal:be})})),n(a,{sx:{width:"2px",cursor:"col-resize",backgroundColor:bn?"#1976d2":"#e0e0e0",transition:"background-color 0.2s ease","&:hover":{backgroundColor:"#1976d2"},flexShrink:0},onMouseDown:Fn}),o(a,e({sx:{width:"".concat(100-gn,"%"),maxWidth:"".concat(100-gn,"%"),transition:bn?"none":"width 0.3s ease-in-out, max-width 0.3s ease-in-out",display:100===gn?"none":"flex",flexDirection:"column",overflowY:"hidden",position:"relative"}},{children:[n(m,{isLoading:Ee||!1,mainText:"Fetching differences between rules",subText:"This may take a moment..."}),n(m,{isLoading:ke||!1,mainText:Re,subText:Ve}),De?n(g,{proposedRule:Pe,variants:ze,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Ne||Ne(),Wn(40),null==We||We(!1)},onSkip:function(){Wn(40),null==We||We(!1)},onBack:function(){Wn(40),null==We||We(!1)},targetVariantId:qe,highlightedField:He}):Fe?Tn?n(C,{proposedRule:Pe,variants:ze,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Ne||Ne(),Wn(40),null==Ae||Ae(!1)},onSkip:function(){Wn(40),null==Ae||Ae(!1)},onBack:function(){Wn(40),null==Ae||Ae(!1)},targetVariantId:qe,highlightedField:He}):n(h,{variants:ze,onSelectVariant:function(e){console.log("Selected Variant ID:",e.id)},onAddAsVariant:function(){null==Ne||Ne(),Wn(40),null==Ae||Ae(!1)},onSkip:function(){Wn(40),null==Ae||Ae(!1)},onBack:function(){Wn(40),null==Ae||Ae(!1)},targetVariantId:qe}):n(c,{setIsFormSavedClicked:un,customSections:R,onSave:L,formHeader:A,onClose:function(){return Dn(0,"manualClose")},validateCustom:_,template:q,templateProps:H,isLoading:K,isAiStreaming:fe,saveButtonConfig:ee,saveButtonColor:ne,showSaveWithoutValidation:Ue,saveWithoutValBtnConfig:te,onSaveWithoutValidation:_e}),n(t,e({open:Se,onClose:function(){return null==xe?void 0:xe(!1)},PaperProps:{sx:{borderRadius:"12px",padding:"8px",maxWidth:"400px"}}},{children:o(a,e({sx:{p:3,textAlign:"center",fontFamily:"'Plus Jakarta Sans', sans-serif"}},{children:[n("h3",e({style:{fontSize:"18px",fontWeight:600,color:"#0F172A",marginBottom:"6px"}},{children:"Exit Teach Me OTJ?"})),n("p",e({style:{fontSize:"14px",color:"#64748B",lineHeight:"1.5",marginBottom:"10px"}},{children:"Exiting will discard any unsaved changes and end your session."})),o(a,e({sx:{display:"flex",gap:2,justifyContent:"center"}},{children:[n("button",e({onClick:function(){return null==xe?void 0:xe(!1)},style:{flex:1,padding:"10px 16px",cursor:"pointer",backgroundColor:"white",border:"1px solid #E2E8F0",borderRadius:"8px",fontSize:"14px",fontWeight:500,color:"#475569",transition:"all 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#F8FAFC"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="white"}},{children:"Cancel"})),n("button",e({onClick:be,style:{flex:1,padding:"10px 16px",backgroundColor:"#EF4444",color:"white",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background-color 0.2s"},onMouseOver:function(e){return e.currentTarget.style.backgroundColor="#DC2626"},onMouseOut:function(e){return e.currentTarget.style.backgroundColor="#EF4444"}},{children:"Yes, Discard"}))]}))]}))}))]}))]}))}))};export{v as default};
|
|
2
2
|
//# sourceMappingURL=ILOTJ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e,__spreadArray as n,__rest as t}from"tslib";import{jsxs as i,jsx as r}from"react/jsx-runtime";import o,{useState as l,useRef as a,useEffect as s,useMemo as d}from"react";import{Box as c,Typography as p,IconButton as h,Skeleton as g}from"@mui/material";import{ArrowLeft as u,ArrowRight as x}from"lucide-react";import f from"../../_svg/SparkleIcon.js";import{CognitiveDecisioningCard as m}from"@e-llm-studio/citation";import{ButtonCognitiveIcon as b}from"../../_svg/ButtonCognitiveIcon.js";var v=function(e,n){if(!n)return null;var t=new RegExp("<".concat(e,"[^>]*>([\\s\\S]*?)<\\/").concat(e,">"),"i"),i=n.match(t);return i?i[1].replace(/\\n/g,"\n"):null},y=function(e,n,t){var i=100*e;if(!t)return{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:"Not Defined"};var r=function(e){return e.split("_").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}).join(" ")}(n);return i>=70?{bg:"#FEF2F2",border:"#FEE2E2",badgeBg:"#FEF2F2",badgeBorder:"#FECACA",badgeText:"#B91C1C",highlightBg:"#FECACA",label:r}:i>=40?{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3",label:r}:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:r}},w=o.forwardRef(function(n,t){var o=n.label,l=n.content,a=n.highlights,s=void 0===a?[]:a,d=n.styleVariant,h=n.isHighlighted,g=void 0!==h&&h,u=Array.isArray(l)?l.join("\n"):l||"",x="#B91C1C"===d.badgeText?{borderColor:"#EF4444",shadow:"rgba(239, 68, 68, 0.25)"}:"#A16207"===d.badgeText?{borderColor:"#F59E0B",shadow:"rgba(245, 158, 11, 0.25)"}:{borderColor:"#6366F1",shadow:"rgba(99, 102, 241, 0.25)"};return i(c,e({sx:{mb:1.5}},{children:[r(p,e({sx:{fontSize:"12px",color:"#19213D",mb:.5,fontWeight:500,lineHeight:"130%"}},{children:o})),r(c,e({ref:t,sx:{p:"4px 12px",borderRadius:"6px",border:g?"1.5px solid ".concat(x.borderColor):"1px solid ".concat(d.border),boxShadow:g?"0px 0px 0px 2px ".concat(x.shadow):"none",bgcolor:d.bg,fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,minHeight:"24px",display:"flex",alignItems:"center",whiteSpace:"pre-line",wordBreak:"break-word"}},{children:r(c,{children:function(){if(!u)return r(p,e({sx:{color:"#94A3B8",fontSize:"12px",fontStyle:"italic"}},{children:"Not Defined"}));if(!s||0===s.length)return u;var n=s.filter(function(e){return e&&e.length>0}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(0===n.length)return u;var t=new RegExp("(".concat(n.join("|"),")"),"gi");return u.split(t).map(function(n,t){return s.some(function(e){return e&&e.toLowerCase()===n.toLowerCase()})?r(c,e({component:"span",sx:{bgcolor:d.highlightBg,borderRadius:"2px",px:"2px"}},{children:n}),t):n})}()})}))]}))}),F=function(n){var t=n.data,o=n.isSelected,l=n.isCognitiveOpen,a=n.onToggleCognitive,s=n.onClick,d=t.summaryText||t.description||"",h=d.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),u=h?d.replace(h[0],"").trim():d,x=!!h;return i(c,e({id:"variant-card-".concat(t.id),onClick:s,sx:{minWidth:"280px",maxWidth:"280px",p:2,m:.5,bgcolor:o?"#EFF6FF99":"#FFFFFF",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s",display:"flex",flexDirection:"column",gap:1,flexShrink:0,opacity:t.isLoading?.7:1,border:o?"1.4px solid #2563EB":null,boxShadow:o?"none":"0px 2px 4px 0px #19213D14","&:hover":{borderColor:o?"#2563EB":"#CBD5E1",boxShadow:o?"none":"0px 4px 8px 0px #19213D1F"}}},{children:[r(c,e({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:t.isLoading?r(g,{variant:"rounded",width:80,height:20}):i(c,e({sx:{bgcolor:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:600,px:1,py:.5,borderRadius:"100px",border:"1px solid #FFE1E1"}},{children:[void 0!==t.similarity?t.similarity:0,"% Similarity"]}))})),i(c,e({sx:{display:"flex",flexDirection:"column",gap:1}},{children:[i(c,e({sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap"}},{children:[r(p,e({title:t.title,sx:{fontWeight:500,fontSize:"14px",color:"#19213D",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"}},{children:t.title})),t.scope&&r(c,e({sx:{flexShrink:0,fontSize:"10px",fontWeight:600,color:"#19213D",bgcolor:"#FFF",border:"1px solid #EDEFF2",px:.75,py:.25,borderRadius:"6px",lineHeight:1.4,whiteSpace:"nowrap"}},{children:t.scope}))]})),t.isLoading?i(c,{children:[r(g,{width:"90%"}),r(g,{width:"60%"})]}):i(c,e({title:u,sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[r(p,e({sx:{fontWeight:400,fontSize:"13px",color:"#666F8D",lineHeight:1.4,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}},{children:u})),x&&i(c,e({onClick:function(e){e.stopPropagation(),o||s(),a()},sx:{display:"inline-flex",alignItems:"center",alignSelf:"flex-start",gap:"4px",padding:"2px 6px",borderRadius:"4px",cursor:"pointer",transition:"all 0.2s ease",marginLeft:"-4px","&:hover":{backgroundColor:"#F1F5F9"}}},{children:[r("div",e({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:r(b,{})})),r("svg",e({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:o&&l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}},{children:r("path",{d:"M6 9l6 6 6-6"})}))]}))]}))]}))]}))},_=function(o){var g,_,C=o.proposedRule,B=o.variants,E=void 0===B?[]:B,k=o.onSelectVariant;o.onAddAsVariant;var S=o.onSkip,A=o.onBack,L=o.targetVariantId,D=o.highlightedField,W=l(L||null),z=W[0],T=W[1],I=l(!1),R=I[0],j=I[1],H=l(null),O=H[0],M=H[1],V=a(null),N=a(null);s(function(){if(L&&T(L),M(null!=D?D:null),D){var e=setTimeout(function(){return M(null)},6e3);return function(){return clearTimeout(e)}}},[L,D]);var U=function(e){V.current&&V.current.scrollBy({left:"left"===e?-300:300,behavior:"smooth"})},P=d(function(){return n([],E,!0).sort(function(e,n){return(n.similarity||0)-(e.similarity||0)})},[E]),Y=d(function(){if(z){var e=String(z).trim();return E.find(function(n){return n.id&&String(n.id).trim()===e})||P[0]}return P.length>0?P[0]:null},[z,E,P]);s(function(){if(z&&V.current){var e=z.trim();setTimeout(function(){var n=document.getElementById("variant-card-".concat(e)),t=V.current;if(n&&t){var i=n.offsetLeft-t.offsetLeft-t.clientWidth/2+n.clientWidth/2;t.scrollTo({left:i,behavior:"smooth"})}},150)}},[z,P]);var $=Y||{title:"",scope:"",description:"",wta:"",wnta:"",variantType:"Default"},q=null==Y?void 0:Y.analysis,J=(null===(_=null===(g=null==q?void 0:q.rule_difference_comparison)||void 0===g?void 0:g.summary)||void 0===_?void 0:_.overall_summary)||"",X=J.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),G=!!X,K=X?X[1]:"",Q=v("reason",K)||"",Z=v("gap",K)||"",ee=v("relevance_score",K)||"",ne=d(function(){return{ul:function(n){n.node;var i=t(n,["node"]);return r("ol",e({},i,{style:{paddingLeft:"1.25rem",listStyleType:"decimal",margin:0}}))},li:function(n){n.node;var i=t(n,["node"]);return r("li",e({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},ol:function(n){n.node;var i=t(n,["node"]);return r("li",e({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},a:function(n){var o=n.href,l=n.children,a=t(n,["href","children"]);if(!o)return r("a",e({},a,{children:l}));var s=o||"";try{s=decodeURIComponent(o)}catch(e){console.error("Error decoding href",e)}if(s.includes("variant_id=")){var d="",c="",p=s.match(/variant_id=([^?&]+)/);p&&(d=p[1]);var h=s.match(/field_name=([^&]+)/);return h&&(c=h[1]),i("button",e({type:"button",onClick:function(e){e.preventDefault(),e.stopPropagation(),T(d),M(c),setTimeout(function(){return M(null)},6e3)},style:{background:"none",border:"none",outline:"none",borderRadius:"6px",padding:"1px 4px",color:"#0F172A",cursor:"pointer",fontSize:"13px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"2px",margin:"0 1px",verticalAlign:"baseline",textDecoration:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none"},title:"View Comparison"},{children:[l,r("svg",e({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:r("path",{d:"M10.2082 8.67708H2.0415M2.0415 8.67708L4.08317 6.63542M2.0415 8.67708L4.08317 10.7188M2.0415 3.57292H10.2082M10.2082 3.57292L8.1665 1.53125M10.2082 3.57292L8.1665 5.61458",stroke:"#0F172A",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}))]}))}return r("a",e({href:o,target:"_blank",rel:"noopener noreferrer",style:{color:"#7C3AED"}},a,{children:l}))}}},[]);s(function(){!z&&!L&&P.length>0&&!P[0].isLoading&&T(P[0].id)},[P,z,L]);var te=a(null),ie=l([]),re=ie[0],oe=ie[1],le=l(!1),ae=le[0],se=le[1],de=l(!1),ce=de[0],pe=de[1];s(function(){var e=V.current;if(e){var n=function(){se(e.scrollLeft>0),pe(e.scrollLeft+e.clientWidth<e.scrollWidth-1)};return n(),e.addEventListener("scroll",n),window.addEventListener("resize",n),function(){e.removeEventListener("scroll",n),window.removeEventListener("resize",n)}}},[P]);var he={title:a(null),scope:a(null),description:a(null),wta:a(null),wnta:a(null)},ge={title:a(null),scope:a(null),description:a(null),wta:a(null),wnta:a(null)};s(function(){if(O){var e="when_to_apply"===O?"wta":"when_not_to_apply"===O?"wnta":O,n=he[e]||ge[e];n&&n.current&&setTimeout(function(){n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}},[O]);var ue=function(e){var n,t,i,r,o,l=null===(n=null==q?void 0:q.rule_difference_comparison)||void 0===n?void 0:n.fields,a="when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e,s=!(!C[a]&&!$[a]);if(!l||!l[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=l[e];if(d.mappings){var c=d.mappings[0]||{};return{score:d.score,relation:c.relation||"",highlightsA:(null===(t=c.highlights)||void 0===t?void 0:t.ruleA_spans)||[],highlightsB:(null===(i=c.highlights)||void 0===i?void 0:i.ruleB_spans)||[],hasContent:s}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(r=d.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(o=d.highlights)||void 0===o?void 0:o.ruleB_spans)||[],hasContent:s}},xe=["title","scope","description","when_to_apply","when_not_to_apply"],fe=function(){if(te.current){var e=te.current.getBoundingClientRect(),n=[];xe.forEach(function(t){var i="when_to_apply"===t?he.wta:"when_not_to_apply"===t?he.wnta:he[t],r="when_to_apply"===t?ge.wta:"when_not_to_apply"===t?ge.wnta:ge[t];if(i.current&&r.current){i.current.style.height="auto",r.current.style.height="auto";var o=i.current.getBoundingClientRect(),l=r.current.getBoundingClientRect(),a=Math.max(o.height,l.height);i.current.style.height="".concat(a,"px"),r.current.style.height="".concat(a,"px");var s=i.current.getBoundingClientRect(),d=r.current.getBoundingClientRect(),c=ue(t),p=y(c.score,c.relation,c.hasContent),h=s.top+s.height/2-e.top;n.push({x1:s.right-e.left,y1:h,x2:d.left-e.left,y2:h,style:p})}}),oe(n)}};return s(function(){var e=setTimeout(fe,250);window.addEventListener("resize",fe);var n=null;return te.current&&(n=new ResizeObserver(function(){window.requestAnimationFrame(function(){fe()})})).observe(te.current),function(){clearTimeout(e),window.removeEventListener("resize",fe),n&&n.disconnect()}},[C,$,q,R]),i(c,e({sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden"}},{children:[i(c,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:[i(c,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:[r(h,e({onClick:A,size:"small"},{children:r(u,{})})),r(p,e({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:"Learning Comparison"}))]})),r(h,e({onClick:S,size:"small"},{children:r(c,e({sx:{fontSize:24,lineHeight:.5}},{children:"×"}))}))]})),P.length>1&&i(c,e({sx:{px:3,pb:.25}},{children:[i(c,e({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1}},{children:[r(p,e({sx:{fontSize:"13px",color:"#475569"}},{children:"Choose the Learning you want to compare with the rule you are creating."})),i(c,e({sx:{display:"flex",gap:.5,flexShrink:0,ml:1}},{children:[r(h,e({onClick:function(){return U("left")},size:"small",disabled:!ae},{children:r(u,{size:18})})),r(h,e({onClick:function(){return U("right")},size:"small",disabled:!ce},{children:r(x,{size:18})}))]}))]})),r(c,e({ref:V,sx:{display:"flex",gap:1,overflowX:"auto",pb:.05,"&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"transparent",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"transparent"}}},{children:P.map(function(e){return r(F,{data:e,isSelected:(null==Y?void 0:Y.id)===e.id,isCognitiveOpen:R,onToggleCognitive:function(){j(function(e){var n=!e;return n&&N.current&&N.current.scrollTo({top:0,behavior:"smooth"}),n})},onClick:function(){return T((n=e).id),k(n),void j(!1);var n}},e.id)})}))]})),r(c,e({ref:N,sx:{flex:1,overflowY:"auto",py:1.5,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:J&&G&&R?"none":"1.5px solid #EEF0F4"}},{children:i(c,e({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:[J&&G&&R&&r(c,e({sx:{width:"100%",pb:1,animation:"fadeIn 0.2s ease-out","& > div > button":{display:"none !important"},"& > div > div":{marginTop:"0px"}}},{children:r(m,{headerIcon:r(b,{}),reasoning:Q,gap:Z,score:ee,mdComponents:ne,isOpen:!0,onToggle:function(){return j(!1)}})})),i(c,e({ref:te,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative"}},{children:[r("svg",e({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:10}},{children:re.map(function(n,t){var o=(n.x1+n.x2)/2,l=n.y1;return i("g",{children:[r("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.badgeBorder,strokeWidth:"1"}),r("foreignObject",e({x:o-125,y:l-16,width:"250",height:"32"},{children:r(c,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:r(c,e({sx:{fontSize:"11px",bgcolor:n.style.badgeBg,color:n.style.badgeText,border:"1px solid ".concat(n.style.badgeBorder),borderRadius:"12px",px:1.5,py:.25,fontWeight:500,textAlign:"center",whiteSpace:"nowrap"}},{children:n.style.label}))}))}))]},t)})})),i(c,e({sx:{border:"1px dashed #B0B0B0",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[r(c,e({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px dashed #B0B0B0",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center"}},{children:r(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D"}},{children:"Learning You’re Creating"}))})),r(c,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:xe.map(function(e){var n=ue(e),t=y(n.score,n.relation,n.hasContent),i="when_to_apply"===e?he.wta:"when_not_to_apply"===e?he.wnta:he[e],o=C["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return r(w,{ref:i,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:n.highlightsA,styleVariant:t,isHighlighted:O===e},"left-".concat(e))})}))]})),r(c,{sx:{width:"1px"}}),i(c,e({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[r(c,e({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center"}},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",display:"flex",alignItems:"center",gap:1}},{children:[r("div",e({style:{width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:r(f,{})})),"Existing Learning"]}))})),r(c,e({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:xe.map(function(e){var n=ue(e),t=y(n.score,n.relation,n.hasContent),i="when_to_apply"===e?ge.wta:"when_not_to_apply"===e?ge.wnta:ge[e],o=$["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return r(w,{ref:i,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:n.highlightsB,styleVariant:t,isHighlighted:O===e},"right-".concat(e))})}))]}))]}))]}))}))]}))};export{_ as default};
|
|
2
|
+
//# sourceMappingURL=RuleComparisonNew.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuleComparisonNew.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as r,__generator as o,__spreadArray as i}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useState as l,useEffect as a}from"react";import{v4 as p}from"uuid";import{IL_CONFIG_CONSTANTS as d}from"../config.js";import s from"../store/useAuthStore.js";import c from"../RuleContent/AddScopeApprovalSearchComponent.js";import{useAppSecRolesStore as u}from"../store/useAppSecRolesStore.js";import f from"../store/useEnvStore.js";import h from"./ScopeSkeletonLoader.js";var x=function(x){var m=x.isOpen,g=x.onClose,v=x.onSubmit,b=x.hasGlobalRuleSet,y=void 0!==b&&b;x.canCreateGlobal;var S=l("");S[0];var C=S[1],k=l(""),E=k[0],
|
|
1
|
+
import{__assign as e,__awaiter as r,__generator as o,__spreadArray as i}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useState as l,useEffect as a}from"react";import{v4 as p}from"uuid";import{IL_CONFIG_CONSTANTS as d}from"../config.js";import s from"../store/useAuthStore.js";import c from"../RuleContent/AddScopeApprovalSearchComponent.js";import{useAppSecRolesStore as u}from"../store/useAppSecRolesStore.js";import f from"../store/useEnvStore.js";import h from"./ScopeSkeletonLoader.js";var x=function(x){var m=x.isOpen,g=x.onClose,v=x.onSubmit,b=x.hasGlobalRuleSet,y=void 0!==b&&b;x.canCreateGlobal;var S=l("");S[0];var C=S[1],k=l(""),E=k[0],w=k[1],B=l(""),_=B[0],D=B[1],R=l(!1),z=R[0],q=R[1],A=l({}),I=A[0],j=A[1],F=l("approval_required"),G=F[0],L=F[1],W=l([]),N=W[0],T=W[1],O=l([]),P=O[0],H=O[1],M=l(""),K=M[0],U=M[1],Y=s().user,J=u(function(e){return e.roles}),Q=f(function(e){return e.rbacConfig});if(a(function(){m&&(C(""),w(""),D(""),j({}),L("approval_required"),T([]),H([]),U(""))},[m]),!m)return null;var V={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.3)"},modal:{position:"relative",width:"600px",borderRadius:"12px",backgroundColor:"#ffffff",padding:"24px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",maxHeight:"90vh",overflowY:"auto"},header:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px"},title:{margin:0,fontSize:"18px",fontWeight:500,color:"#19213D"},subtitle:{marginTop:"4px",fontSize:"14px",fontWeight:400,color:"#666F8D"},closeButton:{background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"#9CA3AF"},formGroup:{display:"flex",flexDirection:"column",marginBottom:"20px",gap:"6px"},label:{fontSize:"14px",fontWeight:500,color:"#19213D"},asterisk:{color:"#8F2C23",marginRight:"4px",fontSize:"16px",fontWeight:600},input:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid #E2E8F0",outline:"none",fontSize:"14px"},inputError:{border:"1px solid #8F2C23"},errorText:{margin:0,marginTop:"4px",fontSize:"12px",color:"#8F2C23"},textarea:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid #E2E8F0",outline:"none",fontSize:"14px",minHeight:"100px",maxHeight:"200px",overflowY:"auto",resize:"vertical"},footer:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"32px"},cancelBtn:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #E2E8F0",backgroundColor:"transparent",color:"#64748B",fontSize:"14px",fontWeight:500,cursor:"pointer"},submitBtn:{padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:"#2563EB",color:"#ffffff",fontSize:"14px",fontWeight:500,cursor:"pointer"},disabledBtn:{opacity:.5,cursor:"not-allowed"}};return z?t(h,{isLoading:z}):t("div",e({style:V.overlay},{children:n("div",e({style:V.modal},{children:[n("div",e({style:V.header},{children:[n("div",{children:[t("h2",e({style:V.title},{children:"Create Scope"})),t("p",e({style:V.subtitle},{children:"Create a scope to group and manage rules."}))]}),t("button",e({onClick:g,style:V.closeButton},{children:"✕"}))]})),n("div",{children:[n("div",e({style:V.formGroup},{children:[n("label",e({style:V.label},{children:[t("span",e({style:V.asterisk},{children:"*"})),"Scope Name"]})),t("input",{type:"text",value:E,onChange:function(r){var o=r.target.value;if(o.length>50)return w(o.slice(0,50)),void j(function(r){return e(e({},r),{name:"Scope Name must be 50 characters or fewer"})});w(o),I.name&&j(function(r){return e(e({},r),{name:void 0})})},placeholder:"e.g. Global Learnings",style:e(e({},V.input),I.name?V.inputError:{})}),I.name&&t("p",e({style:V.errorText},{children:I.name}))]})),n("div",e({style:V.formGroup},{children:[n("label",e({style:V.label},{children:[t("span",e({style:V.asterisk},{children:"*"})),"Description"]})),t("input",{type:"text",value:_,onChange:function(r){var o=r.target.value;if(o.length>200)return D(o.slice(0,200)),void j(function(r){return e(e({},r),{description:"Description must be 200 characters or fewer"})});D(o),I.description&&j(function(r){return e(e({},r),{description:void 0})})},placeholder:"Enter short description for scope",style:e(e({},V.input),I.description?V.inputError:{})}),I.description&&t("p",e({style:V.errorText},{children:I.description}))]})),n("div",e({style:e(e({},V.formGroup),{gap:"12px"})},{children:[t("label",e({style:V.label},{children:"Approval Settings"})),n("div",e({role:"radio","aria-checked":"approval_required"===G,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){return L("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||L("approval_required")}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t("div",e({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===G?"#2563EB":"#CBD5E1")}},{children:"approval_required"===G&&t("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",e({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),"approval_required"===G&&t(c,{selectedApprovers:N,selectedGroupOfApprovers:P,onApproversChange:T,onGroupsChange:H}),K&&t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:K})),n("div",e({role:"radio","aria-checked":"publish_without"===G,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){L("publish_without"),U("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(L("publish_without"),U(""))}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t("div",e({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===G?"#2563EB":"#CBD5E1")}},{children:"publish_without"===G&&t("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",e({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}),n("div",e({style:V.footer},{children:[t("button",e({onClick:g,disabled:z,style:e(e({},V.cancelBtn),z?V.disabledBtn:{})},{children:"Cancel"})),t("button",e({onClick:function(){return r(void 0,void 0,void 0,function(){var e,r,t,n,l,a,s,c;return o(this,function(o){switch(o.label){case 0:if(u={},f=!0,E.trim()||(u.name="Scope Name is required",f=!1),_.trim()||(u.description="Description is required",f=!1),j(u),!f)return[2];if("approval_required"===G&&0===N.length&&0===P.length)return U("Please select at least one approver or approver group."),[2];U(""),q(!0),e=y?"genreRuleSet":"globalRuleSet",r="approval_required"===G,console.log("topicData",e),t={topic:e,customScopeGroupName:d.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:_,parentScopeId:null,customScopeName:E,customScopeId:p(),createByName:null==Y?void 0:Y.firstname,createdBy:null==Y?void 0:Y.email,approvalRequired:r,appsecData:{application:null==Q?void 0:Q.applicationId,module:null==Q?void 0:Q.moduleId,roles:i(i([],r?[{users:N.map(function(e){return e.email}),groups:P.map(function(e){return e._id}),role:null!==(a=null===(l=J.find(function(e){return"Learning Manager"===e.name}))||void 0===l?void 0:l._id)&&void 0!==a?a:""}]:[],!0),[{users:[null==Y?void 0:Y.email],groups:[],role:null!==(c=null===(s=J.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===s?void 0:s._id)&&void 0!==c?c:""}],!1)}},o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,v(t)];case 2:return o.sent(),g(),[3,5];case 3:return n=o.sent(),console.error("Error in submission",n),[3,5];case 4:return q(!1),[7];case 5:return[2]}var u,f})})},disabled:z,style:e(e({},V.submitBtn),z?V.disabledBtn:{})},{children:z?"Creating...":"Create Scope"}))]}))]}))}))};export{x as default};
|
|
2
2
|
//# sourceMappingURL=CreateRuleSetLegacyModal.js.map
|