codicent-app-sdk 0.3.73 → 0.3.75

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.
Files changed (26) hide show
  1. package/dist/cjs/components/MessageItem.d.ts.map +1 -1
  2. package/dist/cjs/components/MessageItem.js +1 -1
  3. package/dist/cjs/hooks/useCodicentState.d.ts.map +1 -1
  4. package/dist/cjs/hooks/useCodicentState.js +1 -1
  5. package/dist/cjs/node_modules/@fluentui/react-icons/lib/icons/chunk-1.js +1 -1
  6. package/dist/cjs/node_modules/@fluentui/react-switch/lib/components/Switch/Switch.js +1 -0
  7. package/dist/cjs/node_modules/@fluentui/react-switch/lib/components/Switch/renderSwitch.js +1 -0
  8. package/dist/cjs/node_modules/@fluentui/react-switch/lib/components/Switch/useSwitch.js +1 -0
  9. package/dist/cjs/node_modules/@fluentui/react-switch/lib/components/Switch/useSwitchStyles.styles.js +1 -0
  10. package/dist/cjs/services/codicent.d.ts +9 -0
  11. package/dist/cjs/services/codicent.d.ts.map +1 -1
  12. package/dist/cjs/services/codicent.js +1 -1
  13. package/dist/esm/components/MessageItem.d.ts.map +1 -1
  14. package/dist/esm/components/MessageItem.js +1 -1
  15. package/dist/esm/hooks/useCodicentState.d.ts.map +1 -1
  16. package/dist/esm/hooks/useCodicentState.js +1 -1
  17. package/dist/esm/node_modules/@fluentui/react-icons/lib/icons/chunk-1.js +1 -1
  18. package/dist/esm/node_modules/@fluentui/react-switch/lib/components/Switch/Switch.js +1 -0
  19. package/dist/esm/node_modules/@fluentui/react-switch/lib/components/Switch/renderSwitch.js +1 -0
  20. package/dist/esm/node_modules/@fluentui/react-switch/lib/components/Switch/useSwitch.js +1 -0
  21. package/dist/esm/node_modules/@fluentui/react-switch/lib/components/Switch/useSwitchStyles.styles.js +1 -0
  22. package/dist/esm/services/codicent.d.ts +9 -0
  23. package/dist/esm/services/codicent.d.ts.map +1 -1
  24. package/dist/esm/services/codicent.js +1 -1
  25. package/dist/index.d.ts +9 -0
  26. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MessageItem.d.ts","sourceRoot":"","sources":["../../../src/components/MessageItem.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAoH9C,QAAA,MAAM,WAAW,0HAad;IACD,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE,eAAe,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,4CAkOA,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"MessageItem.d.ts","sourceRoot":"","sources":["../../../src/components/MessageItem.tsx"],"names":[],"mappings":"AA6BA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA2H9C,QAAA,MAAM,WAAW,0HAad;IACD,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE,eAAe,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,4CAyTA,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("react-router-dom"),i=require("../services/codicent.js"),s=require("./Markdown.js");require("./Textarea.js"),require("./Button.js");var n=require("./Text.js");require("./Spinner.js"),require("./TextHeader.js"),require("./TypingIndicator.js"),require("./Dialog.js"),require("./ChatInput.js"),require("./CombinedPlaceholderDialog.js"),require("./ChatMessage.js"),require("./Header.js");var o=require("../utils/MessageContent.js");require("../node_modules/tinycolor2/esm/tinycolor.js"),require("../_virtual/index.js");var a=require("../config/index.js");require("../lib/wavtools/lib/wav_packer.js"),require("../lib/wavtools/lib/analysis/audio_analysis.js"),require("../lib/wavtools/lib/wav_stream_player.js"),require("../lib/wavtools/lib/wav_recorder.js"),require("../pages/AppFrame.js"),require("../pages/Snap.js"),require("../pages/Search.js"),require("../pages/Login.js"),require("../pages/CrmPage.js"),require("../pages/ImageView.js"),require("../pages/FormInvite.js"),require("../pages/FormAccept.js"),require("../pages/Sales.js"),require("../stores/chatStore.js");var l=require("../hooks/useLocalization.js");require("../hooks/useAppStyles.js");var u=require("./FileThumbnail.js");require("./MessageInput.js"),require("./UploadFile.js"),require("./SnapFooter.js"),require("./Profile.js"),require("./Content.js"),require("./AiInput.js"),require("./SearchBox.js"),require("./HtmlView.js"),require("./Footer.js"),require("./Page.js");var d=require("../node_modules/@griffel/react/makeStyles.esm.js"),c=require("../node_modules/@fluentui/react-card/lib/components/Card/Card.js"),m=require("../node_modules/@fluentui/react-icons/lib/icons/chunk-2.js"),g=require("../node_modules/@fluentui/react-icons/lib/icons/chunk-0.js"),p=require("../node_modules/@fluentui/react-card/lib/components/CardHeader/CardHeader.js"),h=require("../node_modules/@fluentui/react-skeleton/lib/components/Skeleton/Skeleton.js"),j=require("../node_modules/@fluentui/react-skeleton/lib/components/SkeletonItem/SkeletonItem.js"),x=require("../node_modules/@fluentui/react-text/lib/components/presets/Caption1/Caption1.js"),f=require("../node_modules/@fluentui/tokens/lib/tokens.js"),q=require("../node_modules/@fluentui/react-icons/lib/sizedIcons/chunk-7.js");const S=d.makeStyles({iframe:{border:"none",width:"100%",height:"100%"},main:{gap:"36px",display:"flex",flexDirection:"column",flexWrap:"wrap"},card:{minWidth:"300px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",maxHeight:"11em",borderRadius:"10px",position:"relative"},expandedCard:{minWidth:"320px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",borderRadius:"10px",position:"relative"},text:{margin:"0.5em",whiteSpace:"normal",fontSize:"larger"},caption:{color:f.tokens.colorNeutralForeground3},headerImage:{borderRadius:"4px",maxWidth:"44px",maxHeight:"44px"},rectangle:{margin:0,top:"-5px",left:"-2px",width:"5px",position:"absolute",height:"100%"},fileList:{display:"flex",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin",msOverflowStyle:"none",padding:"4px",margin:"0 -4px",maxWidth:"100%",boxSizing:"border-box","&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:f.tokens.colorNeutralStroke1,borderRadius:"3px"}},htmlButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},headerButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},iconButtonRow:{position:"absolute",top:"0.5em",right:"0.5em",display:"flex",alignItems:"center",gap:"0.5em",zIndex:2},content:{overflow:"hidden",transition:"max-height 0.3s ease-out",userSelect:"text"},truncated:{maxHeight:"10em"},header:{display:"flex",flexDirection:"row",gap:"0.5em"}});exports.default=({header:d,description:f,timestamp:b,text:k,image:C,tags:I,id:v,fileIds:O,codicentService:_,busy:w,onEdit:E,onShowHtmlPreview:N})=>{const T=S(),A=t.useNavigate(),[y,R]=r.useState(!1),[F,B]=r.useState(!1),L=r.useRef(null),H=Object.keys(a.getConfigValue("LOGBOOK_TAG_DEFINITIONS")),P=H.find((e=>I.includes(e)))||(O.length>0?H.find((e=>"file"===e)):void 0),[D,G]=r.useState([]),{t:M}=l.default(),z=["TYPE","CUSTOMER","CONTACT","SALESPERSON","MESSAGE","COMPANY","PHONE","EMAIL","WEBSITE","INFO","FÖRETAG","ROLE","KONTAKT"],V=[M("Typ"),M("Kund"),M("Kontakt"),M("Säljare"),M("Meddelande"),M("Företag"),M("Telefon"),M("E-post"),M("Hemsida"),M("Info"),M("Företag"),M("Roll"),M("Kontakt")];r.useEffect((()=>{Promise.all(O.map((e=>_.getFileInfo(e)))).then((e=>{G(e)}))}),[_,G,O]),r.useEffect((()=>{const e=()=>{if(L.current){const e=L.current.scrollHeight>100+(D.length>0?-72:0);B(e)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[k,D]);const K=()=>R(!y),W=I.includes("chat")&&(k.includes("#function_result")||k.includes("#finish_reason_function_call")),$=e=>{const r=e.indexOf("```html");if(-1===r)return e;const t=e.indexOf("```",r+7);if(-1===t)return e.substring(r+7);return e.substring(r+7,t)},U=new o.default(k).data,Y=P&&a.getConfigValue("LOGBOOK_TAG_DEFINITIONS")[P].editable,X=P&&a.getConfigValue("LOGBOOK_TAG_DEFINITIONS")[P].imageSize||void 0;return e.jsxs(c.Card,{className:y?T.expandedCard:T.card,style:{backgroundColor:a.getConfigValue("MESSAGE_HIDE_BAR")?P?a.getConfigValue("LOGBOOK_TAG_DEFINITIONS")[P].color:a.getConfigValue("APP_HEADER_COLOR")||"#eee":"#eee"},onClick:I.includes("chat")?e=>{I.includes("chat")&&(e&&e.stopPropagation(),A("/chat?id="+v))}:void 0,children:[!a.getConfigValue("MESSAGE_HIDE_BAR")&&e.jsx("div",{className:T.rectangle,style:{backgroundColor:P?a.getConfigValue("LOGBOOK_TAG_DEFINITIONS")[P].color:a.getConfigValue("APP_HEADER_COLOR")||void 0}}),e.jsxs("div",{className:T.iconButtonRow,children:[Y&&E&&e.jsx(q.Edit20Regular,{className:T.htmlButton,onClick:()=>E()}),N&&!Y&&I.includes("html")&&e.jsx(m.FullScreenMaximizeRegular,{className:T.htmlButton,onClick:e=>{e.stopPropagation(),N($(k))}}),F&&!I.includes("chat")&&y&&e.jsx(g.ArrowCollapseAllRegular,{className:T.headerButton,onClick:K}),F&&!I.includes("chat")&&!y&&e.jsx(g.ArrowExpandAllRegular,{className:T.headerButton,onClick:K})]}),e.jsx(p.CardHeader,{image:C?e.jsx("img",{className:T.headerImage,src:"app_logo.svg",alt:"User"}):null,header:w?e.jsx(h.Skeleton,{style:{width:"50%"},children:e.jsx(j.SkeletonItem,{})}):e.jsxs("div",{className:T.header,children:[e.jsx(n.Text,{weight:"semibold",children:d}),b&&e.jsx(n.Text,{weight:"regular",children:b})]}),description:e.jsx(x.Caption1,{className:T.caption,children:f})}),e.jsxs("div",{ref:L,className:`${T.content} ${y?"":T.truncated}`,children:[D.length>0&&e.jsx("div",{className:T.fileList,children:D.map((r=>e.jsx(u.FileThumbnail,{file:r,thumbnailSize:X,getImageUrl:i.CodicentService.getImageUrl,onClick:()=>{r.contentType.startsWith("image")?A(`/image?id=${v}&file=${r.id}`):i.CodicentService.downloadFile(r)}},r.id)))}),w?e.jsxs(h.Skeleton,{style:{width:"100%"},children:[e.jsx(j.SkeletonItem,{}),e.jsx(j.SkeletonItem,{}),e.jsx(j.SkeletonItem,{}),e.jsx(j.SkeletonItem,{}),e.jsx(j.SkeletonItem,{})]}):e.jsx("div",{className:T.text,children:I.includes("html")?e.jsx("iframe",{className:T.iframe,title:"html",srcDoc:$(k),sandbox:"allow-same-origin allow-scripts"}):I.includes("crm")&&0===Object.keys(U).length?e.jsx(s.default,{content:W?"*Tänker...*":U?(()=>{const e=new RegExp(`(${z.join("|")})\\s*:\\s*`,"gi"),r=k.replace(e,((e,r)=>{const t=z.indexOf(r.toUpperCase());-1===t&&console.log("Field not found:",r);return`\n**${-1!==t?V[t]:r}:** `}));return r.trim()})():k}):e.jsx(s.default,{content:W?"*Tänker...*":U&&U&&Object.keys(U).length>0?Object.keys(U).map((e=>{const r=z.indexOf(e.toUpperCase());return`**${-1!==r?V[r]:e}:** ${U[e]}\n`})).join("\n"):k})})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-router-dom"),i=require("../services/codicent.js"),o=require("./Markdown.js");require("./Textarea.js"),require("./Button.js");var n=require("./Text.js");require("./Spinner.js"),require("./TextHeader.js"),require("./TypingIndicator.js"),require("./Dialog.js"),require("./ChatInput.js"),require("./CombinedPlaceholderDialog.js"),require("./ChatMessage.js"),require("./Header.js");var s=require("../utils/MessageContent.js");require("../node_modules/tinycolor2/esm/tinycolor.js"),require("../_virtual/index.js");var a=require("../config/index.js");require("../lib/wavtools/lib/wav_packer.js"),require("../lib/wavtools/lib/analysis/audio_analysis.js"),require("../lib/wavtools/lib/wav_stream_player.js"),require("../lib/wavtools/lib/wav_recorder.js"),require("../pages/AppFrame.js"),require("../pages/Snap.js"),require("../pages/Search.js"),require("../pages/Login.js"),require("../pages/CrmPage.js"),require("../pages/ImageView.js"),require("../pages/FormInvite.js"),require("../pages/FormAccept.js"),require("../pages/Sales.js"),require("../stores/chatStore.js");var l=require("../hooks/useLocalization.js");require("../hooks/useAppStyles.js");var u=require("./FileThumbnail.js");require("./MessageInput.js"),require("./UploadFile.js"),require("./SnapFooter.js"),require("./Profile.js"),require("./Content.js"),require("./AiInput.js"),require("./SearchBox.js"),require("./HtmlView.js"),require("./Footer.js"),require("./Page.js");var d=require("../node_modules/@griffel/react/makeStyles.esm.js"),c=require("../node_modules/@fluentui/react-card/lib/components/Card/Card.js"),m=require("../node_modules/@fluentui/react-switch/lib/components/Switch/Switch.js"),g=require("../node_modules/@fluentui/react-icons/lib/icons/chunk-2.js"),p=require("../node_modules/@fluentui/react-icons/lib/icons/chunk-0.js"),h=require("../node_modules/@fluentui/react-card/lib/components/CardHeader/CardHeader.js"),j=require("../node_modules/@fluentui/react-skeleton/lib/components/Skeleton/Skeleton.js"),f=require("../node_modules/@fluentui/react-skeleton/lib/components/SkeletonItem/SkeletonItem.js"),x=require("../node_modules/@fluentui/react-text/lib/components/presets/Caption1/Caption1.js"),S=require("../node_modules/@fluentui/tokens/lib/tokens.js"),b=require("../node_modules/@fluentui/react-icons/lib/sizedIcons/chunk-7.js");const q=d.makeStyles({iframe:{border:"none",width:"100%",height:"100%"},main:{gap:"36px",display:"flex",flexDirection:"column",flexWrap:"wrap"},card:{minWidth:"300px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",maxHeight:"11em",borderRadius:"10px",position:"relative"},expandedCard:{minWidth:"320px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",borderRadius:"10px",position:"relative"},text:{margin:"0.5em",whiteSpace:"normal",fontSize:"larger"},caption:{color:S.tokens.colorNeutralForeground3},headerImage:{borderRadius:"4px",maxWidth:"44px",maxHeight:"44px"},rectangle:{margin:0,top:"-5px",left:"-2px",width:"5px",position:"absolute",height:"100%"},fileList:{display:"flex",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin",msOverflowStyle:"none",padding:"4px",margin:"0 -4px",maxWidth:"100%",boxSizing:"border-box","&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:S.tokens.colorNeutralStroke1,borderRadius:"3px"}},htmlButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},headerButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},iconButtonRow:{position:"absolute",top:"0.5em",right:"0.5em",display:"flex",alignItems:"center",gap:"0.5em",zIndex:2},content:{overflow:"hidden",transition:"max-height 0.3s ease-out",userSelect:"text"},truncated:{maxHeight:"10em"},header:{display:"flex",flexDirection:"row",gap:"0.5em",alignItems:"center"},todoSwitch:{transform:"scale(0.8)","& .fui-Switch__label":{fontSize:"0.75rem"}}});exports.default=({header:d,description:S,timestamp:k,text:w,image:C,tags:I,id:_,fileIds:v,codicentService:O,busy:E,onEdit:N,onShowHtmlPreview:T})=>{const y=q(),A=r.useNavigate(),[R,F]=t.useState(!1),[B,L]=t.useState(!1),[H,P]=t.useState("unknown"),[D,G]=t.useState(!1),z=t.useRef(null),M=Object.keys(a.getConfigValue("LOGBOOK_TAG_DEFINITIONS")),V=M.find((e=>I.includes(e)))||(v.length>0?M.find((e=>"file"===e)):void 0),[K,W]=t.useState([]),$=I.includes("todo"),{t:U}=l.default(),Y=["TYPE","CUSTOMER","CONTACT","SALESPERSON","MESSAGE","COMPANY","PHONE","EMAIL","WEBSITE","INFO","FÖRETAG","ROLE","KONTAKT"],X=[U("Typ"),U("Kund"),U("Kontakt"),U("Säljare"),U("Meddelande"),U("Företag"),U("Telefon"),U("E-post"),U("Hemsida"),U("Info"),U("Företag"),U("Roll"),U("Kontakt")];t.useEffect((()=>{Promise.all(v.map((e=>O.getFileInfo(e)))).then((e=>{W(e)}))}),[O,W,v]),t.useEffect((()=>{const e=()=>{if(z.current){const e=z.current.scrollHeight>100+(K.length>0?-72:0);L(e)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[w,K]),t.useEffect((()=>{if($){(async()=>{try{const e=await O.getTodoStatus(_);P(e)}catch(e){console.error("Error loading todo status:",e),P("unknown")}})()}}),[$,_,O]);const J=()=>F(!R),Q=I.includes("chat")&&(w.includes("#function_result")||w.includes("#finish_reason_function_call")),Z=e=>{const t=e.indexOf("```html");if(-1===t)return e;const r=e.indexOf("```",t+7);if(-1===r)return e.substring(t+7);return e.substring(t+7,r)},ee=new s.default(w).data,te=V&&a.getConfigValue("LOGBOOK_TAG_DEFINITIONS")[V].editable,re=V&&a.getConfigValue("LOGBOOK_TAG_DEFINITIONS")[V].imageSize||void 0;return e.jsxs(c.Card,{className:R?y.expandedCard:y.card,style:{backgroundColor:a.getConfigValue("MESSAGE_HIDE_BAR")?V?a.getConfigValue("LOGBOOK_TAG_DEFINITIONS")[V].color:a.getConfigValue("APP_HEADER_COLOR")||"#eee":"#eee"},onClick:I.includes("chat")?e=>{I.includes("chat")&&(e&&e.stopPropagation(),A("/chat?id="+_))}:void 0,children:[!a.getConfigValue("MESSAGE_HIDE_BAR")&&e.jsx("div",{className:y.rectangle,style:{backgroundColor:V?a.getConfigValue("LOGBOOK_TAG_DEFINITIONS")[V].color:a.getConfigValue("APP_HEADER_COLOR")||void 0}}),e.jsxs("div",{className:y.iconButtonRow,children:[$&&e.jsx(m.Switch,{className:y.todoSwitch,checked:"done"===H,onChange:(e,t)=>(async e=>{if(!D){G(!0);try{const t=e?"done":"undone";await O.updateTodoStatus(_,t)&&P(t)}catch(e){console.error("Error updating todo status:",e)}finally{G(!1)}}})(t.checked),disabled:D||"unknown"===H,label:U("done"===H?"Done":"Todo")}),te&&N&&e.jsx(b.Edit20Regular,{className:y.htmlButton,onClick:()=>N()}),T&&!te&&I.includes("html")&&e.jsx(g.FullScreenMaximizeRegular,{className:y.htmlButton,onClick:e=>{e.stopPropagation(),T(Z(w))}}),B&&!I.includes("chat")&&R&&e.jsx(p.ArrowCollapseAllRegular,{className:y.headerButton,onClick:J}),B&&!I.includes("chat")&&!R&&e.jsx(p.ArrowExpandAllRegular,{className:y.headerButton,onClick:J})]}),e.jsx(h.CardHeader,{image:C?e.jsx("img",{className:y.headerImage,src:"app_logo.svg",alt:"User"}):null,header:E?e.jsx(j.Skeleton,{style:{width:"50%"},children:e.jsx(f.SkeletonItem,{})}):e.jsxs("div",{className:y.header,children:[e.jsx(n.Text,{weight:"semibold",children:d}),k&&e.jsx(n.Text,{weight:"regular",children:k})]}),description:e.jsx(x.Caption1,{className:y.caption,children:S})}),e.jsxs("div",{ref:z,className:`${y.content} ${R?"":y.truncated}`,children:[K.length>0&&e.jsx("div",{className:y.fileList,children:K.map((t=>e.jsx(u.FileThumbnail,{file:t,thumbnailSize:re,getImageUrl:i.CodicentService.getImageUrl,onClick:()=>{t.contentType.startsWith("image")?A(`/image?id=${_}&file=${t.id}`):i.CodicentService.downloadFile(t)}},t.id)))}),E?e.jsxs(j.Skeleton,{style:{width:"100%"},children:[e.jsx(f.SkeletonItem,{}),e.jsx(f.SkeletonItem,{}),e.jsx(f.SkeletonItem,{}),e.jsx(f.SkeletonItem,{}),e.jsx(f.SkeletonItem,{})]}):e.jsx("div",{className:y.text,children:I.includes("html")?e.jsx("iframe",{className:y.iframe,title:"html",srcDoc:Z(w),sandbox:"allow-same-origin allow-scripts"}):I.includes("crm")&&0===Object.keys(ee).length?e.jsx(o.default,{content:Q?"*Tänker...*":ee?(()=>{const e=new RegExp(`(${Y.join("|")})\\s*:\\s*`,"gi"),t=w.replace(e,((e,t)=>{const r=Y.indexOf(t.toUpperCase());-1===r&&console.log("Field not found:",t);return`\n**${-1!==r?X[r]:t}:** `}));return t.trim()})():w}):e.jsx(o.default,{content:Q?"*Tänker...*":ee&&ee&&Object.keys(ee).length>0?Object.keys(ee).map((e=>{const t=Y.indexOf(e.toUpperCase());return`**${-1!==t?X[t]:e}:** ${ee[e]}\n`})).join("\n"):w})})]})]})};
