@e-llm-studio/requirement-ai 0.0.92 → 0.0.93

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),r=require("lucide-react"),s=require("showdown"),i=require("@mui/material"),a=require("uuid"),l=require("./UserStoryCard.module.css.js"),o=require("../../utils/helpers.js"),u=require("../../utils/user-story.utils.js"),d=require("../../shared/AtomicButton.js"),c=require("../RichTextEditor/RichTextEditor.js"),f=require("../userstory-with-citation/UserStoryWithCitation.js"),v=require("../RequirementAIWrapper/RequirementAIWrapper.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=y(s);function _(n){for(var s,l=[],o=/<learned>(.*?)<\/learned>/g,u=0,d=0;null!==(s=o.exec(n));){var c=s[1],f=s.index;f>u&&l.push(t.jsx("span",{children:n.slice(u,f)},"text-pre-".concat(d++))),l.push(t.jsx(i.Tooltip,e.__assign({title:c,placement:"top"},{children:t.jsx(r.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),"tooltip-".concat(a.v4()))),u=o.lastIndex}return u<(null==n?void 0:n.length)&&l.push(t.jsx("span",{children:n.slice(u)},"text-post-".concat(d++))),l}var m=function(n){var s,i=n.displayName,a=v.useRequirementAI().customStyles,o=null===(s=null==a?void 0:a.userStoryCardStyles)||void 0===s?void 0:s.showDisplayName;return t.jsxs("div",e.__assign({className:l.default.displayName,style:null==o?void 0:o.wrapper},{children:[t.jsx(r.Bookmark,{className:l.default.displayNameIcon,style:null==o?void 0:o.displayNameIcon}),t.jsxs("span",e.__assign({style:null==o?void 0:o.label},{children:[i,":"]}))]}))},g=function(s){var a,y,p=s.isUserStoryCurrentlyUpdated,S=s.artifactId,x=s.artifactTitleId,C=s.parentUserStory,j=s.currentUserStory,I=s.onUserStoryChange,w=s.parentIndex,N=s.currentIndex,U=s.enableDownload,D=s.isDiffEditReviewMode,b=s.showUserStoryDiff,M=s.handleDownloadUserStory,k=s.handleOpenSendDialog,B=s.updateUserStoryArtifact,q=s.selectedArtifactId,A=s.isDisplayHighlightControl,R=s.elementDisplayConfig,E=v.useRequirementAI(),T=E.searchQueryList,L=E.citations,H=E.customStyles,z=null==H?void 0:H.userStoryCardStyles,P=null===(a=null==H?void 0:H.userStoryScreenStyles)||void 0===a?void 0:a.userStoryContentStyles,W=n.useState(e.__assign(e.__assign({},structuredClone(j)),{value:o.formatMarkdown(j.value)||""})),O=W[0],F=W[1],V=n.useState({userStory:!1}),Q=V[0],G=V[1],J=v.useRequirementAI().userStory,K=n.useState(""===w||q===j.artifactId),X=K[0],Y=K[1],Z=n.useState(!1);Z[0];var $=Z[1],ee=n.useState(null),te=ee[0],ne=ee[1],re=n.useState(!1),se=re[0],ie=re[1],ae=n.useRef(null),le=n.useState(!1);le[0];var oe=le[1],ue=n.useRef(null);n.useEffect(function(){p&&Y(p)},[p]),n.useEffect(function(){F(e.__assign(e.__assign({},structuredClone(j)),{value:o.formatMarkdown(j.value)||""}))},[j]),n.useEffect(function(){T.length>0?Y(!0):q&&Y(q===j.artifactId)},[T,q,j.artifactId]);var de=function(){ne(null)},ce=function(){Y(function(e){return!e})};return t.jsxs("div",e.__assign({className:l.default.card,style:null==z?void 0:z.cardStyle},{children:[t.jsxs("div",e.__assign({className:l.default.titleSection,style:null==z?void 0:z.titleSection},{children:[t.jsxs("div",e.__assign({className:l.default.titleRow,style:null==z?void 0:z.titleRow,onClick:ce},{children:[t.jsxs("div",e.__assign({className:l.default.titleLeft,style:null==z?void 0:z.titleLeft,onMouseEnter:function(){return oe(!0)},onMouseLeave:function(){return oe(!1)}},{children:[t.jsx(m,{displayName:x}),t.jsx("h2",e.__assign({className:l.default.storyTitle,style:null==z?void 0:z.storyTitle},{children:_(j.title)}),j.artifactId)]})),t.jsxs("div",e.__assign({className:l.default.titleActions,style:null==z?void 0:z.titleActions,onClick:function(e){return e.stopPropagation()}},{children:[!Q.userStory&&t.jsxs(t.Fragment,{children:[!1!==(null==R?void 0:R.showShareButton)&&t.jsx("button",e.__assign({className:l.default.iconButton,style:null==z?void 0:z.iconButton,onClick:function(e){ne(e.currentTarget)}},{children:t.jsx(r.ExternalLink,{size:16})})),t.jsxs(i.Menu,e.__assign({id:"user-story-share-menu",anchorEl:te,open:!!te,onClose:function(){return ne(null)},style:null==z?void 0:z.userStoryShareMenu},{children:[U&&t.jsx(i.MenuItem,e.__assign({style:null==z?void 0:z.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){switch(e.label){case 0:return $(!0),M?[4,Promise.all([M("pdf"),M("doc")])]:[2];case 1:return e.sent(),$(!1),[2]}})})}},{children:t.jsxs("div",e.__assign({ref:ae,className:l.default.menuItemContent,style:null==z?void 0:z.menuItemContent},{children:[t.jsx(r.Download,{size:16,color:null==z?void 0:z.menuIconColor}),t.jsx("p",e.__assign({style:null==z?void 0:z.menuLabel},{children:"Download"}))]}))})),t.jsx(i.MenuItem,e.__assign({style:null==z?void 0:z.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(n){return t=j,C&&(t=e.__assign(e.__assign({},j),{value:"".concat(u.replaceTitleSection(null==C?void 0:C.value,j.title)," \n").concat(j.value)})),null==k||k(!0,[t],j.artifactId),de(),[2]})})}},{children:t.jsxs("div",e.__assign({style:null==z?void 0:z.menuItemContent,className:l.default.menuItemContentPadded},{children:[t.jsx(r.Share2,{size:16,color:null==z?void 0:z.menuIconColor}),t.jsx("p",e.__assign({style:null==z?void 0:z.menuLabel},{children:"Send"}))]}))})),t.jsx(i.MenuItem,e.__assign({style:null==z?void 0:z.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n,r,s,i;return e.__generator(this,function(e){switch(e.label){case 0:t=new h.default.Converter,n=t.makeHtml(o.formatMarkdown(j.value)||j.value),r=function(e){var t=(new h.default.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(o.formatMarkdown(j.value)||j.value),s=new ClipboardItem({"text/plain":new Blob([r],{type:"text/plain"}),"text/html":new Blob([n],{type:"text/html"})}),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,navigator.clipboard.write([s])];case 2:return e.sent(),console.log("Copied User Story"),[3,5];case 3:return i=e.sent(),console.error("Failed to copy user story:",i),[3,5];case 4:return de(),[7];case 5:return[2]}})})}},{children:t.jsxs("div",e.__assign({style:null==z?void 0:z.menuItemContent,className:l.default.menuItemContentPadded},{children:[t.jsx(r.Copy,{size:16,color:null==z?void 0:z.menuIconColor}),t.jsx("p",e.__assign({style:null==z?void 0:z.menuLabel},{children:"Copy"}))]}))}))]}))]}),Q.userStory&&X?t.jsx(d.default,{type:"outline",children:"Cancel",style:null==z?void 0:z.cancelButton,onClick:function(){var t;null===(t=ue.current)||void 0===t||t.abort(),G(function(t){return e.__assign(e.__assign({},t),{userStory:!1})})}}):t.jsx(t.Fragment,{}),Q.userStory&&X?t.jsx(d.default,{type:"fill",children:se?t.jsxs("span",e.__assign({className:l.default.savingSpinner},{children:[t.jsx(r.LoaderCircle,{className:l.default.spinAnimation}),t.jsx("span",{children:"Saving..."})]})):"Save",isDisable:se,style:se?null==z?void 0:z.savingButton:null==z?void 0:z.saveButton,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(n){switch(n.label){case 0:return ie(!0),"userStory"==="userStory"&&(I(O),console.log("I am changing RTE editor values",O)),[4,B(L,J,S,null===(t=ue.current)||void 0===t?void 0:t.signal)];case 1:return n.sent(),G(function(t){return e.__assign(e.__assign({},t),{userStory:!1})}),ie(!1),[2]}})})}}):!D&&!b&&X&&!1!==(null==R?void 0:R.showEditButton)&&t.jsx("button",e.__assign({className:l.default.iconButton,style:null==z?void 0:z.editButton,onClick:function(){return G(function(t){return e.__assign(e.__assign({},t),{userStory:!0})})}},{children:t.jsx(r.PencilIcon,{color:null==z?void 0:z.pencilIconColor,size:16})})),t.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),ce()},style:null==z?void 0:z.chevronButton,className:l.default.chevronButton},{children:X?t.jsx(r.ChevronUp,{className:l.default.chevronIcon,color:null==z?void 0:z.chevronIconColor}):t.jsx(r.ChevronDown,{className:l.default.chevronIcon,color:null==z?void 0:z.chevronIconColor})}))]}))]})),t.jsx("div",{className:l.default.divider,style:null==z?void 0:z.dividerStyle})]})),X&&t.jsx("div",e.__assign({className:l.default.cardContent,style:null==z?void 0:z.cardContentStyle},{children:t.jsxs("div",e.__assign({className:l.default.contentInner,style:null==z?void 0:z.contentInner},{children:[t.jsxs("div",e.__assign({className:l.default.descriptionSection,style:null==z?void 0:z.descriptionSection},{children:[t.jsx("div",{className:l.default.justifyBetween,style:null==z?void 0:z.justifyBetween}),Q.userStory?t.jsx(c.default,{minHeight:"100%",height:"100%",type:"string",value:o.formatMarkdown(j.value)||"",handleUpdateState:function(t,n){var r=o.indentMarkdown(n);F(function(t){return e.__assign(e.__assign({},t),{value:r||""})})},doNotShowBorderInViewMode:!1,onBlur:function(){},mode:Q.userStory?"edit":"readOnly"}):t.jsx(f.default,{showUserStoryDiff:b,isParent:""===w,message:o.formatMarkdown(j.value)||"",artifactId:j.artifactId,customStyles:P,isDisplayHighlightControl:A})]})),null===(y=O.sub_features)||void 0===y?void 0:y.map(function(n,r){return t.jsx(g,{artifactId:S,isUserStoryCurrentlyUpdated:p,artifactTitleId:"".concat(x,"-").concat(String.fromCharCode(65+r)),parentUserStory:j,parentIndex:"".concat(w).concat(w&&".").concat(N),currentIndex:"".concat(r+1),doNotShowBorderInViewMode:!1,currentUserStory:n,onUserStoryChange:function(t){return function(t,n){var r=e.__spreadArray([],j.sub_features||[],!0);r[t]=n,I(e.__assign(e.__assign({},j),{sub_features:r}))}(r,t)},enableDownload:!0,isDiffEditReviewMode:D,showUserStoryDiff:b,updateUserStoryArtifact:B,handleDownloadUserStory:M,handleOpenSendDialog:k,isDisplayHighlightControl:A,elementDisplayConfig:R},n.artifactId)})]}))}))]}))};exports.StoryCard=g,exports.UserStoryCardWrapper=function(n){var s=n.artifactTitleIDs,i=n.isDiffEditReviewMode,a=n.showUserStoryDiff,o=n.updateUserStoryArtifact,u=n.isUserStoryCurrentlyUpdated,d=n.artifactId,c=n.handleOpenSendDialog,f=n.handleDownloadUserStory,y=n.selectedArtifactId,h=n.isDisplayHighlightControl,_=n.elementDisplayConfig,m=v.useRequirementAI(),p=m.userStory,S=m.setUserStory,x=m.customStyles,C=m.searchQueryList,j=m.currentHighlightIndex,I=m.setCurrentHighlightIndex,w=null==x?void 0:x.userStoryCardStyles,N=0===j,U=j===C.length-1;return t.jsxs("div",e.__assign({className:l.default.userStoryCardWrapper,style:h?e.__assign(e.__assign({},null==w?void 0:w.userStoryCardWrapper),{position:"relative"}):null==w?void 0:w.userStoryCardWrapper},{children:[h&&t.jsx(t.Fragment,{children:C.length>1&&t.jsx("div",e.__assign({className:l.default.wrapper},{children:t.jsx("div",e.__assign({className:l.default.highlightNavigation},{children:t.jsxs("div",e.__assign({className:l.default.navigationContainer},{children:[t.jsxs("span",e.__assign({className:l.default.navCounter},{children:[j+1," of ",C.length]})),t.jsxs("div",e.__assign({className:l.default.navButtons},{children:[t.jsx("button",e.__assign({onClick:function(){j>0&&I(function(e){return e-1})},className:l.default.navButton,disabled:N},{children:t.jsx(r.ChevronUpIcon,{size:20,className:l.default.navIcon})})),t.jsx("button",e.__assign({onClick:function(){j<C.length-1&&I(function(e){return e+1})},className:l.default.navButton,disabled:U},{children:t.jsx(r.ChevronDownIcon,{size:20,className:l.default.navIcon})}))]}))]}))}))}))}),p.map(function(n,r){return t.jsx(g,{isUserStoryCurrentlyUpdated:u,artifactId:d,artifactTitleId:s[r]||"",currentUserStory:n,onUserStoryChange:function(t){S(function(n){return n[r]=t,e.__spreadArray([],n,!0)})},parentIndex:"",currentIndex:"".concat(r+1),doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:i,showUserStoryDiff:a,updateUserStoryArtifact:o,handleOpenSendDialog:c,handleDownloadUserStory:f,selectedArtifactId:y,isDisplayHighlightControl:h,elementDisplayConfig:_},n.artifactId)})]}))},exports.default=g,exports.replaceLearnedTagsWithInfo=_;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),r=require("lucide-react"),s=require("showdown"),i=require("@mui/material"),a=require("uuid"),l=require("./UserStoryCard.module.css.js"),o=require("../../utils/helpers.js"),u=require("../../utils/user-story.utils.js"),d=require("../../shared/AtomicButton.js"),c=require("../RichTextEditor/RichTextEditor.js"),f=require("../userstory-with-citation/UserStoryWithCitation.js"),v=require("../RequirementAIWrapper/RequirementAIWrapper.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=y(s);function _(n){for(var s,l=[],o=/<learned>(.*?)<\/learned>/g,u=0,d=0;null!==(s=o.exec(n));){var c=s[1],f=s.index;f>u&&l.push(t.jsx("span",{children:n.slice(u,f)},"text-pre-".concat(d++))),l.push(t.jsx(i.Tooltip,e.__assign({title:c,placement:"top"},{children:t.jsx(r.Info,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),"tooltip-".concat(a.v4()))),u=o.lastIndex}return u<(null==n?void 0:n.length)&&l.push(t.jsx("span",{children:n.slice(u)},"text-post-".concat(d++))),l}var m=function(n){var s,i=n.displayName,a=v.useRequirementAI().customStyles,o=null===(s=null==a?void 0:a.userStoryCardStyles)||void 0===s?void 0:s.showDisplayName;return t.jsxs("div",e.__assign({className:l.default.displayName,style:null==o?void 0:o.wrapper},{children:[t.jsx(r.Bookmark,{className:l.default.displayNameIcon,style:null==o?void 0:o.displayNameIcon}),t.jsxs("span",e.__assign({style:null==o?void 0:o.label},{children:[i,":"]}))]}))},g=function(s){var a,y,p=s.isUserStoryCurrentlyUpdated,S=s.artifactId,x=s.artifactTitleId,C=s.parentUserStory,j=s.currentUserStory,I=s.onUserStoryChange,w=s.parentIndex,N=s.currentIndex,U=s.enableDownload,D=s.isDiffEditReviewMode,b=s.showUserStoryDiff,M=s.handleDownloadUserStory,k=s.handleOpenSendDialog,B=s.updateUserStoryArtifact,q=s.selectedArtifactId,A=s.isDisplayHighlightControl,R=s.elementDisplayConfig,E=v.useRequirementAI(),T=E.searchQueryList,L=E.citations,H=E.customStyles,z=null==H?void 0:H.userStoryCardStyles,P=null===(a=null==H?void 0:H.userStoryScreenStyles)||void 0===a?void 0:a.userStoryContentStyles,W=n.useState(e.__assign(e.__assign({},structuredClone(j)),{value:o.formatMarkdown(j.value)||""})),O=W[0],F=W[1],V=n.useState({userStory:!1}),Q=V[0],G=V[1],J=v.useRequirementAI().userStory,K=n.useState(""===w||q===j.artifactId),X=K[0],Y=K[1],Z=n.useState(!1);Z[0];var $=Z[1],ee=n.useState(null),te=ee[0],ne=ee[1],re=n.useState(!1),se=re[0],ie=re[1],ae=n.useRef(null),le=n.useState(!1);le[0];var oe=le[1],ue=n.useRef(null);n.useEffect(function(){p&&Y(p)},[p]),n.useEffect(function(){F(e.__assign(e.__assign({},structuredClone(j)),{value:o.formatMarkdown(j.value)||""}))},[j]),n.useEffect(function(){T.length>0?Y(!0):q&&Y(q===j.artifactId)},[T,q,j.artifactId]);var de=function(){ne(null)},ce=function(){Y(function(e){return!e})};return t.jsxs("div",e.__assign({className:l.default.card,style:null==z?void 0:z.cardStyle},{children:[t.jsxs("div",e.__assign({className:l.default.titleSection,style:null==z?void 0:z.titleSection},{children:[t.jsxs("div",e.__assign({className:l.default.titleRow,style:null==z?void 0:z.titleRow,onClick:ce},{children:[t.jsxs("div",e.__assign({className:l.default.titleLeft,style:null==z?void 0:z.titleLeft,onMouseEnter:function(){return oe(!0)},onMouseLeave:function(){return oe(!1)}},{children:[t.jsx(m,{displayName:x}),t.jsx("h2",e.__assign({className:l.default.storyTitle,style:null==z?void 0:z.storyTitle},{children:_(j.title)}),j.artifactId)]})),t.jsxs("div",e.__assign({className:l.default.titleActions,style:null==z?void 0:z.titleActions,onClick:function(e){return e.stopPropagation()}},{children:[!Q.userStory&&t.jsxs(t.Fragment,{children:[!1!==(null==R?void 0:R.showShareButton)&&t.jsx("button",e.__assign({className:l.default.iconButton,style:null==z?void 0:z.iconButton,onClick:function(e){ne(e.currentTarget)}},{children:t.jsx(r.ExternalLink,{size:16})})),t.jsxs(i.Menu,e.__assign({id:"user-story-share-menu",anchorEl:te,open:!!te,onClose:function(){return ne(null)},style:null==z?void 0:z.userStoryShareMenu},{children:[U&&t.jsx(i.MenuItem,e.__assign({style:null==z?void 0:z.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){switch(e.label){case 0:return $(!0),M?[4,Promise.all([M("pdf"),M("doc")])]:[2];case 1:return e.sent(),$(!1),[2]}})})}},{children:t.jsxs("div",e.__assign({ref:ae,className:l.default.menuItemContent,style:null==z?void 0:z.menuItemContent},{children:[t.jsx(r.Download,{size:16,color:null==z?void 0:z.menuIconColor}),t.jsx("p",e.__assign({style:null==z?void 0:z.menuLabel},{children:"Download"}))]}))})),t.jsx(i.MenuItem,e.__assign({style:null==z?void 0:z.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(n){return t=j,C&&(t=e.__assign(e.__assign({},j),{value:"".concat(u.replaceTitleSection(null==C?void 0:C.value,j.title)," \n").concat(j.value)})),null==k||k(!0,[t],j.artifactId),de(),[2]})})}},{children:t.jsxs("div",e.__assign({style:null==z?void 0:z.menuItemContent,className:l.default.menuItemContentPadded},{children:[t.jsx(r.Share2,{size:16,color:null==z?void 0:z.menuIconColor}),t.jsx("p",e.__assign({style:null==z?void 0:z.menuLabel},{children:"Send"}))]}))})),t.jsx(i.MenuItem,e.__assign({style:null==z?void 0:z.userStoryMenuItem,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n,r,s,i;return e.__generator(this,function(e){switch(e.label){case 0:t=new h.default.Converter,n=t.makeHtml(o.formatMarkdown(j.value)||j.value),r=function(e){var t=(new h.default.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(o.formatMarkdown(j.value)||j.value),s=new ClipboardItem({"text/plain":new Blob([r],{type:"text/plain"}),"text/html":new Blob([n],{type:"text/html"})}),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,navigator.clipboard.write([s])];case 2:return e.sent(),console.log("Copied User Story"),[3,5];case 3:return i=e.sent(),console.error("Failed to copy user story:",i),[3,5];case 4:return de(),[7];case 5:return[2]}})})}},{children:t.jsxs("div",e.__assign({style:null==z?void 0:z.menuItemContent,className:l.default.menuItemContentPadded},{children:[t.jsx(r.Copy,{size:16,color:null==z?void 0:z.menuIconColor}),t.jsx("p",e.__assign({style:null==z?void 0:z.menuLabel},{children:"Copy"}))]}))}))]}))]}),Q.userStory&&X?t.jsx(d.default,{type:"outline",children:"Cancel",style:null==z?void 0:z.cancelButton,onClick:function(){var t;null===(t=ue.current)||void 0===t||t.abort(),G(function(t){return e.__assign(e.__assign({},t),{userStory:!1})})}}):t.jsx(t.Fragment,{}),Q.userStory&&X?t.jsx(d.default,{type:"fill",children:se?t.jsxs("span",e.__assign({className:l.default.savingSpinner},{children:[t.jsx(r.LoaderCircle,{className:l.default.spinAnimation}),t.jsx("span",{children:"Saving..."})]})):"Save",isDisable:se,style:se?null==z?void 0:z.savingButton:null==z?void 0:z.saveButton,onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t;return e.__generator(this,function(n){switch(n.label){case 0:return ie(!0),"userStory"==="userStory"&&(I(O),console.log("I am changing RTE editor values",O)),[4,B(L,J,S,null===(t=ue.current)||void 0===t?void 0:t.signal)];case 1:return n.sent(),G(function(t){return e.__assign(e.__assign({},t),{userStory:!1})}),ie(!1),[2]}})})}}):!D&&!b&&X&&!1!==(null==R?void 0:R.showEditButton)&&t.jsx("button",e.__assign({className:l.default.iconButton,style:null==z?void 0:z.editButton,onClick:function(){return G(function(t){return e.__assign(e.__assign({},t),{userStory:!0})})}},{children:t.jsx(r.PencilIcon,{color:null==z?void 0:z.pencilIconColor,size:16})})),t.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),ce()},style:null==z?void 0:z.chevronButton,className:l.default.chevronButton},{children:X?t.jsx(r.ChevronUp,{className:l.default.chevronIcon,color:null==z?void 0:z.chevronIconColor}):t.jsx(r.ChevronDown,{className:l.default.chevronIcon,color:null==z?void 0:z.chevronIconColor})}))]}))]})),t.jsx("div",{className:l.default.divider,style:null==z?void 0:z.dividerStyle})]})),X&&t.jsx("div",e.__assign({className:l.default.cardContent,style:null==z?void 0:z.cardContentStyle},{children:t.jsxs("div",e.__assign({className:l.default.contentInner,style:null==z?void 0:z.contentInner},{children:[t.jsxs("div",e.__assign({className:l.default.descriptionSection,style:null==z?void 0:z.descriptionSection},{children:[t.jsx("div",{className:l.default.justifyBetween,style:null==z?void 0:z.justifyBetween}),Q.userStory?t.jsx(c.default,{minHeight:"100%",height:"100%",type:"string",value:o.formatMarkdown(j.value)||"",handleUpdateState:function(t,n){var r=o.indentMarkdown(n);F(function(t){return e.__assign(e.__assign({},t),{value:r||""})})},doNotShowBorderInViewMode:!1,onBlur:function(){},mode:Q.userStory?"edit":"readOnly"}):t.jsx(f.default,{showUserStoryDiff:b,isParent:""===w,message:o.formatMarkdown(j.value)||"",artifactId:j.artifactId,customStyles:P,isDisplayHighlightControl:A})]})),null===(y=O.sub_features)||void 0===y?void 0:y.map(function(n,r){return t.jsx(g,{artifactId:S,isUserStoryCurrentlyUpdated:p,artifactTitleId:"".concat(x,"-").concat(String.fromCharCode(65+r)),parentUserStory:j,parentIndex:"".concat(w).concat(w&&".").concat(N),currentIndex:"".concat(r+1),doNotShowBorderInViewMode:!1,currentUserStory:n,onUserStoryChange:function(t){return function(t,n){var r=e.__spreadArray([],j.sub_features||[],!0);r[t]=n,I(e.__assign(e.__assign({},j),{sub_features:r}))}(r,t)},enableDownload:!0,isDiffEditReviewMode:D,showUserStoryDiff:b,updateUserStoryArtifact:B,handleDownloadUserStory:M,handleOpenSendDialog:k,isDisplayHighlightControl:A,elementDisplayConfig:R},n.artifactId)})]}))}))]}))};exports.StoryCard=g,exports.UserStoryCardWrapper=function(n){var s=n.artifactTitleIDs,i=n.isDiffEditReviewMode,a=n.showUserStoryDiff,o=n.updateUserStoryArtifact,u=n.isUserStoryCurrentlyUpdated,d=n.artifactId,c=n.handleOpenSendDialog,f=n.handleDownloadUserStory,y=n.selectedArtifactId,h=n.isDisplayHighlightControl,_=n.elementDisplayConfig,m=v.useRequirementAI(),p=m.userStory,S=m.setUserStory,x=m.customStyles,C=m.searchQueryList,j=m.currentHighlightIndex,I=m.setCurrentHighlightIndex,w=null==x?void 0:x.userStoryCardStyles,N=0===j,U=j===C.length-1;return t.jsxs("div",e.__assign({className:l.default.userStoryCardWrapper,style:h?e.__assign(e.__assign({},null==w?void 0:w.userStoryCardWrapper),{position:"relative"}):null==w?void 0:w.userStoryCardWrapper},{children:[h&&t.jsx(t.Fragment,{children:C.length>0&&t.jsx("div",e.__assign({className:l.default.wrapper},{children:t.jsx("div",e.__assign({className:l.default.highlightNavigation},{children:t.jsxs("div",e.__assign({className:l.default.navigationContainer},{children:[t.jsxs("span",e.__assign({className:l.default.navCounter},{children:[j+1," of ",C.length]})),t.jsxs("div",e.__assign({className:l.default.navButtons},{children:[t.jsx("button",e.__assign({onClick:function(){j>0&&I(function(e){return e-1})},className:l.default.navButton,disabled:N},{children:t.jsx(r.ChevronUpIcon,{size:20,className:l.default.navIcon})})),t.jsx("button",e.__assign({onClick:function(){j<C.length-1&&I(function(e){return e+1})},className:l.default.navButton,disabled:U},{children:t.jsx(r.ChevronDownIcon,{size:20,className:l.default.navIcon})}))]}))]}))}))}))}),p.map(function(n,r){return t.jsx(g,{isUserStoryCurrentlyUpdated:u,artifactId:d,artifactTitleId:s[r]||"",currentUserStory:n,onUserStoryChange:function(t){S(function(n){return n[r]=t,e.__spreadArray([],n,!0)})},parentIndex:"",currentIndex:"".concat(r+1),doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:i,showUserStoryDiff:a,updateUserStoryArtifact:o,handleOpenSendDialog:c,handleDownloadUserStory:f,selectedArtifactId:y,isDisplayHighlightControl:h,elementDisplayConfig:_},n.artifactId)})]}))},exports.default=g,exports.replaceLearnedTagsWithInfo=_;
2
2
  //# sourceMappingURL=UserStoryCard.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as t,__awaiter as n,__generator as r}from"tslib";import{jsxs as o,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as s,useEffect as u}from"react";import{ChevronUpIcon as c,ChevronDownIcon as d,ExternalLink as v,Download as y,Share2 as h,Copy as m,LoaderCircle as f,PencilIcon as p,ChevronUp as S,ChevronDown as C,Info as I,Bookmark as g}from"lucide-react";import w from"showdown";import{Menu as N,MenuItem as U,Tooltip as D}from"@mui/material";import{v4 as b}from"uuid";import x from"./UserStoryCard.module.css.js";import{formatMarkdown as B,indentMarkdown as k}from"../../utils/helpers.js";import{replaceTitleSection as M}from"../../utils/user-story.utils.js";import A from"../../shared/AtomicButton.js";import T from"../RichTextEditor/RichTextEditor.js";import E from"../userstory-with-citation/UserStoryWithCitation.js";import{useRequirementAI as H}from"../RequirementAIWrapper/RequirementAIWrapper.js";function R(t){for(var n,r=[],o=/<learned>(.*?)<\/learned>/g,l=0,a=0;null!==(n=o.exec(t));){var s=n[1],u=n.index;u>l&&r.push(i("span",{children:t.slice(l,u)},"text-pre-".concat(a++))),r.push(i(D,e({title:s,placement:"top"},{children:i(I,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),"tooltip-".concat(b()))),l=o.lastIndex}return l<(null==t?void 0:t.length)&&r.push(i("span",{children:t.slice(l)},"text-post-".concat(a++))),r}var j=function(t){var n,r=t.displayName,l=H().customStyles,a=null===(n=null==l?void 0:l.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return o("div",e({className:x.displayName,style:null==a?void 0:a.wrapper},{children:[i(g,{className:x.displayNameIcon,style:null==a?void 0:a.displayNameIcon}),o("span",e({style:null==a?void 0:a.label},{children:[r,":"]}))]}))},L=function(c){var d,I,g=c.isUserStoryCurrentlyUpdated,D=c.artifactId,b=c.artifactTitleId,z=c.parentUserStory,P=c.currentUserStory,W=c.onUserStoryChange,O=c.parentIndex,V=c.currentIndex,_=c.enableDownload,q=c.isDiffEditReviewMode,Q=c.showUserStoryDiff,F=c.handleDownloadUserStory,G=c.handleOpenSendDialog,J=c.updateUserStoryArtifact,K=c.selectedArtifactId,X=c.isDisplayHighlightControl,Y=c.elementDisplayConfig,Z=H(),$=Z.searchQueryList,ee=Z.citations,te=Z.customStyles,ne=null==te?void 0:te.userStoryCardStyles,re=null===(d=null==te?void 0:te.userStoryScreenStyles)||void 0===d?void 0:d.userStoryContentStyles,oe=a(e(e({},structuredClone(P)),{value:B(P.value)||""})),ie=oe[0],le=oe[1],ae=a({userStory:!1}),se=ae[0],ue=ae[1],ce=H().userStory,de=a(""===O||K===P.artifactId),ve=de[0],ye=de[1],he=a(!1);he[0];var me=he[1],fe=a(null),pe=fe[0],Se=fe[1],Ce=a(!1),Ie=Ce[0],ge=Ce[1],we=s(null),Ne=a(!1);Ne[0];var Ue=Ne[1],De=s(null);u(function(){g&&ye(g)},[g]),u(function(){le(e(e({},structuredClone(P)),{value:B(P.value)||""}))},[P]),u(function(){$.length>0?ye(!0):K&&ye(K===P.artifactId)},[$,K,P.artifactId]);var be=function(){Se(null)},xe=function(){ye(function(e){return!e})};return o("div",e({className:x.card,style:null==ne?void 0:ne.cardStyle},{children:[o("div",e({className:x.titleSection,style:null==ne?void 0:ne.titleSection},{children:[o("div",e({className:x.titleRow,style:null==ne?void 0:ne.titleRow,onClick:xe},{children:[o("div",e({className:x.titleLeft,style:null==ne?void 0:ne.titleLeft,onMouseEnter:function(){return Ue(!0)},onMouseLeave:function(){return Ue(!1)}},{children:[i(j,{displayName:b}),i("h2",e({className:x.storyTitle,style:null==ne?void 0:ne.storyTitle},{children:R(P.title)}),P.artifactId)]})),o("div",e({className:x.titleActions,style:null==ne?void 0:ne.titleActions,onClick:function(e){return e.stopPropagation()}},{children:[!se.userStory&&o(l,{children:[!1!==(null==Y?void 0:Y.showShareButton)&&i("button",e({className:x.iconButton,style:null==ne?void 0:ne.iconButton,onClick:function(e){Se(e.currentTarget)}},{children:i(v,{size:16})})),o(N,e({id:"user-story-share-menu",anchorEl:pe,open:!!pe,onClose:function(){return Se(null)},style:null==ne?void 0:ne.userStoryShareMenu},{children:[_&&i(U,e({style:null==ne?void 0:ne.userStoryMenuItem,onClick:function(){return n(void 0,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return me(!0),F?[4,Promise.all([F("pdf"),F("doc")])]:[2];case 1:return e.sent(),me(!1),[2]}})})}},{children:o("div",e({ref:we,className:x.menuItemContent,style:null==ne?void 0:ne.menuItemContent},{children:[i(y,{size:16,color:null==ne?void 0:ne.menuIconColor}),i("p",e({style:null==ne?void 0:ne.menuLabel},{children:"Download"}))]}))})),i(U,e({style:null==ne?void 0:ne.userStoryMenuItem,onClick:function(){return n(void 0,void 0,void 0,function(){var t;return r(this,function(n){return t=P,z&&(t=e(e({},P),{value:"".concat(M(null==z?void 0:z.value,P.title)," \n").concat(P.value)})),null==G||G(!0,[t],P.artifactId),be(),[2]})})}},{children:o("div",e({style:null==ne?void 0:ne.menuItemContent,className:x.menuItemContentPadded},{children:[i(h,{size:16,color:null==ne?void 0:ne.menuIconColor}),i("p",e({style:null==ne?void 0:ne.menuLabel},{children:"Send"}))]}))})),i(U,e({style:null==ne?void 0:ne.userStoryMenuItem,onClick:function(){return n(void 0,void 0,void 0,function(){var e,t,n,o,i;return r(this,function(r){switch(r.label){case 0:e=new w.Converter,t=e.makeHtml(B(P.value)||P.value),n=function(e){var t=(new w.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(B(P.value)||P.value),o=new ClipboardItem({"text/plain":new Blob([n],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})}),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,navigator.clipboard.write([o])];case 2:return r.sent(),console.log("Copied User Story"),[3,5];case 3:return i=r.sent(),console.error("Failed to copy user story:",i),[3,5];case 4:return be(),[7];case 5:return[2]}})})}},{children:o("div",e({style:null==ne?void 0:ne.menuItemContent,className:x.menuItemContentPadded},{children:[i(m,{size:16,color:null==ne?void 0:ne.menuIconColor}),i("p",e({style:null==ne?void 0:ne.menuLabel},{children:"Copy"}))]}))}))]}))]}),se.userStory&&ve?i(A,{type:"outline",children:"Cancel",style:null==ne?void 0:ne.cancelButton,onClick:function(){var t;null===(t=De.current)||void 0===t||t.abort(),ue(function(t){return e(e({},t),{userStory:!1})})}}):i(l,{}),se.userStory&&ve?i(A,{type:"fill",children:Ie?o("span",e({className:x.savingSpinner},{children:[i(f,{className:x.spinAnimation}),i("span",{children:"Saving..."})]})):"Save",isDisable:Ie,style:Ie?null==ne?void 0:ne.savingButton:null==ne?void 0:ne.saveButton,onClick:function(){return n(void 0,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return ge(!0),"userStory"==="userStory"&&(W(ie),console.log("I am changing RTE editor values",ie)),[4,J(ee,ce,D,null===(t=De.current)||void 0===t?void 0:t.signal)];case 1:return n.sent(),ue(function(t){return e(e({},t),{userStory:!1})}),ge(!1),[2]}})})}}):!q&&!Q&&ve&&!1!==(null==Y?void 0:Y.showEditButton)&&i("button",e({className:x.iconButton,style:null==ne?void 0:ne.editButton,onClick:function(){return ue(function(t){return e(e({},t),{userStory:!0})})}},{children:i(p,{color:null==ne?void 0:ne.pencilIconColor,size:16})})),i("button",e({type:"button",onClick:function(e){e.stopPropagation(),xe()},style:null==ne?void 0:ne.chevronButton,className:x.chevronButton},{children:i(ve?S:C,{className:x.chevronIcon,color:null==ne?void 0:ne.chevronIconColor})}))]}))]})),i("div",{className:x.divider,style:null==ne?void 0:ne.dividerStyle})]})),ve&&i("div",e({className:x.cardContent,style:null==ne?void 0:ne.cardContentStyle},{children:o("div",e({className:x.contentInner,style:null==ne?void 0:ne.contentInner},{children:[o("div",e({className:x.descriptionSection,style:null==ne?void 0:ne.descriptionSection},{children:[i("div",{className:x.justifyBetween,style:null==ne?void 0:ne.justifyBetween}),se.userStory?i(T,{minHeight:"100%",height:"100%",type:"string",value:B(P.value)||"",handleUpdateState:function(t,n){var r=k(n);le(function(t){return e(e({},t),{value:r||""})})},doNotShowBorderInViewMode:!1,onBlur:function(){},mode:se.userStory?"edit":"readOnly"}):i(E,{showUserStoryDiff:Q,isParent:""===O,message:B(P.value)||"",artifactId:P.artifactId,customStyles:re,isDisplayHighlightControl:X})]})),null===(I=ie.sub_features)||void 0===I?void 0:I.map(function(n,r){return i(L,{artifactId:D,isUserStoryCurrentlyUpdated:g,artifactTitleId:"".concat(b,"-").concat(String.fromCharCode(65+r)),parentUserStory:P,parentIndex:"".concat(O).concat(O&&".").concat(V),currentIndex:"".concat(r+1),doNotShowBorderInViewMode:!1,currentUserStory:n,onUserStoryChange:function(n){return function(n,r){var o=t([],P.sub_features||[],!0);o[n]=r,W(e(e({},P),{sub_features:o}))}(r,n)},enableDownload:!0,isDiffEditReviewMode:q,showUserStoryDiff:Q,updateUserStoryArtifact:J,handleDownloadUserStory:F,handleOpenSendDialog:G,isDisplayHighlightControl:X,elementDisplayConfig:Y},n.artifactId)})]}))}))]}))},z=function(n){var r=n.artifactTitleIDs,a=n.isDiffEditReviewMode,s=n.showUserStoryDiff,u=n.updateUserStoryArtifact,v=n.isUserStoryCurrentlyUpdated,y=n.artifactId,h=n.handleOpenSendDialog,m=n.handleDownloadUserStory,f=n.selectedArtifactId,p=n.isDisplayHighlightControl,S=n.elementDisplayConfig,C=H(),I=C.userStory,g=C.setUserStory,w=C.customStyles,N=C.searchQueryList,U=C.currentHighlightIndex,D=C.setCurrentHighlightIndex,b=null==w?void 0:w.userStoryCardStyles,B=0===U,k=U===N.length-1;return o("div",e({className:x.userStoryCardWrapper,style:p?e(e({},null==b?void 0:b.userStoryCardWrapper),{position:"relative"}):null==b?void 0:b.userStoryCardWrapper},{children:[p&&i(l,{children:N.length>1&&i("div",e({className:x.wrapper},{children:i("div",e({className:x.highlightNavigation},{children:o("div",e({className:x.navigationContainer},{children:[o("span",e({className:x.navCounter},{children:[U+1," of ",N.length]})),o("div",e({className:x.navButtons},{children:[i("button",e({onClick:function(){U>0&&D(function(e){return e-1})},className:x.navButton,disabled:B},{children:i(c,{size:20,className:x.navIcon})})),i("button",e({onClick:function(){U<N.length-1&&D(function(e){return e+1})},className:x.navButton,disabled:k},{children:i(d,{size:20,className:x.navIcon})}))]}))]}))}))}))}),I.map(function(e,n){return i(L,{isUserStoryCurrentlyUpdated:v,artifactId:y,artifactTitleId:r[n]||"",currentUserStory:e,onUserStoryChange:function(e){g(function(r){return r[n]=e,t([],r,!0)})},parentIndex:"",currentIndex:"".concat(n+1),doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:a,showUserStoryDiff:s,updateUserStoryArtifact:u,handleOpenSendDialog:h,handleDownloadUserStory:m,selectedArtifactId:f,isDisplayHighlightControl:p,elementDisplayConfig:S},e.artifactId)})]}))};export{L as StoryCard,z as UserStoryCardWrapper,L as default,R as replaceLearnedTagsWithInfo};
