@e-llm-studio/requirement-ai 0.0.87 → 0.0.88

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"),n=require("react/jsx-runtime"),t=require("react"),r=require("../UserStoryPicker.context.js"),s=require("./Badge.js"),i=require("./CardProceedButton.js"),a=require("../lib/CustomTooltip.js"),o=require("../../RequirementAI/components/ai-reasoning/AiReasoningCitation.js"),l=require("../../RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js");function u(t){var r=t.filled;return n.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:r?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})}))}function c(){return n.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"})}))}function d(){return n.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}))}function p(e){try{var n=e.split(" "),t=n[0],r=n[1],s=void 0===r?"00:00:00":r,i=t.split("/"),a=i[0],o=i[1],l=i[2];if(!a||!o||!l)return e;var u=Number(l)+2e3,c="".concat(u,"-").concat(o,"-").concat(a,"T").concat(s),d=new Date(c);return isNaN(d.getTime())?e:d.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})}catch(n){return e}}exports.UserStoryCard=function(_){var f,v,g,h=this,m=_.story,j=_.className,x=_.style,y=_.headerStyle,S=_.titleStyle,w=_.descriptionStyle,C=_.metaStyle,k=r.useUSPContext(),N=k.state,b=k.dispatch,A=k.classNames,B=k.renderProps,q=k.onStorySelect,M=k.onFavoriteToggle,P=k.adapter,U=k.disableTooltip,I=k.tooltipClassName,L=k.mediaCacheHooks,R=k.showCitations,F=N.selectedStoryId===m.user_story_id,T=t.useState(!1),E=T[0],D=T[1],O=t.useState(null!==(f=m.isFavorite)&&void 0!==f&&f),G=O[0],Q=O[1],H=t.useState(!1),V=H[0],W=H[1],$=t.useState(!1),Z=$[0],z=$[1],Y=t.useState(null),J=Y[0],K=Y[1],X=P.fetchFinalUserStory,ee=t.useCallback(function(n){return e.__awaiter(h,void 0,void 0,function(){var t,r,s,i;return e.__generator(this,function(e){switch(e.label){case 0:if(!X||!n)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,X(n)];case 2:return t=e.sent(),r=null!==(i=null===(s=null==t?void 0:t.artifactData)||void 0===s?void 0:s.citationsSnapshot)&&void 0!==i?i:null,K(r),[3,4];case 3:return e.sent(),K(null),[3,4];case 4:return[2]}})})},[X]);t.useEffect(function(){R&&m.artifact_id&&ee(m.artifact_id)},[m.artifact_id,ee]);var ne=t.useCallback(function(e){e.stopPropagation(),z(function(e){return!e})},[]),te=Z?m.description:(null!==(g=null===(v=m.description)||void 0===v?void 0:v.length)&&void 0!==g?g:0)>100?m.description.slice(0,100):m.description,re=m.description.length>100;if(t.useEffect(function(){var e;Q(null!==(e=m.isFavorite)&&void 0!==e&&e)},[m.isFavorite]),t.useEffect(function(){if(V){var e=window.setTimeout(function(){W(!1)},600);return function(){return window.clearTimeout(e)}}},[V]),B.renderStoryCard)return n.jsx(n.Fragment,{children:B.renderStoryCard(m,{isSelected:F})});var se,ie,ae=t.useCallback(function(){b({type:"SELECT_STORY",payload:F?null:m.user_story_id}),F||null==q||q(m)},[b,F,m,q]),oe=t.useCallback(function(n){return e.__awaiter(h,void 0,void 0,function(){var t,r;return e.__generator(this,function(e){switch(e.label){case 0:return n.stopPropagation(),Q(t=!G),t&&W(!0),null==M||M(m,t),r={user_story_title_id:m.storyId,user_story_id:m.user_story_id,is_favorite:t},[4,P.markFavorite(r)];case 1:return e.sent()||(Q(!t),t&&W(!1),null==M||M(m,!t)),[2]}})})},[G,m,M,P]),le=["usp-card usp-card--story",E&&"usp-card--hovered",V&&"usp-card--favorite-bounce",A.card,j].filter(Boolean).join(" "),ue=(se=m.description||"",ie=(new DOMParser).parseFromString(se,"text/html"),Array.from(ie.querySelectorAll('a[href^="ai_reasoning$"]')).map(function(e){return e.getAttribute("href").replace("ai_reasoning$","")})).map(function(e){var n;return null===(n=null==m?void 0:m.ai_reasonings_snaphost)||void 0===n?void 0:n.find(function(n){return n.id.toString()===e})}).filter(function(e){return void 0!==e});return n.jsxs("div",e.__assign({className:le,style:x,onClick:ae,onMouseEnter:function(){return D(!0)},onMouseLeave:function(){return D(!1)},role:"option","aria-selected":F},{children:[n.jsxs("div",e.__assign({className:["usp-card__header",A.cardHeader].filter(Boolean).join(" "),style:y},{children:[n.jsx("span",e.__assign({className:"usp-card__icon"},{children:B.renderBookmarkIcon?B.renderBookmarkIcon():n.jsx(c,{})})),""!==m.storyId&&n.jsxs("span",e.__assign({className:["usp-card__id",A.cardId].filter(Boolean).join(" ")},{children:[m.storyId,":"]})),n.jsx(a.default,e.__assign({content:m.title,placement:"top",disabled:U,contentClassName:I},{children:n.jsx("span",e.__assign({className:["usp-card__title",A.cardTitle].filter(Boolean).join(" "),style:S},{children:m.title}))})),m.isNew&&n.jsx(s.Badge,{type:"new"}),n.jsx("div",e.__assign({className:"usp-card__actions"},{children:n.jsx(a.default,e.__assign({content:G?"Remove from Shortlist":"Add to Shortlist",placement:"top",disabled:U,contentClassName:I},{children:n.jsxs("button",e.__assign({type:"button",className:["usp-card__heart",G&&"usp-card__heart--active",V&&"usp-card__heart--burst"].filter(Boolean).join(" "),onClick:oe,"aria-label":G?"Remove from Shortlist":"Add to Shortlist","aria-pressed":G},{children:[n.jsx(u,{filled:G}),n.jsxs("span",e.__assign({className:"usp-card__heart-burst","aria-hidden":"true"},{children:[n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{})]}))]}))}))}))]})),n.jsxs("div",e.__assign({className:["usp-card__project-name",A.cardProjectName].filter(Boolean).join(" ")},{children:[B.renderFolderIcon?B.renderFolderIcon():n.jsx(d,{}),m.projectName]})),n.jsx("div",e.__assign({className:["usp-card-userstory-description",!m.description&&"usp-card__description--empty",A.cardDescription].filter(Boolean).join(" "),style:w},{children:m.description?n.jsxs(n.Fragment,{children:[n.jsx("span",{dangerouslySetInnerHTML:{__html:function(e){var n=(new DOMParser).parseFromString(e,"text/html");return n.querySelectorAll('a[href^="ai_reasoning$"]').forEach(function(e){e.remove()}),n.body.innerHTML.trim()}(te)}}),re&&n.jsx("button",e.__assign({onClick:ne,className:["usp-card-moreButton",A.cardViewMore].filter(Boolean).join(" "),"aria-label":Z?"Show less":"Show more"},{children:Z?"less":"..."}))]}):n.jsx("span",e.__assign({className:"usp-card__description--placeholder"},{children:"No Description available"}))})),R&&(null==ue?void 0:ue.length)>0&&n.jsx("span",e.__assign({className:"mt-1 flex-row flex-wrap gap-1 relative w-full",onClick:function(e){return e.stopPropagation()},"data-citation":"true"},{children:null==ue?void 0:ue.map(function(t){var r,s,i,a,u,c;return n.jsx(l.default,e.__assign({searchQueryList:[""],searchQueryReasoningIdList:[],userStory:[],aiReasoning:[],citations:null!=J?J:{},apiCachingConfig:{queryClient:function(){var e;return null!==(e=null==L?void 0:L.queryClient)&&void 0!==e?e:function(){}},useGetSignedUrlQuery:null!==(r=null==L?void 0:L.useGetSignedUrlQuery)&&void 0!==r?r:function(){},useGetSignedUrlMutation:null!==(s=null==L?void 0:L.useGetSignedUrlMutation)&&void 0!==s?s:function(){},useExtractAudioPeaksMutation:null!==(i=null==L?void 0:L.useExtractAudioPeaksMutation)&&void 0!==i?i:function(){},useExtractAudioPeaksQuery:null!==(a=null==L?void 0:L.useExtractAudioPeaksQuery)&&void 0!==a?a:function(){},useGetVideoSignedUrlMutation:null!==(u=null==L?void 0:L.useGetVideoSignedUrlMutation)&&void 0!==u?u:function(){},useGetVideoSignedUrlQuery:null!==(c=null==L?void 0:L.useGetVideoSignedUrlQuery)&&void 0!==c?c:function(){}},setUserStory:function(){},setAiReasoning:function(){},setCitations:function(){},aiReasoningAccordionOpenStates:{isBottomComponentCollapsed:!0,gapAlwaysOpen:!1,gapDefaultOpen:!1,isBottomComponentDefaultOpen:!0,reasoningAlwaysOpen:!0}},{children:n.jsx(o.default,{aiReason:t,isSourceHasHighlight:!1})}))})})),n.jsx("div",e.__assign({className:"usp-card__meta",style:C},{children:n.jsxs("span",e.__assign({className:["usp-card__date",A.cardDate].filter(Boolean).join(" ")},{children:["Last Updated: ",p(m.lastUpdated)]}))})),n.jsx(i.CardProceedButton,{story:m})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),r=require("../UserStoryPicker.context.js"),i=require("./Badge.js"),s=require("./CardProceedButton.js"),a=require("../lib/CustomTooltip.js"),o=require("../../RequirementAI/components/ai-reasoning/AiReasoningCitation.js"),l=require("../../RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js");function u(t){var r=t.filled;return n.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:r?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})}))}function c(){return n.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"})}))}function d(){return n.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}))}function p(e){try{var n=e.split(" "),t=n[0],r=n[1],i=void 0===r?"00:00:00":r,s=t.split("/"),a=s[0],o=s[1],l=s[2];if(!a||!o||!l)return e;var u=Number(l)+2e3,c="".concat(u,"-").concat(o,"-").concat(a,"T").concat(i),d=new Date(c);return isNaN(d.getTime())?e:d.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})}catch(n){return e}}exports.UserStoryCard=function(_){var f,v,g,h=this,m=_.story,j=_.className,x=_.style,y=_.headerStyle,S=_.titleStyle,w=_.descriptionStyle,C=_.metaStyle,k=r.useUSPContext(),N=k.state,b=k.dispatch,A=k.classNames,B=k.renderProps,q=k.onStorySelect,P=k.onFavoriteToggle,M=k.adapter,U=k.disableTooltip,I=k.tooltipClassName,L=k.mediaCacheHooks,R=k.showCitations,F=N.selectedStoryId===m.user_story_id,T=t.useState(!1),E=T[0],D=T[1],O=t.useState(null!==(f=m.isFavorite)&&void 0!==f&&f),G=O[0],Q=O[1],H=t.useState(!1),V=H[0],W=H[1],$=t.useState(!1),z=$[0],Z=$[1],Y=t.useState(null),J=Y[0],K=Y[1],X=M.fetchFinalUserStory,ee=t.useCallback(function(n){return e.__awaiter(h,void 0,void 0,function(){var t,r,i,s;return e.__generator(this,function(e){switch(e.label){case 0:if(!X||!n)return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,X(n)];case 2:return t=e.sent(),r=null!==(s=null===(i=null==t?void 0:t.artifactData)||void 0===i?void 0:i.citationsSnapshot)&&void 0!==s?s:null,K(r),[3,4];case 3:return e.sent(),K(null),[3,4];case 4:return[2]}})})},[X]);t.useEffect(function(){R&&m.artifact_id&&ee(m.artifact_id)},[m.artifact_id,ee]);var ne=t.useCallback(function(e){e.stopPropagation(),Z(function(e){return!e})},[]),te=z?m.description:(null!==(g=null===(v=m.description)||void 0===v?void 0:v.length)&&void 0!==g?g:0)>100?m.description.slice(0,100):m.description,re=m.description.length>100;if(t.useEffect(function(){var e;Q(null!==(e=m.isFavorite)&&void 0!==e&&e)},[m.isFavorite]),t.useEffect(function(){if(V){var e=window.setTimeout(function(){W(!1)},600);return function(){return window.clearTimeout(e)}}},[V]),B.renderStoryCard)return n.jsx(n.Fragment,{children:B.renderStoryCard(m,{isSelected:F})});var ie,se,ae=t.useCallback(function(){b({type:"SELECT_STORY",payload:F?null:m.user_story_id}),F||null==q||q(m)},[b,F,m,q]),oe=t.useCallback(function(n){return e.__awaiter(h,void 0,void 0,function(){var t,r;return e.__generator(this,function(e){switch(e.label){case 0:return n.stopPropagation(),Q(t=!G),t&&W(!0),null==P||P(m,t),r={user_story_title_id:m.storyId,user_story_id:m.user_story_id,is_favorite:t},[4,M.markFavorite(r)];case 1:return e.sent()||(Q(!t),t&&W(!1),null==P||P(m,!t)),[2]}})})},[G,m,P,M]),le=["usp-card usp-card--story",E&&"usp-card--hovered",V&&"usp-card--favorite-bounce",A.card,j].filter(Boolean).join(" "),ue=(ie=m.description||"",se=(new DOMParser).parseFromString(ie,"text/html"),Array.from(se.querySelectorAll('a[href^="ai_reasoning$"]')).map(function(e){return e.getAttribute("href").replace("ai_reasoning$","")})).map(function(e){var n;return null===(n=null==m?void 0:m.ai_reasonings_snaphost)||void 0===n?void 0:n.find(function(n){return n.id.toString()===e})}).filter(function(e){return void 0!==e});return n.jsxs("div",e.__assign({className:le,style:x,onClick:ae,onMouseEnter:function(){return D(!0)},onMouseLeave:function(){return D(!1)},role:"option","aria-selected":F},{children:[n.jsxs("div",e.__assign({className:["usp-card__header",A.cardHeader].filter(Boolean).join(" "),style:y},{children:[n.jsx("span",e.__assign({className:"usp-card__icon"},{children:B.renderBookmarkIcon?B.renderBookmarkIcon():n.jsx(c,{})})),""!==m.storyId&&n.jsxs("span",e.__assign({className:["usp-card__id",A.cardId].filter(Boolean).join(" ")},{children:[m.storyId,":"]})),n.jsx(a.default,e.__assign({content:m.title,placement:"top",disabled:U,contentClassName:I},{children:n.jsx("span",e.__assign({className:["usp-card__title",A.cardTitle].filter(Boolean).join(" "),style:S},{children:m.title}))})),m.isNew&&n.jsx(i.Badge,{type:"new"}),n.jsx("div",e.__assign({className:"usp-card__actions"},{children:n.jsx(a.default,e.__assign({content:G?"Remove from Shortlist":"Add to Shortlist",placement:"top",disabled:U,contentClassName:I},{children:n.jsxs("button",e.__assign({type:"button",className:["usp-card__heart",G&&"usp-card__heart--active",V&&"usp-card__heart--burst"].filter(Boolean).join(" "),onClick:oe,"aria-label":G?"Remove from Shortlist":"Add to Shortlist","aria-pressed":G},{children:[n.jsx(u,{filled:G}),n.jsxs("span",e.__assign({className:"usp-card__heart-burst","aria-hidden":"true"},{children:[n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{}),n.jsx("span",{})]}))]}))}))}))]})),n.jsxs("div",e.__assign({className:["usp-card__project-name",A.cardProjectName].filter(Boolean).join(" ")},{children:[B.renderFolderIcon?B.renderFolderIcon():n.jsx(d,{}),m.projectName]})),n.jsx("div",e.__assign({className:["usp-card-userstory-description",!m.description&&"usp-card__description--empty",A.cardDescription].filter(Boolean).join(" "),style:w},{children:m.description?n.jsxs(n.Fragment,{children:[n.jsx("span",{dangerouslySetInnerHTML:{__html:function(e){var n=(new DOMParser).parseFromString(e,"text/html");return n.querySelectorAll('a[href^="ai_reasoning$"]').forEach(function(e){e.remove()}),n.body.innerHTML.trim()}(te)}}),re&&n.jsx("button",e.__assign({onClick:ne,className:["usp-card-moreButton",A.cardViewMore].filter(Boolean).join(" "),"aria-label":z?"Show less":"Show more"},{children:z?"less":"more"})),R&&(null==ue?void 0:ue.length)>0&&n.jsx("span",e.__assign({className:"mt-1 inline flex-row flex-wrap gap-1 relative w-full",onClick:function(e){return e.stopPropagation()},"data-citation":"true"},{children:null==ue?void 0:ue.map(function(t){var r,i,s,a,u,c;return n.jsx(l.default,e.__assign({searchQueryList:[""],searchQueryReasoningIdList:[],userStory:[],aiReasoning:[],citations:null!=J?J:{},apiCachingConfig:{queryClient:function(){var e;return null!==(e=null==L?void 0:L.queryClient)&&void 0!==e?e:function(){}},useGetSignedUrlQuery:null!==(r=null==L?void 0:L.useGetSignedUrlQuery)&&void 0!==r?r:function(){},useGetSignedUrlMutation:null!==(i=null==L?void 0:L.useGetSignedUrlMutation)&&void 0!==i?i:function(){},useExtractAudioPeaksMutation:null!==(s=null==L?void 0:L.useExtractAudioPeaksMutation)&&void 0!==s?s:function(){},useExtractAudioPeaksQuery:null!==(a=null==L?void 0:L.useExtractAudioPeaksQuery)&&void 0!==a?a:function(){},useGetVideoSignedUrlMutation:null!==(u=null==L?void 0:L.useGetVideoSignedUrlMutation)&&void 0!==u?u:function(){},useGetVideoSignedUrlQuery:null!==(c=null==L?void 0:L.useGetVideoSignedUrlQuery)&&void 0!==c?c:function(){}},setUserStory:function(){},setAiReasoning:function(){},setCitations:function(){},aiReasoningAccordionOpenStates:{isBottomComponentCollapsed:!0,gapAlwaysOpen:!1,gapDefaultOpen:!1,isBottomComponentDefaultOpen:!0,reasoningAlwaysOpen:!0}},{children:n.jsx(o.default,{aiReason:t,isSourceHasHighlight:!1,customStyles:{aiReasoningPill:{background:"transparent",fontSize:"13px"}}})}))})}))]}):n.jsx("span",e.__assign({className:"usp-card__description--placeholder"},{children:"No Description available"}))})),n.jsx("div",e.__assign({className:"usp-card__meta",style:C},{children:n.jsxs("span",e.__assign({className:["usp-card__date",A.cardDate].filter(Boolean).join(" ")},{children:["Last Updated: ",p(m.lastUpdated)]}))})),n.jsx(s.CardProceedButton,{story:m})]}))};
2
2
  //# sourceMappingURL=UserStoryCard.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as e,__generator as t,__assign as r}from"tslib";import{jsx as n,Fragment as o,jsxs as i}from"react/jsx-runtime";import{useState as a,useCallback as s,useEffect as l}from"react";import{useUSPContext as c}from"../UserStoryPicker.context.js";import{Badge as u}from"./Badge.js";import{CardProceedButton as d}from"./CardProceedButton.js";import p from"../lib/CustomTooltip.js";import m from"../../RequirementAI/components/ai-reasoning/AiReasoningCitation.js";import f from"../../RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js";function v(e){var t=e.filled;return n("svg",r({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:t?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})}))}function h(){return n("svg",r({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"})}))}function y(){return n("svg",r({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}))}function g(e){try{var t=e.split(" "),r=t[0],n=t[1],o=void 0===n?"00:00:00":n,i=r.split("/"),a=i[0],s=i[1],l=i[2];if(!a||!s||!l)return e;var c=Number(l)+2e3,u="".concat(c,"-").concat(s,"-").concat(a,"T").concat(o),d=new Date(u);return isNaN(d.getTime())?e:d.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})}catch(t){return e}}function _(_){var S,w,k,C=this,N=_.story,j=_.className,A=_.style,b=_.headerStyle,B=_.titleStyle,x=_.descriptionStyle,I=_.metaStyle,L=c(),M=L.state,U=L.dispatch,P=L.classNames,R=L.renderProps,T=L.onStorySelect,D=L.onFavoriteToggle,F=L.adapter,q=L.disableTooltip,E=L.tooltipClassName,G=L.mediaCacheHooks,O=L.showCitations,Q=M.selectedStoryId===N.user_story_id,H=a(!1),V=H[0],W=H[1],$=a(null!==(S=N.isFavorite)&&void 0!==S&&S),Z=$[0],z=$[1],Y=a(!1),J=Y[0],K=Y[1],X=a(!1),ee=X[0],te=X[1],re=a(null),ne=re[0],oe=re[1],ie=F.fetchFinalUserStory,ae=s(function(r){return e(C,void 0,void 0,function(){var e,n,o,i;return t(this,function(t){switch(t.label){case 0:if(!ie||!r)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,ie(r)];case 2:return e=t.sent(),n=null!==(i=null===(o=null==e?void 0:e.artifactData)||void 0===o?void 0:o.citationsSnapshot)&&void 0!==i?i:null,oe(n),[3,4];case 3:return t.sent(),oe(null),[3,4];case 4:return[2]}})})},[ie]);l(function(){O&&N.artifact_id&&ae(N.artifact_id)},[N.artifact_id,ae]);var se=s(function(e){e.stopPropagation(),te(function(e){return!e})},[]),le=ee?N.description:(null!==(k=null===(w=N.description)||void 0===w?void 0:w.length)&&void 0!==k?k:0)>100?N.description.slice(0,100):N.description,ce=N.description.length>100;if(l(function(){var e;z(null!==(e=N.isFavorite)&&void 0!==e&&e)},[N.isFavorite]),l(function(){if(J){var e=window.setTimeout(function(){K(!1)},600);return function(){return window.clearTimeout(e)}}},[J]),R.renderStoryCard)return n(o,{children:R.renderStoryCard(N,{isSelected:Q})});var ue,de,pe=s(function(){U({type:"SELECT_STORY",payload:Q?null:N.user_story_id}),Q||null==T||T(N)},[U,Q,N,T]),me=s(function(r){return e(C,void 0,void 0,function(){var e,n;return t(this,function(t){switch(t.label){case 0:return r.stopPropagation(),z(e=!Z),e&&K(!0),null==D||D(N,e),n={user_story_title_id:N.storyId,user_story_id:N.user_story_id,is_favorite:e},[4,F.markFavorite(n)];case 1:return t.sent()||(z(!e),e&&K(!1),null==D||D(N,!e)),[2]}})})},[Z,N,D,F]),fe=["usp-card usp-card--story",V&&"usp-card--hovered",J&&"usp-card--favorite-bounce",P.card,j].filter(Boolean).join(" "),ve=(ue=N.description||"",de=(new DOMParser).parseFromString(ue,"text/html"),Array.from(de.querySelectorAll('a[href^="ai_reasoning$"]')).map(function(e){return e.getAttribute("href").replace("ai_reasoning$","")})).map(function(e){var t;return null===(t=null==N?void 0:N.ai_reasonings_snaphost)||void 0===t?void 0:t.find(function(t){return t.id.toString()===e})}).filter(function(e){return void 0!==e});return i("div",r({className:fe,style:A,onClick:pe,onMouseEnter:function(){return W(!0)},onMouseLeave:function(){return W(!1)},role:"option","aria-selected":Q},{children:[i("div",r({className:["usp-card__header",P.cardHeader].filter(Boolean).join(" "),style:b},{children:[n("span",r({className:"usp-card__icon"},{children:R.renderBookmarkIcon?R.renderBookmarkIcon():n(h,{})})),""!==N.storyId&&i("span",r({className:["usp-card__id",P.cardId].filter(Boolean).join(" ")},{children:[N.storyId,":"]})),n(p,r({content:N.title,placement:"top",disabled:q,contentClassName:E},{children:n("span",r({className:["usp-card__title",P.cardTitle].filter(Boolean).join(" "),style:B},{children:N.title}))})),N.isNew&&n(u,{type:"new"}),n("div",r({className:"usp-card__actions"},{children:n(p,r({content:Z?"Remove from Shortlist":"Add to Shortlist",placement:"top",disabled:q,contentClassName:E},{children:i("button",r({type:"button",className:["usp-card__heart",Z&&"usp-card__heart--active",J&&"usp-card__heart--burst"].filter(Boolean).join(" "),onClick:me,"aria-label":Z?"Remove from Shortlist":"Add to Shortlist","aria-pressed":Z},{children:[n(v,{filled:Z}),i("span",r({className:"usp-card__heart-burst","aria-hidden":"true"},{children:[n("span",{}),n("span",{}),n("span",{}),n("span",{}),n("span",{}),n("span",{}),n("span",{}),n("span",{})]}))]}))}))}))]})),i("div",r({className:["usp-card__project-name",P.cardProjectName].filter(Boolean).join(" ")},{children:[R.renderFolderIcon?R.renderFolderIcon():n(y,{}),N.projectName]})),n("div",r({className:["usp-card-userstory-description",!N.description&&"usp-card__description--empty",P.cardDescription].filter(Boolean).join(" "),style:x},{children:N.description?i(o,{children:[n("span",{dangerouslySetInnerHTML:{__html:function(e){var t=(new DOMParser).parseFromString(e,"text/html");return t.querySelectorAll('a[href^="ai_reasoning$"]').forEach(function(e){e.remove()}),t.body.innerHTML.trim()}(le)}}),ce&&n("button",r({onClick:se,className:["usp-card-moreButton",P.cardViewMore].filter(Boolean).join(" "),"aria-label":ee?"Show less":"Show more"},{children:ee?"less":"..."}))]}):n("span",r({className:"usp-card__description--placeholder"},{children:"No Description available"}))})),O&&(null==ve?void 0:ve.length)>0&&n("span",r({className:"mt-1 flex-row flex-wrap gap-1 relative w-full",onClick:function(e){return e.stopPropagation()},"data-citation":"true"},{children:null==ve?void 0:ve.map(function(e){var t,o,i,a,s,l;return n(f,r({searchQueryList:[""],searchQueryReasoningIdList:[],userStory:[],aiReasoning:[],citations:null!=ne?ne:{},apiCachingConfig:{queryClient:function(){var e;return null!==(e=null==G?void 0:G.queryClient)&&void 0!==e?e:function(){}},useGetSignedUrlQuery:null!==(t=null==G?void 0:G.useGetSignedUrlQuery)&&void 0!==t?t:function(){},useGetSignedUrlMutation:null!==(o=null==G?void 0:G.useGetSignedUrlMutation)&&void 0!==o?o:function(){},useExtractAudioPeaksMutation:null!==(i=null==G?void 0:G.useExtractAudioPeaksMutation)&&void 0!==i?i:function(){},useExtractAudioPeaksQuery:null!==(a=null==G?void 0:G.useExtractAudioPeaksQuery)&&void 0!==a?a:function(){},useGetVideoSignedUrlMutation:null!==(s=null==G?void 0:G.useGetVideoSignedUrlMutation)&&void 0!==s?s:function(){},useGetVideoSignedUrlQuery:null!==(l=null==G?void 0:G.useGetVideoSignedUrlQuery)&&void 0!==l?l:function(){}},setUserStory:function(){},setAiReasoning:function(){},setCitations:function(){},aiReasoningAccordionOpenStates:{isBottomComponentCollapsed:!0,gapAlwaysOpen:!1,gapDefaultOpen:!1,isBottomComponentDefaultOpen:!0,reasoningAlwaysOpen:!0}},{children:n(m,{aiReason:e,isSourceHasHighlight:!1})}))})})),n("div",r({className:"usp-card__meta",style:I},{children:i("span",r({className:["usp-card__date",P.cardDate].filter(Boolean).join(" ")},{children:["Last Updated: ",g(N.lastUpdated)]}))})),n(d,{story:N})]}))}export{_ as UserStoryCard};
1
+ import{__awaiter as e,__generator as t,__assign as n}from"tslib";import{jsx as r,Fragment as o,jsxs as i}from"react/jsx-runtime";import{useState as a,useCallback as s,useEffect as l}from"react";import{useUSPContext as c}from"../UserStoryPicker.context.js";import{Badge as u}from"./Badge.js";import{CardProceedButton as d}from"./CardProceedButton.js";import p from"../lib/CustomTooltip.js";import m from"../../RequirementAI/components/ai-reasoning/AiReasoningCitation.js";import f from"../../RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js";function v(e){var t=e.filled;return r("svg",n({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:t?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:r("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})}))}function h(){return r("svg",n({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:r("path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"})}))}function y(){return r("svg",n({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:r("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}))}function g(e){try{var t=e.split(" "),n=t[0],r=t[1],o=void 0===r?"00:00:00":r,i=n.split("/"),a=i[0],s=i[1],l=i[2];if(!a||!s||!l)return e;var c=Number(l)+2e3,u="".concat(c,"-").concat(s,"-").concat(a,"T").concat(o),d=new Date(u);return isNaN(d.getTime())?e:d.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})}catch(t){return e}}function _(_){var S,w,k,C=this,N=_.story,j=_.className,A=_.style,b=_.headerStyle,B=_.titleStyle,x=_.descriptionStyle,I=_.metaStyle,L=c(),M=L.state,P=L.dispatch,R=L.classNames,U=L.renderProps,T=L.onStorySelect,D=L.onFavoriteToggle,F=L.adapter,q=L.disableTooltip,E=L.tooltipClassName,G=L.mediaCacheHooks,O=L.showCitations,Q=M.selectedStoryId===N.user_story_id,H=a(!1),V=H[0],W=H[1],$=a(null!==(S=N.isFavorite)&&void 0!==S&&S),z=$[0],Z=$[1],Y=a(!1),J=Y[0],K=Y[1],X=a(!1),ee=X[0],te=X[1],ne=a(null),re=ne[0],oe=ne[1],ie=F.fetchFinalUserStory,ae=s(function(n){return e(C,void 0,void 0,function(){var e,r,o,i;return t(this,function(t){switch(t.label){case 0:if(!ie||!n)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,ie(n)];case 2:return e=t.sent(),r=null!==(i=null===(o=null==e?void 0:e.artifactData)||void 0===o?void 0:o.citationsSnapshot)&&void 0!==i?i:null,oe(r),[3,4];case 3:return t.sent(),oe(null),[3,4];case 4:return[2]}})})},[ie]);l(function(){O&&N.artifact_id&&ae(N.artifact_id)},[N.artifact_id,ae]);var se=s(function(e){e.stopPropagation(),te(function(e){return!e})},[]),le=ee?N.description:(null!==(k=null===(w=N.description)||void 0===w?void 0:w.length)&&void 0!==k?k:0)>100?N.description.slice(0,100):N.description,ce=N.description.length>100;if(l(function(){var e;Z(null!==(e=N.isFavorite)&&void 0!==e&&e)},[N.isFavorite]),l(function(){if(J){var e=window.setTimeout(function(){K(!1)},600);return function(){return window.clearTimeout(e)}}},[J]),U.renderStoryCard)return r(o,{children:U.renderStoryCard(N,{isSelected:Q})});var ue,de,pe=s(function(){P({type:"SELECT_STORY",payload:Q?null:N.user_story_id}),Q||null==T||T(N)},[P,Q,N,T]),me=s(function(n){return e(C,void 0,void 0,function(){var e,r;return t(this,function(t){switch(t.label){case 0:return n.stopPropagation(),Z(e=!z),e&&K(!0),null==D||D(N,e),r={user_story_title_id:N.storyId,user_story_id:N.user_story_id,is_favorite:e},[4,F.markFavorite(r)];case 1:return t.sent()||(Z(!e),e&&K(!1),null==D||D(N,!e)),[2]}})})},[z,N,D,F]),fe=["usp-card usp-card--story",V&&"usp-card--hovered",J&&"usp-card--favorite-bounce",R.card,j].filter(Boolean).join(" "),ve=(ue=N.description||"",de=(new DOMParser).parseFromString(ue,"text/html"),Array.from(de.querySelectorAll('a[href^="ai_reasoning$"]')).map(function(e){return e.getAttribute("href").replace("ai_reasoning$","")})).map(function(e){var t;return null===(t=null==N?void 0:N.ai_reasonings_snaphost)||void 0===t?void 0:t.find(function(t){return t.id.toString()===e})}).filter(function(e){return void 0!==e});return i("div",n({className:fe,style:A,onClick:pe,onMouseEnter:function(){return W(!0)},onMouseLeave:function(){return W(!1)},role:"option","aria-selected":Q},{children:[i("div",n({className:["usp-card__header",R.cardHeader].filter(Boolean).join(" "),style:b},{children:[r("span",n({className:"usp-card__icon"},{children:U.renderBookmarkIcon?U.renderBookmarkIcon():r(h,{})})),""!==N.storyId&&i("span",n({className:["usp-card__id",R.cardId].filter(Boolean).join(" ")},{children:[N.storyId,":"]})),r(p,n({content:N.title,placement:"top",disabled:q,contentClassName:E},{children:r("span",n({className:["usp-card__title",R.cardTitle].filter(Boolean).join(" "),style:B},{children:N.title}))})),N.isNew&&r(u,{type:"new"}),r("div",n({className:"usp-card__actions"},{children:r(p,n({content:z?"Remove from Shortlist":"Add to Shortlist",placement:"top",disabled:q,contentClassName:E},{children:i("button",n({type:"button",className:["usp-card__heart",z&&"usp-card__heart--active",J&&"usp-card__heart--burst"].filter(Boolean).join(" "),onClick:me,"aria-label":z?"Remove from Shortlist":"Add to Shortlist","aria-pressed":z},{children:[r(v,{filled:z}),i("span",n({className:"usp-card__heart-burst","aria-hidden":"true"},{children:[r("span",{}),r("span",{}),r("span",{}),r("span",{}),r("span",{}),r("span",{}),r("span",{}),r("span",{})]}))]}))}))}))]})),i("div",n({className:["usp-card__project-name",R.cardProjectName].filter(Boolean).join(" ")},{children:[U.renderFolderIcon?U.renderFolderIcon():r(y,{}),N.projectName]})),r("div",n({className:["usp-card-userstory-description",!N.description&&"usp-card__description--empty",R.cardDescription].filter(Boolean).join(" "),style:x},{children:N.description?i(o,{children:[r("span",{dangerouslySetInnerHTML:{__html:function(e){var t=(new DOMParser).parseFromString(e,"text/html");return t.querySelectorAll('a[href^="ai_reasoning$"]').forEach(function(e){e.remove()}),t.body.innerHTML.trim()}(le)}}),ce&&r("button",n({onClick:se,className:["usp-card-moreButton",R.cardViewMore].filter(Boolean).join(" "),"aria-label":ee?"Show less":"Show more"},{children:ee?"less":"more"})),O&&(null==ve?void 0:ve.length)>0&&r("span",n({className:"mt-1 inline flex-row flex-wrap gap-1 relative w-full",onClick:function(e){return e.stopPropagation()},"data-citation":"true"},{children:null==ve?void 0:ve.map(function(e){var t,o,i,a,s,l;return r(f,n({searchQueryList:[""],searchQueryReasoningIdList:[],userStory:[],aiReasoning:[],citations:null!=re?re:{},apiCachingConfig:{queryClient:function(){var e;return null!==(e=null==G?void 0:G.queryClient)&&void 0!==e?e:function(){}},useGetSignedUrlQuery:null!==(t=null==G?void 0:G.useGetSignedUrlQuery)&&void 0!==t?t:function(){},useGetSignedUrlMutation:null!==(o=null==G?void 0:G.useGetSignedUrlMutation)&&void 0!==o?o:function(){},useExtractAudioPeaksMutation:null!==(i=null==G?void 0:G.useExtractAudioPeaksMutation)&&void 0!==i?i:function(){},useExtractAudioPeaksQuery:null!==(a=null==G?void 0:G.useExtractAudioPeaksQuery)&&void 0!==a?a:function(){},useGetVideoSignedUrlMutation:null!==(s=null==G?void 0:G.useGetVideoSignedUrlMutation)&&void 0!==s?s:function(){},useGetVideoSignedUrlQuery:null!==(l=null==G?void 0:G.useGetVideoSignedUrlQuery)&&void 0!==l?l:function(){}},setUserStory:function(){},setAiReasoning:function(){},setCitations:function(){},aiReasoningAccordionOpenStates:{isBottomComponentCollapsed:!0,gapAlwaysOpen:!1,gapDefaultOpen:!1,isBottomComponentDefaultOpen:!0,reasoningAlwaysOpen:!0}},{children:r(m,{aiReason:e,isSourceHasHighlight:!1,customStyles:{aiReasoningPill:{background:"transparent",fontSize:"13px"}}})}))})}))]}):r("span",n({className:"usp-card__description--placeholder"},{children:"No Description available"}))})),r("div",n({className:"usp-card__meta",style:I},{children:i("span",n({className:["usp-card__date",R.cardDate].filter(Boolean).join(" ")},{children:["Last Updated: ",g(N.lastUpdated)]}))})),r(d,{story:N})]}))}export{_ as UserStoryCard};
2
2
  //# sourceMappingURL=UserStoryCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserStoryCard.d.ts","sourceRoot":"","sources":["../../../../../../src/features/UserStoryImport/components/UserStoryCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAIhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAClC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC,gBAAgB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACvC,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACjC;AA2ED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,SAAS,EACT,KAAK,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,SAAS,GACV,EAAE,qBAAqB,2CA8UvB"}
1
+ {"version":3,"file":"UserStoryCard.d.ts","sourceRoot":"","sources":["../../../../../../src/features/UserStoryImport/components/UserStoryCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAIhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAK7D,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAClC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACjC,gBAAgB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACvC,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACjC;AA2ED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,SAAS,EACT,KAAK,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,SAAS,GACV,EAAE,qBAAqB,2CAqVvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/requirement-ai",
3
- "version": "0.0.87",
3
+ "version": "0.0.88",
4
4
  "author": "Saptyadeep Bhattacharjee",
5
5
  "description": "",
6
6
  "license": "MIT",