@@ -1 +1 @@
1
- {"version":3,"file":"useCodicentState.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCodicentState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAkB,MAAM,IAAI,CAAC;AAErD,QAAA,MAAM,gBAAgB,UAAW,eAAe;;;CA+C/C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"useCodicentState.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCodicentState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAkB,MAAM,IAAI,CAAC;AAErD,QAAA,MAAM,gBAAgB,UAAW,eAAe;;;CA+D/C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./useStateWithLocalStorage.js");require("../services/codicent.js"),require("../components/Markdown.js"),require("../components/Textarea.js"),require("../components/Button.js"),require("react/jsx-runtime"),require("../components/Spinner.js"),require("../components/TextHeader.js"),require("../components/TypingIndicator.js"),require("../components/Dialog.js"),require("../components/ChatInput.js"),require("../components/CombinedPlaceholderDialog.js"),require("../components/ChatMessage.js"),require("../components/Header.js");var s=require("../config/index.js");require("../stores/chatStore.js"),require("../utils/MessageContent.js"),require("../node_modules/tinycolor2/esm/tinycolor.js"),require("../_virtual/index.js"),require("../lib/wavtools/lib/wav_packer.js"),require("../lib/wavtools/lib/analysis/audio_analysis.js"),require("../lib/wavtools/lib/wav_stream_player.js"),require("../lib/wavtools/lib/wav_recorder.js"),require("./useLocalization.js"),require("./useAppStyles.js"),require("../components/FileThumbnail.js"),require("../components/MessageInput.js"),require("../components/UploadFile.js"),require("../components/SnapFooter.js"),require("../components/Profile.js"),require("../components/MessageItem.js"),require("../components/Content.js"),require("../components/AiInput.js"),require("../components/SearchBox.js"),require("../components/HtmlView.js"),require("../components/Footer.js"),require("../components/Page.js"),require("../pages/AppFrame.js"),require("../pages/Snap.js"),require("../pages/Search.js"),require("../pages/Login.js"),require("../pages/CrmPage.js"),require("../pages/ImageView.js"),require("../pages/FormInvite.js"),require("../pages/FormAccept.js"),require("../pages/Sales.js");exports.default=t=>{const[o,i]=r.default("APP_WELCOME_STATE_TEXT_"+t.context.selectedApp,""),[n,a]=r.default("CODICENT_STATE_LAST_TIMESTAMP_"+t.context.selectedApp,0),{service:u,current:c}=t,[l,p]=e.useState(!1),j=e.useRef(!1),q=e.useCallback((async()=>{if(!j.current){j.current=!0;try{const e=await u.getMessagesFast(s.getConfigValue("LOGBOOK_TAGS").split(",").filter((e=>"chat"!==e))),r=e.length>0?e[0].createdAt.getTime():n;if(r>n){a(r),p(!0);const e=await u.chat(s.getConfigValue("WELCOME_STATUS_PROMPT"));i(e.content)}}finally{p(!1),j.current=!1}}}),[u,n,a,i]),g=e.useCallback((()=>{u&&s.getConfigValue("CHAT_INSTRUCTIONS")&&u.updateChatInstructions(s.getConfigValue("CHAT_INSTRUCTIONS")).catch(console.warn)}),[u]);return e.useEffect((()=>{c===t.allStates.hasAccess&&s.getConfigValue("WELCOME_STATUS_PROMPT")?(q(),g()):s.getConfigValue("WELCOME_STATUS_PROMPT")||i("")}),[c,t,q,g,i]),{welcomeStatusText:o,updating:l}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./useStateWithLocalStorage.js");require("../services/codicent.js"),require("../components/Markdown.js"),require("../components/Textarea.js"),require("../components/Button.js"),require("react/jsx-runtime"),require("../components/Spinner.js"),require("../components/TextHeader.js"),require("../components/TypingIndicator.js"),require("../components/Dialog.js"),require("../components/ChatInput.js"),require("../components/CombinedPlaceholderDialog.js"),require("../components/ChatMessage.js"),require("../components/Header.js");var s=require("../config/index.js");require("../stores/chatStore.js"),require("../utils/MessageContent.js"),require("../node_modules/tinycolor2/esm/tinycolor.js"),require("../_virtual/index.js"),require("../lib/wavtools/lib/wav_packer.js"),require("../lib/wavtools/lib/analysis/audio_analysis.js"),require("../lib/wavtools/lib/wav_stream_player.js"),require("../lib/wavtools/lib/wav_recorder.js"),require("./useLocalization.js"),require("./useAppStyles.js"),require("../components/FileThumbnail.js"),require("../components/MessageInput.js"),require("../components/UploadFile.js"),require("../components/SnapFooter.js"),require("../components/Profile.js"),require("../components/MessageItem.js"),require("../components/Content.js"),require("../components/AiInput.js"),require("../components/SearchBox.js"),require("../components/HtmlView.js"),require("../components/Footer.js"),require("../components/Page.js"),require("../pages/AppFrame.js"),require("../pages/Snap.js"),require("../pages/Search.js"),require("../pages/Login.js"),require("../pages/CrmPage.js"),require("../pages/ImageView.js"),require("../pages/FormInvite.js"),require("../pages/FormAccept.js"),require("../pages/Sales.js");exports.default=t=>{const[o,i]=r.default("APP_WELCOME_STATE_TEXT_"+t.context.selectedApp,""),[n,a]=r.default("CODICENT_STATE_LAST_TIMESTAMP_"+t.context.selectedApp,0),{service:u,current:c}=t,[l,p]=e.useState(!1),j=e.useRef(!1),q=e.useCallback((async()=>{if(!j.current){j.current=!0;try{const e=await u.getMessagesFast(s.getConfigValue("LOGBOOK_TAGS").split(",").filter((e=>"chat"!==e))),r=e.length>0?e[0].createdAt.getTime():n;if(r>n){a(r),p(!0);const e=await u.chat(s.getConfigValue("WELCOME_STATUS_PROMPT"));i(e.content)}}finally{p(!1),j.current=!1}}}),[u,n,a,i]),m=e.useCallback((()=>{u&&s.getConfigValue("CHAT_INSTRUCTIONS")}),[u]);return e.useEffect((()=>{c===t.allStates.hasAccess&&s.getConfigValue("WELCOME_STATUS_PROMPT")?(q(),m()):s.getConfigValue("WELCOME_STATUS_PROMPT")||i("")}),[c,t,q,m,i]),{welcomeStatusText:o,updating:l}};
@@ -1 +1 @@
1
- "use strict";var e=require("../utils/createFluentIcon.js");const l=e.createFluentIcon("ChannelRegular","1em",["M3.5 5.5a1 1 0 0 0-1 1 1 1 0 1 0 1-1Zm0-1c-.1 0-.2 0-.3.02A2.5 2.5 0 0 1 5.5 3h9A2.5 2.5 0 0 1 17 5.5v9a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 3 14.5V8.44a2 2 0 0 0 1 0v6.06c0 .83.67 1.5 1.5 1.5h9c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5h-9c-.51 0-.97.26-1.24.65a2 2 0 0 0-.76-.15Zm3.5 4c0-.28.22-.5.5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm.5 2.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3Z"]),a=e.createFluentIcon("CheckmarkFilled","1em",["M7.03 13.9 3.56 10a.75.75 0 0 0-1.12 1l4 4.5c.29.32.79.34 1.09.03l10.5-10.5a.75.75 0 0 0-1.06-1.06l-9.94 9.94Z"]),r=e.createFluentIcon("CheckmarkCircleFilled","1em",["M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm3.36 5.65a.5.5 0 0 0-.64-.06l-.07.06L9 11.3 7.35 9.65l-.07-.06a.5.5 0 0 0-.7.7l.07.07 2 2 .07.06c.17.11.4.11.56 0l.07-.06 4-4 .07-.08a.5.5 0 0 0-.06-.63Z"]),c=e.createFluentIcon("ChevronDownRegular","1em",["M15.85 7.65c.2.2.2.5 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16c.2-.2.5-.2.7 0Z"]),t=e.createFluentIcon("ChevronLeftFilled","1em",["M12.27 15.8a.75.75 0 0 1-1.06-.03l-5-5.25a.75.75 0 0 1 0-1.04l5-5.25a.75.75 0 1 1 1.08 1.04L7.8 10l4.5 4.73c.29.3.28.78-.02 1.06Z"]),n=e.createFluentIcon("ChevronLeftRegular","1em",["M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"]),o=e.createFluentIcon("ChevronRightFilled","1em",["M7.73 4.2a.75.75 0 0 1 1.06.03l5 5.25c.28.3.28.75 0 1.04l-5 5.25a.75.75 0 1 1-1.08-1.04L12.2 10l-4.5-4.73a.75.75 0 0 1 .02-1.06Z"]),h=e.createFluentIcon("ChevronRightRegular","1em",["M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"]),i=e.createFluentIcon("CopyRegular","1em",["M8 2a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h6a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8ZM7 4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4ZM4 6a2 2 0 0 1 1-1.73V14.5A2.5 2.5 0 0 0 7.5 17h6.23A2 2 0 0 1 12 18H7.5A3.5 3.5 0 0 1 4 14.5V6Z"]),s=e.createFluentIcon("DismissRegular","1em",["m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"]),u=e.createFluentIcon("DismissCircleFilled","1em",["M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16ZM7.8 7.11a.5.5 0 0 0-.63.06l-.06.07a.5.5 0 0 0 .06.64L9.3 10l-2.12 2.12-.06.07a.5.5 0 0 0 .06.64l.07.06c.2.13.47.11.64-.06L10 10.7l2.12 2.12.07.06c.2.13.46.11.64-.06l.06-.07a.5.5 0 0 0-.06-.64L10.7 10l2.12-2.12.06-.07a.5.5 0 0 0-.06-.64l-.07-.06a.5.5 0 0 0-.64.06L10 9.3 7.88 7.17l-.07-.06Z"]);exports.ChannelRegular=l,exports.CheckmarkCircleFilled=r,exports.CheckmarkFilled=a,exports.ChevronDownRegular=c,exports.ChevronLeftFilled=t,exports.ChevronLeftRegular=n,exports.ChevronRightFilled=o,exports.ChevronRightRegular=h,exports.CopyRegular=i,exports.DismissCircleFilled=u,exports.DismissRegular=s;
1
+ "use strict";var e=require("../utils/createFluentIcon.js");const l=e.createFluentIcon("ChannelRegular","1em",["M3.5 5.5a1 1 0 0 0-1 1 1 1 0 1 0 1-1Zm0-1c-.1 0-.2 0-.3.02A2.5 2.5 0 0 1 5.5 3h9A2.5 2.5 0 0 1 17 5.5v9a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 3 14.5V8.44a2 2 0 0 0 1 0v6.06c0 .83.67 1.5 1.5 1.5h9c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5h-9c-.51 0-.97.26-1.24.65a2 2 0 0 0-.76-.15Zm3.5 4c0-.28.22-.5.5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm.5 2.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3Z"]),a=e.createFluentIcon("CheckmarkFilled","1em",["M7.03 13.9 3.56 10a.75.75 0 0 0-1.12 1l4 4.5c.29.32.79.34 1.09.03l10.5-10.5a.75.75 0 0 0-1.06-1.06l-9.94 9.94Z"]),r=e.createFluentIcon("CheckmarkCircleFilled","1em",["M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm3.36 5.65a.5.5 0 0 0-.64-.06l-.07.06L9 11.3 7.35 9.65l-.07-.06a.5.5 0 0 0-.7.7l.07.07 2 2 .07.06c.17.11.4.11.56 0l.07-.06 4-4 .07-.08a.5.5 0 0 0-.06-.63Z"]),c=e.createFluentIcon("ChevronDownRegular","1em",["M15.85 7.65c.2.2.2.5 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16c.2-.2.5-.2.7 0Z"]),t=e.createFluentIcon("ChevronLeftFilled","1em",["M12.27 15.8a.75.75 0 0 1-1.06-.03l-5-5.25a.75.75 0 0 1 0-1.04l5-5.25a.75.75 0 1 1 1.08 1.04L7.8 10l4.5 4.73c.29.3.28.78-.02 1.06Z"]),n=e.createFluentIcon("ChevronLeftRegular","1em",["M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"]),o=e.createFluentIcon("ChevronRightFilled","1em",["M7.73 4.2a.75.75 0 0 1 1.06.03l5 5.25c.28.3.28.75 0 1.04l-5 5.25a.75.75 0 1 1-1.08-1.04L12.2 10l-4.5-4.73a.75.75 0 0 1 .02-1.06Z"]),i=e.createFluentIcon("ChevronRightRegular","1em",["M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"]),h=e.createFluentIcon("CircleFilled","1em",["M10 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z"]),s=e.createFluentIcon("CopyRegular","1em",["M8 2a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h6a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8ZM7 4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4ZM4 6a2 2 0 0 1 1-1.73V14.5A2.5 2.5 0 0 0 7.5 17h6.23A2 2 0 0 1 12 18H7.5A3.5 3.5 0 0 1 4 14.5V6Z"]),u=e.createFluentIcon("DismissRegular","1em",["m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"]),m=e.createFluentIcon("DismissCircleFilled","1em",["M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16ZM7.8 7.11a.5.5 0 0 0-.63.06l-.06.07a.5.5 0 0 0 .06.64L9.3 10l-2.12 2.12-.06.07a.5.5 0 0 0 .06.64l.07.06c.2.13.47.11.64-.06L10 10.7l2.12 2.12.07.06c.2.13.46.11.64-.06l.06-.07a.5.5 0 0 0-.06-.64L10.7 10l2.12-2.12.06-.07a.5.5 0 0 0-.06-.64l-.07-.06a.5.5 0 0 0-.64.06L10 9.3 7.88 7.17l-.07-.06Z"]);exports.ChannelRegular=l,exports.CheckmarkCircleFilled=r,exports.CheckmarkFilled=a,exports.ChevronDownRegular=c,exports.ChevronLeftFilled=t,exports.ChevronLeftRegular=n,exports.ChevronRightFilled=o,exports.ChevronRightRegular=i,exports.CircleFilled=h,exports.CopyRegular=s,exports.DismissCircleFilled=m,exports.DismissRegular=u;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react"),t=require("./useSwitch.js"),r=require("./renderSwitch.js"),s=require("./useSwitchStyles.styles.js"),u=require("../../../../react-shared-contexts/lib/CustomStyleHooksContext/CustomStyleHooksContext.js");function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}const n=c(e).forwardRef(((e,c)=>{const n=t.useSwitch_unstable(e,c);return s.useSwitchStyles_unstable(n),u.useCustomStyleHook("useSwitchStyles_unstable")(n),r.renderSwitch_unstable(n)}));n.displayName="Switch",exports.Switch=n;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("../../../../react-jsx-runtime/lib/jsx-runtime.js"),s=require("../../../../react-utilities/lib/compose/assertSlots.js");exports.renderSwitch_unstable=t=>{s.assertSlots(t);const{labelPosition:r}=t;return e.jsxs(t.root,{children:[e.jsx(t.input,{}),"after"!==r&&t.label&&e.jsx(t.label,{}),e.jsx(t.indicator,{}),"after"===r&&t.label&&e.jsx(t.label,{})]})};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("react"),t=require("../../../../react-field/lib/contexts/useFieldControlProps.js"),r=require("../../../../react-utilities/lib/utils/getNativeElementProps.js"),i=require("../../../../react-utilities/lib/hooks/useId.js"),l=require("../../../../react-tabster/lib/hooks/useFocusWithin.js"),a=require("../../../../react-utilities/lib/utils/mergeCallbacks.js"),o=require("../../../../react-label/lib/components/Label/Label.js"),s=require("../../../../react-utilities/lib/compose/slot.js"),n=require("../../../../react-icons/lib/icons/chunk-1.js");function u(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=u(e);exports.useSwitch_unstable=(e,u)=>{e=t.useFieldControlProps_unstable(e,{supportsLabelFor:!0,supportsRequired:!0});const{checked:d,defaultChecked:p,disabled:b,labelPosition:h="after",onChange:f,required:m}=e,k=r.getPartitionedNativeProps({props:e,primarySlotTagName:"input",excludedPropNames:["checked","defaultChecked","onChange"]}),y=i.useId("switch-",k.primary.id),P=s.always(e.root,{defaultProps:{ref:l.useFocusWithin(),...k.root},elementType:"div"}),g=s.always(e.indicator,{defaultProps:{"aria-hidden":!0,children:c.createElement(n.CircleFilled,null)},elementType:"div"}),j=s.always(e.input,{defaultProps:{checked:d,defaultChecked:p,id:y,ref:u,role:"switch",type:"checkbox",...k.primary},elementType:"input"});j.onChange=a.mergeCallbacks(j.onChange,(e=>null==f?void 0:f(e,{checked:e.currentTarget.checked})));const q=s.optional(e.label,{defaultProps:{disabled:b,htmlFor:y,required:m,size:"medium"},elementType:o.Label});return{labelPosition:h,components:{root:"div",indicator:"div",input:"input",label:o.Label},root:P,indicator:g,input:j,label:q}};
@@ -0,0 +1 @@
1
+ "use strict";var r=require("../../../../../@griffel/core/mergeClasses.esm.js"),o=require("../../../../../@griffel/react/__resetStyles.esm.js"),e=require("../../../../../@griffel/react/__styles.esm.js");const i={root:"fui-Switch",indicator:"fui-Switch__indicator",input:"fui-Switch__input",label:"fui-Switch__label"},a=o.__resetStyles("r2i81i2","rofhmb8",{r:[".r2i81i2{align-items:flex-start;box-sizing:border-box;display:inline-flex;position:relative;}",".r2i81i2:focus{outline-style:none;}",".r2i81i2:focus-visible{outline-style:none;}",".r2i81i2[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}",'.r2i81i2[data-fui-focus-within]:focus-within::after{content:"";position:absolute;pointer-events:none;z-index:1;border:2px solid var(--colorStrokeFocus2);border-radius:var(--borderRadiusMedium);top:calc(2px * -1);right:calc(2px * -1);bottom:calc(2px * -1);left:calc(2px * -1);}',".rofhmb8{align-items:flex-start;box-sizing:border-box;display:inline-flex;position:relative;}",".rofhmb8:focus{outline-style:none;}",".rofhmb8:focus-visible{outline-style:none;}",".rofhmb8[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}",'.rofhmb8[data-fui-focus-within]:focus-within::after{content:"";position:absolute;pointer-events:none;z-index:1;border:2px solid var(--colorStrokeFocus2);border-radius:var(--borderRadiusMedium);top:calc(2px * -1);left:calc(2px * -1);bottom:calc(2px * -1);right:calc(2px * -1);}'],s:["@media (forced-colors: active){.r2i81i2[data-fui-focus-within]:focus-within::after{border-top-color:Highlight;border-right-color:Highlight;border-bottom-color:Highlight;border-left-color:Highlight;}}","@media (forced-colors: active){.rofhmb8[data-fui-focus-within]:focus-within::after{border-top-color:Highlight;border-left-color:Highlight;border-bottom-color:Highlight;border-right-color:Highlight;}}"]}),t=e.__styles({vertical:{Beiy3e4:"f1vx9l62"}},{d:[".f1vx9l62{flex-direction:column;}"]}),c=o.__resetStyles("r1c3hft5",null,{r:[".r1c3hft5{border-radius:var(--borderRadiusCircular);border:1px solid;line-height:0;box-sizing:border-box;fill:currentColor;flex-shrink:0;font-size:18px;height:20px;margin:var(--spacingVerticalS) var(--spacingHorizontalS);pointer-events:none;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;}",".r1c3hft5>*{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}"],s:["@media screen and (prefers-reduced-motion: reduce){.r1c3hft5{transition-duration:0.01ms;}}","@media (forced-colors: active){.r1c3hft5{color:CanvasText;}.r1c3hft5>i{forced-color-adjust:none;}}","@media screen and (prefers-reduced-motion: reduce){.r1c3hft5>*{transition-duration:0.01ms;}}"]}),l=e.__styles({labelAbove:{B6of3ja:"f1hu3pq6"}},{d:[".f1hu3pq6{margin-top:0;}"]}),n=o.__resetStyles("rsji9ng","r15xih98",{r:[".rsji9ng{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}",".rsji9ng:checked~.fui-Switch__indicator>*{transform:translateX(20px);}",".rsji9ng:disabled{cursor:default;}",".rsji9ng:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}",".rsji9ng:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}",".rsji9ng:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}",".rsji9ng:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}",".rsji9ng:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}",".rsji9ng:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}",".rsji9ng:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}",".rsji9ng:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}",".rsji9ng:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}",".rsji9ng:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}",".rsji9ng:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}",".r15xih98{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}",".r15xih98:checked~.fui-Switch__indicator>*{transform:translateX(-20px);}",".r15xih98:disabled{cursor:default;}",".r15xih98:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}",".r15xih98:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}",".r15xih98:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}",".r15xih98:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}",".r15xih98:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}",".r15xih98:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}",".r15xih98:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}",".r15xih98:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}",".r15xih98:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}",".r15xih98:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}",".r15xih98:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}"],s:["@media (forced-colors: active){.rsji9ng:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.rsji9ng:disabled~.fui-Switch__label{color:GrayText;}.rsji9ng:hover{color:CanvasText;}.rsji9ng:hover:active{color:CanvasText;}.rsji9ng:enabled:checked:hover~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.rsji9ng:enabled:checked:hover:active~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.rsji9ng:enabled:checked~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}}","@media (forced-colors: active){.r15xih98:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.r15xih98:disabled~.fui-Switch__label{color:GrayText;}.r15xih98:hover{color:CanvasText;}.r15xih98:hover:active{color:CanvasText;}.r15xih98:enabled:checked:hover~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.r15xih98:enabled:checked:hover:active~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.r15xih98:enabled:checked~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}}"]}),d=e.__styles({before:{j35jbq:["f1e31b4d","f1vgc2s3"],Bhzewxz:"f15twtuk"},after:{oyh7mz:["f1vgc2s3","f1e31b4d"],Bhzewxz:"f15twtuk"},above:{B5kzvoi:"f1yab3r1",Bqenvij:"f1aar7gd",a9b677:"fly5x3f"}},{d:[".f1e31b4d{right:0;}",".f1vgc2s3{left:0;}",".f15twtuk{top:0;}",".f1yab3r1{bottom:0;}",".f1aar7gd{height:calc(20px + var(--spacingVerticalS));}",".fly5x3f{width:100%;}"]}),s=e.__styles({base:{Bceei9c:"f1k6fduh",jrapky:"f49ad5g",B6of3ja:"f1xlvstr",Byoj8tv:0,uwmqm3:0,z189sj:0,z8tnut:0,B0ocmuz:"f1f5q0n8"},above:{z8tnut:"f1ywm7hm",Byoj8tv:"f14wxoun",a9b677:"fly5x3f"},after:{uwmqm3:["fruq291","f7x41pl"]},before:{z189sj:["f7x41pl","fruq291"]}},{d:[".f1k6fduh{cursor:pointer;}",".f49ad5g{margin-bottom:calc((20px - var(--lineHeightBase300)) / 2);}",".f1xlvstr{margin-top:calc((20px - var(--lineHeightBase300)) / 2);}",[".f1f5q0n8{padding:var(--spacingVerticalS) var(--spacingHorizontalS);}",{p:-1}],".f1ywm7hm{padding-top:var(--spacingVerticalXS);}",".f14wxoun{padding-bottom:var(--spacingVerticalXS);}",".fly5x3f{width:100%;}",".fruq291{padding-left:var(--spacingHorizontalXS);}",".f7x41pl{padding-right:var(--spacingHorizontalXS);}"]});exports.switchClassNames=i,exports.useSwitchStyles_unstable=o=>{const e=a(),u=t(),h=c(),b=l(),f=n(),g=d(),v=s(),{label:p,labelPosition:_}=o;return o.root.className=r.mergeClasses(i.root,e,"above"===_&&u.vertical,o.root.className),o.indicator.className=r.mergeClasses(i.indicator,h,p&&"above"===_&&b.labelAbove,o.indicator.className),o.input.className=r.mergeClasses(i.input,f,p&&g[_],o.input.className),o.label&&(o.label.className=r.mergeClasses(i.label,v.base,v[_],o.label.className)),o};
@@ -57,6 +57,13 @@ export declare class CodicentService {
57
57
  static getFileUrl: (fileId: string, extension?: string) => string;
58
58
  sendMessage: (message: string, parentId?: string) => Promise<string>;
59
59
  chat: (message: string, messageId?: string) => Promise<ChatMessageReply>;
60
+ /**
61
+ * Helper method to make fetch requests with error handling.
62
+ * @param url The URL to fetch.
63
+ * @param method HTTP method (GET, POST, etc).
64
+ * @param options Fetch options (headers, body, etc).
65
+ */
66
+ private request;
60
67
  getMessagesFast: (tags: string[], search?: string, length?: number, publicCodicent?: string | undefined) => Promise<Message[]>;
61
68
  getMessages: (tags: string[], codicent?: string) => Promise<Message[]>;
62
69
  registerUser: (nickname: string, email: string, userId: string, accessToken: string) => Promise<string>;
@@ -105,5 +112,7 @@ export declare class CodicentService {
105
112
  }[]>;
106
113
  getFormById: (id: string) => Promise<any>;
107
114
  private handleUnauthorized;
115
+ getTodoStatus: (messageId: string) => Promise<"done" | "undone" | "unknown">;
116
+ updateTodoStatus: (messageId: string, status: "done" | "undone") => Promise<boolean>;
108
117
  }