1
+ import{__assign as e,__spreadArray as t,__awaiter as n,__generator as r}from"tslib";import{jsxs as o,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as s,useEffect as u}from"react";import{ChevronUpIcon as c,ChevronDownIcon as d,ExternalLink as v,Download as y,Share2 as h,Copy as m,LoaderCircle as f,PencilIcon as p,ChevronUp as S,ChevronDown as C,Info as I,Bookmark as g}from"lucide-react";import w from"showdown";import{Menu as N,MenuItem as U,Tooltip as D}from"@mui/material";import{v4 as b}from"uuid";import x from"./UserStoryCard.module.css.js";import{formatMarkdown as B,indentMarkdown as k}from"../../utils/helpers.js";import{replaceTitleSection as M}from"../../utils/user-story.utils.js";import A from"../../shared/AtomicButton.js";import T from"../RichTextEditor/RichTextEditor.js";import E from"../userstory-with-citation/UserStoryWithCitation.js";import{useRequirementAI as H}from"../RequirementAIWrapper/RequirementAIWrapper.js";function R(t){for(var n,r=[],o=/<learned>(.*?)<\/learned>/g,l=0,a=0;null!==(n=o.exec(t));){var s=n[1],u=n.index;u>l&&r.push(i("span",{children:t.slice(l,u)},"text-pre-".concat(a++))),r.push(i(D,e({title:s,placement:"top"},{children:i(I,{size:16,className:"inline-block mx-1 text-blue-500 hover:text-blue-700 cursor"})}),"tooltip-".concat(b()))),l=o.lastIndex}return l<(null==t?void 0:t.length)&&r.push(i("span",{children:t.slice(l)},"text-post-".concat(a++))),r}var j=function(t){var n,r=t.displayName,l=H().customStyles,a=null===(n=null==l?void 0:l.userStoryCardStyles)||void 0===n?void 0:n.showDisplayName;return o("div",e({className:x.displayName,style:null==a?void 0:a.wrapper},{children:[i(g,{className:x.displayNameIcon,style:null==a?void 0:a.displayNameIcon}),o("span",e({style:null==a?void 0:a.label},{children:[r,":"]}))]}))},L=function(c){var d,I,g=c.isUserStoryCurrentlyUpdated,D=c.artifactId,b=c.artifactTitleId,z=c.parentUserStory,P=c.currentUserStory,W=c.onUserStoryChange,O=c.parentIndex,V=c.currentIndex,_=c.enableDownload,q=c.isDiffEditReviewMode,Q=c.showUserStoryDiff,F=c.handleDownloadUserStory,G=c.handleOpenSendDialog,J=c.updateUserStoryArtifact,K=c.selectedArtifactId,X=c.isDisplayHighlightControl,Y=c.elementDisplayConfig,Z=H(),$=Z.searchQueryList,ee=Z.citations,te=Z.customStyles,ne=null==te?void 0:te.userStoryCardStyles,re=null===(d=null==te?void 0:te.userStoryScreenStyles)||void 0===d?void 0:d.userStoryContentStyles,oe=a(e(e({},structuredClone(P)),{value:B(P.value)||""})),ie=oe[0],le=oe[1],ae=a({userStory:!1}),se=ae[0],ue=ae[1],ce=H().userStory,de=a(""===O||K===P.artifactId),ve=de[0],ye=de[1],he=a(!1);he[0];var me=he[1],fe=a(null),pe=fe[0],Se=fe[1],Ce=a(!1),Ie=Ce[0],ge=Ce[1],we=s(null),Ne=a(!1);Ne[0];var Ue=Ne[1],De=s(null);u(function(){g&&ye(g)},[g]),u(function(){le(e(e({},structuredClone(P)),{value:B(P.value)||""}))},[P]),u(function(){$.length>0?ye(!0):K&&ye(K===P.artifactId)},[$,K,P.artifactId]);var be=function(){Se(null)},xe=function(){ye(function(e){return!e})};return o("div",e({className:x.card,style:null==ne?void 0:ne.cardStyle},{children:[o("div",e({className:x.titleSection,style:null==ne?void 0:ne.titleSection},{children:[o("div",e({className:x.titleRow,style:null==ne?void 0:ne.titleRow,onClick:xe},{children:[o("div",e({className:x.titleLeft,style:null==ne?void 0:ne.titleLeft,onMouseEnter:function(){return Ue(!0)},onMouseLeave:function(){return Ue(!1)}},{children:[i(j,{displayName:b}),i("h2",e({className:x.storyTitle,style:null==ne?void 0:ne.storyTitle},{children:R(P.title)}),P.artifactId)]})),o("div",e({className:x.titleActions,style:null==ne?void 0:ne.titleActions,onClick:function(e){return e.stopPropagation()}},{children:[!se.userStory&&o(l,{children:[!1!==(null==Y?void 0:Y.showShareButton)&&i("button",e({className:x.iconButton,style:null==ne?void 0:ne.iconButton,onClick:function(e){Se(e.currentTarget)}},{children:i(v,{size:16})})),o(N,e({id:"user-story-share-menu",anchorEl:pe,open:!!pe,onClose:function(){return Se(null)},style:null==ne?void 0:ne.userStoryShareMenu},{children:[_&&i(U,e({style:null==ne?void 0:ne.userStoryMenuItem,onClick:function(){return n(void 0,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return me(!0),F?[4,Promise.all([F("pdf"),F("doc")])]:[2];case 1:return e.sent(),me(!1),[2]}})})}},{children:o("div",e({ref:we,className:x.menuItemContent,style:null==ne?void 0:ne.menuItemContent},{children:[i(y,{size:16,color:null==ne?void 0:ne.menuIconColor}),i("p",e({style:null==ne?void 0:ne.menuLabel},{children:"Download"}))]}))})),i(U,e({style:null==ne?void 0:ne.userStoryMenuItem,onClick:function(){return n(void 0,void 0,void 0,function(){var t;return r(this,function(n){return t=P,z&&(t=e(e({},P),{value:"".concat(M(null==z?void 0:z.value,P.title)," \n").concat(P.value)})),null==G||G(!0,[t],P.artifactId),be(),[2]})})}},{children:o("div",e({style:null==ne?void 0:ne.menuItemContent,className:x.menuItemContentPadded},{children:[i(h,{size:16,color:null==ne?void 0:ne.menuIconColor}),i("p",e({style:null==ne?void 0:ne.menuLabel},{children:"Send"}))]}))})),i(U,e({style:null==ne?void 0:ne.userStoryMenuItem,onClick:function(){return n(void 0,void 0,void 0,function(){var e,t,n,o,i;return r(this,function(r){switch(r.label){case 0:e=new w.Converter,t=e.makeHtml(B(P.value)||P.value),n=function(e){var t=(new w.Converter).makeHtml(e),n=document.createElement("div");return n.innerHTML=t,n.textContent||n.innerText||""}(B(P.value)||P.value),o=new ClipboardItem({"text/plain":new Blob([n],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})}),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,navigator.clipboard.write([o])];case 2:return r.sent(),console.log("Copied User Story"),[3,5];case 3:return i=r.sent(),console.error("Failed to copy user story:",i),[3,5];case 4:return be(),[7];case 5:return[2]}})})}},{children:o("div",e({style:null==ne?void 0:ne.menuItemContent,className:x.menuItemContentPadded},{children:[i(m,{size:16,color:null==ne?void 0:ne.menuIconColor}),i("p",e({style:null==ne?void 0:ne.menuLabel},{children:"Copy"}))]}))}))]}))]}),se.userStory&&ve?i(A,{type:"outline",children:"Cancel",style:null==ne?void 0:ne.cancelButton,onClick:function(){var t;null===(t=De.current)||void 0===t||t.abort(),ue(function(t){return e(e({},t),{userStory:!1})})}}):i(l,{}),se.userStory&&ve?i(A,{type:"fill",children:Ie?o("span",e({className:x.savingSpinner},{children:[i(f,{className:x.spinAnimation}),i("span",{children:"Saving..."})]})):"Save",isDisable:Ie,style:Ie?null==ne?void 0:ne.savingButton:null==ne?void 0:ne.saveButton,onClick:function(){return n(void 0,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return ge(!0),"userStory"==="userStory"&&(W(ie),console.log("I am changing RTE editor values",ie)),[4,J(ee,ce,D,null===(t=De.current)||void 0===t?void 0:t.signal)];case 1:return n.sent(),ue(function(t){return e(e({},t),{userStory:!1})}),ge(!1),[2]}})})}}):!q&&!Q&&ve&&!1!==(null==Y?void 0:Y.showEditButton)&&i("button",e({className:x.iconButton,style:null==ne?void 0:ne.editButton,onClick:function(){return ue(function(t){return e(e({},t),{userStory:!0})})}},{children:i(p,{color:null==ne?void 0:ne.pencilIconColor,size:16})})),i("button",e({type:"button",onClick:function(e){e.stopPropagation(),xe()},style:null==ne?void 0:ne.chevronButton,className:x.chevronButton},{children:i(ve?S:C,{className:x.chevronIcon,color:null==ne?void 0:ne.chevronIconColor})}))]}))]})),i("div",{className:x.divider,style:null==ne?void 0:ne.dividerStyle})]})),ve&&i("div",e({className:x.cardContent,style:null==ne?void 0:ne.cardContentStyle},{children:o("div",e({className:x.contentInner,style:null==ne?void 0:ne.contentInner},{children:[o("div",e({className:x.descriptionSection,style:null==ne?void 0:ne.descriptionSection},{children:[i("div",{className:x.justifyBetween,style:null==ne?void 0:ne.justifyBetween}),se.userStory?i(T,{minHeight:"100%",height:"100%",type:"string",value:B(P.value)||"",handleUpdateState:function(t,n){var r=k(n);le(function(t){return e(e({},t),{value:r||""})})},doNotShowBorderInViewMode:!1,onBlur:function(){},mode:se.userStory?"edit":"readOnly"}):i(E,{showUserStoryDiff:Q,isParent:""===O,message:B(P.value)||"",artifactId:P.artifactId,customStyles:re,isDisplayHighlightControl:X})]})),null===(I=ie.sub_features)||void 0===I?void 0:I.map(function(n,r){return i(L,{artifactId:D,isUserStoryCurrentlyUpdated:g,artifactTitleId:"".concat(b,"-").concat(String.fromCharCode(65+r)),parentUserStory:P,parentIndex:"".concat(O).concat(O&&".").concat(V),currentIndex:"".concat(r+1),doNotShowBorderInViewMode:!1,currentUserStory:n,onUserStoryChange:function(n){return function(n,r){var o=t([],P.sub_features||[],!0);o[n]=r,W(e(e({},P),{sub_features:o}))}(r,n)},enableDownload:!0,isDiffEditReviewMode:q,showUserStoryDiff:Q,updateUserStoryArtifact:J,handleDownloadUserStory:F,handleOpenSendDialog:G,isDisplayHighlightControl:X,elementDisplayConfig:Y},n.artifactId)})]}))}))]}))},z=function(n){var r=n.artifactTitleIDs,a=n.isDiffEditReviewMode,s=n.showUserStoryDiff,u=n.updateUserStoryArtifact,v=n.isUserStoryCurrentlyUpdated,y=n.artifactId,h=n.handleOpenSendDialog,m=n.handleDownloadUserStory,f=n.selectedArtifactId,p=n.isDisplayHighlightControl,S=n.elementDisplayConfig,C=H(),I=C.userStory,g=C.setUserStory,w=C.customStyles,N=C.searchQueryList,U=C.currentHighlightIndex,D=C.setCurrentHighlightIndex,b=null==w?void 0:w.userStoryCardStyles,B=0===U,k=U===N.length-1;return o("div",e({className:x.userStoryCardWrapper,style:p?e(e({},null==b?void 0:b.userStoryCardWrapper),{position:"relative"}):null==b?void 0:b.userStoryCardWrapper},{children:[p&&i(l,{children:N.length>0&&i("div",e({className:x.wrapper},{children:i("div",e({className:x.highlightNavigation},{children:o("div",e({className:x.navigationContainer},{children:[o("span",e({className:x.navCounter},{children:[U+1," of ",N.length]})),o("div",e({className:x.navButtons},{children:[i("button",e({onClick:function(){U>0&&D(function(e){return e-1})},className:x.navButton,disabled:B},{children:i(c,{size:20,className:x.navIcon})})),i("button",e({onClick:function(){U<N.length-1&&D(function(e){return e+1})},className:x.navButton,disabled:k},{children:i(d,{size:20,className:x.navIcon})}))]}))]}))}))}))}),I.map(function(e,n){return i(L,{isUserStoryCurrentlyUpdated:v,artifactId:y,artifactTitleId:r[n]||"",currentUserStory:e,onUserStoryChange:function(e){g(function(r){return r[n]=e,t([],r,!0)})},parentIndex:"",currentIndex:"".concat(n+1),doNotShowBorderInViewMode:!0,enableDownload:!0,isDiffEditReviewMode:a,showUserStoryDiff:s,updateUserStoryArtifact:u,handleOpenSendDialog:h,handleDownloadUserStory:m,selectedArtifactId:f,isDisplayHighlightControl:p,elementDisplayConfig:S},e.artifactId)})]}))};export{L as StoryCard,z as UserStoryCardWrapper,L as default,R as replaceLearnedTagsWithInfo};
2
2
  //# sourceMappingURL=UserStoryCard.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/requirement-ai",
3
- "version": "0.0.92",
3
+ "version": "0.0.93",
4
4
  "author": "Saptyadeep Bhattacharjee",
5
5
  "description": "",
6
6
  "license": "MIT",