@epam/statgpt-conversation-list 0.2.0-rc.1 → 0.2.0-rc.3
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/index.js +2 -2
- package/index.mjs +78 -78
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),X=require("classnames"),E=require("react"),le=require("lodash"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),X=require("classnames"),E=require("react"),le=require("lodash"),N=require("@epam/statgpt-ui-components"),K=require("@tabler/icons-react"),Pe=require("jszip"),Y=require("@epam/statgpt-dial-toolkit"),_=require("@epam/statgpt-shared-toolkit");var B=(t=>(t.DELETE="delete",t.EXPORT="export",t.SHARE="share",t.RENAME="rename",t))(B||{}),U=(t=>(t.SHARED="shared",t.TODAY="today",t.YESTERDAY="yesterday",t.WEEK="week",t.EARLIER="earlier",t))(U||{});const te=(t,r)=>{var o,c;return((c=(o=t==null?void 0:t.resources)==null?void 0:o.filter(a=>(a==null?void 0:a.parentPath)===r))==null?void 0:c.map(a=>{var f,e,n;const i=`${a==null?void 0:a.bucket}/${r}`,g=(n=(e=(f=a==null?void 0:a.url)==null?void 0:f.split("/"))==null?void 0:e.slice(1))==null?void 0:n.join("/");return{...a,folderId:i,id:g,isShared:!0}}))||[]},ce=t=>({[U.SHARED]:t}),ye={[U.TODAY]:[],[U.YESTERDAY]:[],[U.WEEK]:[],[U.EARLIER]:[]},ue=(t,r)=>t.toDateString()===r.toDateString(),Se=(t,r)=>{const o=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1);return ue(r,o)},Te=(t,r)=>{const o=t.getTime()-r.getTime();return Math.floor(o/(1e3*60*60*24))},De=t=>{const r=new Date,o=le.cloneDeep(ye);for(const c of t)if(c.updatedAt){const a=new Date(c.updatedAt);let i;ue(r,a)?i=o[U.TODAY]:Se(r,a)?i=o[U.YESTERDAY]:Te(r,a)<=7?i=o[U.WEEK]:i=o[U.EARLIER],i!=null&&i.some(g=>g.id===c.id)||i.push(c)}return o},de=t=>t==null?void 0:t.sort((r,o)=>((o==null?void 0:o.updatedAt)||0)-((r==null?void 0:r.updatedAt)||0)),je=(t,r)=>t===U.SHARED?(r==null?void 0:r.shared)||"Shared":t===U.TODAY?(r==null?void 0:r.today)||"Today":t===U.YESTERDAY?(r==null?void 0:r.yesterday)||"Yesterday":t===U.WEEK?(r==null?void 0:r.lastWeek)||"Last week":(r==null?void 0:r.earlier)||"Earlier",Oe=({onCloseModal:t,disableModalDividers:r,deleteConversation:o,isSmallButton:c,titles:a,locale:i})=>d.jsxs(N.Popup,{heading:(a==null?void 0:a.deleteTitle)??"Delete conversation",portalId:"delete-conversation",containerClassName:"delete-conversation-popup",size:N.PopUpSize.SM,dividers:!r,onClose:t,closeButtonTitle:(a==null?void 0:a.close)??"Cancel",children:[d.jsx("div",{className:"py-4 px-6 sm:px-0",lang:i,children:(a==null?void 0:a.deleteMessage)??"Are you sure you want to delete this conversation? This action cannot be undone."}),d.jsxs("div",{className:"flex justify-end gap-x-2 py-3 px-6 delete-conversation-popup-footer",children:[d.jsx(N.Button,{buttonClassName:"cancel-button",title:(a==null?void 0:a.cancel)??"Cancel",isSmallButton:c,onClick:g=>{g.stopPropagation(),t()}}),d.jsx(N.Button,{buttonClassName:"text-button-primary text-button-primary-error",title:(a==null?void 0:a.delete)??"Delete",isSmallButton:c,onClick:g=>{g.stopPropagation(),o()}})]})]}),Le=t=>{const r=t.messages.flatMap(c=>{var g,f,e;const a=((g=c.custom_content)==null?void 0:g.attachments)||[],i=((e=(f=c.custom_content)==null?void 0:f.stages)==null?void 0:e.flatMap(({attachments:n})=>n??[]))||[];return[...a,...i]})||[],o=ke(r).map(c=>({...c,relativePath:"",contentLength:0}));return le.uniqBy(o,c=>Z(c.relativePath,c.name))},Be=t=>t.endsWith("/"),Ue=t=>{const r=t.toLowerCase();return["data:","//","http://","https://","file://","ftp://","mailto:","telnet://","api/files"].some(o=>r.startsWith(o))},Fe=t=>{const r=Z(...t.split("/").map(c=>decodeURIComponent(c))),o=r.lastIndexOf("/");return{absolutePath:r.slice(0,o),name:r.slice(o+1)}},ke=t=>t?t.map(r=>{if(!r.url||Ue(r.url)||Be(r.url))return null;const{absolutePath:o,name:c}=Fe(r.url);return{id:r.url,name:c,contentType:r.type,folderId:o,absolutePath:o}}).filter(Boolean):[];async function ze(t,r){const o=Le(t),c=new Pe;o.forEach(f=>{const e=encodeURI(Z(f.absolutePath,f.name)),n=r(`${e}`.replace("files/","")),s=_e(f.folderId),l=Z("res",s,f.name);c.file(l,n)});const a={version:5,history:[t].map($e)||[],folders:[]},i=JSON.stringify(a,null,2);return c.file("conversations/conversations_history.json",i),await c.generateAsync({type:"base64"})}const _e=t=>{const r=t.split("/");return r.length>2?Z(...r.slice(2)):void 0},$e=t=>le.omit(t,["publicationInfo"]),Z=(...t)=>t.filter(Boolean).join("/");function He(t,r){const o=document.createElement("a");o.download=r,o.href=t,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}var Ye=Object.defineProperty,ne=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable,ie=(t,r,o)=>r in t?Ye(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,se=(t,r)=>{for(var o in r||(r={}))he.call(r,o)&&ie(t,o,r[o]);if(ne)for(var o of ne(r))fe.call(r,o)&&ie(t,o,r[o]);return t},oe=(t,r)=>{var o={};for(var c in t)he.call(t,c)&&r.indexOf(c)<0&&(o[c]=t[c]);if(t!=null&&ne)for(var c of ne(t))r.indexOf(c)<0&&fe.call(t,c)&&(o[c]=t[c]);return o};/**
|
|
2
2
|
* @license QR Code generator library (TypeScript)
|
|
3
3
|
* Copyright (c) Project Nayuki.
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* @license qrcode.react
|
|
7
7
|
* Copyright (c) Paul O'Shannessy
|
|
8
8
|
* SPDX-License-Identifier: ISC
|
|
9
|
-
*/var Qe={L:W.QrCode.Ecc.LOW,M:W.QrCode.Ecc.MEDIUM,Q:W.QrCode.Ecc.QUARTILE,H:W.QrCode.Ecc.HIGH},me=128,pe="L",ge="#FFFFFF",Ee="#000000",Ce=!1,Re=1,Ve=4,We=0,Xe=.1;function we(t,r=0){const o=[];return t.forEach(function(c,a){let i=null;c.forEach(function(g,f){if(!g&&i!==null){o.push(`M${i+r} ${a+r}h${f-i}v1H${i+r}z`),i=null;return}if(f===c.length-1){if(!g)return;i===null?o.push(`M${f+r},${a+r} h1v1H${f+r}z`):o.push(`M${i+r},${a+r} h${f+1-i}v1H${i+r}z`);return}g&&i===null&&(i=f)})}),o.join("")}function xe(t,r){return t.slice().map((o,c)=>c<r.y||c>=r.y+r.h?o:o.map((a,i)=>i<r.x||i>=r.x+r.w?a:!1))}function Ke(t,r,o,c){if(c==null)return null;const a=t.length+o*2,i=Math.floor(r*Xe),g=a/r,f=(c.width||i)*g,e=(c.height||i)*g,n=c.x==null?t.length/2-f/2:c.x*g,s=c.y==null?t.length/2-e/2:c.y*g,l=c.opacity==null?1:c.opacity;let u=null;if(c.excavate){let h=Math.floor(n),R=Math.floor(s),p=Math.ceil(f+n-h),b=Math.ceil(e+s-R);u={x:h,y:R,w:p,h:b}}const m=c.crossOrigin;return{x:n,y:s,h:e,w:f,excavation:u,opacity:l,crossOrigin:m}}function qe(t,r){return r!=null?Math.max(Math.floor(r),0):t?Ve:We}function Me({value:t,level:r,minVersion:o,includeMargin:c,marginSize:a,imageSettings:i,size:g,boostLevel:f}){let e=E.useMemo(()=>{const h=(Array.isArray(t)?t:[t]).reduce((R,p)=>(R.push(...W.QrSegment.makeSegments(p)),R),[]);return W.QrCode.encodeSegments(h,Qe[r],o,void 0,void 0,f)},[t,r,o,f]);const{cells:n,margin:s,numCells:l,calculatedImageSettings:u}=E.useMemo(()=>{let m=e.getModules();const h=qe(c,a),R=m.length+h*2,p=Ke(m,g,h,i);return{cells:m,margin:h,numCells:R,calculatedImageSettings:p}},[e,g,i,c,a]);return{qrcode:e,margin:s,cells:n,numCells:l,calculatedImageSettings:u}}var Ze=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Je=E.forwardRef(function(r,o){const c=r,{value:a,size:i=me,level:g=pe,bgColor:f=ge,fgColor:e=Ee,includeMargin:n=Ce,minVersion:s=Re,boostLevel:l,marginSize:u,imageSettings:m}=c,R=oe(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:p}=R,b=oe(R,["style"]),x=m==null?void 0:m.src,C=E.useRef(null),I=E.useRef(null),P=E.useCallback(L=>{C.current=L,typeof o=="function"?o(L):o&&(o.current=L)},[o]),[S,j]=E.useState(!1),{margin:D,cells:F,numCells:k,calculatedImageSettings:T}=Me({value:a,level:g,minVersion:s,boostLevel:l,includeMargin:n,marginSize:u,imageSettings:m,size:i});E.useEffect(()=>{if(C.current!=null){const L=C.current,N=L.getContext("2d");if(!N)return;let A=F;const O=I.current,G=T!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;G&&T.excavation!=null&&(A=xe(F,T.excavation));const J=window.devicePixelRatio||1;L.height=L.width=i*J;const v=i/k*J;N.scale(v,v),N.fillStyle=f,N.fillRect(0,0,k,k),N.fillStyle=e,Ze?N.fill(new Path2D(we(A,D))):F.forEach(function(Q,$){Q.forEach(function(q,re){q&&N.fillRect(re+D,$+D,1,1)})}),T&&(N.globalAlpha=T.opacity),G&&N.drawImage(O,T.x+D,T.y+D,T.w,T.h)}}),E.useEffect(()=>{j(!1)},[x]);const z=se({height:i,width:i},p);let _=null;return x!=null&&(_=E.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{j(!0)},ref:I,crossOrigin:T==null?void 0:T.crossOrigin})),E.createElement(E.Fragment,null,E.createElement("canvas",se({style:z,height:i,width:i,ref:P,role:"img"},b)),_)});Je.displayName="QRCodeCanvas";var Ne=E.forwardRef(function(r,o){const c=r,{value:a,size:i=me,level:g=pe,bgColor:f=ge,fgColor:e=Ee,includeMargin:n=Ce,minVersion:s=Re,boostLevel:l,title:u,marginSize:m,imageSettings:h}=c,R=oe(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:p,cells:b,numCells:x,calculatedImageSettings:C}=Me({value:a,level:g,minVersion:s,boostLevel:l,includeMargin:n,marginSize:m,imageSettings:h,size:i});let I=b,P=null;h!=null&&C!=null&&(C.excavation!=null&&(I=xe(b,C.excavation)),P=E.createElement("image",{href:h.src,height:C.h,width:C.w,x:C.x+p,y:C.y+p,preserveAspectRatio:"none",opacity:C.opacity,crossOrigin:C.crossOrigin}));const S=we(I,p);return E.createElement("svg",se({height:i,width:i,viewBox:`0 0 ${x} ${x}`,ref:o,role:"img"},R),!!u&&E.createElement("title",null,u),E.createElement("path",{fill:f,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),E.createElement("path",{fill:e,d:S,shapeRendering:"crispEdges"}),P)});Ne.displayName="QRCodeSVG";const Ie="share",ve="onboarding",et=(t,r)=>({invitationType:H.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(t)}`},...r]}),tt=t=>{var o;const r=((o=t==null?void 0:t.invitationLink)==null?void 0:o.split("/").at(-1))||"";return`/${Ie}/${r}`},nt=(t,r)=>r==null?void 0:r.find(o=>{var i,g,f,e;const c=(g=(i=t==null?void 0:t.id)==null?void 0:i.split("/"))==null?void 0:g.pop(),a=((e=(f=o==null?void 0:o.url)==null?void 0:f.split("/"))==null?void 0:e.pop())||"";return a===c||decodeURI(a)===c}),rt=t=>{var o,c;const r=(o=t==null?void 0:t.messages)==null?void 0:o.filter(a=>{var i;return!!((i=a==null?void 0:a.custom_content)!=null&&i.attachments)});return((c=r==null?void 0:r.flatMap(a=>{var i,g;return((g=(i=a==null?void 0:a.custom_content)==null?void 0:i.attachments)==null?void 0:g.map(f=>({url:(f==null?void 0:f.url)||""})))||[]}))==null?void 0:c.filter(a=>!!(a!=null&&a.url)))||[]},st=({conversation:t,locale:r,onCloseModal:o,modalDividers:c,getConversation:a,generateConversationLink:i,chatExpiration:g,chatExpirationDays:f,close:e,chatWarning:n,shareLink:s,shareCopyLink:l,shareCopiedLink:u,shareDescription:m,shareRemoveAccessToUsers:h,chatName:R,getSharedConversations:p,revokeSharedConversations:b,baseUrl:x,id:C,clientSharedPage:I,clientSharedProp:P})=>{const[S,j]=E.useState(null),[D,F]=E.useState(),[k,T]=E.useState(!1),[z,_]=E.useState(!1),[L,N]=E.useState(),A=E.useMemo(()=>{var $;const Q=x||window.location.origin;if(x&&x!==window.location.origin&&I&&P){const q=($=S==null?void 0:S.split(`/${Ie}/`))==null?void 0:$[1];return`${Q}/${I}?${P}=${q}`}return`${Q}/${r}${S}`},[x,S,r,I,P]);E.useEffect(()=>{(async()=>{try{const $=decodeURI(t?t==null?void 0:t.id:`${C==null?void 0:C[0]}/${r}/${C==null?void 0:C[1]}`),q=`${decodeURI($)}`,re=await(a==null?void 0:a(q)),Pe=et($,rt(re)),ae=await(i==null?void 0:i(Pe)),ee=await(p==null?void 0:p(H.getSharedConversationsRequest(H.ShareTarget.OTHERS)));ae&&ee&&(T(!0),j(tt(ae)),F(nt(t,ee==null?void 0:ee.resources)))}catch($){T(!1),console.error("Error sharing conversation",$)}})()},[t,i,a,p,C,r]);const O=E.useCallback(()=>{o(),j(null),T(!1),_(!1)},[o]),G=E.useCallback(()=>{_(!0),navigator.clipboard.writeText(A||"")},[A]),J=async()=>{try{N(!0),D&&await(b==null?void 0:b({resources:[D]}))}catch(Q){N(!1),console.error("Error revoking shared conversation",Q)}},v=E.useCallback(()=>d.jsx(M.Button,{buttonClassName:z?"text-button-secondary":"text-button-primary",iconBefore:z?d.jsx(K.IconCheck,{width:20,height:20}):d.jsx(K.IconCopy,{width:20,height:20}),title:z?u??"Copied":l??"Copy link",disabled:z,onClick:G}),[z,G,u,l]);return d.jsxs(M.Popup,{heading:s??"Share link",portalId:"share",size:M.PopUpSize.SM,dividers:c,onClose:O,closeButtonTitle:e??"Close",children:[k?d.jsxs("div",{className:"share flex flex-col gap-y-4 px-6 pb-6 overflow-auto sm:p-0",children:[t!=null&&t.name?d.jsxs("div",{className:"flex share-info w-full",children:[d.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:R??"Chat name:"}),d.jsx("h3",{className:"flex-1 min-w-0 truncate",title:t==null?void 0:t.name,children:t==null?void 0:t.name})]}):null,d.jsxs("div",{className:"flex share-info",children:[d.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:g??"Link expiration date:"}),d.jsxs("h3",{children:["3 ",f??"days"]})]}),d.jsx(Ne,{className:"self-center border border-neutrals-600 p-2 rounded min-h-[200px]",value:A,size:200}),d.jsx("p",{className:"body-2 text-neutrals-1000",children:m??"Your name, special instructions, and any messages you add after sharing remain confidential."}),d.jsx(M.InputWithIcon,{containerClasses:"share-input-container",cssClass:"share-input",readonly:!0,placeholder:A,value:A,inputId:"conversationLink",iconAfterInput:v()})]}):d.jsx("div",{className:"flex justify-center items-center py-6 px-6",children:d.jsx(M.Loader,{})}),k?t&&D?d.jsx("div",{className:"remove-access",children:d.jsx(M.Button,{title:h??"Remove access to all users",buttonClassName:"remove-access-button py-3 px-4",isSmallButton:!0,disabled:L,onClick:J})}):d.jsx("p",{className:"body-2 text-neutrals-800 share-footer",children:n??"This chat has not been shared with anyone yet."}):d.jsx("div",{})]})},ot=({conversation:t,onCloseModal:r,renameConversation:o,locale:c,disableModalDividers:a,titles:i,isSmallButton:g})=>{const[f,e]=E.useState((t==null?void 0:t.name)||""),n=l=>{e(l)},s=()=>{const l=`${t==null?void 0:t.folderId}/${encodeURIComponent(Y.getClearedConversationName(f))}-${new Date().getTime()}`;o(`conversations/${t.id}`,`conversations/${l}`)};return d.jsxs(M.Popup,{heading:(i==null?void 0:i.renameTitle)??"Rename conversation",portalId:"rename-conversation",containerClassName:"rename-conversation-popup",size:M.PopUpSize.SM,dividers:!a,onClose:r,closeButtonTitle:(i==null?void 0:i.close)??"Cancel",children:[d.jsx("div",{className:"py-4 px-6 sm:px-0",lang:c,children:d.jsx(M.Input,{inputId:"rename",value:f,onChange:n,cssClass:"w-full"})}),d.jsxs("div",{className:"flex justify-end gap-x-2 py-3 px-6 delete-conversation-popup-footer",children:[d.jsx(M.Button,{buttonClassName:"cancel-button",title:(i==null?void 0:i.cancel)??"Cancel",isSmallButton:g,onClick:l=>{l.stopPropagation(),r()}}),d.jsx(M.Button,{buttonClassName:"text-button-primary text-button-primary",title:(i==null?void 0:i.save)??"Rename",isSmallButton:g,disabled:!f,onClick:l=>{l.stopPropagation(),s()}})]})]})},be=({conversation:t,conversationStyles:r,shareConversationProps:o,onConversationDelete:c,getConversation:a,getFileBlob:i,renameConversation:g,triggerButton:f,locale:e})=>{var S;const n=E.useMemo(()=>{var D,F,k,T,z,_,L,N,A,O;const j=[{key:B.DELETE,title:((D=r==null?void 0:r.titles)==null?void 0:D.delete)??"Delete",icon:(F=r.actionsIcons)==null?void 0:F[B.DELETE]}];return(T=(k=t==null?void 0:t.model)==null?void 0:k.id)!=null&&T.endsWith(ve)?j:[...t.isShared?[]:[{key:B.SHARE,title:((z=r==null?void 0:r.titles)==null?void 0:z.share)??"Share",icon:(_=r.actionsIcons)==null?void 0:_[B.SHARE]},{key:B.RENAME,title:((L=r==null?void 0:r.titles)==null?void 0:L.rename)??"Rename",icon:(N=r.actionsIcons)==null?void 0:N[B.RENAME]}],{key:B.EXPORT,title:((A=r==null?void 0:r.titles)==null?void 0:A.export)??"Export",icon:(O=r.actionsIcons)==null?void 0:O[B.EXPORT]},...j]},[t.isShared,(S=t==null?void 0:t.model)==null?void 0:S.id,r.titles,r.actionsIcons]),[s,l]=E.useState(M.PopUpState.Closed),[u,m]=E.useState(M.PopUpState.Closed),[h,R]=E.useState(M.PopUpState.Closed),p=E.useCallback(()=>{l(M.PopUpState.Closed)},[l]),b=E.useCallback(()=>{m(M.PopUpState.Closed)},[m]),x=E.useCallback(()=>{R(M.PopUpState.Closed)},[R]),C=E.useCallback(()=>{c(t),p()},[t,c,p]),I=E.useCallback((j,D)=>{g(j,D),x()},[g,x]),P=j=>{j===B.DELETE&&l(M.PopUpState.Opened),j===B.SHARE&&m(M.PopUpState.Opened),j===B.RENAME&&R(M.PopUpState.Opened),j===B.EXPORT&&a(decodeURI(t.id)).then(D=>{_e(D,i).then(F=>{Ye(`data:application/zip;base64,${F}`,`chat_with_attachments_${new Date().toLocaleDateString()}.dial`)})})};return d.jsxs(d.Fragment,{children:[d.jsx(M.Dropdown,{containerClassName:"invisible ml-3 group-hover:visible",triggerButton:f??d.jsx(lt,{}),options:n,openedClassName:"action-menu-opened",onOptionSelect:P}),s===M.PopUpState.Opened&&d.jsx(Le,{titles:r.titles,locale:e,disableModalDividers:r.disableModalDividers,isSmallButton:r.isSmallModalButton,deleteConversation:C,onCloseModal:p}),u===M.PopUpState.Opened&&d.jsx(st,{conversation:t,locale:e,onCloseModal:b,...o}),h===M.PopUpState.Opened&&d.jsx(ot,{conversation:t,locale:e,titles:r.titles,renameConversation:I,onCloseModal:x,disableModalDividers:r.disableModalDividers,isSmallButton:r.isSmallModalButton})]})},lt=()=>d.jsx("div",{className:"cursor-pointer flex items-center justify-center w-[24px]",children:d.jsx(K.IconDotsVertical,{width:20,height:20,stroke:2,className:"text-primary"})}),Ae=({conversation:t,selectedConversationId:r,searchQuery:o,onConversationClick:c,actions:a,locale:i,conversationStyles:g,shareConversationProps:f})=>{const e=E.useRef(null),n=Y.getClearedConversationName(t==null?void 0:t.name);return E.useEffect(()=>{var s,l;if((t==null?void 0:t.id)===r&&e!=null&&e.current){const u=(l=(s=e.current.parentElement)==null?void 0:s.parentElement)==null?void 0:l.parentElement;if(u){const m=e.current.getBoundingClientRect(),h=u.getBoundingClientRect(),R=m.height,p=h.height,x=m.top-h.top+u.scrollTop-(p/2-R/2);u.scrollTo({top:x,behavior:"smooth"})}}},[t,r]),d.jsxs("div",{ref:e,className:X("flex justify-between items-center py-2 px-3 border-transparent relative group cursor-pointer border hover:border-hues-600","conversation-item",r===(t==null?void 0:t.id)&&"bg-hues-100 conversation-item-active"),onClick:()=>c(t.folderId,t==null?void 0:t.id),title:n,children:[d.jsxs("div",{className:"flex flex-1 min-w-0 items-center",children:[g.conversationItemIcon?g.conversationItemIcon:null,d.jsx("h3",{className:X("truncate font-semibold text-neutrals-1000 sm:body-2","conversation-item-text",r===(t==null?void 0:t.id)?"conversation-item-text-active":""),title:n,children:o!=null&&o.length?d.jsx(M.HighlightText,{text:n,highlightText:o}):n})]}),d.jsx(be,{locale:i,conversationStyles:g,conversation:t,onConversationDelete:a.deleteConversation,getConversation:a.getConversation,getFileBlob:a.getFileBlob,renameConversation:a.renameConversation,shareConversationProps:f})]})},at=({handleConversationClick:t,actions:r,selectedConversationId:o,groupLabel:c,conversationStyles:a,groupedConversations:i,shareConversationProps:g,locale:f})=>{const[e,n]=E.useState(!1),s=E.useCallback(()=>{n(l=>!l)},[n]);return d.jsxs("div",{children:[d.jsxs("div",{className:"inline-flex gap-1 items-center text-neutrals-700 mb-3 cursor-pointer conversation-group-items-title",onClick:s,children:[d.jsx(K.IconCaretRightFilled,{className:X("w-3 h-3 conversation-group-items-arrow",e?"rotate-[90deg]":"rotate-0")}),d.jsx("span",{className:"body-3 conversation-group-items-title-text",children:Oe(c,a==null?void 0:a.titles)})]}),!e&&d.jsx("div",{className:X("flex flex-col gap-y-3","conversation-group-items"),children:de(i).map(l=>d.jsx(Ae,{locale:f,conversationStyles:a,conversation:l,selectedConversationId:o,onConversationClick:t,actions:r,shareConversationProps:g},l.id||l.name))})]},c)},it=({searchQuery:t,isExpandedSearch:r,titles:o,searchIcon:c,onSearchConversations:a,toggleSearchField:i})=>d.jsx(d.Fragment,{children:r?d.jsx(M.InputWithIcon,{inputId:"conversations-search",placeholder:(o==null?void 0:o.searchPlaceholder)??"Search",containerClasses:"conversation-list-search-input h-[40px] bg-transparent px-4 py-2 rounded-full border-neutrals-400 shadow-none",cssClass:"h-auto",value:t,iconAfterInput:d.jsx(M.IconButton,{buttonClassName:"text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5",onClick:i,icon:d.jsx(K.IconX,{})}),onChange:a}):d.jsx(M.Button,{buttonClassName:"text-button-tertiary p-0 search-button",iconBefore:c||d.jsx(K.IconSearch,{className:"w-5 h-5"}),onClick:i})}),ct=({conversations:t,selectedConversationId:r,searchQuery:o,conversationStyles:c,handleConversationClick:a,actions:i,locale:g,shareConversationProps:f})=>{var s;const[e,n]=E.useState([]);return E.useEffect(()=>{n(de(t==null?void 0:t.filter(l=>{var u;return(u=Y.getClearedConversationName(l==null?void 0:l.name))==null?void 0:u.includes(o||"")})))},[t,o]),d.jsx(d.Fragment,{children:e!=null&&e.length?e.map(l=>d.jsx(Ae,{locale:g,conversationStyles:c,conversation:l,searchQuery:o,selectedConversationId:r,onConversationClick:a,actions:i,shareConversationProps:f},l.id)):d.jsx("h3",{className:"text-neutrals-800",children:((s=c==null?void 0:c.titles)==null?void 0:s.noConversation)??"No conversations yet"})})},ut=({titles:t})=>d.jsxs("div",{className:"p-8 text-center flex flex-col",children:[d.jsx("p",{className:"text-neutrals-800",children:(t==null?void 0:t.noConversation)??"No conversations yet"}),d.jsx("p",{className:"text-sm text-neutrals-800 mt-2",children:(t==null?void 0:t.clickNewChat)??'Click "New Chat" to start a conversation'})]}),dt=({handleConversationClick:t,selectedConversationId:r,actions:o,children:c,isCollapsed:a,conversationStyles:i,conversations:g,locale:f,sharedConversations:e,setConversations:n,setSharedConversations:s,shareConversationProps:l,handleSelectedConversationRemove:u})=>{var L;const[m,h]=E.useState({}),[R,p]=E.useState(!0),[b,x]=E.useState(""),[C,I]=E.useState(!1),{getConversations:P,getSharedConversations:S,deleteConversation:j,renameConversation:D}=o,F=E.useMemo(()=>!!(b!=null&&b.length),[b]);E.useEffect(()=>{h({...ce(e),...je(g)})},[g,e]),E.useEffect(()=>{async function N(){try{p(!0);const A=await P(f),O=await S(H.getSharedConversationsRequest(H.ShareTarget.ME));n(Y.cleanConversationNames(A)),s(Y.cleanConversationNames(te(O,f)))}catch(A){console.error("Error loading conversation",A)}finally{p(!1)}}N()},[P,n,f,S,s]);const k=E.useCallback(async N=>{try{await j(N);const A=await P(f),O=await S(H.getSharedConversationsRequest(H.ShareTarget.ME));n(Y.cleanConversationNames(A)),s(Y.cleanConversationNames(te(O,f))),r===(N==null?void 0:N.id)&&u()}catch(A){console.error("Error deleting conversation",A)}},[j,P,f,S,n,s,r,u]),T=E.useCallback(async(N,A)=>{try{p(!0),await D(N,A);const O=await P(f),G=await S(H.getSharedConversationsRequest(H.ShareTarget.ME));n(Y.cleanConversationNames(O)),s(Y.cleanConversationNames(te(G,f)))}catch(O){console.error("Error renaming conversation",O)}finally{p(!1)}},[P,f,S,n,s,D]),z=E.useCallback(N=>{x(N)},[x]),_=E.useCallback(()=>{I(N=>!N),x("")},[I]);return R?d.jsx(M.Loader,{}):d.jsxs(d.Fragment,{children:[!a&&d.jsxs("div",{className:X("flex justify-between items-center",C?" pt-4 pb-0 sm:pt-10":" pt-6 pb-2 sm:pt-10"),children:[!C&&d.jsx("h3",{className:"text-neutrals-700 sm:body-2",children:((L=i==null?void 0:i.titles)==null?void 0:L.allChats)??"All Chats"}),d.jsx(it,{searchQuery:b,searchIcon:i.searchIcon,titles:i.titles,isExpandedSearch:C,onSearchConversations:z,toggleSearchField:_})]}),d.jsx("div",{className:X("overflow-y-auto flex flex-col mt-4 flex-1 min-h-0 pr-2",F?"gap-y-1":"gap-y-6"),children:a?null:d.jsx(d.Fragment,{children:(g==null?void 0:g.length)===0&&(e==null?void 0:e.length)===0?d.jsx(ut,{titles:i.titles}):F?d.jsx(ct,{locale:f,conversationStyles:i,conversations:[...e,...g],searchQuery:b,selectedConversationId:r,handleConversationClick:t,shareConversationProps:l,actions:{...o,deleteConversation:k}}):Object.entries(m).map(([N,A])=>(A==null?void 0:A.length)>0&&d.jsx(at,{locale:f,groupLabel:N,conversationStyles:i,groupedConversations:A,handleConversationClick:t,actions:{...o,deleteConversation:k,renameConversation:T},shareConversationProps:l,selectedConversationId:r},N))})}),c]})};exports.ActionMenu=be;exports.ActionMenuItem=B;exports.ConversationList=dt;exports.getSharedConversationsGroup=ce;exports.transformSharedConversations=te;
|
|
9
|
+
*/var Ge={L:W.QrCode.Ecc.LOW,M:W.QrCode.Ecc.MEDIUM,Q:W.QrCode.Ecc.QUARTILE,H:W.QrCode.Ecc.HIGH},me=128,pe="L",ge="#FFFFFF",Ee="#000000",Ce=!1,Re=1,Qe=4,Ve=0,We=.1;function we(t,r=0){const o=[];return t.forEach(function(c,a){let i=null;c.forEach(function(g,f){if(!g&&i!==null){o.push(`M${i+r} ${a+r}h${f-i}v1H${i+r}z`),i=null;return}if(f===c.length-1){if(!g)return;i===null?o.push(`M${f+r},${a+r} h1v1H${f+r}z`):o.push(`M${i+r},${a+r} h${f+1-i}v1H${i+r}z`);return}g&&i===null&&(i=f)})}),o.join("")}function xe(t,r){return t.slice().map((o,c)=>c<r.y||c>=r.y+r.h?o:o.map((a,i)=>i<r.x||i>=r.x+r.w?a:!1))}function Xe(t,r,o,c){if(c==null)return null;const a=t.length+o*2,i=Math.floor(r*We),g=a/r,f=(c.width||i)*g,e=(c.height||i)*g,n=c.x==null?t.length/2-f/2:c.x*g,s=c.y==null?t.length/2-e/2:c.y*g,l=c.opacity==null?1:c.opacity;let u=null;if(c.excavate){let h=Math.floor(n),R=Math.floor(s),p=Math.ceil(f+n-h),b=Math.ceil(e+s-R);u={x:h,y:R,w:p,h:b}}const m=c.crossOrigin;return{x:n,y:s,h:e,w:f,excavation:u,opacity:l,crossOrigin:m}}function Ke(t,r){return r!=null?Math.max(Math.floor(r),0):t?Qe:Ve}function Ne({value:t,level:r,minVersion:o,includeMargin:c,marginSize:a,imageSettings:i,size:g,boostLevel:f}){let e=E.useMemo(()=>{const h=(Array.isArray(t)?t:[t]).reduce((R,p)=>(R.push(...W.QrSegment.makeSegments(p)),R),[]);return W.QrCode.encodeSegments(h,Ge[r],o,void 0,void 0,f)},[t,r,o,f]);const{cells:n,margin:s,numCells:l,calculatedImageSettings:u}=E.useMemo(()=>{let m=e.getModules();const h=Ke(c,a),R=m.length+h*2,p=Xe(m,g,h,i);return{cells:m,margin:h,numCells:R,calculatedImageSettings:p}},[e,g,i,c,a]);return{qrcode:e,margin:s,cells:n,numCells:l,calculatedImageSettings:u}}var qe=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Ze=E.forwardRef(function(r,o){const c=r,{value:a,size:i=me,level:g=pe,bgColor:f=ge,fgColor:e=Ee,includeMargin:n=Ce,minVersion:s=Re,boostLevel:l,marginSize:u,imageSettings:m}=c,R=oe(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:p}=R,b=oe(R,["style"]),x=m==null?void 0:m.src,C=E.useRef(null),I=E.useRef(null),P=E.useCallback(L=>{C.current=L,typeof o=="function"?o(L):o&&(o.current=L)},[o]),[S,j]=E.useState(!1),{margin:D,cells:F,numCells:k,calculatedImageSettings:T}=Ne({value:a,level:g,minVersion:s,boostLevel:l,includeMargin:n,marginSize:u,imageSettings:m,size:i});E.useEffect(()=>{if(C.current!=null){const L=C.current,M=L.getContext("2d");if(!M)return;let A=F;const O=I.current,G=T!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWidth!==0;G&&T.excavation!=null&&(A=xe(F,T.excavation));const J=window.devicePixelRatio||1;L.height=L.width=i*J;const v=i/k*J;M.scale(v,v),M.fillStyle=f,M.fillRect(0,0,k,k),M.fillStyle=e,qe?M.fill(new Path2D(we(A,D))):F.forEach(function(Q,H){Q.forEach(function(q,re){q&&M.fillRect(re+D,H+D,1,1)})}),T&&(M.globalAlpha=T.opacity),G&&M.drawImage(O,T.x+D,T.y+D,T.w,T.h)}}),E.useEffect(()=>{j(!1)},[x]);const z=se({height:i,width:i},p);let $=null;return x!=null&&($=E.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{j(!0)},ref:I,crossOrigin:T==null?void 0:T.crossOrigin})),E.createElement(E.Fragment,null,E.createElement("canvas",se({style:z,height:i,width:i,ref:P,role:"img"},b)),$)});Ze.displayName="QRCodeCanvas";var Me=E.forwardRef(function(r,o){const c=r,{value:a,size:i=me,level:g=pe,bgColor:f=ge,fgColor:e=Ee,includeMargin:n=Ce,minVersion:s=Re,boostLevel:l,title:u,marginSize:m,imageSettings:h}=c,R=oe(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:p,cells:b,numCells:x,calculatedImageSettings:C}=Ne({value:a,level:g,minVersion:s,boostLevel:l,includeMargin:n,marginSize:m,imageSettings:h,size:i});let I=b,P=null;h!=null&&C!=null&&(C.excavation!=null&&(I=xe(b,C.excavation)),P=E.createElement("image",{href:h.src,height:C.h,width:C.w,x:C.x+p,y:C.y+p,preserveAspectRatio:"none",opacity:C.opacity,crossOrigin:C.crossOrigin}));const S=we(I,p);return E.createElement("svg",se({height:i,width:i,viewBox:`0 0 ${x} ${x}`,ref:o,role:"img"},R),!!u&&E.createElement("title",null,u),E.createElement("path",{fill:f,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),E.createElement("path",{fill:e,d:S,shapeRendering:"crispEdges"}),P)});Me.displayName="QRCodeSVG";const Je=(t,r)=>({invitationType:Y.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(t)}`},...r]}),ve=t=>{var o;const r=((o=t==null?void 0:t.invitationLink)==null?void 0:o.split("/").at(-1))||"";return`/${_.SHARE_CONVERSATION_ROUTE}/${r}`},et=(t,r)=>r==null?void 0:r.find(o=>{var i,g,f,e;const c=(g=(i=t==null?void 0:t.id)==null?void 0:i.split("/"))==null?void 0:g.pop(),a=((e=(f=o==null?void 0:o.url)==null?void 0:f.split("/"))==null?void 0:e.pop())||"";return a===c||decodeURI(a)===c}),tt=t=>{var o,c;const r=(o=t==null?void 0:t.messages)==null?void 0:o.filter(a=>{var i;return!!((i=a==null?void 0:a.custom_content)!=null&&i.attachments)});return((c=r==null?void 0:r.flatMap(a=>{var i,g;return((g=(i=a==null?void 0:a.custom_content)==null?void 0:i.attachments)==null?void 0:g.map(f=>({url:(f==null?void 0:f.url)||""})))||[]}))==null?void 0:c.filter(a=>!!(a!=null&&a.url)))||[]},nt=({conversation:t,locale:r,onCloseModal:o,modalDividers:c,getConversation:a,generateConversationLink:i,chatExpiration:g,chatExpirationDays:f,close:e,chatWarning:n,shareLink:s,shareCopyLink:l,shareCopiedLink:u,shareDescription:m,shareRemoveAccessToUsers:h,chatName:R,getSharedConversations:p,revokeSharedConversations:b,baseUrl:x,id:C,clientSharedPage:I,clientSharedProp:P})=>{const[S,j]=E.useState(null),[D,F]=E.useState(),[k,T]=E.useState(!1),[z,$]=E.useState(!1),[L,M]=E.useState(),A=E.useMemo(()=>{var H;const Q=x||window.location.origin;if(x&&x!==window.location.origin&&I&&P){const q=(H=S==null?void 0:S.split(`/${_.SHARE_CONVERSATION_ROUTE}/`))==null?void 0:H[1];return`${Q}/${I}?${P}=${q}`}return`${Q}/${r}${S}`},[x,S,r,I,P]);E.useEffect(()=>{(async()=>{try{const H=decodeURI(t?t==null?void 0:t.id:`${C==null?void 0:C[0]}/${r}/${C==null?void 0:C[1]}`),q=`${decodeURI(H)}`,re=await(a==null?void 0:a(q)),Ae=Je(H,tt(re)),ae=await(i==null?void 0:i(Ae)),ee=await(p==null?void 0:p(Y.getSharedConversationsRequest(Y.ShareTarget.OTHERS)));ae&&ee&&(T(!0),j(ve(ae)),F(et(t,ee==null?void 0:ee.resources)))}catch(H){T(!1),console.error("Error sharing conversation",H)}})()},[t,i,a,p,C,r]);const O=E.useCallback(()=>{o(),j(null),T(!1),$(!1)},[o]),G=E.useCallback(()=>{$(!0),navigator.clipboard.writeText(A||"")},[A]),J=async()=>{try{M(!0),D&&await(b==null?void 0:b({resources:[D]}))}catch(Q){M(!1),console.error("Error revoking shared conversation",Q)}},v=E.useCallback(()=>d.jsx(N.Button,{buttonClassName:z?"text-button-secondary":"text-button-primary",iconBefore:z?d.jsx(K.IconCheck,{width:20,height:20}):d.jsx(K.IconCopy,{width:20,height:20}),title:z?u??"Copied":l??"Copy link",disabled:z,onClick:G}),[z,G,u,l]);return d.jsxs(N.Popup,{heading:s??"Share link",portalId:"share",size:N.PopUpSize.SM,dividers:c,onClose:O,closeButtonTitle:e??"Close",children:[k?d.jsxs("div",{className:"share flex flex-col gap-y-4 px-6 pb-6 overflow-auto sm:p-0",children:[t!=null&&t.name?d.jsxs("div",{className:"flex share-info w-full",children:[d.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:R??"Chat name:"}),d.jsx("h3",{className:"flex-1 min-w-0 truncate",title:t==null?void 0:t.name,children:t==null?void 0:t.name})]}):null,d.jsxs("div",{className:"flex share-info",children:[d.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:g??"Link expiration date:"}),d.jsxs("h3",{children:["3 ",f??"days"]})]}),d.jsx(Me,{className:"self-center border border-neutrals-600 p-2 rounded min-h-[200px]",value:A,size:200}),d.jsx("p",{className:"body-2 text-neutrals-1000",children:m??"Your name, special instructions, and any messages you add after sharing remain confidential."}),d.jsx(N.InputWithIcon,{containerClasses:"share-input-container",cssClass:"share-input",readonly:!0,placeholder:A,value:A,inputId:"conversationLink",iconAfterInput:v()})]}):d.jsx("div",{className:"flex justify-center items-center py-6 px-6",children:d.jsx(N.Loader,{})}),k?t&&D?d.jsx("div",{className:"remove-access",children:d.jsx(N.Button,{title:h??"Remove access to all users",buttonClassName:"remove-access-button py-3 px-4",isSmallButton:!0,disabled:L,onClick:J})}):d.jsx("p",{className:"body-2 text-neutrals-800 share-footer",children:n??"This chat has not been shared with anyone yet."}):d.jsx("div",{})]})},rt=({conversation:t,onCloseModal:r,renameConversation:o,locale:c,disableModalDividers:a,titles:i,isSmallButton:g})=>{const[f,e]=E.useState((t==null?void 0:t.name)||""),n=l=>{e(l)},s=()=>{const l=`${t==null?void 0:t.folderId}/${encodeURIComponent(_.getClearedConversationName(f))}-${new Date().getTime()}`;o(`conversations/${t.id}`,`conversations/${l}`)};return d.jsxs(N.Popup,{heading:(i==null?void 0:i.renameTitle)??"Rename conversation",portalId:"rename-conversation",containerClassName:"rename-conversation-popup",size:N.PopUpSize.SM,dividers:!a,onClose:r,closeButtonTitle:(i==null?void 0:i.close)??"Cancel",children:[d.jsx("div",{className:"py-4 px-6 sm:px-0",lang:c,children:d.jsx(N.Input,{inputId:"rename",value:f,onChange:n,cssClass:"w-full"})}),d.jsxs("div",{className:"flex justify-end gap-x-2 py-3 px-6 delete-conversation-popup-footer",children:[d.jsx(N.Button,{buttonClassName:"cancel-button",title:(i==null?void 0:i.cancel)??"Cancel",isSmallButton:g,onClick:l=>{l.stopPropagation(),r()}}),d.jsx(N.Button,{buttonClassName:"text-button-primary text-button-primary",title:(i==null?void 0:i.save)??"Rename",isSmallButton:g,disabled:!f,onClick:l=>{l.stopPropagation(),s()}})]})]})},Ie=({conversation:t,conversationStyles:r,shareConversationProps:o,onConversationDelete:c,getConversation:a,getFileBlob:i,renameConversation:g,triggerButton:f,locale:e})=>{var S;const n=E.useMemo(()=>{var D,F,k,T,z,$,L,M,A,O;const j=[{key:B.DELETE,title:((D=r==null?void 0:r.titles)==null?void 0:D.delete)??"Delete",icon:(F=r.actionsIcons)==null?void 0:F[B.DELETE]}];return(T=(k=t==null?void 0:t.model)==null?void 0:k.id)!=null&&T.endsWith(_.ONBOARDING_MODEL_POSTFIX)?j:[...t.isShared?[]:[{key:B.SHARE,title:((z=r==null?void 0:r.titles)==null?void 0:z.share)??"Share",icon:($=r.actionsIcons)==null?void 0:$[B.SHARE]},{key:B.RENAME,title:((L=r==null?void 0:r.titles)==null?void 0:L.rename)??"Rename",icon:(M=r.actionsIcons)==null?void 0:M[B.RENAME]}],{key:B.EXPORT,title:((A=r==null?void 0:r.titles)==null?void 0:A.export)??"Export",icon:(O=r.actionsIcons)==null?void 0:O[B.EXPORT]},...j]},[t.isShared,(S=t==null?void 0:t.model)==null?void 0:S.id,r.titles,r.actionsIcons]),[s,l]=E.useState(N.PopUpState.Closed),[u,m]=E.useState(N.PopUpState.Closed),[h,R]=E.useState(N.PopUpState.Closed),p=E.useCallback(()=>{l(N.PopUpState.Closed)},[l]),b=E.useCallback(()=>{m(N.PopUpState.Closed)},[m]),x=E.useCallback(()=>{R(N.PopUpState.Closed)},[R]),C=E.useCallback(()=>{c(t),p()},[t,c,p]),I=E.useCallback((j,D)=>{g(j,D),x()},[g,x]),P=j=>{j===B.DELETE&&l(N.PopUpState.Opened),j===B.SHARE&&m(N.PopUpState.Opened),j===B.RENAME&&R(N.PopUpState.Opened),j===B.EXPORT&&a(decodeURI(t.id)).then(D=>{ze(D,i).then(F=>{He(`data:application/zip;base64,${F}`,`chat_with_attachments_${new Date().toLocaleDateString()}.dial`)})})};return d.jsxs(d.Fragment,{children:[d.jsx(N.Dropdown,{containerClassName:"invisible ml-3 group-hover:visible",triggerButton:f??d.jsx(st,{}),options:n,openedClassName:"action-menu-opened",onOptionSelect:P}),s===N.PopUpState.Opened&&d.jsx(Oe,{titles:r.titles,locale:e,disableModalDividers:r.disableModalDividers,isSmallButton:r.isSmallModalButton,deleteConversation:C,onCloseModal:p}),u===N.PopUpState.Opened&&d.jsx(nt,{conversation:t,locale:e,onCloseModal:b,...o}),h===N.PopUpState.Opened&&d.jsx(rt,{conversation:t,locale:e,titles:r.titles,renameConversation:I,onCloseModal:x,disableModalDividers:r.disableModalDividers,isSmallButton:r.isSmallModalButton})]})},st=()=>d.jsx("div",{className:"cursor-pointer flex items-center justify-center w-[24px]",children:d.jsx(K.IconDotsVertical,{width:20,height:20,stroke:2,className:"text-primary"})}),be=({conversation:t,selectedConversationId:r,searchQuery:o,onConversationClick:c,actions:a,locale:i,conversationStyles:g,shareConversationProps:f})=>{const e=E.useRef(null),n=_.getClearedConversationName(t==null?void 0:t.name);return E.useEffect(()=>{var s,l;if((t==null?void 0:t.id)===r&&e!=null&&e.current){const u=(l=(s=e.current.parentElement)==null?void 0:s.parentElement)==null?void 0:l.parentElement;if(u){const m=e.current.getBoundingClientRect(),h=u.getBoundingClientRect(),R=m.height,p=h.height,x=m.top-h.top+u.scrollTop-(p/2-R/2);u.scrollTo({top:x,behavior:"smooth"})}}},[t,r]),d.jsxs("div",{ref:e,className:X("flex justify-between items-center py-2 px-3 border-transparent relative group cursor-pointer border hover:border-hues-600","conversation-item",r===(t==null?void 0:t.id)&&"bg-hues-100 conversation-item-active"),onClick:()=>c(t.folderId,t==null?void 0:t.id),title:n,children:[d.jsxs("div",{className:"flex flex-1 min-w-0 items-center",children:[g.conversationItemIcon?g.conversationItemIcon:null,d.jsx("h3",{className:X("truncate font-semibold text-neutrals-1000 sm:body-2","conversation-item-text",r===(t==null?void 0:t.id)?"conversation-item-text-active":""),title:n,children:o!=null&&o.length?d.jsx(N.HighlightText,{text:n,highlightText:o}):n})]}),d.jsx(Ie,{locale:i,conversationStyles:g,conversation:t,onConversationDelete:a.deleteConversation,getConversation:a.getConversation,getFileBlob:a.getFileBlob,renameConversation:a.renameConversation,shareConversationProps:f})]})},ot=({handleConversationClick:t,actions:r,selectedConversationId:o,groupLabel:c,conversationStyles:a,groupedConversations:i,shareConversationProps:g,locale:f})=>{const[e,n]=E.useState(!1),s=E.useCallback(()=>{n(l=>!l)},[n]);return d.jsxs("div",{children:[d.jsxs("div",{className:"inline-flex gap-1 items-center text-neutrals-700 mb-3 cursor-pointer conversation-group-items-title",onClick:s,children:[d.jsx(K.IconCaretRightFilled,{className:X("w-3 h-3 conversation-group-items-arrow",e?"rotate-[90deg]":"rotate-0")}),d.jsx("span",{className:"body-3 conversation-group-items-title-text",children:je(c,a==null?void 0:a.titles)})]}),!e&&d.jsx("div",{className:X("flex flex-col gap-y-3","conversation-group-items"),children:de(i).map(l=>d.jsx(be,{locale:f,conversationStyles:a,conversation:l,selectedConversationId:o,onConversationClick:t,actions:r,shareConversationProps:g},l.id||l.name))})]},c)},lt=({searchQuery:t,isExpandedSearch:r,titles:o,searchIcon:c,onSearchConversations:a,toggleSearchField:i})=>d.jsx(d.Fragment,{children:r?d.jsx(N.InputWithIcon,{inputId:"conversations-search",placeholder:(o==null?void 0:o.searchPlaceholder)??"Search",containerClasses:"conversation-list-search-input h-[40px] bg-transparent px-4 py-2 rounded-full border-neutrals-400 shadow-none",cssClass:"h-auto",value:t,iconAfterInput:d.jsx(N.IconButton,{buttonClassName:"text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5",onClick:i,icon:d.jsx(K.IconX,{})}),onChange:a}):d.jsx(N.Button,{buttonClassName:"text-button-tertiary p-0 search-button",iconBefore:c||d.jsx(K.IconSearch,{className:"w-5 h-5"}),onClick:i})}),at=({conversations:t,selectedConversationId:r,searchQuery:o,conversationStyles:c,handleConversationClick:a,actions:i,locale:g,shareConversationProps:f})=>{var s;const[e,n]=E.useState([]);return E.useEffect(()=>{n(de(t==null?void 0:t.filter(l=>{var u;return(u=_.getClearedConversationName(l==null?void 0:l.name))==null?void 0:u.includes(o||"")})))},[t,o]),d.jsx(d.Fragment,{children:e!=null&&e.length?e.map(l=>d.jsx(be,{locale:g,conversationStyles:c,conversation:l,searchQuery:o,selectedConversationId:r,onConversationClick:a,actions:i,shareConversationProps:f},l.id)):d.jsx("h3",{className:"text-neutrals-800",children:((s=c==null?void 0:c.titles)==null?void 0:s.noConversation)??"No conversations yet"})})},it=({titles:t})=>d.jsxs("div",{className:"p-8 text-center flex flex-col",children:[d.jsx("p",{className:"text-neutrals-800",children:(t==null?void 0:t.noConversation)??"No conversations yet"}),d.jsx("p",{className:"text-sm text-neutrals-800 mt-2",children:(t==null?void 0:t.clickNewChat)??'Click "New Chat" to start a conversation'})]}),ct=({handleConversationClick:t,selectedConversationId:r,actions:o,children:c,isCollapsed:a,conversationStyles:i,conversations:g,locale:f,sharedConversations:e,setConversations:n,setSharedConversations:s,shareConversationProps:l,handleSelectedConversationRemove:u})=>{var L;const[m,h]=E.useState({}),[R,p]=E.useState(!0),[b,x]=E.useState(""),[C,I]=E.useState(!1),{getConversations:P,getSharedConversations:S,deleteConversation:j,renameConversation:D}=o,F=E.useMemo(()=>!!(b!=null&&b.length),[b]);E.useEffect(()=>{h({...ce(e),...De(g)})},[g,e]),E.useEffect(()=>{async function M(){try{p(!0);const A=await P(f),O=await S(Y.getSharedConversationsRequest(Y.ShareTarget.ME));n(_.cleanConversationNames(A)),s(_.cleanConversationNames(te(O,f)))}catch(A){console.error("Error loading conversation",A)}finally{p(!1)}}M()},[P,n,f,S,s]);const k=E.useCallback(async M=>{try{await j(M);const A=await P(f),O=await S(Y.getSharedConversationsRequest(Y.ShareTarget.ME));n(_.cleanConversationNames(A)),s(_.cleanConversationNames(te(O,f))),r===(M==null?void 0:M.id)&&u()}catch(A){console.error("Error deleting conversation",A)}},[j,P,f,S,n,s,r,u]),T=E.useCallback(async(M,A)=>{try{p(!0),await D(M,A);const O=await P(f),G=await S(Y.getSharedConversationsRequest(Y.ShareTarget.ME));n(_.cleanConversationNames(O)),s(_.cleanConversationNames(te(G,f)))}catch(O){console.error("Error renaming conversation",O)}finally{p(!1)}},[P,f,S,n,s,D]),z=E.useCallback(M=>{x(M)},[x]),$=E.useCallback(()=>{I(M=>!M),x("")},[I]);return R?d.jsx(N.Loader,{}):d.jsxs(d.Fragment,{children:[!a&&d.jsxs("div",{className:X("flex justify-between items-center",C?" pt-4 pb-0 sm:pt-10":" pt-6 pb-2 sm:pt-10"),children:[!C&&d.jsx("h3",{className:"text-neutrals-700 sm:body-2",children:((L=i==null?void 0:i.titles)==null?void 0:L.allChats)??"All Chats"}),d.jsx(lt,{searchQuery:b,searchIcon:i.searchIcon,titles:i.titles,isExpandedSearch:C,onSearchConversations:z,toggleSearchField:$})]}),d.jsx("div",{className:X("overflow-y-auto flex flex-col mt-4 flex-1 min-h-0 pr-2",F?"gap-y-1":"gap-y-6"),children:a?null:d.jsx(d.Fragment,{children:(g==null?void 0:g.length)===0&&(e==null?void 0:e.length)===0?d.jsx(it,{titles:i.titles}):F?d.jsx(at,{locale:f,conversationStyles:i,conversations:[...e,...g],searchQuery:b,selectedConversationId:r,handleConversationClick:t,shareConversationProps:l,actions:{...o,deleteConversation:k}}):Object.entries(m).map(([M,A])=>(A==null?void 0:A.length)>0&&d.jsx(ot,{locale:f,groupLabel:M,conversationStyles:i,groupedConversations:A,handleConversationClick:t,actions:{...o,deleteConversation:k,renameConversation:T},shareConversationProps:l,selectedConversationId:r},M))})}),c]})};exports.ActionMenu=Ie;exports.ActionMenuItem=B;exports.ConversationList=ct;exports.getSharedConversationsGroup=ce;exports.transformSharedConversations=te;
|
package/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { Popup as fe, PopUpSize as me, Button as X, Loader as Ce, InputWithIcon
|
|
|
6
6
|
import { IconCheck as je, IconCopy as Ve, IconDotsVertical as Xe, IconCaretRightFilled as We, IconX as Ke, IconSearch as Ze } from "@tabler/icons-react";
|
|
7
7
|
import Je from "jszip";
|
|
8
8
|
import { InvitationType as qe, getSharedConversationsRequest as le, ShareTarget as ie } from "@epam/statgpt-dial-toolkit";
|
|
9
|
-
import { getClearedConversationName as pe, cleanConversationNames as K } from "@epam/statgpt-shared-toolkit";
|
|
9
|
+
import { SHARE_CONVERSATION_ROUTE as we, getClearedConversationName as pe, ONBOARDING_MODEL_POSTFIX as ve, cleanConversationNames as K } from "@epam/statgpt-shared-toolkit";
|
|
10
10
|
var k = /* @__PURE__ */ ((t) => (t.DELETE = "delete", t.EXPORT = "export", t.SHARE = "share", t.RENAME = "rename", t))(k || {}), U = /* @__PURE__ */ ((t) => (t.SHARED = "shared", t.TODAY = "today", t.YESTERDAY = "yesterday", t.WEEK = "week", t.EARLIER = "earlier", t))(U || {});
|
|
11
11
|
const ce = (t, r) => {
|
|
12
12
|
var l, c;
|
|
@@ -20,37 +20,37 @@ const ce = (t, r) => {
|
|
|
20
20
|
isShared: !0
|
|
21
21
|
};
|
|
22
22
|
})) || [];
|
|
23
|
-
},
|
|
23
|
+
}, et = (t) => ({
|
|
24
24
|
[U.SHARED]: t
|
|
25
|
-
}),
|
|
25
|
+
}), tt = {
|
|
26
26
|
[U.TODAY]: [],
|
|
27
27
|
[U.YESTERDAY]: [],
|
|
28
28
|
[U.WEEK]: [],
|
|
29
29
|
[U.EARLIER]: []
|
|
30
|
-
},
|
|
30
|
+
}, Me = (t, r) => t.toDateString() === r.toDateString(), nt = (t, r) => {
|
|
31
31
|
const l = new Date(
|
|
32
32
|
t.getFullYear(),
|
|
33
33
|
t.getMonth(),
|
|
34
34
|
t.getDate() - 1
|
|
35
35
|
);
|
|
36
|
-
return
|
|
37
|
-
},
|
|
36
|
+
return Me(r, l);
|
|
37
|
+
}, rt = (t, r) => {
|
|
38
38
|
const l = t.getTime() - r.getTime();
|
|
39
39
|
return Math.floor(l / (1e3 * 60 * 60 * 24));
|
|
40
|
-
},
|
|
41
|
-
const r = /* @__PURE__ */ new Date(), l = ke(
|
|
40
|
+
}, ot = (t) => {
|
|
41
|
+
const r = /* @__PURE__ */ new Date(), l = ke(tt);
|
|
42
42
|
for (const c of t)
|
|
43
43
|
if (c.updatedAt) {
|
|
44
44
|
const s = new Date(c.updatedAt);
|
|
45
45
|
let a;
|
|
46
|
-
|
|
46
|
+
Me(r, s) ? a = l[U.TODAY] : nt(r, s) ? a = l[U.YESTERDAY] : rt(r, s) <= 7 ? a = l[U.WEEK] : a = l[U.EARLIER], a != null && a.some(
|
|
47
47
|
(p) => p.id === c.id
|
|
48
48
|
) || a.push(c);
|
|
49
49
|
}
|
|
50
50
|
return l;
|
|
51
|
-
},
|
|
51
|
+
}, Ne = (t) => t == null ? void 0 : t.sort(
|
|
52
52
|
(r, l) => ((l == null ? void 0 : l.updatedAt) || 0) - ((r == null ? void 0 : r.updatedAt) || 0)
|
|
53
|
-
),
|
|
53
|
+
), lt = (t, r) => t === U.SHARED ? (r == null ? void 0 : r.shared) || "Shared" : t === U.TODAY ? (r == null ? void 0 : r.today) || "Today" : t === U.YESTERDAY ? (r == null ? void 0 : r.yesterday) || "Yesterday" : t === U.WEEK ? (r == null ? void 0 : r.lastWeek) || "Last week" : (r == null ? void 0 : r.earlier) || "Earlier", it = ({
|
|
54
54
|
onCloseModal: t,
|
|
55
55
|
disableModalDividers: r,
|
|
56
56
|
deleteConversation: l,
|
|
@@ -95,14 +95,14 @@ const ce = (t, r) => {
|
|
|
95
95
|
] })
|
|
96
96
|
]
|
|
97
97
|
}
|
|
98
|
-
),
|
|
98
|
+
), st = (t) => {
|
|
99
99
|
const r = t.messages.flatMap((c) => {
|
|
100
100
|
var p, h, e;
|
|
101
101
|
const s = ((p = c.custom_content) == null ? void 0 : p.attachments) || [], a = ((e = (h = c.custom_content) == null ? void 0 : h.stages) == null ? void 0 : e.flatMap(
|
|
102
102
|
({ attachments: n }) => n ?? []
|
|
103
103
|
)) || [];
|
|
104
104
|
return [...s, ...a];
|
|
105
|
-
}) || [], l =
|
|
105
|
+
}) || [], l = dt(r).map(
|
|
106
106
|
(c) => ({
|
|
107
107
|
...c,
|
|
108
108
|
relativePath: "",
|
|
@@ -113,7 +113,7 @@ const ce = (t, r) => {
|
|
|
113
113
|
l,
|
|
114
114
|
(c) => te(c.relativePath, c.name)
|
|
115
115
|
);
|
|
116
|
-
},
|
|
116
|
+
}, at = (t) => t.endsWith("/"), ct = (t) => {
|
|
117
117
|
const r = t.toLowerCase();
|
|
118
118
|
return [
|
|
119
119
|
"data:",
|
|
@@ -126,7 +126,7 @@ const ce = (t, r) => {
|
|
|
126
126
|
"telnet://",
|
|
127
127
|
"api/files"
|
|
128
128
|
].some((l) => r.startsWith(l));
|
|
129
|
-
},
|
|
129
|
+
}, ut = (t) => {
|
|
130
130
|
const r = te(
|
|
131
131
|
...t.split("/").map((c) => decodeURIComponent(c))
|
|
132
132
|
), l = r.lastIndexOf("/");
|
|
@@ -134,10 +134,10 @@ const ce = (t, r) => {
|
|
|
134
134
|
absolutePath: r.slice(0, l),
|
|
135
135
|
name: r.slice(l + 1)
|
|
136
136
|
};
|
|
137
|
-
},
|
|
138
|
-
if (!r.url ||
|
|
137
|
+
}, dt = (t) => t ? t.map((r) => {
|
|
138
|
+
if (!r.url || ct(r.url) || at(r.url))
|
|
139
139
|
return null;
|
|
140
|
-
const { absolutePath: l, name: c } =
|
|
140
|
+
const { absolutePath: l, name: c } = ut(r.url);
|
|
141
141
|
return {
|
|
142
142
|
id: r.url,
|
|
143
143
|
name: c,
|
|
@@ -146,41 +146,41 @@ const ce = (t, r) => {
|
|
|
146
146
|
absolutePath: l
|
|
147
147
|
};
|
|
148
148
|
}).filter(Boolean) : [];
|
|
149
|
-
async function
|
|
150
|
-
const l =
|
|
149
|
+
async function ht(t, r) {
|
|
150
|
+
const l = st(t), c = new Je();
|
|
151
151
|
l.forEach((h) => {
|
|
152
|
-
const e = encodeURI(te(h.absolutePath, h.name)), n = r(`${e}`.replace("files/", "")), o =
|
|
152
|
+
const e = encodeURI(te(h.absolutePath, h.name)), n = r(`${e}`.replace("files/", "")), o = ft(h.folderId), i = te("res", o, h.name);
|
|
153
153
|
c.file(i, n);
|
|
154
154
|
});
|
|
155
155
|
const s = {
|
|
156
156
|
version: 5,
|
|
157
|
-
history: [t].map(
|
|
157
|
+
history: [t].map(mt) || [],
|
|
158
158
|
folders: []
|
|
159
159
|
}, a = JSON.stringify(s, null, 2);
|
|
160
160
|
return c.file("conversations/conversations_history.json", a), await c.generateAsync({ type: "base64" });
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const ft = (t) => {
|
|
163
163
|
const r = t.split("/");
|
|
164
164
|
return r.length > 2 ? te(...r.slice(2)) : void 0;
|
|
165
|
-
},
|
|
166
|
-
function
|
|
165
|
+
}, mt = (t) => _e(t, ["publicationInfo"]), te = (...t) => t.filter(Boolean).join("/");
|
|
166
|
+
function pt(t, r) {
|
|
167
167
|
const l = document.createElement("a");
|
|
168
168
|
l.download = r, l.href = t, l.style.display = "none", document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(t);
|
|
169
169
|
}
|
|
170
|
-
var
|
|
170
|
+
var gt = Object.defineProperty, se = Object.getOwnPropertySymbols, Ie = Object.prototype.hasOwnProperty, Ae = Object.prototype.propertyIsEnumerable, Ee = (t, r, l) => r in t ? gt(t, r, { enumerable: !0, configurable: !0, writable: !0, value: l }) : t[r] = l, ue = (t, r) => {
|
|
171
171
|
for (var l in r || (r = {}))
|
|
172
|
-
|
|
172
|
+
Ie.call(r, l) && Ee(t, l, r[l]);
|
|
173
173
|
if (se)
|
|
174
174
|
for (var l of se(r))
|
|
175
|
-
|
|
175
|
+
Ae.call(r, l) && Ee(t, l, r[l]);
|
|
176
176
|
return t;
|
|
177
177
|
}, de = (t, r) => {
|
|
178
178
|
var l = {};
|
|
179
179
|
for (var c in t)
|
|
180
|
-
|
|
180
|
+
Ie.call(t, c) && r.indexOf(c) < 0 && (l[c] = t[c]);
|
|
181
181
|
if (t != null && se)
|
|
182
182
|
for (var c of se(t))
|
|
183
|
-
r.indexOf(c) < 0 &&
|
|
183
|
+
r.indexOf(c) < 0 && Ae.call(t, c) && (l[c] = t[c]);
|
|
184
184
|
return l;
|
|
185
185
|
};
|
|
186
186
|
/**
|
|
@@ -729,13 +729,13 @@ var Z = W;
|
|
|
729
729
|
* Copyright (c) Paul O'Shannessy
|
|
730
730
|
* SPDX-License-Identifier: ISC
|
|
731
731
|
*/
|
|
732
|
-
var
|
|
732
|
+
var Et = {
|
|
733
733
|
L: Z.QrCode.Ecc.LOW,
|
|
734
734
|
M: Z.QrCode.Ecc.MEDIUM,
|
|
735
735
|
Q: Z.QrCode.Ecc.QUARTILE,
|
|
736
736
|
H: Z.QrCode.Ecc.HIGH
|
|
737
|
-
},
|
|
738
|
-
function
|
|
737
|
+
}, be = 128, ye = "L", Pe = "#FFFFFF", De = "#000000", Te = !1, Oe = 1, Ct = 4, Rt = 0, wt = 0.1;
|
|
738
|
+
function xe(t, r = 0) {
|
|
739
739
|
const l = [];
|
|
740
740
|
return t.forEach(function(c, s) {
|
|
741
741
|
let a = null;
|
|
@@ -758,13 +758,13 @@ function Oe(t, r = 0) {
|
|
|
758
758
|
});
|
|
759
759
|
}), l.join("");
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function Le(t, r) {
|
|
762
762
|
return t.slice().map((l, c) => c < r.y || c >= r.y + r.h ? l : l.map((s, a) => a < r.x || a >= r.x + r.w ? s : !1));
|
|
763
763
|
}
|
|
764
|
-
function
|
|
764
|
+
function Mt(t, r, l, c) {
|
|
765
765
|
if (c == null)
|
|
766
766
|
return null;
|
|
767
|
-
const s = t.length + l * 2, a = Math.floor(r *
|
|
767
|
+
const s = t.length + l * 2, a = Math.floor(r * wt), p = s / r, h = (c.width || a) * p, e = (c.height || a) * p, n = c.x == null ? t.length / 2 - h / 2 : c.x * p, o = c.y == null ? t.length / 2 - e / 2 : c.y * p, i = c.opacity == null ? 1 : c.opacity;
|
|
768
768
|
let u = null;
|
|
769
769
|
if (c.excavate) {
|
|
770
770
|
let d = Math.floor(n), C = Math.floor(o), m = Math.ceil(h + n - d), I = Math.ceil(e + o - C);
|
|
@@ -773,10 +773,10 @@ function wt(t, r, l, c) {
|
|
|
773
773
|
const f = c.crossOrigin;
|
|
774
774
|
return { x: n, y: o, h: e, w: h, excavation: u, opacity: i, crossOrigin: f };
|
|
775
775
|
}
|
|
776
|
-
function
|
|
777
|
-
return r != null ? Math.max(Math.floor(r), 0) : t ?
|
|
776
|
+
function Nt(t, r) {
|
|
777
|
+
return r != null ? Math.max(Math.floor(r), 0) : t ? Ct : Rt;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function Be({
|
|
780
780
|
value: t,
|
|
781
781
|
level: r,
|
|
782
782
|
minVersion: l,
|
|
@@ -790,7 +790,7 @@ function Le({
|
|
|
790
790
|
const d = (Array.isArray(t) ? t : [t]).reduce((C, m) => (C.push(...Z.QrSegment.makeSegments(m)), C), []);
|
|
791
791
|
return Z.QrCode.encodeSegments(
|
|
792
792
|
d,
|
|
793
|
-
|
|
793
|
+
Et[r],
|
|
794
794
|
l,
|
|
795
795
|
void 0,
|
|
796
796
|
void 0,
|
|
@@ -799,7 +799,7 @@ function Le({
|
|
|
799
799
|
}, [t, r, l, h]);
|
|
800
800
|
const { cells: n, margin: o, numCells: i, calculatedImageSettings: u } = O.useMemo(() => {
|
|
801
801
|
let f = e.getModules();
|
|
802
|
-
const d =
|
|
802
|
+
const d = Nt(c, s), C = f.length + d * 2, m = Mt(
|
|
803
803
|
f,
|
|
804
804
|
p,
|
|
805
805
|
d,
|
|
@@ -820,23 +820,23 @@ function Le({
|
|
|
820
820
|
calculatedImageSettings: u
|
|
821
821
|
};
|
|
822
822
|
}
|
|
823
|
-
var
|
|
823
|
+
var It = (function() {
|
|
824
824
|
try {
|
|
825
825
|
new Path2D().addPath(new Path2D());
|
|
826
826
|
} catch {
|
|
827
827
|
return !1;
|
|
828
828
|
}
|
|
829
829
|
return !0;
|
|
830
|
-
})(),
|
|
830
|
+
})(), At = O.forwardRef(
|
|
831
831
|
function(r, l) {
|
|
832
832
|
const c = r, {
|
|
833
833
|
value: s,
|
|
834
|
-
size: a =
|
|
835
|
-
level: p =
|
|
836
|
-
bgColor: h =
|
|
837
|
-
fgColor: e =
|
|
838
|
-
includeMargin: n =
|
|
839
|
-
minVersion: o =
|
|
834
|
+
size: a = be,
|
|
835
|
+
level: p = ye,
|
|
836
|
+
bgColor: h = Pe,
|
|
837
|
+
fgColor: e = De,
|
|
838
|
+
includeMargin: n = Te,
|
|
839
|
+
minVersion: o = Oe,
|
|
840
840
|
boostLevel: i,
|
|
841
841
|
marginSize: u,
|
|
842
842
|
imageSettings: f
|
|
@@ -856,7 +856,7 @@ var Nt = (function() {
|
|
|
856
856
|
E.current = S, typeof l == "function" ? l(S) : l && (l.current = S);
|
|
857
857
|
},
|
|
858
858
|
[l]
|
|
859
|
-
), [P, x] = O.useState(!1), { margin: T, cells: z, numCells: $, calculatedImageSettings: D } =
|
|
859
|
+
), [P, x] = O.useState(!1), { margin: T, cells: z, numCells: $, calculatedImageSettings: D } = Be({
|
|
860
860
|
value: s,
|
|
861
861
|
level: p,
|
|
862
862
|
minVersion: o,
|
|
@@ -873,14 +873,14 @@ var Nt = (function() {
|
|
|
873
873
|
return;
|
|
874
874
|
let A = z;
|
|
875
875
|
const L = N.current, j = D != null && L !== null && L.complete && L.naturalHeight !== 0 && L.naturalWidth !== 0;
|
|
876
|
-
j && D.excavation != null && (A =
|
|
876
|
+
j && D.excavation != null && (A = Le(
|
|
877
877
|
z,
|
|
878
878
|
D.excavation
|
|
879
879
|
));
|
|
880
880
|
const ne = window.devicePixelRatio || 1;
|
|
881
881
|
S.height = S.width = a * ne;
|
|
882
882
|
const re = a / $ * ne;
|
|
883
|
-
M.scale(re, re), M.fillStyle = h, M.fillRect(0, 0, $, $), M.fillStyle = e,
|
|
883
|
+
M.scale(re, re), M.fillStyle = h, M.fillRect(0, 0, $, $), M.fillStyle = e, It ? M.fill(new Path2D(xe(A, T))) : z.forEach(function(V, G) {
|
|
884
884
|
V.forEach(function(q, ae) {
|
|
885
885
|
q && M.fillRect(ae + T, G + T, 1, 1);
|
|
886
886
|
});
|
|
@@ -921,17 +921,17 @@ var Nt = (function() {
|
|
|
921
921
|
), Q);
|
|
922
922
|
}
|
|
923
923
|
);
|
|
924
|
-
|
|
925
|
-
var
|
|
924
|
+
At.displayName = "QRCodeCanvas";
|
|
925
|
+
var Se = O.forwardRef(
|
|
926
926
|
function(r, l) {
|
|
927
927
|
const c = r, {
|
|
928
928
|
value: s,
|
|
929
|
-
size: a =
|
|
930
|
-
level: p =
|
|
931
|
-
bgColor: h =
|
|
932
|
-
fgColor: e =
|
|
933
|
-
includeMargin: n =
|
|
934
|
-
minVersion: o =
|
|
929
|
+
size: a = be,
|
|
930
|
+
level: p = ye,
|
|
931
|
+
bgColor: h = Pe,
|
|
932
|
+
fgColor: e = De,
|
|
933
|
+
includeMargin: n = Te,
|
|
934
|
+
minVersion: o = Oe,
|
|
935
935
|
boostLevel: i,
|
|
936
936
|
title: u,
|
|
937
937
|
marginSize: f,
|
|
@@ -948,7 +948,7 @@ var Be = O.forwardRef(
|
|
|
948
948
|
"title",
|
|
949
949
|
"marginSize",
|
|
950
950
|
"imageSettings"
|
|
951
|
-
]), { margin: m, cells: I, numCells: w, calculatedImageSettings: E } =
|
|
951
|
+
]), { margin: m, cells: I, numCells: w, calculatedImageSettings: E } = Be({
|
|
952
952
|
value: s,
|
|
953
953
|
level: p,
|
|
954
954
|
minVersion: o,
|
|
@@ -959,7 +959,7 @@ var Be = O.forwardRef(
|
|
|
959
959
|
size: a
|
|
960
960
|
});
|
|
961
961
|
let N = I, b = null;
|
|
962
|
-
d != null && E != null && (E.excavation != null && (N =
|
|
962
|
+
d != null && E != null && (E.excavation != null && (N = Le(
|
|
963
963
|
I,
|
|
964
964
|
E.excavation
|
|
965
965
|
)), b = /* @__PURE__ */ O.createElement(
|
|
@@ -975,7 +975,7 @@ var Be = O.forwardRef(
|
|
|
975
975
|
crossOrigin: E.crossOrigin
|
|
976
976
|
}
|
|
977
977
|
));
|
|
978
|
-
const P =
|
|
978
|
+
const P = xe(N, m);
|
|
979
979
|
return /* @__PURE__ */ O.createElement(
|
|
980
980
|
"svg",
|
|
981
981
|
ue({
|
|
@@ -999,8 +999,8 @@ var Be = O.forwardRef(
|
|
|
999
999
|
);
|
|
1000
1000
|
}
|
|
1001
1001
|
);
|
|
1002
|
-
|
|
1003
|
-
const
|
|
1002
|
+
Se.displayName = "QRCodeSVG";
|
|
1003
|
+
const bt = (t, r) => ({
|
|
1004
1004
|
invitationType: qe.LINK,
|
|
1005
1005
|
resources: [
|
|
1006
1006
|
{
|
|
@@ -1011,7 +1011,7 @@ const Se = "share", At = "onboarding", bt = (t, r) => ({
|
|
|
1011
1011
|
}), yt = (t) => {
|
|
1012
1012
|
var l;
|
|
1013
1013
|
const r = ((l = t == null ? void 0 : t.invitationLink) == null ? void 0 : l.split("/").at(-1)) || "";
|
|
1014
|
-
return `/${
|
|
1014
|
+
return `/${we}/${r}`;
|
|
1015
1015
|
}, Pt = (t, r) => r == null ? void 0 : r.find((l) => {
|
|
1016
1016
|
var a, p, h, e;
|
|
1017
1017
|
const c = (p = (a = t == null ? void 0 : t.id) == null ? void 0 : a.split("/")) == null ? void 0 : p.pop(), s = ((e = (h = l == null ? void 0 : l.url) == null ? void 0 : h.split("/")) == null ? void 0 : e.pop()) || "";
|
|
@@ -1058,7 +1058,7 @@ const Se = "share", At = "onboarding", bt = (t, r) => ({
|
|
|
1058
1058
|
var G;
|
|
1059
1059
|
const V = w || window.location.origin;
|
|
1060
1060
|
if (w && w !== window.location.origin && N && b) {
|
|
1061
|
-
const q = (G = P == null ? void 0 : P.split(`/${
|
|
1061
|
+
const q = (G = P == null ? void 0 : P.split(`/${we}/`)) == null ? void 0 : G[1];
|
|
1062
1062
|
return `${V}/${N}?${b}=${q}`;
|
|
1063
1063
|
}
|
|
1064
1064
|
return `${V}/${r}${P}`;
|
|
@@ -1140,7 +1140,7 @@ const Se = "share", At = "onboarding", bt = (t, r) => ({
|
|
|
1140
1140
|
] })
|
|
1141
1141
|
] }),
|
|
1142
1142
|
/* @__PURE__ */ g(
|
|
1143
|
-
|
|
1143
|
+
Se,
|
|
1144
1144
|
{
|
|
1145
1145
|
className: "self-center border border-neutrals-600 p-2 rounded min-h-[200px]",
|
|
1146
1146
|
value: A,
|
|
@@ -1261,7 +1261,7 @@ const Se = "share", At = "onboarding", bt = (t, r) => ({
|
|
|
1261
1261
|
icon: (z = r.actionsIcons) == null ? void 0 : z[k.DELETE]
|
|
1262
1262
|
}
|
|
1263
1263
|
];
|
|
1264
|
-
return (D = ($ = t == null ? void 0 : t.model) == null ? void 0 : $.id) != null && D.endsWith(
|
|
1264
|
+
return (D = ($ = t == null ? void 0 : t.model) == null ? void 0 : $.id) != null && D.endsWith(ve) ? x : [
|
|
1265
1265
|
...t.isShared ? [] : [
|
|
1266
1266
|
{
|
|
1267
1267
|
key: k.SHARE,
|
|
@@ -1310,8 +1310,8 @@ const Se = "share", At = "onboarding", bt = (t, r) => ({
|
|
|
1310
1310
|
openedClassName: "action-menu-opened",
|
|
1311
1311
|
onOptionSelect: (x) => {
|
|
1312
1312
|
x === k.DELETE && i(Y.Opened), x === k.SHARE && f(Y.Opened), x === k.RENAME && C(Y.Opened), x === k.EXPORT && s(decodeURI(t.id)).then((T) => {
|
|
1313
|
-
|
|
1314
|
-
|
|
1313
|
+
ht(T, a).then((z) => {
|
|
1314
|
+
pt(
|
|
1315
1315
|
`data:application/zip;base64,${z}`,
|
|
1316
1316
|
`chat_with_attachments_${(/* @__PURE__ */ new Date()).toLocaleDateString()}.dial`
|
|
1317
1317
|
);
|
|
@@ -1321,7 +1321,7 @@ const Se = "share", At = "onboarding", bt = (t, r) => ({
|
|
|
1321
1321
|
}
|
|
1322
1322
|
),
|
|
1323
1323
|
o === Y.Opened && /* @__PURE__ */ g(
|
|
1324
|
-
|
|
1324
|
+
it,
|
|
1325
1325
|
{
|
|
1326
1326
|
titles: r.titles,
|
|
1327
1327
|
locale: e,
|
|
@@ -1462,7 +1462,7 @@ const Se = "share", At = "onboarding", bt = (t, r) => ({
|
|
|
1462
1462
|
)
|
|
1463
1463
|
}
|
|
1464
1464
|
),
|
|
1465
|
-
/* @__PURE__ */ g("span", { className: "body-3 conversation-group-items-title-text", children:
|
|
1465
|
+
/* @__PURE__ */ g("span", { className: "body-3 conversation-group-items-title-text", children: lt(c, s == null ? void 0 : s.titles) })
|
|
1466
1466
|
]
|
|
1467
1467
|
}
|
|
1468
1468
|
),
|
|
@@ -1473,7 +1473,7 @@ const Se = "share", At = "onboarding", bt = (t, r) => ({
|
|
|
1473
1473
|
"flex flex-col gap-y-3",
|
|
1474
1474
|
"conversation-group-items"
|
|
1475
1475
|
),
|
|
1476
|
-
children:
|
|
1476
|
+
children: Ne(a).map(
|
|
1477
1477
|
(i) => /* @__PURE__ */ g(
|
|
1478
1478
|
Fe,
|
|
1479
1479
|
{
|
|
@@ -1537,7 +1537,7 @@ const Se = "share", At = "onboarding", bt = (t, r) => ({
|
|
|
1537
1537
|
const [e, n] = F([]);
|
|
1538
1538
|
return ee(() => {
|
|
1539
1539
|
n(
|
|
1540
|
-
|
|
1540
|
+
Ne(
|
|
1541
1541
|
t == null ? void 0 : t.filter(
|
|
1542
1542
|
(i) => {
|
|
1543
1543
|
var u;
|
|
@@ -1589,8 +1589,8 @@ const Se = "share", At = "onboarding", bt = (t, r) => ({
|
|
|
1589
1589
|
} = l, z = he(() => !!(I != null && I.length), [I]);
|
|
1590
1590
|
ee(() => {
|
|
1591
1591
|
d({
|
|
1592
|
-
...
|
|
1593
|
-
...
|
|
1592
|
+
...et(e),
|
|
1593
|
+
...ot(p)
|
|
1594
1594
|
});
|
|
1595
1595
|
}, [p, e]), ee(() => {
|
|
1596
1596
|
async function M() {
|
|
@@ -1753,6 +1753,6 @@ export {
|
|
|
1753
1753
|
xt as ActionMenu,
|
|
1754
1754
|
k as ActionMenuItem,
|
|
1755
1755
|
Wt as ConversationList,
|
|
1756
|
-
|
|
1756
|
+
et as getSharedConversationsGroup,
|
|
1757
1757
|
ce as transformSharedConversations
|
|
1758
1758
|
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/statgpt-conversation-list",
|
|
3
|
-
"version": "0.2.0-rc.
|
|
3
|
+
"version": "0.2.0-rc.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@tabler/icons-react": "^3.34.1",
|
|
7
7
|
"react": "19.1.0",
|
|
8
8
|
"@epam/ai-dial-shared": "^0.34.0",
|
|
9
|
-
"@epam/statgpt-ui-components": "0.2.0-rc.
|
|
9
|
+
"@epam/statgpt-ui-components": "0.2.0-rc.3",
|
|
10
10
|
"classnames": "^2.5.1",
|
|
11
|
-
"@epam/statgpt-shared-toolkit": "0.2.0-rc.
|
|
12
|
-
"@epam/statgpt-dial-toolkit": "0.2.0-rc.
|
|
11
|
+
"@epam/statgpt-shared-toolkit": "0.2.0-rc.3",
|
|
12
|
+
"@epam/statgpt-dial-toolkit": "0.2.0-rc.3",
|
|
13
13
|
"jszip": "3.10.1",
|
|
14
14
|
"lodash": "^4.17.21"
|
|
15
15
|
},
|