109
118
  //# sourceMappingURL=codicent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codicent.d.ts","sourceRoot":"","sources":["../../../src/services/codicent.ts"],"names":[],"mappings":"AAkCA,MAAM,WA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M,UAK1B;IAEF,OAAO,CAAC,QAAQ,CAAe;IAE/B,mBAAmB,QAAa,OAAO,CAAC,OAAO,CAAC,CAe9C;IAEF,uBAAuB,QAAa,OAAO,CAAC,MAAM,CAAC,CAyBjD;IAEF,qBAAqB,YAAmB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,CAoB9D;IAEF,kBAAkB,YAAmB,MAAM,mBAUzC;IAEF,cAAc,OAAc,MAAM,wBAoBhC;IAEF,aAAa,aAAoB,MAAM,wBAmBrC;IAEF,iBAAiB,OAAc,MAAM;;;OAcnC;IAEF,SAAS,YAAmB,MAAM,YAAY,MAAM,qBAuBlD;IAEF,SAAS,+BA8CP;IAEF,YAAY,+BAeV;IAEF,MAAM,CAAC,YAAY,SAAgB,QAAQ,mBAyBzC;IAEF,MAAM,CAAC,gBAAgB,YACZ,MAAM,YACN,MAAM,cACH,MAAM,iCA2BlB;IAEF,QAAQ;cASkB,MAAM;gBAAU,MAAM;eAAS,MAAM;SAC7D;IAEF,WAAW,OAAc,MAAM,kBAO7B;IAGF,OAAO,CAAC,kBAAkB;IAM1B,aAAa,cACA,MAAM,KAChB,OAAO,CAAC,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,CAoBvC;IAEF,gBAAgB,cAAqB,MAAM,UAAU,MAAM,GAAG,QAAQ,sBAiBpE;CACH"}
@@ -1 +1 @@
1
- "use strict";var t,e=require("../node_modules/@stripe/stripe-js/dist/index.js"),n=require("../utils/MessageContent.js");require("../node_modules/tinycolor2/esm/tinycolor.js"),require("react/jsx-runtime"),require("react"),require("../_virtual/index.js"),require("../config/index.js"),require("../lib/wavtools/lib/wav_packer.js"),require("../lib/wavtools/lib/analysis/audio_analysis.js"),require("../lib/wavtools/lib/wav_stream_player.js"),require("../lib/wavtools/lib/wav_recorder.js");let o="https://codicent.com/",a="-";const i=()=>void 0!==window.Codicent&&(window.Codicent.handleMessage=function(t){const e=new CustomEvent("codicent-log",{detail:{message:t}});window.dispatchEvent(e)},window.Codicent.init({token:a,baseUrl:o}),!0);let s=i();if(!s){const t=setInterval((()=>{s=i(),s&&clearInterval(t)}),100)}class r{constructor(t){this.createDataMessage=async(t,e)=>await window.Codicent.data.create({codicent:this.codicent,tag:t,data:e}),this.readDataMessages=async(t,e)=>await window.Codicent.data.read({codicent:this.codicent,tag:t,search:e}),this.readOneDataMessage=async t=>await window.Codicent.data.readOne(t),this.updateDataMessage=async(t,e)=>await window.Codicent.data.update({id:t,data:e,codicent:this.codicent}),this.deleteDataMessage=async t=>await window.Codicent.data.delete({id:t,codicent:this.codicent}),this.getAppTheme=async()=>{try{const t=await window.Codicent.getDataMessages({tags:["app-theme"],codicent:this.codicent});return t.length>0?t[0].data:null}catch(t){return console.error("Error fetching app theme:",t),null}},this.getAppButtons=async()=>{const t=(await window.Codicent.getDataMessages({tags:[this.options.BUTTON_TAG],codicent:this.codicent})).map((t=>t.data));return t.sort(((t,e)=>t.title>e.title?1:-1)),t},this.getAppTasks=async()=>(await window.Codicent.getMessages({search:`@${this.codicent} #app-task`,length:50})).map((t=>{const e=new n.default(t.content).content.split("\n"),o=e[0],a=e.slice(1).join("\n");return{id:t.id,title:o,content:a}})),this.getAppPrompts=async()=>(await window.Codicent.getDataMessages({tags:["chatprompt"],codicent:this.codicent})).map((t=>t.data)).map((({title:t,prompt:e})=>({title:t,prompt:e}))),this.uploadFile=async(t,e)=>await window.Codicent.upload(e,t),this.getFileInfo=async t=>await window.Codicent.getFileInfo(t),this.sendMessage=(t,e)=>window.Codicent.postMessage({message:`@${this.codicent} ${t}`,type:"text",parentId:e}),this.chat=(t,e)=>window.Codicent.getChatReply3({message:t,codicent:this.codicent,messageId:e}),this.getMessagesFast=async(t,e,n=100,a=void 0)=>{const i=await fetch(`${o}app/AppGetMessages`,{method:"POST",headers:[["Authorization",`Bearer ${this.getToken()}`],["Content-Type","application/json; charset=utf-8"]],body:JSON.stringify({tags:t,codicent:this.codicent,search:e,length:n})});if(!i.ok)throw 401===i.status&&this.handleUnauthorized(),new Error(`${i.statusText}`);let s=await i.json();if(s.forEach((t=>{t.createdAt=new Date(Date.parse(t.createdAt))})),a){const t=await this.getPublicFlow(a);s=s.concat(t),s.sort(((t,e)=>e.createdAt.getTime()-t.createdAt.getTime()))}return s},this.getMessages=async(t,e)=>{let n=[];for(const e of t){const t=await window.Codicent.getMessages({search:`@${this.codicent} #${e}`,length:10});"chat"===e&&t.forEach((t=>t.content=`#chat\n${t.content}`)),n=n.concat(t)}if(e)try{const t=await this.getPublicFlow(e);n=n.concat(t)}catch(t){console.warn("Error fetching public flow, PUBLIC_TAG missing in codicent?",t)}return n=n.filter(((t,e,n)=>e===n.findIndex((e=>e.id===t.id)))),n.sort(((t,e)=>e.createdAt.getTime()-t.createdAt.getTime())),n},this.registerUser=async(t,e,n,a)=>{const i=await fetch(`${o}app/RegisterAuth0User`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${a}`]],body:JSON.stringify({nickname:t,email:e,userId:n})});if(!i.ok)return"";const s=await i.text();return window.Codicent.init({token:a,baseUrl:o}),s},this.loginUser=async(t,e)=>{try{const n=await fetch(`${o}app/LoginAuth0User`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${e}`]],body:JSON.stringify({userId:t})});if(!n.ok)return 404===n.status||400===n.status?null:401===n.status?(this.handleUnauthorized(),null):"";const a=await n.text();return this.setToken(a),a}catch(t){return console.warn("Error logging in user:",t),""}},this.nicknameExists=async t=>{const e=await fetch(`${o}app/NicknameExists?nickname=${encodeURIComponent(t)}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"]]});if(!e.ok)return!1;return await e.json()},this.logout=()=>{this.setToken("")},this.isRegistered=()=>null!==localStorage.getItem("codicent_nickname"),this.getApps=async()=>{try{const t=await fetch(`${o}app/AppGetApps`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!t.ok)throw t.status,new Error(`${t.statusText}`);const e=(await t.json()).filter(((t,e,n)=>e===n.findIndex((e=>e.id===t.id))&&(this.options.APP_NAME||t.id.startsWith(this.options.APP_PREFIX))));return e}catch(t){return console.warn("Error fetching apps:",t),null}},this.addFollower=async(t,e)=>{const n=await fetch(`${o}app/AddFollower?nickname=${t}&followerNickname=${e}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!n.ok)throw n.status,new Error(`${n.statusText||"Failed to add follower!"}`);return await n.json()},this.cloneProject=async(t,e)=>{const n=await fetch(`${o}app/CloneProject?project=${t}&newProject=${e}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!n.ok)throw n.status,new Error(`${n.statusText}`);let a=await n.json();if(a){const t='#data #app-theme \n{\n "textcolor": "#212121",\n "backgroundcolor": "#273044",\n "color": "#ffffff",\n "logo": "https://codicent.com/logo512.png",\n "title": "",\n "themeColor": "#581d71",\n "buttonColor": "#c0c0c0",\n "buttonTextColor": "#000000",\n "font": "Montserrat",\n "welcome": "Hej {{username}}!",\n "chatPlaceholder": "Tjena, Loociz här! Vad vill du?",\n "textPlaceholder": "Skriv det du vill spara, så tar jag (Loociz alltså) hand om det!",\n "transcriptionInstructions": "Tryck på knappen för att start och sedan stoppa ljudinspelning."\n}';try{await window.Codicent.postMessage({message:`@${e} ${t}`,type:"text"})||(a=!1)}catch{a=!1}if(a){const t='#data #app-button\n{\n "title": "Ta fram företagsinfo",\n "url": "/#/chat?text=Hej!%20Jag%20vill%20spara%20f%C3%B6retagsinfo.%20Guida%20mig%20steg%20f%C3%B6r%20steg%2C%20ett%20i%20taget%2C%20tills%20vi%20har%20all%20info%20om%20mitt%20f%C3%B6retag.%20Exempel%20p%C3%A5%20data%3A%20f%C3%B6retagsnamn%20eller%20id%C3%A9namn%2C%20org.nr.%2C%20%C3%A4gare%2C%20kontaktinformation%2C%20vision%2C%20aff%C3%A4rsid%C3%A9%2C%20mm."\n}';try{await window.Codicent.postMessage({message:`@${e} ${t}`,type:"text"})||(a=!1)}catch{a=!1}}}return a},this.getNickname=async()=>{try{const t=a.split(".")[1],e=atob(t),n=JSON.parse(e),i=n.sub||n.userId,s=await fetch(`${o}app/GetNickname?userId=${i}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!s.ok)throw 401===s.status?(this.handleUnauthorized(),new Error("Unauthorized")):new Error(`${s.statusText}`);return await s.text()}catch{return""}},this.getChatInstructions=async()=>{try{const t=await window.Codicent.getMessages({search:`@${this.codicent} #instructions`,length:1});if(t.length>0)return t[0].content}catch{console.warn("Error fetching chat instructions")}return""},this.updateChatInstructions=async t=>{try{const e=await window.Codicent.getMessages({search:`@${this.codicent} #instructions`,length:100}),n=`@${this.codicent} #instructions\n${t}`;e.length>0?e[0].content!==n&&(console.log("updating instructions",n),await window.Codicent.postMessage({message:n,type:"text",parentId:e[0].id})):(console.log("new instructions",n),await window.Codicent.postMessage({message:n,type:"text"}))}catch{console.warn("Error updating chat instructions")}},this.getUserInfo=async(t,e=!1)=>{const n=await fetch(`${o}/app/GetUserInfo?nickname=${t}${e?"&t="+Date.now():""}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!n.ok)throw 401===n.status?(this.handleUnauthorized(),new Error("Unauthorized")):new Error(`${n.statusText}`);const a=await n.json(),{email:i,picture:s,description:r,followers:c,properties:h,owner:d}=a;return{nickname:t,email:i,name:r,picture:s,followers:c,properties:h,owner:d}},this.updateUserInfo=async({nickname:t,email:e,name:n,picture:a})=>{const i=await fetch(`${o}/app/AddOrUpdateUser`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]],body:JSON.stringify({nickname:t,email:e,name:n,picture:a,description:""})});if(!i.ok)throw i.status,new Error(`${i.statusText}`);return await this.getUserInfo(t,!0)},this.requestInvite=async(t,e)=>{const n=await fetch(`${o}/app/CreateInvitationOrRequest?forUserNickname=${t}&toProjectNickname=${e}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return!!n.ok||(console.warn(`requestInvite() => ${n.statusText}`),!1)},this.getProjectInfo=this.getUserInfo,this.updateMembersAccess=async(t,e)=>{const n=await fetch(`${o}/app/AddOrUpdateProjectProperty?project=${t}&key=APP_EDITORS&value=${e.join(",")}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return!!n.ok||(console.warn(`updateMembersAccess() => ${n.statusText}`),!1)},this.getMembersAccess=async t=>{const e=(await this.getProjectInfo(t,!0)).properties.find((t=>"APP_EDITORS"===t.name));return e&&e.value?e.value.split(","):[]},this.setToken=t=>{a=t,a&&window.Codicent.init({token:a,baseUrl:o})},this.getToken=()=>a,this.checkPurchaseStatus=async()=>{const t=await fetch(`${o}payments/GetPaymentStatus`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!t.ok)throw new Error("Failed to check purchase status");const{isPaid:e}=await t.json();return e},this.checkSubscriptionStatus=async()=>{if(!this.options.SUBSCRIPTION_NEEDED)return"active";const t=await fetch(`${o}payments/GetSubscriptionStatus?t=${Date.now()}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`],["Cache-Control","no-cache, no-store, must-revalidate"],["Pragma","no-cache"],["Expires","0"]]});if(!t.ok)throw new Error("Failed to check subscription status");const{status:e}=await t.json();return e},this.createCheckoutSession=async t=>{const e=await fetch(`${o}payments/CreateCheckoutSession`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]],body:JSON.stringify({priceId:t,successUrl:window.location.href,cancelUrl:window.location.href})});if(!e.ok)throw new Error("Failed to create checkout session");const{id:n}=await e.json();return n},this.redirectToCheckout=async t=>{const n=await e.loadStripe(this.options.STRIPE_PUBLIC_KEY);if(!n)throw new Error("Stripe failed to load");const o=await this.createCheckoutSession(t),{error:a}=await n.redirectToCheckout({sessionId:o});if(a)throw new Error(a.message)},this.getChatHistory=async t=>{const e=await fetch(`${o}api/GetMessageHistory?messageId=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!e.ok)throw new Error("Failed to get chat history");let n=await e.json();return n=n.filter((t=>!t.content.includes("#function_result")&&!t.content.includes("#finish_reason_function_call"))),n},this.getPublicFlow=async t=>{const e=await fetch(`${o}/app/GetPublicFlow?codicent=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!e.ok)throw new Error("Failed to get public flow");const n=await e.json();return n.forEach((t=>{t.createdAt=new Date(Date.parse(t.createdAt))})),n},this.getMessageContent=async t=>{const e=await fetch(`${o}app/GetMessageContent?id=${t}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(e.ok){const t=await e.json();return{content:t.content,url:t.url}}return{content:"",url:""}},this.logAction=async(t,e)=>{if(!this.options.APP_LOG_CODICENT)return"";const n={content:`@${this.options.APP_LOG_CODICENT} #debug #${e}\n${t}`,type:"text"},a=await fetch(`${o}app/AddChatMessage`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.options.APP_LOG_TOKEN}`]],body:JSON.stringify(n)});if(!a.ok)throw new Error(`${a.statusText||"Failed to post log message!"}`);return(await a.json()).id},this.createApp=async()=>{try{for(let t=0;t<50;t++){const t=Math.floor(99999*Math.random())+1,e=`${this.options.APP_PREFIX}${t}`;if(!await this.nicknameExists(e)){if(await this.cloneProject(this.options.APP_TEMPLATE,e)){if(this.options.ANONYMOUS_TOKEN)try{const t=this.options.ANONYMOUS_TOKEN.split(".")[1],n=atob(t),o=JSON.parse(n).nickname;if(!await this.addFollower(e,o))throw new Error("Failed to add follower: "+o)}catch(t){console.error("Error extracting adding anonymous follower:",t)}return e}}}}catch(t){console.error("Error creating app:",t)}return null},this.findUsername=async()=>{try{for(let t=0;t<50;t++){const t=Math.floor(99999*Math.random())+1,e=`${this.options.USER_PREFIX}${t}`;if(!await this.nicknameExists(e))return e}}catch(t){console.warn("Error finding username:",t)}return null},this.getForms=async()=>{const t=await fetch(`${o}app/GetForms?codicent=${this.codicent}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return await t.json()},this.getFormById=async t=>{const e=await fetch(`${o}app/GetFormById?id=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return await e.json()},this.codicent="",this.options=t}handleUnauthorized(){this.onUnauthorized&&this.onUnauthorized()}}t=r,r.getImageUrl=(t,e)=>`${o}app/GetImage?fileId=${t}&width=${e}`,r.getFileUrl=(t,e)=>`${o}app/DownloadFile?fileId=${t}${e?`&extension=${e}`:""}`,r.downloadFile=async e=>{fetch(t.getFileUrl(e.id)).then((t=>{if(t.headers.forEach(((t,e)=>{console.log(`${e}: ${t}`)})),t.ok)return t.blob();throw new Error("Network response was not ok.")})).then((t=>{const n=window.URL.createObjectURL(t),o=document.createElement("a");o.style.display="none",o.href=n,o.download=e.filename,document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n)})).catch((t=>{console.error("There was a problem with the fetch operation:",t)}))},r.getMiniChatReply=async(t,e="codicent-mini",n)=>{const a=await fetch(`${o}app/GetAi2ChatReply?message=${t}&project=${e}${n?"&messageId="+n:""}`,{method:"GET",headers:[["Authorization","Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjJlMTliNjNmLWQxNDgtNGRmMi04MzMxLTZlZGE3ZTQzNjQ1ZCIsIm5pY2tuYW1lIjoiam9oYW4iLCJuYW1lIjoiSm9oYW4gSXNha3Nzb24iLCJ1c2VySWQiOiIyZTE5YjYzZi1kMTQ4LTRkZjItODMzMS02ZWRhN2U0MzY0NWQiLCJwcm9qZWN0IjoiY29kaWNlbnQtbWluaSIsIm5iZiI6MTczNjkzMjcyOCwiZXhwIjoxNzY4NDY4NzI4LCJpYXQiOjE3MzY5MzI3Mjh9.l2J7GgfU01iihdud7QP1aYBCM3NgxxqiM4VrplLO1s0"]]});if(!a.ok)return void a.status;return(await a.json()).content.replace("@codicent-mini","").trim()},exports.CodicentService=r;
1
+ "use strict";var t,e=require("../node_modules/@stripe/stripe-js/dist/index.js"),a=require("../utils/MessageContent.js");require("../node_modules/tinycolor2/esm/tinycolor.js"),require("react/jsx-runtime"),require("react"),require("../_virtual/index.js"),require("../config/index.js"),require("../lib/wavtools/lib/wav_packer.js"),require("../lib/wavtools/lib/analysis/audio_analysis.js"),require("../lib/wavtools/lib/wav_stream_player.js"),require("../lib/wavtools/lib/wav_recorder.js");let o="https://codicent.com/",n="-";const i=()=>void 0!==window.Codicent&&(window.Codicent.handleMessage=function(t){const e=new CustomEvent("codicent-log",{detail:{message:t}});window.dispatchEvent(e)},window.Codicent.init({token:n,baseUrl:o}),!0);let s=i();if(!s){const t=setInterval((()=>{s=i(),s&&clearInterval(t)}),100)}class r{constructor(t){this.createDataMessage=async(t,e)=>await window.Codicent.data.create({codicent:this.codicent,tag:t,data:e}),this.readDataMessages=async(t,e)=>await window.Codicent.data.read({codicent:this.codicent,tag:t,search:e}),this.readOneDataMessage=async t=>await window.Codicent.data.readOne(t),this.updateDataMessage=async(t,e)=>await window.Codicent.data.update({id:t,data:e,codicent:this.codicent}),this.deleteDataMessage=async t=>await window.Codicent.data.delete({id:t,codicent:this.codicent}),this.getAppTheme=async()=>{try{const t=await window.Codicent.getDataMessages({tags:["app-theme"],codicent:this.codicent});return t.length>0?t[0].data:null}catch(t){return console.error("Error fetching app theme:",t),null}},this.getAppButtons=async()=>{const t=(await window.Codicent.getDataMessages({tags:[this.options.BUTTON_TAG],codicent:this.codicent})).map((t=>t.data));return t.sort(((t,e)=>t.title>e.title?1:-1)),t},this.getAppTasks=async()=>(await window.Codicent.getMessages({search:`@${this.codicent} #app-task`,length:50})).map((t=>{const e=new a.default(t.content).content.split("\n"),o=e[0],n=e.slice(1).join("\n");return{id:t.id,title:o,content:n}})),this.getAppPrompts=async()=>(await window.Codicent.getDataMessages({tags:["chatprompt"],codicent:this.codicent})).map((t=>t.data)).map((({title:t,prompt:e})=>({title:t,prompt:e}))),this.uploadFile=async(t,e)=>await window.Codicent.upload(e,t),this.getFileInfo=async t=>await window.Codicent.getFileInfo(t),this.sendMessage=(t,e)=>window.Codicent.postMessage({message:`@${this.codicent} ${t}`,type:"text",parentId:e}),this.chat=(t,e)=>window.Codicent.getChatReply3({message:t,codicent:this.codicent,messageId:e}),this.getMessagesFast=async(t,e,a=100,n=void 0)=>{const i=await this.request(`${o}app/AppGetMessages`,"POST",{headers:[["Authorization",`Bearer ${this.getToken()}`],["Content-Type","application/json; charset=utf-8"]],body:JSON.stringify({tags:t,codicent:this.codicent,search:e,length:a})});let s=await i.json();if(s.forEach((t=>{t.createdAt=new Date(Date.parse(t.createdAt))})),n){const t=await this.getPublicFlow(n);s=s.concat(t),s.sort(((t,e)=>e.createdAt.getTime()-t.createdAt.getTime()))}return s},this.getMessages=async(t,e)=>{let a=[];const o=t.map((async t=>{const e=await window.Codicent.getMessages({search:`@${this.codicent} #${t}`,length:10});return"chat"===t&&e.forEach((t=>t.content=`#chat\n${t.content}`)),e}));if((await Promise.all(o)).forEach((t=>{a=a.concat(t)})),e)try{const t=await this.getPublicFlow(e);a=a.concat(t)}catch(t){console.warn("Error fetching public flow, PUBLIC_TAG missing in codicent?",t)}return a=a.filter(((t,e,a)=>e===a.findIndex((e=>e.id===t.id)))),a.sort(((t,e)=>e.createdAt.getTime()-t.createdAt.getTime())),a},this.registerUser=async(t,e,a,n)=>{const i=await fetch(`${o}app/RegisterAuth0User`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${n}`]],body:JSON.stringify({nickname:t,email:e,userId:a})});if(!i.ok)return"";const s=await i.text();return window.Codicent.init({token:n,baseUrl:o}),s},this.loginUser=async(t,e)=>{try{const a=await fetch(`${o}app/LoginAuth0User`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${e}`]],body:JSON.stringify({userId:t})});if(!a.ok)return 404===a.status||400===a.status?null:401===a.status?(this.handleUnauthorized(),null):"";const n=await a.text();return this.setToken(n),n}catch(t){return console.warn("Error logging in user:",t),""}},this.nicknameExists=async t=>{const e=await fetch(`${o}app/NicknameExists?nickname=${encodeURIComponent(t)}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"]]});if(!e.ok)return!1;return await e.json()},this.logout=()=>{this.setToken("")},this.isRegistered=()=>null!==localStorage.getItem("codicent_nickname"),this.getApps=async()=>{try{const t=await fetch(`${o}app/AppGetApps`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!t.ok)throw t.status,new Error(`${t.statusText}`);const e=(await t.json()).filter(((t,e,a)=>e===a.findIndex((e=>e.id===t.id))&&(this.options.APP_NAME||t.id.startsWith(this.options.APP_PREFIX))));return e}catch(t){return console.warn("Error fetching apps:",t),null}},this.addFollower=async(t,e)=>{const a=await fetch(`${o}app/AddFollower?nickname=${t}&followerNickname=${e}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!a.ok)throw a.status,new Error(`${a.statusText||"Failed to add follower!"}`);return await a.json()},this.cloneProject=async(t,e)=>{const a=await fetch(`${o}app/CloneProject?project=${t}&newProject=${e}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!a.ok)throw a.status,new Error(`${a.statusText}`);let n=await a.json();if(n){const t='#data #app-theme \n{\n "textcolor": "#212121",\n "backgroundcolor": "#273044",\n "color": "#ffffff",\n "logo": "https://codicent.com/logo512.png",\n "title": "",\n "themeColor": "#581d71",\n "buttonColor": "#c0c0c0",\n "buttonTextColor": "#000000",\n "font": "Montserrat",\n "welcome": "Hej {{username}}!",\n "chatPlaceholder": "Tjena, Loociz här! Vad vill du?",\n "textPlaceholder": "Skriv det du vill spara, så tar jag (Loociz alltså) hand om det!",\n "transcriptionInstructions": "Tryck på knappen för att start och sedan stoppa ljudinspelning."\n}';try{await window.Codicent.postMessage({message:`@${e} ${t}`,type:"text"})||(n=!1)}catch{n=!1}if(n){const t='#data #app-button\n{\n "title": "Ta fram företagsinfo",\n "url": "/#/chat?text=Hej!%20Jag%20vill%20spara%20f%C3%B6retagsinfo.%20Guida%20mig%20steg%20f%C3%B6r%20steg%2C%20ett%20i%20taget%2C%20tills%20vi%20har%20all%20info%20om%20mitt%20f%C3%B6retag.%20Exempel%20p%C3%A5%20data%3A%20f%C3%B6retagsnamn%20eller%20id%C3%A9namn%2C%20org.nr.%2C%20%C3%A4gare%2C%20kontaktinformation%2C%20vision%2C%20aff%C3%A4rsid%C3%A9%2C%20mm."\n}';try{await window.Codicent.postMessage({message:`@${e} ${t}`,type:"text"})||(n=!1)}catch{n=!1}}}return n},this.getNickname=async()=>{try{const t=n.split(".")[1],e=atob(t),a=JSON.parse(e),i=a.sub||a.userId,s=await fetch(`${o}app/GetNickname?userId=${i}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!s.ok)throw 401===s.status?(this.handleUnauthorized(),new Error("Unauthorized")):new Error(`${s.statusText}`);return await s.text()}catch{return""}},this.getChatInstructions=async()=>{try{const t=await window.Codicent.getMessages({search:`@${this.codicent} #instructions`,length:1});if(t.length>0)return t[0].content}catch{console.warn("Error fetching chat instructions")}return""},this.updateChatInstructions=async t=>{try{const e=await window.Codicent.getMessages({search:`@${this.codicent} #instructions`,length:100}),a=`@${this.codicent} #instructions\n${t}`;e.length>0?e[0].content!==a&&(console.log("updating instructions",a),await window.Codicent.postMessage({message:a,type:"text",parentId:e[0].id})):(console.log("new instructions",a),await window.Codicent.postMessage({message:a,type:"text"}))}catch{console.warn("Error updating chat instructions")}},this.getUserInfo=async(t,e=!1)=>{const a=await fetch(`${o}/app/GetUserInfo?nickname=${t}${e?"&t="+Date.now():""}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!a.ok)throw 401===a.status?(this.handleUnauthorized(),new Error("Unauthorized")):new Error(`${a.statusText}`);const n=await a.json(),{email:i,picture:s,description:r,followers:c,properties:h,owner:d}=n;return{nickname:t,email:i,name:r,picture:s,followers:c,properties:h,owner:d}},this.updateUserInfo=async({nickname:t,email:e,name:a,picture:n})=>{const i=await fetch(`${o}/app/AddOrUpdateUser`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]],body:JSON.stringify({nickname:t,email:e,name:a,picture:n,description:""})});if(!i.ok)throw i.status,new Error(`${i.statusText}`);return await this.getUserInfo(t,!0)},this.requestInvite=async(t,e)=>{const a=await fetch(`${o}/app/CreateInvitationOrRequest?forUserNickname=${t}&toProjectNickname=${e}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return!!a.ok||(console.warn(`requestInvite() => ${a.statusText}`),!1)},this.getProjectInfo=this.getUserInfo,this.updateMembersAccess=async(t,e)=>{const a=await fetch(`${o}/app/AddOrUpdateProjectProperty?project=${t}&key=APP_EDITORS&value=${e.join(",")}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return!!a.ok||(console.warn(`updateMembersAccess() => ${a.statusText}`),!1)},this.getMembersAccess=async t=>{const e=(await this.getProjectInfo(t,!0)).properties.find((t=>"APP_EDITORS"===t.name));return e&&e.value?e.value.split(","):[]},this.setToken=t=>{n=t,n&&window.Codicent.init({token:n,baseUrl:o})},this.getToken=()=>n,this.checkPurchaseStatus=async()=>{const t=await fetch(`${o}payments/GetPaymentStatus`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!t.ok)throw new Error("Failed to check purchase status");const{isPaid:e}=await t.json();return e},this.checkSubscriptionStatus=async()=>{if(!this.options.SUBSCRIPTION_NEEDED)return"active";const t=await fetch(`${o}payments/GetSubscriptionStatus?t=${Date.now()}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`],["Cache-Control","no-cache, no-store, must-revalidate"],["Pragma","no-cache"],["Expires","0"]]});if(!t.ok)throw new Error("Failed to check subscription status");const{status:e}=await t.json();return e},this.createCheckoutSession=async t=>{const e=await fetch(`${o}payments/CreateCheckoutSession`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]],body:JSON.stringify({priceId:t,successUrl:window.location.href,cancelUrl:window.location.href})});if(!e.ok)throw new Error("Failed to create checkout session");const{id:a}=await e.json();return a},this.redirectToCheckout=async t=>{const a=await e.loadStripe(this.options.STRIPE_PUBLIC_KEY);if(!a)throw new Error("Stripe failed to load");const o=await this.createCheckoutSession(t),{error:n}=await a.redirectToCheckout({sessionId:o});if(n)throw new Error(n.message)},this.getChatHistory=async t=>{const e=await fetch(`${o}api/GetMessageHistory?messageId=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!e.ok)throw new Error("Failed to get chat history");let a=await e.json();return a=a.filter((t=>!t.content.includes("#function_result")&&!t.content.includes("#finish_reason_function_call"))),a},this.getPublicFlow=async t=>{const e=await fetch(`${o}/app/GetPublicFlow?codicent=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!e.ok)throw new Error("Failed to get public flow");const a=await e.json();return a.forEach((t=>{t.createdAt=new Date(Date.parse(t.createdAt))})),a},this.getMessageContent=async t=>{const e=await fetch(`${o}app/GetMessageContent?id=${t}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(e.ok){const t=await e.json();return{content:t.content,url:t.url}}return{content:"",url:""}},this.logAction=async(t,e)=>{if(!this.options.APP_LOG_CODICENT)return"";const a={content:`@${this.options.APP_LOG_CODICENT} #debug #${e}\n${t}`,type:"text"},n=await fetch(`${o}app/AddChatMessage`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.options.APP_LOG_TOKEN}`]],body:JSON.stringify(a)});if(!n.ok)throw new Error(`${n.statusText||"Failed to post log message!"}`);return(await n.json()).id},this.createApp=async()=>{try{for(let t=0;t<50;t++){const t=Math.floor(99999*Math.random())+1,e=`${this.options.APP_PREFIX}${t}`;if(!await this.nicknameExists(e)){if(await this.cloneProject(this.options.APP_TEMPLATE,e)){if(this.options.ANONYMOUS_TOKEN)try{const t=this.options.ANONYMOUS_TOKEN.split(".")[1],a=atob(t),o=JSON.parse(a).nickname;if(!await this.addFollower(e,o))throw new Error("Failed to add follower: "+o)}catch(t){console.error("Error extracting adding anonymous follower:",t)}return e}}}}catch(t){console.error("Error creating app:",t)}return null},this.findUsername=async()=>{try{for(let t=0;t<50;t++){const t=Math.floor(99999*Math.random())+1,e=`${this.options.USER_PREFIX}${t}`;if(!await this.nicknameExists(e))return e}}catch(t){console.warn("Error finding username:",t)}return null},this.getForms=async()=>{const t=await this.request(`${o}app/GetForms?codicent=${this.codicent}`,"GET",{headers:[["Authorization",`Bearer ${this.getToken()}`]]});return await t.json()},this.getFormById=async t=>{const e=await fetch(`${o}app/GetFormById?id=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return await e.json()},this.getTodoStatus=async t=>{const e=await fetch(`${o}/app/GetTodoStatus?messageId=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return e.ok?await e.text():(e.status,console.warn(`getTodoStatus() => ${e.statusText}`),"unknown")},this.updateTodoStatus=async(t,e)=>{const a=await fetch(`${o}/app/UpdateTodoStatus?messageId=${t}&status=${e}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!a.ok)return console.warn(`updateTodoStatus() => ${a.statusText}`),!1;return await a.json()},this.codicent="",this.options=t}async request(t,e,a={}){const o={};a.headers&&a.headers.forEach((([t,e])=>{o[t]=e}));const n=await fetch(t,{...a,method:e,headers:o});if(!n.ok)throw 401===n.status&&this.handleUnauthorized(),new Error(`${n.statusText}`);return n}handleUnauthorized(){this.onUnauthorized&&this.onUnauthorized()}}t=r,r.getImageUrl=(t,e)=>`${o}app/GetImage?fileId=${t}&width=${e}`,r.getFileUrl=(t,e)=>`${o}app/DownloadFile?fileId=${t}${e?`&extension=${e}`:""}`,r.downloadFile=async e=>{fetch(t.getFileUrl(e.id)).then((t=>{if(t.headers.forEach(((t,e)=>{console.log(`${e}: ${t}`)})),t.ok)return t.blob();throw new Error("Network response was not ok.")})).then((t=>{const a=window.URL.createObjectURL(t),o=document.createElement("a");o.style.display="none",o.href=a,o.download=e.filename,document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(a)})).catch((t=>{console.error("There was a problem with the fetch operation:",t)}))},r.getMiniChatReply=async(t,e="codicent-mini",a)=>{const n=await fetch(`${o}app/GetAi2ChatReply?message=${t}&project=${e}${a?"&messageId="+a:""}`,{method:"GET",headers:[["Authorization","Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjJlMTliNjNmLWQxNDgtNGRmMi04MzMxLTZlZGE3ZTQzNjQ1ZCIsIm5pY2tuYW1lIjoiam9oYW4iLCJuYW1lIjoiSm9oYW4gSXNha3Nzb24iLCJ1c2VySWQiOiIyZTE5YjYzZi1kMTQ4LTRkZjItODMzMS02ZWRhN2U0MzY0NWQiLCJwcm9qZWN0IjoiY29kaWNlbnQtbWluaSIsIm5iZiI6MTczNjkzMjcyOCwiZXhwIjoxNzY4NDY4NzI4LCJpYXQiOjE3MzY5MzI3Mjh9.l2J7GgfU01iihdud7QP1aYBCM3NgxxqiM4VrplLO1s0"]]});if(!n.ok)return void n.status;return(await n.json()).content.replace("@codicent-mini","").trim()},exports.CodicentService=r;
@@ -1 +1 @@
1
- {"version":3,"file":"MessageItem.d.ts","sourceRoot":"","sources":["../../../src/components/MessageItem.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAoH9C,QAAA,MAAM,WAAW,0HAad;IACD,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE,eAAe,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,4CAkOA,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"MessageItem.d.ts","sourceRoot":"","sources":["../../../src/components/MessageItem.tsx"],"names":[],"mappings":"AA6BA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA2H9C,QAAA,MAAM,WAAW,0HAad;IACD,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE,eAAe,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,4CAyTA,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as i,useEffect as r}from"react";import{useNavigate as n}from"react-router-dom";import{CodicentService as s}from"../services/codicent.js";import a from"./Markdown.js";import"./Textarea.js";import"./Button.js";import{Text as l}from"./Text.js";import"./Spinner.js";import"./TextHeader.js";import"./TypingIndicator.js";import"./Dialog.js";import"./ChatInput.js";import"./CombinedPlaceholderDialog.js";import"./ChatMessage.js";import"./Header.js";import m from"../utils/MessageContent.js";import"../node_modules/tinycolor2/esm/tinycolor.js";import"../_virtual/index.js";import{getConfigValue as d}from"../config/index.js";import"../lib/wavtools/lib/wav_packer.js";import"../lib/wavtools/lib/analysis/audio_analysis.js";import"../lib/wavtools/lib/wav_stream_player.js";import"../lib/wavtools/lib/wav_recorder.js";import"../pages/AppFrame.js";import"../pages/Snap.js";import"../pages/Search.js";import"../pages/Login.js";import"../pages/CrmPage.js";import"../pages/ImageView.js";import"../pages/FormInvite.js";import"../pages/FormAccept.js";import"../pages/Sales.js";import"../stores/chatStore.js";import c from"../hooks/useLocalization.js";import"../hooks/useAppStyles.js";import{FileThumbnail as p}from"./FileThumbnail.js";import"./MessageInput.js";import"./UploadFile.js";import"./SnapFooter.js";import"./Profile.js";import"./Content.js";import"./AiInput.js";import"./SearchBox.js";import"./HtmlView.js";import"./Footer.js";import"./Page.js";import{makeStyles as u}from"../node_modules/@griffel/react/makeStyles.esm.js";import{Card as h}from"../node_modules/@fluentui/react-card/lib/components/Card/Card.js";import{FullScreenMaximizeRegular as g}from"../node_modules/@fluentui/react-icons/lib/icons/chunk-2.js";import{ArrowCollapseAllRegular as f,ArrowExpandAllRegular as j}from"../node_modules/@fluentui/react-icons/lib/icons/chunk-0.js";import{CardHeader as x}from"../node_modules/@fluentui/react-card/lib/components/CardHeader/CardHeader.js";import{Skeleton as b}from"../node_modules/@fluentui/react-skeleton/lib/components/Skeleton/Skeleton.js";import{SkeletonItem as S}from"../node_modules/@fluentui/react-skeleton/lib/components/SkeletonItem/SkeletonItem.js";import{Caption1 as O}from"../node_modules/@fluentui/react-text/lib/components/presets/Caption1/Caption1.js";import{tokens as _}from"../node_modules/@fluentui/tokens/lib/tokens.js";import{Edit20Regular as k}from"../node_modules/@fluentui/react-icons/lib/sizedIcons/chunk-7.js";const w=u({iframe:{border:"none",width:"100%",height:"100%"},main:{gap:"36px",display:"flex",flexDirection:"column",flexWrap:"wrap"},card:{minWidth:"300px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",maxHeight:"11em",borderRadius:"10px",position:"relative"},expandedCard:{minWidth:"320px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",borderRadius:"10px",position:"relative"},text:{margin:"0.5em",whiteSpace:"normal",fontSize:"larger"},caption:{color:_.colorNeutralForeground3},headerImage:{borderRadius:"4px",maxWidth:"44px",maxHeight:"44px"},rectangle:{margin:0,top:"-5px",left:"-2px",width:"5px",position:"absolute",height:"100%"},fileList:{display:"flex",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin",msOverflowStyle:"none",padding:"4px",margin:"0 -4px",maxWidth:"100%",boxSizing:"border-box","&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:_.colorNeutralStroke1,borderRadius:"3px"}},htmlButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},headerButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},iconButtonRow:{position:"absolute",top:"0.5em",right:"0.5em",display:"flex",alignItems:"center",gap:"0.5em",zIndex:2},content:{overflow:"hidden",transition:"max-height 0.3s ease-out",userSelect:"text"},truncated:{maxHeight:"10em"},header:{display:"flex",flexDirection:"row",gap:"0.5em"}}),I=({header:u,description:_,timestamp:I,text:v,image:E,tags:N,id:C,fileIds:T,codicentService:y,busy:A,onEdit:B,onShowHtmlPreview:F})=>{const L=w(),R=n(),[H,P]=o(!1),[D,G]=o(!1),z=i(null),M=Object.keys(d("LOGBOOK_TAG_DEFINITIONS")),K=M.find((e=>N.includes(e)))||(T.length>0?M.find((e=>"file"===e)):void 0),[W,$]=o([]),{t:U}=c(),Y=["TYPE","CUSTOMER","CONTACT","SALESPERSON","MESSAGE","COMPANY","PHONE","EMAIL","WEBSITE","INFO","FÖRETAG","ROLE","KONTAKT"],V=[U("Typ"),U("Kund"),U("Kontakt"),U("Säljare"),U("Meddelande"),U("Företag"),U("Telefon"),U("E-post"),U("Hemsida"),U("Info"),U("Företag"),U("Roll"),U("Kontakt")];r((()=>{Promise.all(T.map((e=>y.getFileInfo(e)))).then((e=>{$(e)}))}),[y,$,T]),r((()=>{const e=()=>{if(z.current){const e=z.current.scrollHeight>100+(W.length>0?-72:0);G(e)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[v,W]);const X=()=>P(!H),q=N.includes("chat")&&(v.includes("#function_result")||v.includes("#finish_reason_function_call")),J=e=>{const t=e.indexOf("```html");if(-1===t)return e;const o=e.indexOf("```",t+7);if(-1===o)return e.substring(t+7);return e.substring(t+7,o)},Q=new m(v).data,Z=K&&d("LOGBOOK_TAG_DEFINITIONS")[K].editable,ee=K&&d("LOGBOOK_TAG_DEFINITIONS")[K].imageSize||void 0;return e(h,{className:H?L.expandedCard:L.card,style:{backgroundColor:d("MESSAGE_HIDE_BAR")?K?d("LOGBOOK_TAG_DEFINITIONS")[K].color:d("APP_HEADER_COLOR")||"#eee":"#eee"},onClick:N.includes("chat")?e=>{N.includes("chat")&&(e&&e.stopPropagation(),R("/chat?id="+C))}:void 0,children:[!d("MESSAGE_HIDE_BAR")&&t("div",{className:L.rectangle,style:{backgroundColor:K?d("LOGBOOK_TAG_DEFINITIONS")[K].color:d("APP_HEADER_COLOR")||void 0}}),e("div",{className:L.iconButtonRow,children:[Z&&B&&t(k,{className:L.htmlButton,onClick:()=>B()}),F&&!Z&&N.includes("html")&&t(g,{className:L.htmlButton,onClick:e=>{e.stopPropagation(),F(J(v))}}),D&&!N.includes("chat")&&H&&t(f,{className:L.headerButton,onClick:X}),D&&!N.includes("chat")&&!H&&t(j,{className:L.headerButton,onClick:X})]}),t(x,{image:E?t("img",{className:L.headerImage,src:"app_logo.svg",alt:"User"}):null,header:A?t(b,{style:{width:"50%"},children:t(S,{})}):e("div",{className:L.header,children:[t(l,{weight:"semibold",children:u}),I&&t(l,{weight:"regular",children:I})]}),description:t(O,{className:L.caption,children:_})}),e("div",{ref:z,className:`${L.content} ${H?"":L.truncated}`,children:[W.length>0&&t("div",{className:L.fileList,children:W.map((e=>t(p,{file:e,thumbnailSize:ee,getImageUrl:s.getImageUrl,onClick:()=>{e.contentType.startsWith("image")?R(`/image?id=${C}&file=${e.id}`):s.downloadFile(e)}},e.id)))}),A?e(b,{style:{width:"100%"},children:[t(S,{}),t(S,{}),t(S,{}),t(S,{}),t(S,{})]}):t("div",{className:L.text,children:N.includes("html")?t("iframe",{className:L.iframe,title:"html",srcDoc:J(v),sandbox:"allow-same-origin allow-scripts"}):N.includes("crm")&&0===Object.keys(Q).length?t(a,{content:q?"*Tänker...*":Q?(()=>{const e=new RegExp(`(${Y.join("|")})\\s*:\\s*`,"gi");return v.replace(e,((e,t)=>{const o=Y.indexOf(t.toUpperCase());-1===o&&console.log("Field not found:",t);return`\n**${-1!==o?V[o]:t}:** `})).trim()})():v}):t(a,{content:q?"*Tänker...*":Q&&Q&&Object.keys(Q).length>0?Object.keys(Q).map((e=>{const t=Y.indexOf(e.toUpperCase());return`**${-1!==t?V[t]:e}:** ${Q[e]}\n`})).join("\n"):v})})]})]})};export{I as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as i,useEffect as r}from"react";import{useNavigate as n}from"react-router-dom";import{CodicentService as s}from"../services/codicent.js";import a from"./Markdown.js";import"./Textarea.js";import"./Button.js";import{Text as l}from"./Text.js";import"./Spinner.js";import"./TextHeader.js";import"./TypingIndicator.js";import"./Dialog.js";import"./ChatInput.js";import"./CombinedPlaceholderDialog.js";import"./ChatMessage.js";import"./Header.js";import m from"../utils/MessageContent.js";import"../node_modules/tinycolor2/esm/tinycolor.js";import"../_virtual/index.js";import{getConfigValue as d}from"../config/index.js";import"../lib/wavtools/lib/wav_packer.js";import"../lib/wavtools/lib/analysis/audio_analysis.js";import"../lib/wavtools/lib/wav_stream_player.js";import"../lib/wavtools/lib/wav_recorder.js";import"../pages/AppFrame.js";import"../pages/Snap.js";import"../pages/Search.js";import"../pages/Login.js";import"../pages/CrmPage.js";import"../pages/ImageView.js";import"../pages/FormInvite.js";import"../pages/FormAccept.js";import"../pages/Sales.js";import"../stores/chatStore.js";import c from"../hooks/useLocalization.js";import"../hooks/useAppStyles.js";import{FileThumbnail as p}from"./FileThumbnail.js";import"./MessageInput.js";import"./UploadFile.js";import"./SnapFooter.js";import"./Profile.js";import"./Content.js";import"./AiInput.js";import"./SearchBox.js";import"./HtmlView.js";import"./Footer.js";import"./Page.js";import{makeStyles as u}from"../node_modules/@griffel/react/makeStyles.esm.js";import{Card as h}from"../node_modules/@fluentui/react-card/lib/components/Card/Card.js";import{Switch as g}from"../node_modules/@fluentui/react-switch/lib/components/Switch/Switch.js";import{FullScreenMaximizeRegular as f}from"../node_modules/@fluentui/react-icons/lib/icons/chunk-2.js";import{ArrowCollapseAllRegular as j,ArrowExpandAllRegular as b}from"../node_modules/@fluentui/react-icons/lib/icons/chunk-0.js";import{CardHeader as x}from"../node_modules/@fluentui/react-card/lib/components/CardHeader/CardHeader.js";import{Skeleton as w}from"../node_modules/@fluentui/react-skeleton/lib/components/Skeleton/Skeleton.js";import{SkeletonItem as S}from"../node_modules/@fluentui/react-skeleton/lib/components/SkeletonItem/SkeletonItem.js";import{Caption1 as k}from"../node_modules/@fluentui/react-text/lib/components/presets/Caption1/Caption1.js";import{tokens as _}from"../node_modules/@fluentui/tokens/lib/tokens.js";import{Edit20Regular as O}from"../node_modules/@fluentui/react-icons/lib/sizedIcons/chunk-7.js";const I=u({iframe:{border:"none",width:"100%",height:"100%"},main:{gap:"36px",display:"flex",flexDirection:"column",flexWrap:"wrap"},card:{minWidth:"300px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",maxHeight:"11em",borderRadius:"10px",position:"relative"},expandedCard:{minWidth:"320px",maxWidth:"100%",height:"fit-content",marginBottom:"1em",paddingLeft:"1em",borderRadius:"10px",position:"relative"},text:{margin:"0.5em",whiteSpace:"normal",fontSize:"larger"},caption:{color:_.colorNeutralForeground3},headerImage:{borderRadius:"4px",maxWidth:"44px",maxHeight:"44px"},rectangle:{margin:0,top:"-5px",left:"-2px",width:"5px",position:"absolute",height:"100%"},fileList:{display:"flex",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin",msOverflowStyle:"none",padding:"4px",margin:"0 -4px",maxWidth:"100%",boxSizing:"border-box","&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:_.colorNeutralStroke1,borderRadius:"3px"}},htmlButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},headerButton:{fontSize:"1.5em",cursor:"pointer",marginLeft:"0.5em"},iconButtonRow:{position:"absolute",top:"0.5em",right:"0.5em",display:"flex",alignItems:"center",gap:"0.5em",zIndex:2},content:{overflow:"hidden",transition:"max-height 0.3s ease-out",userSelect:"text"},truncated:{maxHeight:"10em"},header:{display:"flex",flexDirection:"row",gap:"0.5em",alignItems:"center"},todoSwitch:{transform:"scale(0.8)","& .fui-Switch__label":{fontSize:"0.75rem"}}}),E=({header:u,description:_,timestamp:E,text:N,image:v,tags:C,id:T,fileIds:y,codicentService:A,busy:B,onEdit:F,onShowHtmlPreview:L})=>{const R=I(),H=n(),[P,D]=o(!1),[G,z]=o(!1),[M,K]=o("unknown"),[W,$]=o(!1),U=i(null),Y=Object.keys(d("LOGBOOK_TAG_DEFINITIONS")),V=Y.find((e=>C.includes(e)))||(y.length>0?Y.find((e=>"file"===e)):void 0),[X,q]=o([]),J=C.includes("todo"),{t:Q}=c(),Z=["TYPE","CUSTOMER","CONTACT","SALESPERSON","MESSAGE","COMPANY","PHONE","EMAIL","WEBSITE","INFO","FÖRETAG","ROLE","KONTAKT"],ee=[Q("Typ"),Q("Kund"),Q("Kontakt"),Q("Säljare"),Q("Meddelande"),Q("Företag"),Q("Telefon"),Q("E-post"),Q("Hemsida"),Q("Info"),Q("Företag"),Q("Roll"),Q("Kontakt")];r((()=>{Promise.all(y.map((e=>A.getFileInfo(e)))).then((e=>{q(e)}))}),[A,q,y]),r((()=>{const e=()=>{if(U.current){const e=U.current.scrollHeight>100+(X.length>0?-72:0);z(e)}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[N,X]),r((()=>{if(J){(async()=>{try{const e=await A.getTodoStatus(T);K(e)}catch(e){console.error("Error loading todo status:",e),K("unknown")}})()}}),[J,T,A]);const te=()=>D(!P),oe=C.includes("chat")&&(N.includes("#function_result")||N.includes("#finish_reason_function_call")),ie=e=>{const t=e.indexOf("```html");if(-1===t)return e;const o=e.indexOf("```",t+7);if(-1===o)return e.substring(t+7);return e.substring(t+7,o)},re=new m(N).data,ne=V&&d("LOGBOOK_TAG_DEFINITIONS")[V].editable,se=V&&d("LOGBOOK_TAG_DEFINITIONS")[V].imageSize||void 0;return e(h,{className:P?R.expandedCard:R.card,style:{backgroundColor:d("MESSAGE_HIDE_BAR")?V?d("LOGBOOK_TAG_DEFINITIONS")[V].color:d("APP_HEADER_COLOR")||"#eee":"#eee"},onClick:C.includes("chat")?e=>{C.includes("chat")&&(e&&e.stopPropagation(),H("/chat?id="+T))}:void 0,children:[!d("MESSAGE_HIDE_BAR")&&t("div",{className:R.rectangle,style:{backgroundColor:V?d("LOGBOOK_TAG_DEFINITIONS")[V].color:d("APP_HEADER_COLOR")||void 0}}),e("div",{className:R.iconButtonRow,children:[J&&t(g,{className:R.todoSwitch,checked:"done"===M,onChange:(e,t)=>(async e=>{if(!W){$(!0);try{const t=e?"done":"undone";await A.updateTodoStatus(T,t)&&K(t)}catch(e){console.error("Error updating todo status:",e)}finally{$(!1)}}})(t.checked),disabled:W||"unknown"===M,label:Q("done"===M?"Done":"Todo")}),ne&&F&&t(O,{className:R.htmlButton,onClick:()=>F()}),L&&!ne&&C.includes("html")&&t(f,{className:R.htmlButton,onClick:e=>{e.stopPropagation(),L(ie(N))}}),G&&!C.includes("chat")&&P&&t(j,{className:R.headerButton,onClick:te}),G&&!C.includes("chat")&&!P&&t(b,{className:R.headerButton,onClick:te})]}),t(x,{image:v?t("img",{className:R.headerImage,src:"app_logo.svg",alt:"User"}):null,header:B?t(w,{style:{width:"50%"},children:t(S,{})}):e("div",{className:R.header,children:[t(l,{weight:"semibold",children:u}),E&&t(l,{weight:"regular",children:E})]}),description:t(k,{className:R.caption,children:_})}),e("div",{ref:U,className:`${R.content} ${P?"":R.truncated}`,children:[X.length>0&&t("div",{className:R.fileList,children:X.map((e=>t(p,{file:e,thumbnailSize:se,getImageUrl:s.getImageUrl,onClick:()=>{e.contentType.startsWith("image")?H(`/image?id=${T}&file=${e.id}`):s.downloadFile(e)}},e.id)))}),B?e(w,{style:{width:"100%"},children:[t(S,{}),t(S,{}),t(S,{}),t(S,{}),t(S,{})]}):t("div",{className:R.text,children:C.includes("html")?t("iframe",{className:R.iframe,title:"html",srcDoc:ie(N),sandbox:"allow-same-origin allow-scripts"}):C.includes("crm")&&0===Object.keys(re).length?t(a,{content:oe?"*Tänker...*":re?(()=>{const e=new RegExp(`(${Z.join("|")})\\s*:\\s*`,"gi");return N.replace(e,((e,t)=>{const o=Z.indexOf(t.toUpperCase());-1===o&&console.log("Field not found:",t);return`\n**${-1!==o?ee[o]:t}:** `})).trim()})():N}):t(a,{content:oe?"*Tänker...*":re&&re&&Object.keys(re).length>0?Object.keys(re).map((e=>{const t=Z.indexOf(e.toUpperCase());return`**${-1!==t?ee[t]:e}:** ${re[e]}\n`})).join("\n"):N})})]})]})};export{E as default};
@@ -1 +1 @@
1
- {"version":3,"file":"useCodicentState.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCodicentState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAkB,MAAM,IAAI,CAAC;AAErD,QAAA,MAAM,gBAAgB,UAAW,eAAe;;;CA+C/C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"useCodicentState.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCodicentState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAkB,MAAM,IAAI,CAAC;AAErD,QAAA,MAAM,gBAAgB,UAAW,eAAe;;;CA+D/C,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- import{useState as t,useRef as o,useCallback as s,useEffect as e}from"react";import p from"./useStateWithLocalStorage.js";import"../services/codicent.js";import"../components/Markdown.js";import"../components/Textarea.js";import"../components/Button.js";import"react/jsx-runtime";import"../components/Spinner.js";import"../components/TextHeader.js";import"../components/TypingIndicator.js";import"../components/Dialog.js";import"../components/ChatInput.js";import"../components/CombinedPlaceholderDialog.js";import"../components/ChatMessage.js";import"../components/Header.js";import{getConfigValue as r}from"../config/index.js";import"../stores/chatStore.js";import"../utils/MessageContent.js";import"../node_modules/tinycolor2/esm/tinycolor.js";import"../_virtual/index.js";import"../lib/wavtools/lib/wav_packer.js";import"../lib/wavtools/lib/analysis/audio_analysis.js";import"../lib/wavtools/lib/wav_stream_player.js";import"../lib/wavtools/lib/wav_recorder.js";import"./useLocalization.js";import"./useAppStyles.js";import"../components/FileThumbnail.js";import"../components/MessageInput.js";import"../components/UploadFile.js";import"../components/SnapFooter.js";import"../components/Profile.js";import"../components/MessageItem.js";import"../components/Content.js";import"../components/AiInput.js";import"../components/SearchBox.js";import"../components/HtmlView.js";import"../components/Footer.js";import"../components/Page.js";import"../pages/AppFrame.js";import"../pages/Snap.js";import"../pages/Search.js";import"../pages/Login.js";import"../pages/CrmPage.js";import"../pages/ImageView.js";import"../pages/FormInvite.js";import"../pages/FormAccept.js";import"../pages/Sales.js";const i=i=>{const[n,m]=p("APP_WELCOME_STATE_TEXT_"+i.context.selectedApp,""),[a,c]=p("CODICENT_STATE_LAST_TIMESTAMP_"+i.context.selectedApp,0),{service:j,current:l}=i,[T,g]=t(!1),S=o(!1),_=s((async()=>{if(!S.current){S.current=!0;try{const t=await j.getMessagesFast(r("LOGBOOK_TAGS").split(",").filter((t=>"chat"!==t))),o=t.length>0?t[0].createdAt.getTime():a;if(o>a){c(o),g(!0);const t=await j.chat(r("WELCOME_STATUS_PROMPT"));m(t.content)}}finally{g(!1),S.current=!1}}}),[j,a,c,m]),u=s((()=>{j&&r("CHAT_INSTRUCTIONS")&&j.updateChatInstructions(r("CHAT_INSTRUCTIONS")).catch(console.warn)}),[j]);return e((()=>{l===i.allStates.hasAccess&&r("WELCOME_STATUS_PROMPT")?(_(),u()):r("WELCOME_STATUS_PROMPT")||m("")}),[l,i,_,u,m]),{welcomeStatusText:n,updating:T}};export{i as default};
1
+ import{useState as t,useRef as o,useCallback as e,useEffect as s}from"react";import p from"./useStateWithLocalStorage.js";import"../services/codicent.js";import"../components/Markdown.js";import"../components/Textarea.js";import"../components/Button.js";import"react/jsx-runtime";import"../components/Spinner.js";import"../components/TextHeader.js";import"../components/TypingIndicator.js";import"../components/Dialog.js";import"../components/ChatInput.js";import"../components/CombinedPlaceholderDialog.js";import"../components/ChatMessage.js";import"../components/Header.js";import{getConfigValue as r}from"../config/index.js";import"../stores/chatStore.js";import"../utils/MessageContent.js";import"../node_modules/tinycolor2/esm/tinycolor.js";import"../_virtual/index.js";import"../lib/wavtools/lib/wav_packer.js";import"../lib/wavtools/lib/analysis/audio_analysis.js";import"../lib/wavtools/lib/wav_stream_player.js";import"../lib/wavtools/lib/wav_recorder.js";import"./useLocalization.js";import"./useAppStyles.js";import"../components/FileThumbnail.js";import"../components/MessageInput.js";import"../components/UploadFile.js";import"../components/SnapFooter.js";import"../components/Profile.js";import"../components/MessageItem.js";import"../components/Content.js";import"../components/AiInput.js";import"../components/SearchBox.js";import"../components/HtmlView.js";import"../components/Footer.js";import"../components/Page.js";import"../pages/AppFrame.js";import"../pages/Snap.js";import"../pages/Search.js";import"../pages/Login.js";import"../pages/CrmPage.js";import"../pages/ImageView.js";import"../pages/FormInvite.js";import"../pages/FormAccept.js";import"../pages/Sales.js";const i=i=>{const[n,m]=p("APP_WELCOME_STATE_TEXT_"+i.context.selectedApp,""),[a,c]=p("CODICENT_STATE_LAST_TIMESTAMP_"+i.context.selectedApp,0),{service:j,current:l}=i,[T,g]=t(!1),S=o(!1),_=e((async()=>{if(!S.current){S.current=!0;try{const t=await j.getMessagesFast(r("LOGBOOK_TAGS").split(",").filter((t=>"chat"!==t))),o=t.length>0?t[0].createdAt.getTime():a;if(o>a){c(o),g(!0);const t=await j.chat(r("WELCOME_STATUS_PROMPT"));m(t.content)}}finally{g(!1),S.current=!1}}}),[j,a,c,m]),u=e((()=>{j&&r("CHAT_INSTRUCTIONS")}),[j]);return s((()=>{l===i.allStates.hasAccess&&r("WELCOME_STATUS_PROMPT")?(_(),u()):r("WELCOME_STATUS_PROMPT")||m("")}),[l,i,_,u,m]),{welcomeStatusText:n,updating:T}};export{i as default};
@@ -1 +1 @@
1
- import{createFluentIcon as l}from"../utils/createFluentIcon.js";const a=l("ChannelRegular","1em",["M3.5 5.5a1 1 0 0 0-1 1 1 1 0 1 0 1-1Zm0-1c-.1 0-.2 0-.3.02A2.5 2.5 0 0 1 5.5 3h9A2.5 2.5 0 0 1 17 5.5v9a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 3 14.5V8.44a2 2 0 0 0 1 0v6.06c0 .83.67 1.5 1.5 1.5h9c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5h-9c-.51 0-.97.26-1.24.65a2 2 0 0 0-.76-.15Zm3.5 4c0-.28.22-.5.5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm.5 2.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3Z"]),e=l("CheckmarkFilled","1em",["M7.03 13.9 3.56 10a.75.75 0 0 0-1.12 1l4 4.5c.29.32.79.34 1.09.03l10.5-10.5a.75.75 0 0 0-1.06-1.06l-9.94 9.94Z"]),c=l("CheckmarkCircleFilled","1em",["M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm3.36 5.65a.5.5 0 0 0-.64-.06l-.07.06L9 11.3 7.35 9.65l-.07-.06a.5.5 0 0 0-.7.7l.07.07 2 2 .07.06c.17.11.4.11.56 0l.07-.06 4-4 .07-.08a.5.5 0 0 0-.06-.63Z"]),m=l("ChevronDownRegular","1em",["M15.85 7.65c.2.2.2.5 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16c.2-.2.5-.2.7 0Z"]),h=l("ChevronLeftFilled","1em",["M12.27 15.8a.75.75 0 0 1-1.06-.03l-5-5.25a.75.75 0 0 1 0-1.04l5-5.25a.75.75 0 1 1 1.08 1.04L7.8 10l4.5 4.73c.29.3.28.78-.02 1.06Z"]),r=l("ChevronLeftRegular","1em",["M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"]),L=l("ChevronRightFilled","1em",["M7.73 4.2a.75.75 0 0 1 1.06.03l5 5.25c.28.3.28.75 0 1.04l-5 5.25a.75.75 0 1 1-1.08-1.04L12.2 10l-4.5-4.73a.75.75 0 0 1 .02-1.06Z"]),Z=l("ChevronRightRegular","1em",["M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"]),i=l("CopyRegular","1em",["M8 2a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h6a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8ZM7 4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4ZM4 6a2 2 0 0 1 1-1.73V14.5A2.5 2.5 0 0 0 7.5 17h6.23A2 2 0 0 1 12 18H7.5A3.5 3.5 0 0 1 4 14.5V6Z"]),M=l("DismissRegular","1em",["m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"]),o=l("DismissCircleFilled","1em",["M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16ZM7.8 7.11a.5.5 0 0 0-.63.06l-.06.07a.5.5 0 0 0 .06.64L9.3 10l-2.12 2.12-.06.07a.5.5 0 0 0 .06.64l.07.06c.2.13.47.11.64-.06L10 10.7l2.12 2.12.07.06c.2.13.46.11.64-.06l.06-.07a.5.5 0 0 0-.06-.64L10.7 10l2.12-2.12.06-.07a.5.5 0 0 0-.06-.64l-.07-.06a.5.5 0 0 0-.64.06L10 9.3 7.88 7.17l-.07-.06Z"]);export{a as ChannelRegular,c as CheckmarkCircleFilled,e as CheckmarkFilled,m as ChevronDownRegular,h as ChevronLeftFilled,r as ChevronLeftRegular,L as ChevronRightFilled,Z as ChevronRightRegular,i as CopyRegular,o as DismissCircleFilled,M as DismissRegular};
1
+ import{createFluentIcon as l}from"../utils/createFluentIcon.js";const a=l("ChannelRegular","1em",["M3.5 5.5a1 1 0 0 0-1 1 1 1 0 1 0 1-1Zm0-1c-.1 0-.2 0-.3.02A2.5 2.5 0 0 1 5.5 3h9A2.5 2.5 0 0 1 17 5.5v9a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 3 14.5V8.44a2 2 0 0 0 1 0v6.06c0 .83.67 1.5 1.5 1.5h9c.83 0 1.5-.67 1.5-1.5v-9c0-.83-.67-1.5-1.5-1.5h-9c-.51 0-.97.26-1.24.65a2 2 0 0 0-.76-.15Zm3.5 4c0-.28.22-.5.5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm.5 2.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3Z"]),e=l("CheckmarkFilled","1em",["M7.03 13.9 3.56 10a.75.75 0 0 0-1.12 1l4 4.5c.29.32.79.34 1.09.03l10.5-10.5a.75.75 0 0 0-1.06-1.06l-9.94 9.94Z"]),c=l("CheckmarkCircleFilled","1em",["M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm3.36 5.65a.5.5 0 0 0-.64-.06l-.07.06L9 11.3 7.35 9.65l-.07-.06a.5.5 0 0 0-.7.7l.07.07 2 2 .07.06c.17.11.4.11.56 0l.07-.06 4-4 .07-.08a.5.5 0 0 0-.06-.63Z"]),m=l("ChevronDownRegular","1em",["M15.85 7.65c.2.2.2.5 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16c.2-.2.5-.2.7 0Z"]),h=l("ChevronLeftFilled","1em",["M12.27 15.8a.75.75 0 0 1-1.06-.03l-5-5.25a.75.75 0 0 1 0-1.04l5-5.25a.75.75 0 1 1 1.08 1.04L7.8 10l4.5 4.73c.29.3.28.78-.02 1.06Z"]),r=l("ChevronLeftRegular","1em",["M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"]),Z=l("ChevronRightFilled","1em",["M7.73 4.2a.75.75 0 0 1 1.06.03l5 5.25c.28.3.28.75 0 1.04l-5 5.25a.75.75 0 1 1-1.08-1.04L12.2 10l-4.5-4.73a.75.75 0 0 1 .02-1.06Z"]),L=l("ChevronRightRegular","1em",["M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"]),i=l("CircleFilled","1em",["M10 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z"]),M=l("CopyRegular","1em",["M8 2a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h6a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8ZM7 4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4ZM4 6a2 2 0 0 1 1-1.73V14.5A2.5 2.5 0 0 0 7.5 17h6.23A2 2 0 0 1 12 18H7.5A3.5 3.5 0 0 1 4 14.5V6Z"]),o=l("DismissRegular","1em",["m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"]),C=l("DismissCircleFilled","1em",["M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16ZM7.8 7.11a.5.5 0 0 0-.63.06l-.06.07a.5.5 0 0 0 .06.64L9.3 10l-2.12 2.12-.06.07a.5.5 0 0 0 .06.64l.07.06c.2.13.47.11.64-.06L10 10.7l2.12 2.12.07.06c.2.13.46.11.64-.06l.06-.07a.5.5 0 0 0-.06-.64L10.7 10l2.12-2.12.06-.07a.5.5 0 0 0-.06-.64l-.07-.06a.5.5 0 0 0-.64.06L10 9.3 7.88 7.17l-.07-.06Z"]);export{a as ChannelRegular,c as CheckmarkCircleFilled,e as CheckmarkFilled,m as ChevronDownRegular,h as ChevronLeftFilled,r as ChevronLeftRegular,Z as ChevronRightFilled,L as ChevronRightRegular,i as CircleFilled,M as CopyRegular,C as DismissCircleFilled,o as DismissRegular};
@@ -0,0 +1 @@
1
+ import*as t from"react";import{useSwitch_unstable as o}from"./useSwitch.js";import{renderSwitch_unstable as s}from"./renderSwitch.js";import{useSwitchStyles_unstable as e}from"./useSwitchStyles.styles.js";import{useCustomStyleHook as r}from"../../../../react-shared-contexts/lib/CustomStyleHooksContext/CustomStyleHooksContext.js";const m=t.forwardRef(((t,m)=>{const i=o(t,m);return e(i),r("useSwitchStyles_unstable")(i),s(i)}));m.displayName="Switch";export{m as Switch};
@@ -0,0 +1 @@
1
+ import{jsxs as t,jsx as e}from"../../../../react-jsx-runtime/lib/jsx-runtime.js";import{assertSlots as r}from"../../../../react-utilities/lib/compose/assertSlots.js";const i=i=>{r(i);const{labelPosition:l}=i;return t(i.root,{children:[e(i.input,{}),"after"!==l&&i.label&&e(i.label,{}),e(i.indicator,{}),"after"===l&&i.label&&e(i.label,{})]})};export{i as renderSwitch_unstable};
@@ -0,0 +1 @@
1
+ import*as e from"react";import{useFieldControlProps_unstable as t}from"../../../../react-field/lib/contexts/useFieldControlProps.js";import{getPartitionedNativeProps as i}from"../../../../react-utilities/lib/utils/getNativeElementProps.js";import{useId as o}from"../../../../react-utilities/lib/hooks/useId.js";import{useFocusWithin as r}from"../../../../react-tabster/lib/hooks/useFocusWithin.js";import{mergeCallbacks as l}from"../../../../react-utilities/lib/utils/mergeCallbacks.js";import{Label as s}from"../../../../react-label/lib/components/Label/Label.js";import{always as a,optional as c}from"../../../../react-utilities/lib/compose/slot.js";import{CircleFilled as n}from"../../../../react-icons/lib/icons/chunk-1.js";const d=(d,p)=>{d=t(d,{supportsLabelFor:!0,supportsRequired:!0});const{checked:m,defaultChecked:u,disabled:b,labelPosition:h="after",onChange:f,required:k}=d,C=i({props:d,primarySlotTagName:"input",excludedPropNames:["checked","defaultChecked","onChange"]}),P=o("switch-",C.primary.id),g=a(d.root,{defaultProps:{ref:r(),...C.root},elementType:"div"}),j=a(d.indicator,{defaultProps:{"aria-hidden":!0,children:e.createElement(n,null)},elementType:"div"}),y=a(d.input,{defaultProps:{checked:m,defaultChecked:u,id:P,ref:p,role:"switch",type:"checkbox",...C.primary},elementType:"input"});y.onChange=l(y.onChange,(e=>null==f?void 0:f(e,{checked:e.currentTarget.checked})));const v=c(d.label,{defaultProps:{disabled:b,htmlFor:P,required:k,size:"medium"},elementType:s});return{labelPosition:h,components:{root:"div",indicator:"div",input:"input",label:s},root:g,indicator:j,input:y,label:v}};export{d as useSwitch_unstable};
@@ -0,0 +1 @@
1
+ import{mergeClasses as r}from"../../../../../@griffel/core/mergeClasses.esm.js";import{__resetStyles as o}from"../../../../../@griffel/react/__resetStyles.esm.js";import{__styles as e}from"../../../../../@griffel/react/__styles.esm.js";const i={root:"fui-Switch",indicator:"fui-Switch__indicator",input:"fui-Switch__input",label:"fui-Switch__label"},a=o("r2i81i2","rofhmb8",{r:[".r2i81i2{align-items:flex-start;box-sizing:border-box;display:inline-flex;position:relative;}",".r2i81i2:focus{outline-style:none;}",".r2i81i2:focus-visible{outline-style:none;}",".r2i81i2[data-fui-focus-within]:focus-within{border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent;}",'.r2i81i2[data-fui-focus-within]:focus-within::after{content:"";position:absolute;pointer-events:none;z-index:1;border:2px solid var(--colorStrokeFocus2);border-radius:var(--borderRadiusMedium);top:calc(2px * -1);right:calc(2px * -1);bottom:calc(2px * -1);left:calc(2px * -1);}',".rofhmb8{align-items:flex-start;box-sizing:border-box;display:inline-flex;position:relative;}",".rofhmb8:focus{outline-style:none;}",".rofhmb8:focus-visible{outline-style:none;}",".rofhmb8[data-fui-focus-within]:focus-within{border-top-color:transparent;border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;}",'.rofhmb8[data-fui-focus-within]:focus-within::after{content:"";position:absolute;pointer-events:none;z-index:1;border:2px solid var(--colorStrokeFocus2);border-radius:var(--borderRadiusMedium);top:calc(2px * -1);left:calc(2px * -1);bottom:calc(2px * -1);right:calc(2px * -1);}'],s:["@media (forced-colors: active){.r2i81i2[data-fui-focus-within]:focus-within::after{border-top-color:Highlight;border-right-color:Highlight;border-bottom-color:Highlight;border-left-color:Highlight;}}","@media (forced-colors: active){.rofhmb8[data-fui-focus-within]:focus-within::after{border-top-color:Highlight;border-left-color:Highlight;border-bottom-color:Highlight;border-right-color:Highlight;}}"]}),c=e({vertical:{Beiy3e4:"f1vx9l62"}},{d:[".f1vx9l62{flex-direction:column;}"]}),t=o("r1c3hft5",null,{r:[".r1c3hft5{border-radius:var(--borderRadiusCircular);border:1px solid;line-height:0;box-sizing:border-box;fill:currentColor;flex-shrink:0;font-size:18px;height:20px;margin:var(--spacingVerticalS) var(--spacingHorizontalS);pointer-events:none;transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:background,border,color;width:40px;}",".r1c3hft5>*{transition-duration:var(--durationNormal);transition-timing-function:var(--curveEasyEase);transition-property:transform;}"],s:["@media screen and (prefers-reduced-motion: reduce){.r1c3hft5{transition-duration:0.01ms;}}","@media (forced-colors: active){.r1c3hft5{color:CanvasText;}.r1c3hft5>i{forced-color-adjust:none;}}","@media screen and (prefers-reduced-motion: reduce){.r1c3hft5>*{transition-duration:0.01ms;}}"]}),l=e({labelAbove:{B6of3ja:"f1hu3pq6"}},{d:[".f1hu3pq6{margin-top:0;}"]}),n=o("rsji9ng","r15xih98",{r:[".rsji9ng{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}",".rsji9ng:checked~.fui-Switch__indicator>*{transform:translateX(20px);}",".rsji9ng:disabled{cursor:default;}",".rsji9ng:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}",".rsji9ng:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}",".rsji9ng:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}",".rsji9ng:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}",".rsji9ng:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}",".rsji9ng:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}",".rsji9ng:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}",".rsji9ng:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}",".rsji9ng:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}",".rsji9ng:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}",".rsji9ng:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}",".r15xih98{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;position:absolute;width:calc(40px + 2 * var(--spacingHorizontalS));}",".r15xih98:checked~.fui-Switch__indicator>*{transform:translateX(-20px);}",".r15xih98:disabled{cursor:default;}",".r15xih98:disabled~.fui-Switch__indicator{color:var(--colorNeutralForegroundDisabled);}",".r15xih98:disabled~.fui-Switch__label{cursor:default;color:var(--colorNeutralForegroundDisabled);}",".r15xih98:enabled:not(:checked)~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessible);border-color:var(--colorNeutralStrokeAccessible);}",".r15xih98:enabled:not(:checked)~.fui-Switch__label{color:var(--colorNeutralForeground1);}",".r15xih98:enabled:not(:checked):hover~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessibleHover);border-color:var(--colorNeutralStrokeAccessibleHover);}",".r15xih98:enabled:not(:checked):hover:active~.fui-Switch__indicator{color:var(--colorNeutralStrokeAccessiblePressed);border-color:var(--colorNeutralStrokeAccessiblePressed);}",".r15xih98:enabled:checked~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackground);color:var(--colorNeutralForegroundInverted);border-color:var(--colorTransparentStroke);}",".r15xih98:enabled:checked:hover~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundHover);border-color:var(--colorTransparentStrokeInteractive);}",".r15xih98:enabled:checked:hover:active~.fui-Switch__indicator{background-color:var(--colorCompoundBrandBackgroundPressed);border-color:var(--colorTransparentStrokeInteractive);}",".r15xih98:disabled:not(:checked)~.fui-Switch__indicator{border-color:var(--colorNeutralStrokeDisabled);}",".r15xih98:disabled:checked~.fui-Switch__indicator{background-color:var(--colorNeutralBackgroundDisabled);border-color:var(--colorTransparentStrokeDisabled);}"],s:["@media (forced-colors: active){.rsji9ng:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.rsji9ng:disabled~.fui-Switch__label{color:GrayText;}.rsji9ng:hover{color:CanvasText;}.rsji9ng:hover:active{color:CanvasText;}.rsji9ng:enabled:checked:hover~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.rsji9ng:enabled:checked:hover:active~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.rsji9ng:enabled:checked~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}}","@media (forced-colors: active){.r15xih98:disabled~.fui-Switch__indicator{color:GrayText;border-color:GrayText;}.r15xih98:disabled~.fui-Switch__label{color:GrayText;}.r15xih98:hover{color:CanvasText;}.r15xih98:hover:active{color:CanvasText;}.r15xih98:enabled:checked:hover~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.r15xih98:enabled:checked:hover:active~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}.r15xih98:enabled:checked~.fui-Switch__indicator{background-color:Highlight;color:Canvas;}}"]}),d=e({before:{j35jbq:["f1e31b4d","f1vgc2s3"],Bhzewxz:"f15twtuk"},after:{oyh7mz:["f1vgc2s3","f1e31b4d"],Bhzewxz:"f15twtuk"},above:{B5kzvoi:"f1yab3r1",Bqenvij:"f1aar7gd",a9b677:"fly5x3f"}},{d:[".f1e31b4d{right:0;}",".f1vgc2s3{left:0;}",".f15twtuk{top:0;}",".f1yab3r1{bottom:0;}",".f1aar7gd{height:calc(20px + var(--spacingVerticalS));}",".fly5x3f{width:100%;}"]}),s=e({base:{Bceei9c:"f1k6fduh",jrapky:"f49ad5g",B6of3ja:"f1xlvstr",Byoj8tv:0,uwmqm3:0,z189sj:0,z8tnut:0,B0ocmuz:"f1f5q0n8"},above:{z8tnut:"f1ywm7hm",Byoj8tv:"f14wxoun",a9b677:"fly5x3f"},after:{uwmqm3:["fruq291","f7x41pl"]},before:{z189sj:["f7x41pl","fruq291"]}},{d:[".f1k6fduh{cursor:pointer;}",".f49ad5g{margin-bottom:calc((20px - var(--lineHeightBase300)) / 2);}",".f1xlvstr{margin-top:calc((20px - var(--lineHeightBase300)) / 2);}",[".f1f5q0n8{padding:var(--spacingVerticalS) var(--spacingHorizontalS);}",{p:-1}],".f1ywm7hm{padding-top:var(--spacingVerticalXS);}",".f14wxoun{padding-bottom:var(--spacingVerticalXS);}",".fly5x3f{width:100%;}",".fruq291{padding-left:var(--spacingHorizontalXS);}",".f7x41pl{padding-right:var(--spacingHorizontalXS);}"]}),u=o=>{const e=a(),u=c(),h=t(),b=l(),f=n(),v=d(),g=s(),{label:p,labelPosition:x}=o;return o.root.className=r(i.root,e,"above"===x&&u.vertical,o.root.className),o.indicator.className=r(i.indicator,h,p&&"above"===x&&b.labelAbove,o.indicator.className),o.input.className=r(i.input,f,p&&v[x],o.input.className),o.label&&(o.label.className=r(i.label,g.base,g[x],o.label.className)),o};export{i as switchClassNames,u as useSwitchStyles_unstable};
@@ -57,6 +57,13 @@ export declare class CodicentService {
57
57
  static getFileUrl: (fileId: string, extension?: string) => string;
58
58
  sendMessage: (message: string, parentId?: string) => Promise<string>;
59
59
  chat: (message: string, messageId?: string) => Promise<ChatMessageReply>;
60
+ /**
61
+ * Helper method to make fetch requests with error handling.
62
+ * @param url The URL to fetch.
63
+ * @param method HTTP method (GET, POST, etc).
64
+ * @param options Fetch options (headers, body, etc).
65
+ */
66
+ private request;
60
67
  getMessagesFast: (tags: string[], search?: string, length?: number, publicCodicent?: string | undefined) => Promise<Message[]>;
61
68
  getMessages: (tags: string[], codicent?: string) => Promise<Message[]>;
62
69
  registerUser: (nickname: string, email: string, userId: string, accessToken: string) => Promise<string>;
@@ -105,5 +112,7 @@ export declare class CodicentService {
105
112
  }[]>;
106
113
  getFormById: (id: string) => Promise<any>;
107
114
  private handleUnauthorized;
115
+ getTodoStatus: (messageId: string) => Promise<"done" | "undone" | "unknown">;
116
+ updateTodoStatus: (messageId: string, status: "done" | "undone") => Promise<boolean>;
108
117
  }
109
118
  //# sourceMappingURL=codicent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codicent.d.ts","sourceRoot":"","sources":["../../../src/services/codicent.ts"],"names":[],"mappings":"AAkCA,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvC,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CA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AC,gBAAgB,YACZ,MAAM,YACN,MAAM,cACH,MAAM,iCA2BlB;IAEF,QAAQ;cASkB,MAAM;gBAAU,MAAM;eAAS,MAAM;SAC7D;IAEF,WAAW,OAAc,MAAM,kBAO7B;IAGF,OAAO,CAAC,kBAAkB;IAM1B,aAAa,cACA,MAAM,KAChB,OAAO,CAAC,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC,CAoBvC;IAEF,gBAAgB,cAAqB,MAAM,UAAU,MAAM,GAAG,QAAQ,sBAiBpE;CACH"}
@@ -1 +1 @@
1
- import{loadStripe as t}from"../node_modules/@stripe/stripe-js/dist/index.js";import e from"../utils/MessageContent.js";import"../node_modules/tinycolor2/esm/tinycolor.js";import"react/jsx-runtime";import"react";import"../_virtual/index.js";import"../config/index.js";import"../lib/wavtools/lib/wav_packer.js";import"../lib/wavtools/lib/analysis/audio_analysis.js";import"../lib/wavtools/lib/wav_stream_player.js";import"../lib/wavtools/lib/wav_recorder.js";var o;let n="https://codicent.com/",a="-";const i=()=>void 0!==window.Codicent&&(window.Codicent.handleMessage=function(t){const e=new CustomEvent("codicent-log",{detail:{message:t}});window.dispatchEvent(e)},window.Codicent.init({token:a,baseUrl:n}),!0);let s=i();if(!s){const t=setInterval((()=>{s=i(),s&&clearInterval(t)}),100)}class r{constructor(o){this.createDataMessage=async(t,e)=>await window.Codicent.data.create({codicent:this.codicent,tag:t,data:e}),this.readDataMessages=async(t,e)=>await window.Codicent.data.read({codicent:this.codicent,tag:t,search:e}),this.readOneDataMessage=async t=>await window.Codicent.data.readOne(t),this.updateDataMessage=async(t,e)=>await window.Codicent.data.update({id:t,data:e,codicent:this.codicent}),this.deleteDataMessage=async t=>await window.Codicent.data.delete({id:t,codicent:this.codicent}),this.getAppTheme=async()=>{try{const t=await window.Codicent.getDataMessages({tags:["app-theme"],codicent:this.codicent});return t.length>0?t[0].data:null}catch(t){return console.error("Error fetching app theme:",t),null}},this.getAppButtons=async()=>{const t=(await window.Codicent.getDataMessages({tags:[this.options.BUTTON_TAG],codicent:this.codicent})).map((t=>t.data));return t.sort(((t,e)=>t.title>e.title?1:-1)),t},this.getAppTasks=async()=>(await window.Codicent.getMessages({search:`@${this.codicent} #app-task`,length:50})).map((t=>{const o=new e(t.content).content.split("\n"),n=o[0],a=o.slice(1).join("\n");return{id:t.id,title:n,content:a}})),this.getAppPrompts=async()=>(await window.Codicent.getDataMessages({tags:["chatprompt"],codicent:this.codicent})).map((t=>t.data)).map((({title:t,prompt:e})=>({title:t,prompt:e}))),this.uploadFile=async(t,e)=>await window.Codicent.upload(e,t),this.getFileInfo=async t=>await window.Codicent.getFileInfo(t),this.sendMessage=(t,e)=>window.Codicent.postMessage({message:`@${this.codicent} ${t}`,type:"text",parentId:e}),this.chat=(t,e)=>window.Codicent.getChatReply3({message:t,codicent:this.codicent,messageId:e}),this.getMessagesFast=async(t,e,o=100,a=void 0)=>{const i=await fetch(`${n}app/AppGetMessages`,{method:"POST",headers:[["Authorization",`Bearer ${this.getToken()}`],["Content-Type","application/json; charset=utf-8"]],body:JSON.stringify({tags:t,codicent:this.codicent,search:e,length:o})});if(!i.ok)throw 401===i.status&&this.handleUnauthorized(),new Error(`${i.statusText}`);let s=await i.json();if(s.forEach((t=>{t.createdAt=new Date(Date.parse(t.createdAt))})),a){const t=await this.getPublicFlow(a);s=s.concat(t),s.sort(((t,e)=>e.createdAt.getTime()-t.createdAt.getTime()))}return s},this.getMessages=async(t,e)=>{let o=[];for(const e of t){const t=await window.Codicent.getMessages({search:`@${this.codicent} #${e}`,length:10});"chat"===e&&t.forEach((t=>t.content=`#chat\n${t.content}`)),o=o.concat(t)}if(e)try{const t=await this.getPublicFlow(e);o=o.concat(t)}catch(t){console.warn("Error fetching public flow, PUBLIC_TAG missing in codicent?",t)}return o=o.filter(((t,e,o)=>e===o.findIndex((e=>e.id===t.id)))),o.sort(((t,e)=>e.createdAt.getTime()-t.createdAt.getTime())),o},this.registerUser=async(t,e,o,a)=>{const i=await fetch(`${n}app/RegisterAuth0User`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${a}`]],body:JSON.stringify({nickname:t,email:e,userId:o})});if(!i.ok)return"";const s=await i.text();return window.Codicent.init({token:a,baseUrl:n}),s},this.loginUser=async(t,e)=>{try{const o=await fetch(`${n}app/LoginAuth0User`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${e}`]],body:JSON.stringify({userId:t})});if(!o.ok)return 404===o.status||400===o.status?null:401===o.status?(this.handleUnauthorized(),null):"";const a=await o.text();return this.setToken(a),a}catch(t){return console.warn("Error logging in user:",t),""}},this.nicknameExists=async t=>{const e=await fetch(`${n}app/NicknameExists?nickname=${encodeURIComponent(t)}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"]]});if(!e.ok)return!1;return await e.json()},this.logout=()=>{this.setToken("")},this.isRegistered=()=>null!==localStorage.getItem("codicent_nickname"),this.getApps=async()=>{try{const t=await fetch(`${n}app/AppGetApps`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!t.ok)throw t.status,new Error(`${t.statusText}`);const e=await t.json();return e.filter(((t,e,o)=>e===o.findIndex((e=>e.id===t.id))&&(this.options.APP_NAME||t.id.startsWith(this.options.APP_PREFIX))))}catch(t){return console.warn("Error fetching apps:",t),null}},this.addFollower=async(t,e)=>{const o=await fetch(`${n}app/AddFollower?nickname=${t}&followerNickname=${e}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!o.ok)throw o.status,new Error(`${o.statusText||"Failed to add follower!"}`);return await o.json()},this.cloneProject=async(t,e)=>{const o=await fetch(`${n}app/CloneProject?project=${t}&newProject=${e}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!o.ok)throw o.status,new Error(`${o.statusText}`);let a=await o.json();if(a){const t='#data #app-theme \n{\n "textcolor": "#212121",\n "backgroundcolor": "#273044",\n "color": "#ffffff",\n "logo": "https://codicent.com/logo512.png",\n "title": "",\n "themeColor": "#581d71",\n "buttonColor": "#c0c0c0",\n "buttonTextColor": "#000000",\n "font": "Montserrat",\n "welcome": "Hej {{username}}!",\n "chatPlaceholder": "Tjena, Loociz här! Vad vill du?",\n "textPlaceholder": "Skriv det du vill spara, så tar jag (Loociz alltså) hand om det!",\n "transcriptionInstructions": "Tryck på knappen för att start och sedan stoppa ljudinspelning."\n}';try{await window.Codicent.postMessage({message:`@${e} ${t}`,type:"text"})||(a=!1)}catch{a=!1}if(a){const t='#data #app-button\n{\n "title": "Ta fram företagsinfo",\n "url": "/#/chat?text=Hej!%20Jag%20vill%20spara%20f%C3%B6retagsinfo.%20Guida%20mig%20steg%20f%C3%B6r%20steg%2C%20ett%20i%20taget%2C%20tills%20vi%20har%20all%20info%20om%20mitt%20f%C3%B6retag.%20Exempel%20p%C3%A5%20data%3A%20f%C3%B6retagsnamn%20eller%20id%C3%A9namn%2C%20org.nr.%2C%20%C3%A4gare%2C%20kontaktinformation%2C%20vision%2C%20aff%C3%A4rsid%C3%A9%2C%20mm."\n}';try{await window.Codicent.postMessage({message:`@${e} ${t}`,type:"text"})||(a=!1)}catch{a=!1}}}return a},this.getNickname=async()=>{try{const t=a.split(".")[1],e=atob(t),o=JSON.parse(e),i=o.sub||o.userId,s=await fetch(`${n}app/GetNickname?userId=${i}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!s.ok)throw 401===s.status?(this.handleUnauthorized(),new Error("Unauthorized")):new Error(`${s.statusText}`);return await s.text()}catch{return""}},this.getChatInstructions=async()=>{try{const t=await window.Codicent.getMessages({search:`@${this.codicent} #instructions`,length:1});if(t.length>0)return t[0].content}catch{console.warn("Error fetching chat instructions")}return""},this.updateChatInstructions=async t=>{try{const e=await window.Codicent.getMessages({search:`@${this.codicent} #instructions`,length:100}),o=`@${this.codicent} #instructions\n${t}`;e.length>0?e[0].content!==o&&(console.log("updating instructions",o),await window.Codicent.postMessage({message:o,type:"text",parentId:e[0].id})):(console.log("new instructions",o),await window.Codicent.postMessage({message:o,type:"text"}))}catch{console.warn("Error updating chat instructions")}},this.getUserInfo=async(t,e=!1)=>{const o=await fetch(`${n}/app/GetUserInfo?nickname=${t}${e?"&t="+Date.now():""}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!o.ok)throw 401===o.status?(this.handleUnauthorized(),new Error("Unauthorized")):new Error(`${o.statusText}`);const a=await o.json(),{email:i,picture:s,description:r,followers:c,properties:h,owner:d}=a;return{nickname:t,email:i,name:r,picture:s,followers:c,properties:h,owner:d}},this.updateUserInfo=async({nickname:t,email:e,name:o,picture:a})=>{const i=await fetch(`${n}/app/AddOrUpdateUser`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]],body:JSON.stringify({nickname:t,email:e,name:o,picture:a,description:""})});if(!i.ok)throw i.status,new Error(`${i.statusText}`);return await this.getUserInfo(t,!0)},this.requestInvite=async(t,e)=>{const o=await fetch(`${n}/app/CreateInvitationOrRequest?forUserNickname=${t}&toProjectNickname=${e}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return!!o.ok||(console.warn(`requestInvite() => ${o.statusText}`),!1)},this.getProjectInfo=this.getUserInfo,this.updateMembersAccess=async(t,e)=>{const o=await fetch(`${n}/app/AddOrUpdateProjectProperty?project=${t}&key=APP_EDITORS&value=${e.join(",")}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return!!o.ok||(console.warn(`updateMembersAccess() => ${o.statusText}`),!1)},this.getMembersAccess=async t=>{const e=(await this.getProjectInfo(t,!0)).properties.find((t=>"APP_EDITORS"===t.name));return e&&e.value?e.value.split(","):[]},this.setToken=t=>{a=t,a&&window.Codicent.init({token:a,baseUrl:n})},this.getToken=()=>a,this.checkPurchaseStatus=async()=>{const t=await fetch(`${n}payments/GetPaymentStatus`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!t.ok)throw new Error("Failed to check purchase status");const{isPaid:e}=await t.json();return e},this.checkSubscriptionStatus=async()=>{if(!this.options.SUBSCRIPTION_NEEDED)return"active";const t=await fetch(`${n}payments/GetSubscriptionStatus?t=${Date.now()}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`],["Cache-Control","no-cache, no-store, must-revalidate"],["Pragma","no-cache"],["Expires","0"]]});if(!t.ok)throw new Error("Failed to check subscription status");const{status:e}=await t.json();return e},this.createCheckoutSession=async t=>{const e=await fetch(`${n}payments/CreateCheckoutSession`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]],body:JSON.stringify({priceId:t,successUrl:window.location.href,cancelUrl:window.location.href})});if(!e.ok)throw new Error("Failed to create checkout session");const{id:o}=await e.json();return o},this.redirectToCheckout=async e=>{const o=await t(this.options.STRIPE_PUBLIC_KEY);if(!o)throw new Error("Stripe failed to load");const n=await this.createCheckoutSession(e),{error:a}=await o.redirectToCheckout({sessionId:n});if(a)throw new Error(a.message)},this.getChatHistory=async t=>{const e=await fetch(`${n}api/GetMessageHistory?messageId=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!e.ok)throw new Error("Failed to get chat history");let o=await e.json();return o=o.filter((t=>!t.content.includes("#function_result")&&!t.content.includes("#finish_reason_function_call"))),o},this.getPublicFlow=async t=>{const e=await fetch(`${n}/app/GetPublicFlow?codicent=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!e.ok)throw new Error("Failed to get public flow");const o=await e.json();return o.forEach((t=>{t.createdAt=new Date(Date.parse(t.createdAt))})),o},this.getMessageContent=async t=>{const e=await fetch(`${n}app/GetMessageContent?id=${t}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(e.ok){const t=await e.json();return{content:t.content,url:t.url}}return{content:"",url:""}},this.logAction=async(t,e)=>{if(!this.options.APP_LOG_CODICENT)return"";const o={content:`@${this.options.APP_LOG_CODICENT} #debug #${e}\n${t}`,type:"text"},a=await fetch(`${n}app/AddChatMessage`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.options.APP_LOG_TOKEN}`]],body:JSON.stringify(o)});if(!a.ok)throw new Error(`${a.statusText||"Failed to post log message!"}`);return(await a.json()).id},this.createApp=async()=>{try{for(let t=0;t<50;t++){const t=Math.floor(99999*Math.random())+1,e=`${this.options.APP_PREFIX}${t}`;if(!await this.nicknameExists(e)){if(await this.cloneProject(this.options.APP_TEMPLATE,e)){if(this.options.ANONYMOUS_TOKEN)try{const t=this.options.ANONYMOUS_TOKEN.split(".")[1],o=atob(t),n=JSON.parse(o).nickname;if(!await this.addFollower(e,n))throw new Error("Failed to add follower: "+n)}catch(t){console.error("Error extracting adding anonymous follower:",t)}return e}}}}catch(t){console.error("Error creating app:",t)}return null},this.findUsername=async()=>{try{for(let t=0;t<50;t++){const t=Math.floor(99999*Math.random())+1,e=`${this.options.USER_PREFIX}${t}`;if(!await this.nicknameExists(e))return e}}catch(t){console.warn("Error finding username:",t)}return null},this.getForms=async()=>{const t=await fetch(`${n}app/GetForms?codicent=${this.codicent}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return await t.json()},this.getFormById=async t=>{const e=await fetch(`${n}app/GetFormById?id=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return await e.json()},this.codicent="",this.options=o}handleUnauthorized(){this.onUnauthorized&&this.onUnauthorized()}}o=r,r.getImageUrl=(t,e)=>`${n}app/GetImage?fileId=${t}&width=${e}`,r.getFileUrl=(t,e)=>`${n}app/DownloadFile?fileId=${t}${e?`&extension=${e}`:""}`,r.downloadFile=async t=>{fetch(o.getFileUrl(t.id)).then((t=>{if(t.headers.forEach(((t,e)=>{console.log(`${e}: ${t}`)})),t.ok)return t.blob();throw new Error("Network response was not ok.")})).then((e=>{const o=window.URL.createObjectURL(e),n=document.createElement("a");n.style.display="none",n.href=o,n.download=t.filename,document.body.appendChild(n),n.click(),window.URL.revokeObjectURL(o)})).catch((t=>{console.error("There was a problem with the fetch operation:",t)}))},r.getMiniChatReply=async(t,e="codicent-mini",o)=>{const a=await fetch(`${n}app/GetAi2ChatReply?message=${t}&project=${e}${o?"&messageId="+o:""}`,{method:"GET",headers:[["Authorization","Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjJlMTliNjNmLWQxNDgtNGRmMi04MzMxLTZlZGE3ZTQzNjQ1ZCIsIm5pY2tuYW1lIjoiam9oYW4iLCJuYW1lIjoiSm9oYW4gSXNha3Nzb24iLCJ1c2VySWQiOiIyZTE5YjYzZi1kMTQ4LTRkZjItODMzMS02ZWRhN2U0MzY0NWQiLCJwcm9qZWN0IjoiY29kaWNlbnQtbWluaSIsIm5iZiI6MTczNjkzMjcyOCwiZXhwIjoxNzY4NDY4NzI4LCJpYXQiOjE3MzY5MzI3Mjh9.l2J7GgfU01iihdud7QP1aYBCM3NgxxqiM4VrplLO1s0"]]});if(!a.ok)return void a.status;return(await a.json()).content.replace("@codicent-mini","").trim()};export{r as CodicentService};
1
+ import{loadStripe as t}from"../node_modules/@stripe/stripe-js/dist/index.js";import e from"../utils/MessageContent.js";import"../node_modules/tinycolor2/esm/tinycolor.js";import"react/jsx-runtime";import"react";import"../_virtual/index.js";import"../config/index.js";import"../lib/wavtools/lib/wav_packer.js";import"../lib/wavtools/lib/analysis/audio_analysis.js";import"../lib/wavtools/lib/wav_stream_player.js";import"../lib/wavtools/lib/wav_recorder.js";var a;let o="https://codicent.com/",n="-";const i=()=>void 0!==window.Codicent&&(window.Codicent.handleMessage=function(t){const e=new CustomEvent("codicent-log",{detail:{message:t}});window.dispatchEvent(e)},window.Codicent.init({token:n,baseUrl:o}),!0);let s=i();if(!s){const t=setInterval((()=>{s=i(),s&&clearInterval(t)}),100)}class r{constructor(a){this.createDataMessage=async(t,e)=>await window.Codicent.data.create({codicent:this.codicent,tag:t,data:e}),this.readDataMessages=async(t,e)=>await window.Codicent.data.read({codicent:this.codicent,tag:t,search:e}),this.readOneDataMessage=async t=>await window.Codicent.data.readOne(t),this.updateDataMessage=async(t,e)=>await window.Codicent.data.update({id:t,data:e,codicent:this.codicent}),this.deleteDataMessage=async t=>await window.Codicent.data.delete({id:t,codicent:this.codicent}),this.getAppTheme=async()=>{try{const t=await window.Codicent.getDataMessages({tags:["app-theme"],codicent:this.codicent});return t.length>0?t[0].data:null}catch(t){return console.error("Error fetching app theme:",t),null}},this.getAppButtons=async()=>{const t=(await window.Codicent.getDataMessages({tags:[this.options.BUTTON_TAG],codicent:this.codicent})).map((t=>t.data));return t.sort(((t,e)=>t.title>e.title?1:-1)),t},this.getAppTasks=async()=>(await window.Codicent.getMessages({search:`@${this.codicent} #app-task`,length:50})).map((t=>{const a=new e(t.content).content.split("\n"),o=a[0],n=a.slice(1).join("\n");return{id:t.id,title:o,content:n}})),this.getAppPrompts=async()=>(await window.Codicent.getDataMessages({tags:["chatprompt"],codicent:this.codicent})).map((t=>t.data)).map((({title:t,prompt:e})=>({title:t,prompt:e}))),this.uploadFile=async(t,e)=>await window.Codicent.upload(e,t),this.getFileInfo=async t=>await window.Codicent.getFileInfo(t),this.sendMessage=(t,e)=>window.Codicent.postMessage({message:`@${this.codicent} ${t}`,type:"text",parentId:e}),this.chat=(t,e)=>window.Codicent.getChatReply3({message:t,codicent:this.codicent,messageId:e}),this.getMessagesFast=async(t,e,a=100,n=void 0)=>{const i=await this.request(`${o}app/AppGetMessages`,"POST",{headers:[["Authorization",`Bearer ${this.getToken()}`],["Content-Type","application/json; charset=utf-8"]],body:JSON.stringify({tags:t,codicent:this.codicent,search:e,length:a})});let s=await i.json();if(s.forEach((t=>{t.createdAt=new Date(Date.parse(t.createdAt))})),n){const t=await this.getPublicFlow(n);s=s.concat(t),s.sort(((t,e)=>e.createdAt.getTime()-t.createdAt.getTime()))}return s},this.getMessages=async(t,e)=>{let a=[];const o=t.map((async t=>{const e=await window.Codicent.getMessages({search:`@${this.codicent} #${t}`,length:10});return"chat"===t&&e.forEach((t=>t.content=`#chat\n${t.content}`)),e}));if((await Promise.all(o)).forEach((t=>{a=a.concat(t)})),e)try{const t=await this.getPublicFlow(e);a=a.concat(t)}catch(t){console.warn("Error fetching public flow, PUBLIC_TAG missing in codicent?",t)}return a=a.filter(((t,e,a)=>e===a.findIndex((e=>e.id===t.id)))),a.sort(((t,e)=>e.createdAt.getTime()-t.createdAt.getTime())),a},this.registerUser=async(t,e,a,n)=>{const i=await fetch(`${o}app/RegisterAuth0User`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${n}`]],body:JSON.stringify({nickname:t,email:e,userId:a})});if(!i.ok)return"";const s=await i.text();return window.Codicent.init({token:n,baseUrl:o}),s},this.loginUser=async(t,e)=>{try{const a=await fetch(`${o}app/LoginAuth0User`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${e}`]],body:JSON.stringify({userId:t})});if(!a.ok)return 404===a.status||400===a.status?null:401===a.status?(this.handleUnauthorized(),null):"";const n=await a.text();return this.setToken(n),n}catch(t){return console.warn("Error logging in user:",t),""}},this.nicknameExists=async t=>{const e=await fetch(`${o}app/NicknameExists?nickname=${encodeURIComponent(t)}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"]]});if(!e.ok)return!1;return await e.json()},this.logout=()=>{this.setToken("")},this.isRegistered=()=>null!==localStorage.getItem("codicent_nickname"),this.getApps=async()=>{try{const t=await fetch(`${o}app/AppGetApps`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!t.ok)throw t.status,new Error(`${t.statusText}`);const e=await t.json();return e.filter(((t,e,a)=>e===a.findIndex((e=>e.id===t.id))&&(this.options.APP_NAME||t.id.startsWith(this.options.APP_PREFIX))))}catch(t){return console.warn("Error fetching apps:",t),null}},this.addFollower=async(t,e)=>{const a=await fetch(`${o}app/AddFollower?nickname=${t}&followerNickname=${e}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!a.ok)throw a.status,new Error(`${a.statusText||"Failed to add follower!"}`);return await a.json()},this.cloneProject=async(t,e)=>{const a=await fetch(`${o}app/CloneProject?project=${t}&newProject=${e}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!a.ok)throw a.status,new Error(`${a.statusText}`);let n=await a.json();if(n){const t='#data #app-theme \n{\n "textcolor": "#212121",\n "backgroundcolor": "#273044",\n "color": "#ffffff",\n "logo": "https://codicent.com/logo512.png",\n "title": "",\n "themeColor": "#581d71",\n "buttonColor": "#c0c0c0",\n "buttonTextColor": "#000000",\n "font": "Montserrat",\n "welcome": "Hej {{username}}!",\n "chatPlaceholder": "Tjena, Loociz här! Vad vill du?",\n "textPlaceholder": "Skriv det du vill spara, så tar jag (Loociz alltså) hand om det!",\n "transcriptionInstructions": "Tryck på knappen för att start och sedan stoppa ljudinspelning."\n}';try{await window.Codicent.postMessage({message:`@${e} ${t}`,type:"text"})||(n=!1)}catch{n=!1}if(n){const t='#data #app-button\n{\n "title": "Ta fram företagsinfo",\n "url": "/#/chat?text=Hej!%20Jag%20vill%20spara%20f%C3%B6retagsinfo.%20Guida%20mig%20steg%20f%C3%B6r%20steg%2C%20ett%20i%20taget%2C%20tills%20vi%20har%20all%20info%20om%20mitt%20f%C3%B6retag.%20Exempel%20p%C3%A5%20data%3A%20f%C3%B6retagsnamn%20eller%20id%C3%A9namn%2C%20org.nr.%2C%20%C3%A4gare%2C%20kontaktinformation%2C%20vision%2C%20aff%C3%A4rsid%C3%A9%2C%20mm."\n}';try{await window.Codicent.postMessage({message:`@${e} ${t}`,type:"text"})||(n=!1)}catch{n=!1}}}return n},this.getNickname=async()=>{try{const t=n.split(".")[1],e=atob(t),a=JSON.parse(e),i=a.sub||a.userId,s=await fetch(`${o}app/GetNickname?userId=${i}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!s.ok)throw 401===s.status?(this.handleUnauthorized(),new Error("Unauthorized")):new Error(`${s.statusText}`);return await s.text()}catch{return""}},this.getChatInstructions=async()=>{try{const t=await window.Codicent.getMessages({search:`@${this.codicent} #instructions`,length:1});if(t.length>0)return t[0].content}catch{console.warn("Error fetching chat instructions")}return""},this.updateChatInstructions=async t=>{try{const e=await window.Codicent.getMessages({search:`@${this.codicent} #instructions`,length:100}),a=`@${this.codicent} #instructions\n${t}`;e.length>0?e[0].content!==a&&(console.log("updating instructions",a),await window.Codicent.postMessage({message:a,type:"text",parentId:e[0].id})):(console.log("new instructions",a),await window.Codicent.postMessage({message:a,type:"text"}))}catch{console.warn("Error updating chat instructions")}},this.getUserInfo=async(t,e=!1)=>{const a=await fetch(`${o}/app/GetUserInfo?nickname=${t}${e?"&t="+Date.now():""}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!a.ok)throw 401===a.status?(this.handleUnauthorized(),new Error("Unauthorized")):new Error(`${a.statusText}`);const n=await a.json(),{email:i,picture:s,description:r,followers:c,properties:h,owner:d}=n;return{nickname:t,email:i,name:r,picture:s,followers:c,properties:h,owner:d}},this.updateUserInfo=async({nickname:t,email:e,name:a,picture:n})=>{const i=await fetch(`${o}/app/AddOrUpdateUser`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]],body:JSON.stringify({nickname:t,email:e,name:a,picture:n,description:""})});if(!i.ok)throw i.status,new Error(`${i.statusText}`);return await this.getUserInfo(t,!0)},this.requestInvite=async(t,e)=>{const a=await fetch(`${o}/app/CreateInvitationOrRequest?forUserNickname=${t}&toProjectNickname=${e}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return!!a.ok||(console.warn(`requestInvite() => ${a.statusText}`),!1)},this.getProjectInfo=this.getUserInfo,this.updateMembersAccess=async(t,e)=>{const a=await fetch(`${o}/app/AddOrUpdateProjectProperty?project=${t}&key=APP_EDITORS&value=${e.join(",")}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return!!a.ok||(console.warn(`updateMembersAccess() => ${a.statusText}`),!1)},this.getMembersAccess=async t=>{const e=(await this.getProjectInfo(t,!0)).properties.find((t=>"APP_EDITORS"===t.name));return e&&e.value?e.value.split(","):[]},this.setToken=t=>{n=t,n&&window.Codicent.init({token:n,baseUrl:o})},this.getToken=()=>n,this.checkPurchaseStatus=async()=>{const t=await fetch(`${o}payments/GetPaymentStatus`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(!t.ok)throw new Error("Failed to check purchase status");const{isPaid:e}=await t.json();return e},this.checkSubscriptionStatus=async()=>{if(!this.options.SUBSCRIPTION_NEEDED)return"active";const t=await fetch(`${o}payments/GetSubscriptionStatus?t=${Date.now()}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`],["Cache-Control","no-cache, no-store, must-revalidate"],["Pragma","no-cache"],["Expires","0"]]});if(!t.ok)throw new Error("Failed to check subscription status");const{status:e}=await t.json();return e},this.createCheckoutSession=async t=>{const e=await fetch(`${o}payments/CreateCheckoutSession`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]],body:JSON.stringify({priceId:t,successUrl:window.location.href,cancelUrl:window.location.href})});if(!e.ok)throw new Error("Failed to create checkout session");const{id:a}=await e.json();return a},this.redirectToCheckout=async e=>{const a=await t(this.options.STRIPE_PUBLIC_KEY);if(!a)throw new Error("Stripe failed to load");const o=await this.createCheckoutSession(e),{error:n}=await a.redirectToCheckout({sessionId:o});if(n)throw new Error(n.message)},this.getChatHistory=async t=>{const e=await fetch(`${o}api/GetMessageHistory?messageId=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!e.ok)throw new Error("Failed to get chat history");let a=await e.json();return a=a.filter((t=>!t.content.includes("#function_result")&&!t.content.includes("#finish_reason_function_call"))),a},this.getPublicFlow=async t=>{const e=await fetch(`${o}/app/GetPublicFlow?codicent=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!e.ok)throw new Error("Failed to get public flow");const a=await e.json();return a.forEach((t=>{t.createdAt=new Date(Date.parse(t.createdAt))})),a},this.getMessageContent=async t=>{const e=await fetch(`${o}app/GetMessageContent?id=${t}`,{method:"GET",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.getToken()}`]]});if(e.ok){const t=await e.json();return{content:t.content,url:t.url}}return{content:"",url:""}},this.logAction=async(t,e)=>{if(!this.options.APP_LOG_CODICENT)return"";const a={content:`@${this.options.APP_LOG_CODICENT} #debug #${e}\n${t}`,type:"text"},n=await fetch(`${o}app/AddChatMessage`,{method:"POST",headers:[["Content-Type","application/json; charset=utf-8"],["Authorization",`Bearer ${this.options.APP_LOG_TOKEN}`]],body:JSON.stringify(a)});if(!n.ok)throw new Error(`${n.statusText||"Failed to post log message!"}`);return(await n.json()).id},this.createApp=async()=>{try{for(let t=0;t<50;t++){const t=Math.floor(99999*Math.random())+1,e=`${this.options.APP_PREFIX}${t}`;if(!await this.nicknameExists(e)){if(await this.cloneProject(this.options.APP_TEMPLATE,e)){if(this.options.ANONYMOUS_TOKEN)try{const t=this.options.ANONYMOUS_TOKEN.split(".")[1],a=atob(t),o=JSON.parse(a).nickname;if(!await this.addFollower(e,o))throw new Error("Failed to add follower: "+o)}catch(t){console.error("Error extracting adding anonymous follower:",t)}return e}}}}catch(t){console.error("Error creating app:",t)}return null},this.findUsername=async()=>{try{for(let t=0;t<50;t++){const t=Math.floor(99999*Math.random())+1,e=`${this.options.USER_PREFIX}${t}`;if(!await this.nicknameExists(e))return e}}catch(t){console.warn("Error finding username:",t)}return null},this.getForms=async()=>{const t=await this.request(`${o}app/GetForms?codicent=${this.codicent}`,"GET",{headers:[["Authorization",`Bearer ${this.getToken()}`]]});return await t.json()},this.getFormById=async t=>{const e=await fetch(`${o}app/GetFormById?id=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return await e.json()},this.getTodoStatus=async t=>{const e=await fetch(`${o}/app/GetTodoStatus?messageId=${t}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});return e.ok?await e.text():(e.status,console.warn(`getTodoStatus() => ${e.statusText}`),"unknown")},this.updateTodoStatus=async(t,e)=>{const a=await fetch(`${o}/app/UpdateTodoStatus?messageId=${t}&status=${e}`,{method:"GET",headers:[["Authorization",`Bearer ${this.getToken()}`]]});if(!a.ok)return console.warn(`updateTodoStatus() => ${a.statusText}`),!1;return await a.json()},this.codicent="",this.options=a}async request(t,e,a={}){const o={};a.headers&&a.headers.forEach((([t,e])=>{o[t]=e}));const n=await fetch(t,{...a,method:e,headers:o});if(!n.ok)throw 401===n.status&&this.handleUnauthorized(),new Error(`${n.statusText}`);return n}handleUnauthorized(){this.onUnauthorized&&this.onUnauthorized()}}a=r,r.getImageUrl=(t,e)=>`${o}app/GetImage?fileId=${t}&width=${e}`,r.getFileUrl=(t,e)=>`${o}app/DownloadFile?fileId=${t}${e?`&extension=${e}`:""}`,r.downloadFile=async t=>{fetch(a.getFileUrl(t.id)).then((t=>{if(t.headers.forEach(((t,e)=>{console.log(`${e}: ${t}`)})),t.ok)return t.blob();throw new Error("Network response was not ok.")})).then((e=>{const a=window.URL.createObjectURL(e),o=document.createElement("a");o.style.display="none",o.href=a,o.download=t.filename,document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(a)})).catch((t=>{console.error("There was a problem with the fetch operation:",t)}))},r.getMiniChatReply=async(t,e="codicent-mini",a)=>{const n=await fetch(`${o}app/GetAi2ChatReply?message=${t}&project=${e}${a?"&messageId="+a:""}`,{method:"GET",headers:[["Authorization","Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjJlMTliNjNmLWQxNDgtNGRmMi04MzMxLTZlZGE3ZTQzNjQ1ZCIsIm5pY2tuYW1lIjoiam9oYW4iLCJuYW1lIjoiSm9oYW4gSXNha3Nzb24iLCJ1c2VySWQiOiIyZTE5YjYzZi1kMTQ4LTRkZjItODMzMS02ZWRhN2U0MzY0NWQiLCJwcm9qZWN0IjoiY29kaWNlbnQtbWluaSIsIm5iZiI6MTczNjkzMjcyOCwiZXhwIjoxNzY4NDY4NzI4LCJpYXQiOjE3MzY5MzI3Mjh9.l2J7GgfU01iihdud7QP1aYBCM3NgxxqiM4VrplLO1s0"]]});if(!n.ok)return void n.status;return(await n.json()).content.replace("@codicent-mini","").trim()};export{r as CodicentService};
package/dist/index.d.ts CHANGED
@@ -69,6 +69,13 @@ declare class CodicentService {
69
69
  static getFileUrl: (fileId: string, extension?: string) => string;
70
70
  sendMessage: (message: string, parentId?: string) => Promise<string>;
71
71
  chat: (message: string, messageId?: string) => Promise<ChatMessageReply>;
72
+ /**
73
+ * Helper method to make fetch requests with error handling.
74
+ * @param url The URL to fetch.
75
+ * @param method HTTP method (GET, POST, etc).
76
+ * @param options Fetch options (headers, body, etc).
77
+ */
78
+ private request;
72
79
  getMessagesFast: (tags: string[], search?: string, length?: number, publicCodicent?: string | undefined) => Promise<Message[]>;
73
80
  getMessages: (tags: string[], codicent?: string) => Promise<Message[]>;
74
81
  registerUser: (nickname: string, email: string, userId: string, accessToken: string) => Promise<string>;
@@ -117,6 +124,8 @@ declare class CodicentService {
117
124
  }[]>;
118
125
  getFormById: (id: string) => Promise<any>;
119
126
  private handleUnauthorized;
127
+ getTodoStatus: (messageId: string) => Promise<"done" | "undone" | "unknown">;
128
+ updateTodoStatus: (messageId: string, status: "done" | "undone") => Promise<boolean>;
120
129
  }
121
130
 
122
131
  declare const Markdown: ({ content }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codicent-app-sdk",
3
- "version": "0.3.73",
3
+ "version": "0.3.75",
4
4
  "description": "SDK for building AI-powered applications with Codicent",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",