@pickaxeproject/react 2.2.4 → 2.3.0

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 (79) hide show
  1. package/dist/cjs/components/Pickaxe/Addons/IceBreaker/Breaker.js +1 -1
  2. package/dist/cjs/components/Pickaxe/Chat/History/Document.js +1 -1
  3. package/dist/cjs/components/Pickaxe/Chat/History/Message.js +1 -1
  4. package/dist/cjs/components/Pickaxe/Chat/History/index.js +1 -1
  5. package/dist/cjs/components/Pickaxe/Chat/Input.js +1 -1
  6. package/dist/cjs/components/Pickaxe/ui/Input/StyledAttachmentGrid.js +1 -0
  7. package/dist/cjs/components/Pickaxe/ui/Input/StyledIconButton.js +1 -0
  8. package/dist/cjs/components/Pickaxe/ui/Input/StyledImagePreview.js +1 -0
  9. package/dist/cjs/components/Pickaxe/ui/Input/StyledInputContainer.js +1 -0
  10. package/dist/cjs/components/Pickaxe/ui/Input/StyledInputWrapper.js +1 -0
  11. package/dist/cjs/components/Pickaxe/ui/Input/StyledRemoveButton.js +1 -0
  12. package/dist/cjs/components/Pickaxe/ui/Input/StyledTextareaWrapper.js +1 -0
  13. package/dist/cjs/components/Pickaxe/ui/Message/StyledIconWrapper.js +1 -0
  14. package/dist/cjs/components/Pickaxe/ui/Message/StyledMessage.js +1 -0
  15. package/dist/cjs/components/Pickaxe/ui/Message/StyledMessageBubble.js +1 -0
  16. package/dist/cjs/components/Pickaxe/ui/Message/StyledMessageContainer.js +1 -0
  17. package/dist/cjs/components/Pickaxe/ui/StyledCopyButton.js +1 -0
  18. package/dist/cjs/components/Pickaxe/ui/StyledDocumentCard.js +1 -0
  19. package/dist/cjs/components/Pickaxe/ui/StyledIceBreaker.js +1 -0
  20. package/dist/cjs/components/Pickaxe/ui/StyledLoadingDots.js +1 -0
  21. package/dist/cjs/index.js +1 -1
  22. package/dist/cjs/src/components/Pickaxe/ui/Input/StyledAttachmentGrid.d.ts +7 -0
  23. package/dist/cjs/src/components/Pickaxe/ui/Input/StyledIconButton.d.ts +10 -0
  24. package/dist/cjs/src/components/Pickaxe/ui/Input/StyledImagePreview.d.ts +12 -0
  25. package/dist/cjs/src/components/Pickaxe/ui/Input/StyledInputContainer.d.ts +13 -0
  26. package/dist/cjs/src/components/Pickaxe/ui/Input/StyledInputWrapper.d.ts +13 -0
  27. package/dist/cjs/src/components/Pickaxe/ui/Input/StyledRemoveButton.d.ts +13 -0
  28. package/dist/cjs/src/components/Pickaxe/ui/Input/StyledTextareaWrapper.d.ts +8 -0
  29. package/dist/cjs/src/components/Pickaxe/ui/Message/StyledIconWrapper.d.ts +11 -0
  30. package/dist/cjs/src/components/Pickaxe/ui/Message/StyledMessage.d.ts +10 -0
  31. package/dist/cjs/src/components/Pickaxe/ui/Message/StyledMessageBubble.d.ts +14 -0
  32. package/dist/cjs/src/components/Pickaxe/ui/Message/StyledMessageContainer.d.ts +10 -0
  33. package/dist/cjs/src/components/Pickaxe/ui/StyledCopyButton.d.ts +12 -0
  34. package/dist/cjs/src/components/Pickaxe/ui/StyledDocumentCard.d.ts +25 -0
  35. package/dist/cjs/src/components/Pickaxe/ui/StyledIceBreaker.d.ts +20 -0
  36. package/dist/cjs/src/components/Pickaxe/ui/StyledLoadingDots.d.ts +9 -0
  37. package/dist/cjs/src/components/Pickaxe/ui/index.d.ts +20 -0
  38. package/dist/cjs/src/components/Pickaxe/ui/types.d.ts +5 -0
  39. package/dist/cjs/src/index.d.ts +2 -0
  40. package/dist/esm/components/Pickaxe/Addons/IceBreaker/Breaker.js +1 -1
  41. package/dist/esm/components/Pickaxe/Chat/History/Document.js +1 -1
  42. package/dist/esm/components/Pickaxe/Chat/History/Message.js +1 -1
  43. package/dist/esm/components/Pickaxe/Chat/History/index.js +1 -1
  44. package/dist/esm/components/Pickaxe/Chat/Input.js +1 -1
  45. package/dist/esm/components/Pickaxe/ui/Input/StyledAttachmentGrid.js +1 -0
  46. package/dist/esm/components/Pickaxe/ui/Input/StyledIconButton.js +1 -0
  47. package/dist/esm/components/Pickaxe/ui/Input/StyledImagePreview.js +1 -0
  48. package/dist/esm/components/Pickaxe/ui/Input/StyledInputContainer.js +1 -0
  49. package/dist/esm/components/Pickaxe/ui/Input/StyledInputWrapper.js +1 -0
  50. package/dist/esm/components/Pickaxe/ui/Input/StyledRemoveButton.js +1 -0
  51. package/dist/esm/components/Pickaxe/ui/Input/StyledTextareaWrapper.js +1 -0
  52. package/dist/esm/components/Pickaxe/ui/Message/StyledIconWrapper.js +1 -0
  53. package/dist/esm/components/Pickaxe/ui/Message/StyledMessage.js +1 -0
  54. package/dist/esm/components/Pickaxe/ui/Message/StyledMessageBubble.js +1 -0
  55. package/dist/esm/components/Pickaxe/ui/Message/StyledMessageContainer.js +1 -0
  56. package/dist/esm/components/Pickaxe/ui/StyledCopyButton.js +1 -0
  57. package/dist/esm/components/Pickaxe/ui/StyledDocumentCard.js +1 -0
  58. package/dist/esm/components/Pickaxe/ui/StyledIceBreaker.js +1 -0
  59. package/dist/esm/components/Pickaxe/ui/StyledLoadingDots.js +1 -0
  60. package/dist/esm/index.js +1 -1
  61. package/dist/esm/src/components/Pickaxe/ui/Input/StyledAttachmentGrid.d.ts +7 -0
  62. package/dist/esm/src/components/Pickaxe/ui/Input/StyledIconButton.d.ts +10 -0
  63. package/dist/esm/src/components/Pickaxe/ui/Input/StyledImagePreview.d.ts +12 -0
  64. package/dist/esm/src/components/Pickaxe/ui/Input/StyledInputContainer.d.ts +13 -0
  65. package/dist/esm/src/components/Pickaxe/ui/Input/StyledInputWrapper.d.ts +13 -0
  66. package/dist/esm/src/components/Pickaxe/ui/Input/StyledRemoveButton.d.ts +13 -0
  67. package/dist/esm/src/components/Pickaxe/ui/Input/StyledTextareaWrapper.d.ts +8 -0
  68. package/dist/esm/src/components/Pickaxe/ui/Message/StyledIconWrapper.d.ts +11 -0
  69. package/dist/esm/src/components/Pickaxe/ui/Message/StyledMessage.d.ts +10 -0
  70. package/dist/esm/src/components/Pickaxe/ui/Message/StyledMessageBubble.d.ts +14 -0
  71. package/dist/esm/src/components/Pickaxe/ui/Message/StyledMessageContainer.d.ts +10 -0
  72. package/dist/esm/src/components/Pickaxe/ui/StyledCopyButton.d.ts +12 -0
  73. package/dist/esm/src/components/Pickaxe/ui/StyledDocumentCard.d.ts +25 -0
  74. package/dist/esm/src/components/Pickaxe/ui/StyledIceBreaker.d.ts +20 -0
  75. package/dist/esm/src/components/Pickaxe/ui/StyledLoadingDots.d.ts +9 -0
  76. package/dist/esm/src/components/Pickaxe/ui/index.d.ts +20 -0
  77. package/dist/esm/src/components/Pickaxe/ui/types.d.ts +5 -0
  78. package/dist/esm/src/index.d.ts +2 -0
  79. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),o=require("../../../../hooks/core/useHover.js"),s=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../../common/cn.js");exports.default=({text:i,onSend:a})=>{const{colors:n,styles:l,forceMobile:c,responsiveBy:u}=s.usePickaxeContext(),x=o.useHover(),{isHover:d}=x,p=e.__rest(x,["isHover"]);return r.jsxs("div",Object.assign({className:t.default("relative text-sm group flex flex-grow cursor-pointer overflow-hidden font-semilight w-full select-none px-[1em] py-[9px] duration-200 transition-colors border w-full ease-in-out","viewport"===u?"min-[767px]:justify-end min-[767px]:max-w-max":"@[767px]/pickaxe-root:justify-end @[767px]/pickaxe-root:max-w-max",c&&"max-w-full"),onClick:()=>null==a?void 0:a(i),style:{background:d?n.secondary:"transparent",borderColor:n.secondaryText+"30",borderRadius:l.cornerRadius}},p,{children:[r.jsx("div",{className:"absolute inset-0 backdrop-blur-md z-0",style:{background:d?n.secondary:n.primary+"10",borderRadius:l.cornerRadius}}),r.jsx("p",Object.assign({className:t.default("line-clamp-2 duration-200 transition-colors ease-in-out relative","viewport"===u?"min-[767px]:text-right":"@[767px]/pickaxe-root:text-right",c&&"text-left"),style:{color:d?n.secondaryText:n.secondaryText+"60"}},{children:i}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),s=require("../../../../hooks/core/useHover.js"),o=require("../../../../hooks/pickaxe/usePickaxeContext.js");require("clsx"),require("tailwind-merge"),require("react");var t=require("../../ui/StyledIceBreaker.js");exports.default=({text:i,onSend:u})=>{const{colors:c,styles:l,forceMobile:a,responsiveBy:n}=o.usePickaxeContext(),v=s.useHover(),{isHover:x}=v,d=e.__rest(v,["isHover"]);return r.jsx(t.StyledIceBreaker,{colors:c,styles:l,isHover:x,responsiveBy:n,forceMobile:a,text:i,onSend:u,hoverProps:d})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../common/cn.js"),t=require("../../../../common/utils.js"),r=require("../../../../hooks/pickaxe/useDocumentData.js"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),c=require("../../../../hooks/studio/useStyleFontSize.js"),o=require("../../../Icons/file.svg.js");exports.default=({documentId:i})=>{const n=r.useDocumentData({documentId:i}),{colors:l,styles:u,isRtl:d}=a.usePickaxeContext(),x=c.useStyleFontSize();return"success"!==n.status?e.jsx("div",{}):e.jsxs("a",Object.assign({href:n.data.storageUrl?n.data.storageUrl:"#",target:"_blank",className:s.default("gap-x-[10px] w-full max-w-[500px] flex items-center px-2 h-[56px] border",d&&"flex-row-reverse"),style:{borderRadius:u.cornerRadius,borderColor:l.secondary+"50"},rel:"noreferrer"},{children:[e.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:l.accent,borderRadius:u.cornerRadius}},{children:e.jsx(o.default,{className:"w-5 h-5",style:{color:l.accentText}})})),e.jsxs("div",Object.assign({className:s.default("flex flex-col justify-center truncate",d?"text-right":"text-left")},{children:[e.jsx("p",Object.assign({className:(s.default(x.b3),"font-medium truncate")},{children:n.data.name})),e.jsxs("p",Object.assign({className:s.default(x.b4,"opacity-80 truncate")},{children:[n.data.extension&&n.data.extension.toUpperCase()+", ",t.formatBytes(n.data.size)]}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../common/utils.js"),r=require("../../../../hooks/pickaxe/useDocumentData.js"),s=require("../../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../../hooks/studio/useStyleFontSize.js"),a=require("../../../Icons/file.svg.js");require("clsx"),require("tailwind-merge");var i=require("../../ui/StyledDocumentCard.js");require("react");exports.default=({documentId:u})=>{const c=r.useDocumentData({documentId:u}),{colors:n,styles:d,isRtl:l}=s.usePickaxeContext(),x=o.useStyleFontSize();return"success"!==c.status?e.jsx("div",{}):e.jsx(i.StyledDocumentCard,{icon:e.jsx(a.default,{className:"w-5 h-5"}),title:c.data.name,subtitle:`${c.data.extension?c.data.extension.toUpperCase()+", ":""}${t.formatBytes(c.data.size)}`,href:c.data.storageUrl||"#",borderColor:`${n.secondary}50`,borderRadius:d.cornerRadius,iconBackgroundColor:n.accent,iconColor:n.accentText,textColor:n.secondaryText,titleFontSize:x.b3,subtitleFontSize:x.b4,isRtl:l})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("../../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../../../hooks/studio/useStyleFontSize.js"),i=require("../../common/PickaxeMarkdown/index.js"),c=require("../../common/PickaxeMarkdown/Renderer.js"),r=require("../../common/PickaxeIcon.js"),l=require("./Document.js"),n=require("../../common/PickaxeCopyButton.js"),o=require("../../../../common/cn.js");exports.default=({index:d,message:x,isIntroExpand:u})=>{var m,j;const{formId:p,pickaxe:h,styles:f,colors:g,misc:v,responsiveBy:k,isNewChat:b,isRtl:w}=t.usePickaxeContext(),y=a.useStyleFontSize(),N=null!==(m=null==h?void 0:h.chaticon)&&void 0!==m?m:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${p}.png`;return"assistant"===x.role?e.jsx("div",Object.assign({className:o.default("flex w-full",w?"justify-end":"justify-start")},{children:e.jsx("div",Object.assign({className:o.default("flex flex-col",0===d&&b&&"viewport"===k&&"min-[767px]:max-w-[80%]",0===d&&b&&"container"===k&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:e.jsxs("div",Object.assign({className:o.default("flex gap-x-3",w&&"flex-row-reverse")},{children:[v.isChatImage&&"NONE"!==N&&e.jsx(r.default,{src:N,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:g.text}),e.jsxs("div",Object.assign({className:o.default("flex flex-col",w?"items-end":"items-start")},{children:[e.jsx("div",Object.assign({className:o.default(y.b2,"chat-message pt-3",w?"text-right":"text-left")},{children:e.jsx(i.PickaxeMarkdown,Object.assign({theme:f.theme,accentColor:g.accent,actions:!0},{children:e.jsx(c.PickaxeMarkdownRenderer,Object.assign({value:x.content},0===d&&b&&x.content.length>470&&3===(null!==(j=null==h?void 0:h.icebreakers)&&void 0!==j?j:[]).length&&!x.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:u?void 0:12}))}))})),e.jsx("div",Object.assign({className:"mt-4 flex gap-3"},{children:e.jsx(n.default,{color:g.accent,text:x.content})}))]}))]}))}))})):"user"===x.role?e.jsx("div",Object.assign({className:o.default("flex w-full",w?"justify-start":"justify-end")},{children:e.jsx("div",Object.assign({className:o.default("flex gap-x-3 max-w-[80%]",w?"pr-9":"pl-9","viewport"===k?w?"min-[767px]:pr-0":"min-[767px]:pl-0":w?"@[767px]/pickaxe-root:pr-0":"@[767px]/pickaxe-root:pl-0")},{children:e.jsxs("div",Object.assign({className:o.default(y.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3",w?"text-right":"text-left"),style:{backgroundColor:g.secondary+"80",color:g.secondaryText,borderRadius:f.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e.jsx("div",Object.assign({className:o.default("flex flex-col",w?"items-start":"items-end")},{children:x.documentIds.map((t=>e.jsx(s.Fragment,{children:t.startsWith("IMAGE-")?e.jsx("div",Object.assign({className:"max-w-[300px]"},{children:e.jsx("img",{style:{borderRadius:f.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${t.split("-")[2]}/${t.split("-")[1]}.${null==t?void 0:t.split("-")[2]}`,alt:""})})):e.jsx(l.default,{documentId:t})},t)))})),e.jsx(i.PickaxeMarkdown,Object.assign({theme:f.theme,accentColor:g.accent},{children:e.jsx(c.PickaxeMarkdownRenderer,{value:x.content})}))]}))}))})):e.jsx("div",{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("../../../../hooks/pickaxe/usePickaxeContext.js"),i=require("../../../../hooks/studio/useStyleFontSize.js"),a=require("../../common/PickaxeMarkdown/index.js"),r=require("../../common/PickaxeMarkdown/Renderer.js"),n=require("../../common/PickaxeIcon.js"),c=require("./Document.js"),o=require("../../common/PickaxeCopyButton.js"),l=require("../../ui/Message/StyledMessage.js"),d=require("../../ui/Message/StyledMessageBubble.js");require("clsx"),require("tailwind-merge");var x=require("../../ui/Message/StyledIconWrapper.js"),u=require("../../ui/Message/StyledMessageContainer.js");exports.default=({index:m,message:p,isIntroExpand:j})=>{var g,h;const{formId:k,pickaxe:b,styles:v,colors:w,misc:y,responsiveBy:M,isNewChat:f,isRtl:q}=t.usePickaxeContext(),O=i.useStyleFontSize(),S=null!==(g=null==b?void 0:b.chaticon)&&void 0!==g?g:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${k}.png`;return"assistant"===p.role?e.jsx(l.StyledMessage,Object.assign({alignment:"left",isRtl:q,maxWidth:0===m&&f&&"viewport"===M?"min-[767px]:max-w-[80%]":0===m&&f&&"container"===M?"@[767px]/pickaxe-root:max-w-[80%]":"100%"},{children:e.jsxs(u.StyledMessageContainer,Object.assign({isRtl:q,gap:"12px"},{children:[y.isChatImage&&"NONE"!==S&&e.jsx(x.StyledIconWrapper,Object.assign({size:"24px",margin:"12px 0"},{children:e.jsx(n.default,{src:S,alt:"Assistant",width:24,height:24,className:"h-6 w-6",textColor:w.text})})),e.jsxs("div",Object.assign({className:"flex flex-col items-start"},{children:[e.jsx("div",Object.assign({className:"chat-message pt-3"},{children:e.jsx(a.PickaxeMarkdown,Object.assign({theme:v.theme,accentColor:w.accent,actions:!0},{children:e.jsx(r.PickaxeMarkdownRenderer,Object.assign({value:p.content},0===m&&f&&p.content.length>470&&3===(null!==(h=null==b?void 0:b.icebreakers)&&void 0!==h?h:[]).length&&!p.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:j?void 0:12}))}))})),e.jsx("div",Object.assign({className:"mt-4 flex gap-3"},{children:e.jsx(o.default,{color:w.accent,text:p.content})}))]}))]}))})):"user"===p.role?e.jsx(l.StyledMessage,Object.assign({alignment:"right",isRtl:q,maxWidth:"80%",className:""+("viewport"===M?q?"pr-9 min-[767px]:pr-0":"pl-9 min-[767px]:pl-0":q?"pr-9 @[767px]/pickaxe-root:pr-0":"pl-9 @[767px]/pickaxe-root:pl-0")},{children:e.jsxs(d.StyledMessageBubble,Object.assign({backgroundColor:w.secondary,textColor:w.secondaryText,opacity:.5,borderRadius:v.cornerRadius,fontSize:O.b2,isRtl:q},{children:[p.documentIds&&p.documentIds.length>0&&e.jsx("div",Object.assign({className:q?"flex flex-col items-start":"flex flex-col items-end"},{children:p.documentIds.map((t=>e.jsx(s.Fragment,{children:t.startsWith("IMAGE-")?e.jsx("div",Object.assign({className:"max-w-[300px]"},{children:e.jsx("img",{style:{borderRadius:v.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${t.split("-")[2]}/${t.split("-")[1]}.${null==t?void 0:t.split("-")[2]}`,alt:""})})):e.jsx(c.default,{documentId:t})},t)))})),e.jsx(a.PickaxeMarkdown,Object.assign({theme:v.theme,accentColor:w.accent},{children:e.jsx(r.PickaxeMarkdownRenderer,{value:p.content})}))]}))})):e.jsx("div",{})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../../hooks/pickaxe/useDimensionContext.js"),i=require("../../Addons/Scroll/hooks/useScrollContext.js"),o=require("../../../../hooks/studio/useStyleFontSize.js"),n=require("../../../../hooks/pickaxe/useConversation.js"),r=require("../../common/PickaxeIcon.js"),c=require("../../../Core/ErrorAlert.js"),d=require("../../../Core/Skeleton.js"),u=require("../../Addons/Scroll/ScrollLockView.js"),x=require("../../common/PickaxeHead.js"),m=require("../../common/PickaxeCompactHead.js"),f=require("../../common/PickaxeUpgradeCard.js"),j=require("./Message.js"),h=require("../../common/PickaxeBranding.js"),p=require("../../../../common/cn.js");exports.default=({hideInfo:g,isInputFocused:w})=>{var v;const N=n.useConversation(),b=o.useStyleFontSize(),{pickaxe:k,colors:y,misc:C,isNewChat:q,isRtl:O,isEmbed:S,setChatId:P}=a.usePickaxeContext(),{scrollContainerRef:I}=i.useScrollContext(),{messages:L,status:E,limitData:M,error:A}=t.useResponseContext(),{height:H}=l.useDimensionContext(),R=s.useMemo((()=>!!N.data&&!(N.data.messages.length<=1)),[N.data]),z=s.useMemo((()=>!g&&N.isSuccess&&q&&!R),[g,N.isSuccess,q,R]),D=s.useMemo((()=>{var e,s;return!!L.length&&!(null!==(s=null===(e=null==L?void 0:L[L.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[L]);return e.jsx("div",Object.assign({ref:I,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${H}px - 74px)`}},{children:e.jsxs("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(z||!S)&&!C.isWhiteLabel&&e.jsx(h.default,{className:p.default("absolute top-4 right-4",!z&&!S&&"top-2"),animateHover:!0}),e.jsx(x.default,{className:p.default("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",z&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>P("")}),S&&!N.isLoading&&e.jsx(m.default,{className:p.default("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!z&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>P("")}),e.jsx("div",Object.assign({className:p.default("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",S&&!N.isLoading&&!z&&"mt-0")},{children:N.isLoading&&!(null==k?void 0:k.enablechatresponses)?e.jsxs("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[q&&e.jsxs("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e.jsx(d.default,{className:"w-[72px] h-[72px]"}),e.jsx(d.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(d.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(d.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e.jsx(d.default,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e.jsx(d.default,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e.jsx(d.default,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):N.isError?e.jsx("div",Object.assign({className:"flex w-full justify-center"},{children:e.jsxs("p",Object.assign({className:p.default(b.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e.jsx("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):N.data?e.jsxs("div",Object.assign({className:"flex flex-col w-full"},{children:[e.jsxs("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[N.data.messages.map(((s,a)=>e.jsx(j.default,Object.assign({index:a,message:s},0===a&&{isIntroExpand:w}),a))),L.map(((s,a)=>e.jsx(j.default,{index:N.data.messages.length+a,message:s},a))),"fetching"===E||D?e.jsxs("div",Object.assign({className:p.default("flex max-w-[80%] items-center gap-x-3 ",O?"justify-end":"justify-start")},{children:["NONE"!==(null==k?void 0:k.chaticon)&&e.jsx(r.default,{src:null!==(v=null==k?void 0:k.chaticon)&&void 0!==v?v:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==k?void 0:k.formid}.png`,alt:`${null==k?void 0:k.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:y.text}),e.jsx("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4"},{children:Array.from({length:3}).map(((s,a)=>e.jsx("div",{className:p.default("h-1.5 w-1.5 animate-dot rounded-full",1===a&&"animate-dot-down"),style:{backgroundColor:y.secondaryText}},a)))}))]})):M?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(f.default,{})})):A?e.jsx("div",Object.assign({className:p.default("flex items-center gap-x-3",O?"justify-end":"justify-start")},{children:e.jsx(c.default,{error:A})})):null]})),e.jsx(u.default,{className:"w-full"})]})):null}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../../hooks/pickaxe/useResponseContext.js"),i=require("../../../../hooks/pickaxe/useDimensionContext.js"),l=require("../../Addons/Scroll/hooks/useScrollContext.js"),o=require("../../../../hooks/studio/useStyleFontSize.js"),n=require("../../../../hooks/pickaxe/useConversation.js"),r=require("../../common/PickaxeIcon.js"),c=require("../../../Core/ErrorAlert.js"),d=require("../../../Core/Skeleton.js"),u=require("../../Addons/Scroll/ScrollLockView.js"),x=require("../../common/PickaxeHead.js"),m=require("../../common/PickaxeCompactHead.js"),j=require("../../common/PickaxeUpgradeCard.js"),f=require("./Message.js"),p=require("../../common/PickaxeBranding.js"),h=require("../../../../common/cn.js"),g=require("../../ui/StyledLoadingDots.js"),v=require("../../ui/Message/StyledIconWrapper.js"),w=require("../../ui/Message/StyledMessageContainer.js");exports.default=({hideInfo:N,isInputFocused:y})=>{var b;const C=n.useConversation(),k=o.useStyleFontSize(),{pickaxe:q,colors:S,misc:O,isNewChat:I,isRtl:M,isEmbed:P,setChatId:L}=a.usePickaxeContext(),{scrollContainerRef:z}=l.useScrollContext(),{messages:D,status:E,limitData:R,error:H}=t.useResponseContext(),{height:A}=i.useDimensionContext(),F=s.useMemo((()=>!!C.data&&!(C.data.messages.length<=1)),[C.data]),W=s.useMemo((()=>!N&&C.isSuccess&&I&&!F),[N,C.isSuccess,I,F]),$=s.useMemo((()=>{var e,s;return!!D.length&&!(null!==(s=null===(e=null==D?void 0:D[D.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[D]);return e.jsx("div",Object.assign({ref:z,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${A}px - 74px)`}},{children:e.jsxs("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(W||!P)&&!O.isWhiteLabel&&e.jsx(p.default,{className:h.default("absolute top-4 right-4",!W&&!P&&"top-2"),animateHover:!0}),e.jsx(x.default,{className:h.default("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",W&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>L("")}),P&&!C.isLoading&&e.jsx(m.default,{className:h.default("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!W&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>L("")}),e.jsx("div",Object.assign({className:h.default("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",P&&!C.isLoading&&!W&&"mt-0")},{children:C.isLoading&&!(null==q?void 0:q.enablechatresponses)?e.jsxs("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[I&&e.jsxs("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e.jsx(d.default,{className:"w-[72px] h-[72px]"}),e.jsx(d.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(d.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(d.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e.jsx(d.default,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e.jsx(d.default,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e.jsx(d.default,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):C.isError?e.jsx("div",Object.assign({className:"flex w-full justify-center"},{children:e.jsxs("p",Object.assign({className:h.default(k.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e.jsx("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):C.data?e.jsxs("div",Object.assign({className:"flex flex-col w-full"},{children:[e.jsxs("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[C.data.messages.map(((s,a)=>e.jsx(f.default,Object.assign({index:a,message:s},0===a&&{isIntroExpand:y}),a))),D.map(((s,a)=>e.jsx(f.default,{index:C.data.messages.length+a,message:s},a))),"fetching"===E||$?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3 "+(M?"justify-end":"justify-start")},{children:e.jsxs(w.StyledMessageContainer,Object.assign({isRtl:M,gap:"12px"},{children:["NONE"!==(null==q?void 0:q.chaticon)&&e.jsx(v.StyledIconWrapper,Object.assign({size:"24px"},{children:e.jsx(r.default,{src:null!==(b=null==q?void 0:q.chaticon)&&void 0!==b?b:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==q?void 0:q.formid}.png`,alt:`${null==q?void 0:q.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:S.text})})),e.jsx("div",Object.assign({className:"flex items-center rounded px-4 py-4"},{children:e.jsx(g.StyledLoadingDots,{dotColor:S.secondaryText,dotSize:"6px",gap:"8px"})}))]}))})):R?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(j.default,{})})):H?e.jsx("div",Object.assign({className:h.default("flex items-center gap-x-3",M?"justify-end":"justify-start")},{children:e.jsx(c.default,{error:H})})):null]})),e.jsx(u.default,{className:"w-full"})]})):null}))]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),r=require("../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../hooks/studio/useStyleInput.js"),i=require("../../../hooks/studio/useStyleFontSize.js"),a=require("../../../hooks/pickaxe/useConversation.js"),n=require("../../../hooks/pickaxe/useSubmit.js"),d=require("../Addons/Document/hooks/useDocument.js"),c=require("../Addons/Scroll/hooks/useScroll.js"),u=require("../../../hooks/core/useHover.js"),m=require("../../../common/utils.js"),f=require("../../../common/documents.js"),x=require("eventsource-parser"),h=require("../../Icons/attach-vertical.svg.js"),p=require("../../Icons/spinner-lines.svg.js"),g=require("../../Icons/file.svg.js"),b=require("../../Icons/x.svg.js"),j=require("../../Icons/arrow-right.svg.js"),v=require("../Addons/IceBreaker/index.js"),y=require("../../Core/Textarea.js"),k=require("../../../common/error.js"),w=require("../../../common/cn.js");exports.default=({isFocused:I,onFocus:N,onBlur:O})=>{var C;const{formId:q,isRtl:S,chatId:R,userId:_,studioUserId:T,embedUserId:A,deploymentId:F,pickaxe:B,styles:D,colors:U,responsiveBy:H,isNewChat:E,setIsNewChat:z,setIsShowIceBreaker:M,onGenerateComplete:P}=r.usePickaxeContext(),{messages:L,status:$,limits:G,isGenerating:J,setMessages:K,setStatus:W,setLimitData:Q,setError:V}=o.useResponseContext(),{documents:X,isUploading:Y,isImageUploadAllowed:Z,setDocuments:ee,onFileUpload:se}=d.useDocument(),{scrollStartSession:te,scrollEndSession:re,scrollToBottom:oe}=c.useScroll({auto:!0}),le=a.useConversation(),ie=n.useSubmit(),[ae,ne]=t.useState(""),de=t.useRef(null),ce=u.useHover(),{isHover:ue}=ce,me=e.__rest(ce,["isHover"]),fe=u.useHover(),{isHover:xe}=fe,he=e.__rest(fe,["isHover"]),pe=i.useStyleFontSize(),ge=l.useStyleInput(),be=t.useMemo((()=>{var e,s,t;return!!E&&(!!B&&(!le.isLoading&&(!((null!==(s=null===(e=le.data)||void 0===e?void 0:e.messages.length)&&void 0!==s?s:0)>1)&&!!(null===(t=B.icebreakers)||void 0===t?void 0:t.length))))}),[B,E,le.data,le.isLoading]),je=s=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if("idle"!==$||Y)return;const e=null!=s?s:ae;if(!e)return;V(""),Q(null),ne(""),z(!1),W("fetching"),te(),oe();const t=X.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),r=t.length?t[t.length-1].documentId:"",o="enduserupload"===(null==B?void 0:B.documentuploadtype)&&r,l=[...Array.from(L),Object.assign({id:L.length+1,role:"user",content:e},o&&{documentIds:[r]})];K(l),oe(),o&&ee([]);const i=(yield ie.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:q,responseId:R,value:e},o&&{documentId:r}),_&&{userId:_}),T&&{studioUserId:T}),A&&{embedUserId:A}),F&&{deploymentId:F}))).body;if(!i)throw new Error("Streaming error");const a=l.length,n=new TextDecoder,d=i.getReader();let c="",u=!0,m=!1;const f=x.createParser({onEvent:e=>{if("delta"===e.event){const s=JSON.parse(e.data).token.replace(/\u200B/g,"");c+=s,K([...l.slice(0,a),{id:L.length+1,role:"assistant",content:c}])}else if("error"===e.event){const s=JSON.parse(e.data);V(s.error||"Something went wrong, please try again.")}else"stop"===e.event&&(u=!1)}});for(;u;){const{value:e,done:s}=yield d.read();if(s){u=!1;break}const t=n.decode(e);t&&(m||(W("streaming"),m=!0),f.feed(t))}null==P||P(R)}catch(e){let s=k.default(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(G).find((([e])=>s.includes(e)));t?Q(t[1]):V(s)}finally{oe(),W("idle"),re()}}));return t.useEffect((()=>{M(be)}),[be]),s.jsx("div",Object.assign({className:"px-4 pb-4 w-full flex flex-col items-center absolute bottom-0 left-0 z-1",dir:S?"rtl":"ltr"},{children:s.jsxs("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[s.jsx("div",Object.assign({className:w.default("absolute bottom-full",S?"left-0":"right-0")},{children:s.jsx("div",Object.assign({className:w.default("flex flex-col gap-2 pb-4 px-2",S?"justify-start":"justify-end","viewport"===H?S?"min-[767px]:items-start":"min-[767px]:items-end":S?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:be&&!I&&s.jsx(v.default,{data:(null==B?void 0:B.icebreakers)||[],onSend:je})}))})),s.jsxs("div",Object.assign({className:w.default("flex flex-col gap-y-2 px-4 py-3","block"===D.formFieldStyle&&"shadow"),style:ge},{children:["idle"===$&&X.length>0&&s.jsx("div",Object.assign({className:w.default("grid grid-cols-1","viewport"===H?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:X.map((e=>{var r,o,l;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:w.default("relative gap-x-[10px] flex items-center px-2 h-[56px] border",S&&"flex-row-reverse"),style:{borderRadius:ge.borderRadius,borderColor:U.secondaryText+"50"}},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:U.accent,borderRadius:ge.borderRadius}},{children:Y?s.jsx(p.default,{className:"w-5 h-5 animate-spin",style:{color:U.accentText}}):s.jsx(g.default,{className:"w-5 h-5",style:{color:U.accentText}})})),s.jsxs("div",Object.assign({className:w.default("flex flex-col justify-center truncate",S?"text-right items-end":"text-left items-start")},{children:[s.jsx("p",Object.assign({className:(w.default(pe.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:w.default(pe.b4,"opacity-80 truncate")},{children:m.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",className:w.default("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",S?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:U.accent,borderColor:ge.backgroundColor},disabled:Y||"idle"!==$,onClick:()=>ee([])},{children:s.jsx(b.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:ge.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:ge.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[2]}/${null===(o=e.documentId)||void 0===o?void 0:o.split("-")[1]}.${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:ge.borderRadius,backgroundColor:U.secondary}}),s.jsx("button",Object.assign({type:"button",className:w.default("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",S?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:U.accent,borderColor:ge.backgroundColor},disabled:Y||"idle"!==$,onClick:()=>ee([])},{children:s.jsx(b.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):null},e.id)}))})),s.jsxs("div",Object.assign({className:w.default("flex items-end gap-x-2",S&&"flex-row-reverse")},{children:[s.jsx(y.default,{className:w.default(pe.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!ae.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",S?"text-right":"text-left"),value:ae,placeholder:S?"بماذا تريد أن تتحدث؟":null!==(C=null==B?void 0:B.placeholdertext)&&void 0!==C?C:"What do you want to talk about?",onChange:e=>ne(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),Y||"idle"!==$||je()))},onFocus:N,onBlur:O,dir:S?"rtl":"ltr"}),s.jsxs("div",Object.assign({className:w.default("flex items-center gap-x-2")},{children:["enduserupload"===(null==B?void 0:B.documentuploadtype)&&s.jsxs("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:xe?U.accent+"10":void 0},disabled:Y||"idle"!==$,onClick:()=>{var e;return null===(e=de.current)||void 0===e?void 0:e.click()}},he,{children:[s.jsx("input",{id:"file-upload",ref:de,type:"file",accept:[...f.allowedFileMimeTypes,...Z?f.allowedImageMimeTypes:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield se(Array.from(s.target.files||[])),s.target.value=""}))}),s.jsx(h.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:xe?U.accent:U.accent+"80"}})]})),s.jsx("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(ue||ae.length||X.length&&X.every((e=>"finished"===e.status)))&&!J?U.accent:U.accent+"10"},disabled:Y||"idle"!==$,onClick:()=>je()},me,{children:s.jsx(j.default,{className:w.default("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",S&&"transform scale-x-[-1]"),style:{color:(ue||ae.length||X.length&&X.every((e=>"finished"===e.status)))&&!J?U.accentText:U.accent+"80"}})}))]}))]}))]}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("react"),o=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useResponseContext.js"),n=require("../../../hooks/studio/useStyleInput.js"),i=require("../../../hooks/studio/useStyleFontSize.js"),a=require("../../../hooks/pickaxe/useConversation.js"),l=require("../../../hooks/pickaxe/useSubmit.js"),d=require("../Addons/Document/hooks/useDocument.js"),u=require("../Addons/Scroll/hooks/useScroll.js"),c=require("../../../hooks/core/useHover.js"),p=require("../../../common/utils.js"),m=require("../../../common/documents.js"),g=require("eventsource-parser"),x=require("../../Icons/attach-vertical.svg.js"),h=require("../../Icons/spinner-lines.svg.js"),j=require("../../Icons/file.svg.js"),v=require("../../Icons/x.svg.js"),b=require("../../Icons/arrow-right.svg.js"),f=require("../Addons/IceBreaker/index.js"),y=require("../../Core/Textarea.js"),I=require("../../../common/error.js"),k=require("../../../common/cn.js"),S=require("../ui/StyledDocumentCard.js"),C=require("../ui/Input/StyledInputContainer.js"),w=require("../ui/Input/StyledTextareaWrapper.js"),q=require("../ui/Input/StyledIconButton.js"),O=require("../ui/Input/StyledRemoveButton.js"),R=require("../ui/Input/StyledImagePreview.js"),B=require("../ui/Input/StyledAttachmentGrid.js"),N=require("../ui/Input/StyledInputWrapper.js");exports.default=({isFocused:T,onFocus:F,onBlur:_})=>{var A;const{formId:D,isRtl:P,chatId:U,userId:z,studioUserId:H,embedUserId:$,deploymentId:E,pickaxe:W,styles:M,colors:G,responsiveBy:L,isNewChat:J,setIsNewChat:K,setIsShowIceBreaker:Q,onGenerateComplete:V}=o.usePickaxeContext(),{messages:X,status:Y,limits:Z,isGenerating:ee,setMessages:te,setStatus:se,setLimitData:oe,setError:re}=r.useResponseContext(),{documents:ne,isUploading:ie,isImageUploadAllowed:ae,setDocuments:le,onFileUpload:de}=d.useDocument(),{scrollStartSession:ue,scrollEndSession:ce,scrollToBottom:pe}=u.useScroll({auto:!0}),me=a.useConversation(),ge=l.useSubmit(),[xe,he]=s.useState(""),je=s.useRef(null),ve=c.useHover(),{isHover:be}=ve,fe=e.__rest(ve,["isHover"]),ye=c.useHover(),{isHover:Ie}=ye,ke=e.__rest(ye,["isHover"]),Se=i.useStyleFontSize(),Ce=n.useStyleInput(),we=s.useMemo((()=>{var e,t,s;return!!J&&(!!W&&(!me.isLoading&&(!((null!==(t=null===(e=me.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(s=W.icebreakers)||void 0===s?void 0:s.length))))}),[W,J,me.data,me.isLoading]),qe=t=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if("idle"!==Y||ie)return;const e=null!=t?t:xe;if(!e)return;re(""),oe(null),he(""),K(!1),se("fetching"),ue(),pe();const s=ne.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),o=s.length?s[s.length-1].documentId:"",r="enduserupload"===(null==W?void 0:W.documentuploadtype)&&o,n=[...Array.from(X),Object.assign({id:X.length+1,role:"user",content:e},r&&{documentIds:[o]})];te(n),pe(),r&&le([]);const i=(yield ge.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:D,responseId:U,value:e},r&&{documentId:o}),z&&{userId:z}),H&&{studioUserId:H}),$&&{embedUserId:$}),E&&{deploymentId:E}))).body;if(!i)throw new Error("Streaming error");const a=n.length,l=new TextDecoder,d=i.getReader();let u="",c=!0,p=!1;const m=g.createParser({onEvent:e=>{if("delta"===e.event){const t=JSON.parse(e.data).token.replace(/\u200B/g,"");u+=t,te([...n.slice(0,a),{id:X.length+1,role:"assistant",content:u}])}else if("error"===e.event){const t=JSON.parse(e.data);re(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(c=!1)}});for(;c;){const{value:e,done:t}=yield d.read();if(t){c=!1;break}const s=l.decode(e);s&&(p||(se("streaming"),p=!0),m.feed(s))}null==V||V(U)}catch(e){let t=I.default(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(Z).find((([e])=>t.includes(e)));s?oe(s[1]):re(t)}finally{pe(),se("idle"),ce()}}));return s.useEffect((()=>{Q(we)}),[we]),t.jsx(N.StyledInputWrapper,Object.assign({position:"absolute",bottom:"0",padding:"16px",isRtl:P,zIndex:1},{children:t.jsxs("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[t.jsx("div",Object.assign({className:k.default("absolute bottom-full",P?"left-0":"right-0")},{children:t.jsx("div",Object.assign({className:k.default("flex flex-col gap-2 pb-4 px-2",P?"justify-start":"justify-end","viewport"===L?P?"min-[767px]:items-start":"min-[767px]:items-end":P?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:we&&!T&&t.jsx(f.default,{data:(null==W?void 0:W.icebreakers)||[],onSend:qe})}))})),t.jsxs(C.StyledInputContainer,Object.assign({backgroundColor:Ce.backgroundColor,borderColor:Ce.borderColor,borderRadius:Ce.borderRadius,padding:"12px 16px",boxShadow:"block"===M.formFieldStyle,gap:"8px"},{children:["idle"===Y&&ne.length>0&&t.jsx(B.StyledAttachmentGrid,Object.assign({columns:2},{children:ne.map((e=>{var o,r,n;return t.jsx(s.Fragment,{children:"document"===e.type?t.jsx(S.StyledDocumentCard,Object.assign({icon:ie?t.jsx(h.default,{className:"w-5 h-5 animate-spin"}):t.jsx(j.default,{className:"w-5 h-5"}),title:e.name,subtitle:p.formatBytes(e.size),borderColor:`${G.secondaryText}50`,borderRadius:Ce.borderRadius,iconBackgroundColor:G.accent,iconColor:G.accentText,textColor:G.secondaryText,titleFontSize:Se.b3,subtitleFontSize:Se.b4,isRtl:P,style:{position:"relative"}},{children:t.jsx(O.StyledRemoveButton,Object.assign({onClick:()=>le([]),disabled:ie||"idle"!==Y,backgroundColor:G.accent,borderColor:Ce.backgroundColor,isRtl:P},{children:t.jsx(v.default,{className:"w-4 h-4",style:{color:G.accentText}})}))})):"image"===e.type?t.jsx(R.StyledImagePreview,{src:"finished"===e.status?`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(o=e.documentId)||void 0===o?void 0:o.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(n=e.documentId)||void 0===n?void 0:n.split("-")[2]}`:void 0,isLoading:"finished"!==e.status,borderRadius:Ce.borderRadius,backgroundColor:G.secondary,removeButton:t.jsx(O.StyledRemoveButton,Object.assign({onClick:()=>le([]),disabled:ie||"idle"!==Y,backgroundColor:G.accent,borderColor:Ce.backgroundColor,isRtl:P},{children:t.jsx(v.default,{className:"w-4 h-4",style:{color:G.accentText}})}))}):null},e.id)}))})),t.jsxs(w.StyledTextareaWrapper,Object.assign({isRtl:P,gap:"8px"},{children:[t.jsx(y.default,{className:k.default(Se.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!xe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",P?"text-right":"text-left"),value:xe,placeholder:P?"بماذا تريد أن تتحدث؟":null!==(A=null==W?void 0:W.placeholdertext)&&void 0!==A?A:"What do you want to talk about?",onChange:e=>he(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ie||"idle"!==Y||qe()))},onFocus:F,onBlur:_,dir:P?"rtl":"ltr"}),t.jsxs("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==W?void 0:W.documentuploadtype)&&t.jsxs(t.Fragment,{children:[t.jsx("input",{id:"file-upload",ref:je,type:"file",accept:[...m.allowedFileMimeTypes,...ae?m.allowedImageMimeTypes:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:t=>e.__awaiter(void 0,void 0,void 0,(function*(){yield de(Array.from(t.target.files||[])),t.target.value=""}))}),t.jsx(q.StyledIconButton,Object.assign({onClick:()=>{var e;return null===(e=je.current)||void 0===e?void 0:e.click()},disabled:ie||"idle"!==Y,backgroundColor:Ie?G.accent+"10":void 0,hoverProps:ke},{children:t.jsx(x.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:Ie?G.accent:`${G.accent}80`}})}))]}),t.jsx(q.StyledIconButton,Object.assign({onClick:()=>qe(),disabled:ie||"idle"!==Y,backgroundColor:(be||xe.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!ee?G.accent:`${G.accent}10`,hoverProps:fe},{children:t.jsx(b.default,{className:k.default("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",P&&"transform scale-x-[-1]"),style:{color:(be||xe.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!ee?G.accentText:`${G.accent}80`}})}))]}))]}))]}))]}))}))};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../common/cn.js");exports.StyledAttachmentGrid=({children:r,columns:t=1,className:a,style:i})=>e.jsx("div",Object.assign({className:s.default("grid",a),style:Object.assign({gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`},i)},{children:r}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../../common/cn.js");exports.StyledIconButton=({children:o,onClick:t,disabled:n=!1,backgroundColor:s,hoverProps:i})=>e.jsx("button",Object.assign({onClick:t,disabled:n,className:r.default("outline-none disabled:cursor-default flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out"),style:{backgroundColor:s,width:"2rem",height:"2rem"}},i,{children:o}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../common/cn.js");exports.StyledImagePreview=({src:r,alt:l="",size:a="56px",borderRadius:t=4,backgroundColor:i="#F3F4F6",isLoading:o=!1,removeButton:u,className:d,style:c})=>e.jsxs("div",Object.assign({className:s.default("relative bg-stone-100",d),style:Object.assign({width:a,height:a,borderRadius:t},c)},{children:[o?e.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:t,backgroundColor:i}}):r?e.jsx("img",{src:r,alt:l,className:"object-cover w-full h-full",style:{borderRadius:t}}):null,u]}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../../common/cn.js");exports.StyledInputContainer=({children:o,maxWidth:d="800px",backgroundColor:a="#FFFFFF",borderColor:s="#E5E7EB",borderRadius:t=8,padding:i="12px 16px",boxShadow:l=!1,gap:n="8px",className:c,style:x})=>e.jsx("div",Object.assign({className:r.default("flex flex-col",l&&"shadow",c),style:Object.assign({maxWidth:d,width:"100%",backgroundColor:a,borderColor:s,borderRadius:t,padding:i,gap:n},x)},{children:o}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../common/cn.js");exports.StyledInputWrapper=({children:r,position:s="absolute",bottom:o="0",padding:i="16px",width:l="100%",backgroundColor:n="transparent",zIndex:a=1,isRtl:d=!1,className:c,style:p})=>e.jsx("div",Object.assign({className:t.default("flex flex-col items-center left-0",c),style:Object.assign({position:s,bottom:o,padding:i,width:l,backgroundColor:n,zIndex:a},p),dir:d?"rtl":"ltr"},{children:r}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../common/cn.js");exports.StyledRemoveButton=({children:o,onClick:r,disabled:l=!1,size:s="20px",backgroundColor:i="#228DD7",borderColor:n="#FFFFFF",position:u="top-right",isRtl:a=!1,className:d,style:c})=>e.jsx("button",Object.assign({type:"button",onClick:r,disabled:l,className:t.default("absolute rounded-full flex items-center justify-center border outline-none disabled:cursor-default",d),style:Object.assign(Object.assign({width:s,height:s,backgroundColor:i,borderColor:n,top:"-0.5rem"},a?{left:"top-right"===u?"-0.5rem":"auto",right:"top-left"===u?"-0.5rem":"auto"}:{right:"top-right"===u?"-0.5rem":"auto",left:"top-left"===u?"-0.5rem":"auto"}),c)},{children:o}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../common/cn.js");exports.StyledTextareaWrapper=({children:r,gap:t="8px",isRtl:a=!1,className:i,style:c})=>e.jsx("div",Object.assign({className:s.default("flex items-end",i),style:Object.assign(Object.assign({gap:t},c),a?{flexDirection:"row-reverse"}:{})},{children:r}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../../common/cn.js");exports.StyledIconWrapper=({children:s,size:i="24px",backgroundColor:t="transparent",borderRadius:a="50%",padding:n="0",margin:d="0",className:c,style:o})=>e.jsx("div",Object.assign({className:r.default("flex items-center justify-center shrink-0",c),style:Object.assign({width:i,height:i,backgroundColor:t,borderRadius:a,padding:n,margin:d},o)},{children:s}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../common/cn.js");exports.StyledMessage=({children:t,alignment:l="left",maxWidth:i="100%",isRtl:a=!1,gap:r="12px",className:c,style:d})=>e.jsx("div",Object.assign({className:s.default("flex w-full","right"===l?a?"justify-start":"justify-end":a?"justify-end":"justify-start",c),style:d},{children:e.jsx("div",Object.assign({className:"flex flex-col",style:{maxWidth:i,gap:r}},{children:t}))}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../../common/cn.js");exports.StyledMessageBubble=({children:t,backgroundColor:o="#f0f0f0",textColor:l="#000000",padding:a="12px 16px",borderRadius:s=4,fontSize:i="16px",fontFamily:c,isRtl:d=!1,opacity:n=1,className:u,style:f})=>e.jsx("div",Object.assign({className:r.default("overflow-x-auto overflow-y-hidden scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3",d?"text-right":"text-left",u),style:Object.assign({backgroundColor:n<1?`${o}${Math.round(255*n).toString(16)}`:o,color:l,padding:a,borderRadius:s,fontSize:i,fontFamily:c},f)},{children:t}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../../common/cn.js");exports.StyledMessageContainer=({children:s,direction:t="row",gap:a="12px",alignItems:i="start",isRtl:l=!1,className:n,style:c})=>e.jsx("div",Object.assign({className:r.default("flex",l&&"row"===t?"flex-row-reverse":"row"===t?"flex-row":"flex-row-reverse","start"===i?"items-start":"center"===i?"items-center":"items-end",n),style:Object.assign({gap:a},c)},{children:s}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),o=require("../../../common/cn.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t);exports.StyledCopyButton=({onClick:t,icon:r,label:s,color:a="#228DD7",hoverColor:c,fontSize:l="14px",gap:i="4px",className:u,style:d})=>{const[f,p]=n.default.useState(!1);return e.jsxs("button",Object.assign({onClick:t,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),className:o.default("flex items-center transition-colors duration-200",u),style:Object.assign({color:f&&c?c:a,fontSize:l,gap:i},d)},{children:[r,s&&e.jsx("span",{children:s})]}))};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../common/cn.js");exports.StyledDocumentCard=({icon:r,title:s,subtitle:i,href:a="#",target:l="_blank",borderColor:o="#00000010",borderRadius:n=4,backgroundColor:c="transparent",textColor:d="#000000",titleFontSize:x="14px",subtitleFontSize:u="12px",iconBackgroundColor:g="#228DD7",iconColor:b="#FFFFFF",iconSize:h="40px",height:j="56px",padding:f="8px",gap:m="10px",maxWidth:p="500px",isRtl:y=!1,children:v,className:O,style:C})=>{const F=e.jsxs(e.Fragment,{children:[e.jsx("div",Object.assign({className:"flex items-center justify-center shrink-0",style:{backgroundColor:g,borderRadius:n,width:h,height:h,color:b}},{children:r})),e.jsxs("div",Object.assign({className:t.default("flex flex-col justify-center truncate",y?"text-right":"text-left"),style:{color:d}},{children:[e.jsx("p",Object.assign({className:"font-medium truncate",style:{fontSize:x}},{children:s})),i&&e.jsx("p",Object.assign({className:"truncate",style:{fontSize:u,opacity:.8}},{children:i}))]}))]}),N=Object.assign({borderRadius:n,borderColor:o,backgroundColor:c,height:j,padding:f,gap:m,maxWidth:p,width:"100%",position:"relative"},C);return a&&"#"!==a?e.jsxs("a",Object.assign({href:a,target:l,rel:"noreferrer",className:t.default("relative flex items-center border",O),style:Object.assign(Object.assign({},N),y?{flexDirection:"row-reverse"}:{})},{children:[F,v]})):e.jsxs("div",Object.assign({className:t.default("relative flex items-center border",y&&"flex-row-reverse",O),style:N},{children:[F,v]}))};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../common/cn.js");exports.StyledIceBreaker=({colors:t,styles:o,isHover:i,responsiveBy:s,forceMobile:a,text:n,onSend:d,hoverProps:l})=>e.jsxs("div",Object.assign({className:r.default("relative text-sm group flex flex-grow cursor-pointer overflow-hidden font-semilight w-full select-none duration-200 transition-colors border ease-in-out","viewport"===s?"min-[767px]:justify-end min-[767px]:max-w-max":"@[767px]/pickaxe-root:justify-end @[767px]/pickaxe-root:max-w-max",a&&"max-w-full"),onClick:()=>null==d?void 0:d(n),style:{background:i?t.secondary:"transparent",borderColor:t.secondaryText+"30",borderRadius:o.cornerRadius,paddingTop:"9px",paddingRight:"1em",paddingBottom:"9px",paddingLeft:"1em",justifyContent:"flex-end",maxWidth:"max-content"}},l,{children:[e.jsx("div",{className:"absolute inset-0 backdrop-blur-md z-0",style:{background:i?t.secondary:t.primary+"10",borderRadius:o.cornerRadius}}),e.jsx("p",Object.assign({className:r.default("line-clamp-2 duration-200 transition-colors ease-in-out relative","viewport"===s?"min-[767px]:text-right":"@[767px]/pickaxe-root:text-right",a&&"text-left"),style:{color:i?t.secondaryText:t.secondaryText+"60"}},{children:n}))]}));
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../common/cn.js");exports.StyledLoadingDots=({dotColor:i="#4A4A4B",dotSize:s="6px",gap:a="8px",animationDuration:o="0.8s",className:n,style:r})=>e.jsx("div",Object.assign({className:t.default("flex items-center",n),style:Object.assign({gap:a},r)},{children:Array.from({length:3}).map(((t,a)=>e.jsx("div",{className:"rounded-full",style:{backgroundColor:i,width:s,height:s,animation:1===a?`dot-down ${o} infinite`:`dot ${o} infinite`}},a)))}));
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./components/Pickaxe/index.js"),o=require("./components/Pickaxe/Provider.js"),s=require("./components/Pickaxe/ResponseProvider.js"),r=require("./components/Pickaxe/common/PickaxeMarkdown/index.js"),i=require("./components/Pickaxe/common/PickaxeMarkdown/Renderer.js"),t=require("./hooks/pickaxe/useConversation.js"),x=require("./hooks/pickaxe/useHistory.js"),n=require("./hooks/pickaxe/usePickaxe.js"),k=require("./hooks/pickaxe/usePickaxeContext.js"),u=require("./hooks/pickaxe/useResponseContext.js"),a=require("./hooks/pickaxe/useDimensionContext.js"),c=require("./hooks/pickaxe/useSubmit.js"),p=require("./hooks/pickaxe/useSubmitDocument.js");exports.Pickaxe=e.Pickaxe,exports.PickaxeContext=o.PickaxeContext,exports.PickaxeProvider=o.PickaxeProvider,exports.ResponseContext=s.ResponseContext,exports.PickaxeMarkdown=r.PickaxeMarkdown,exports.PickaxeMarkdownContext=r.PickaxeMarkdownContext,exports.PickaxeMarkdownRenderer=i.PickaxeMarkdownRenderer,exports.useConversation=t.useConversation,exports.useHistory=x.useHistory,exports.usePickaxe=n.usePickaxe,exports.usePickaxeContext=k.usePickaxeContext,exports.useResponseContext=u.useResponseContext,exports.useDimensionContext=a.useDimensionContext,exports.useSubmit=c.useSubmit,exports.useSubmitDocument=p.useSubmitDocument;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./components/Pickaxe/index.js"),t=require("./components/Pickaxe/Provider.js");require("react/jsx-runtime"),require("./_virtual/_tslib.js"),require("react");var o=require("./hooks/pickaxe/usePickaxeContext.js"),r=require("./components/Pickaxe/ui/Message/StyledMessage.js"),s=require("./components/Pickaxe/ui/Message/StyledMessageBubble.js"),n=require("./components/Pickaxe/ui/StyledLoadingDots.js"),i=require("./components/Pickaxe/ui/StyledDocumentCard.js"),a=require("./components/Pickaxe/ui/Message/StyledIconWrapper.js"),u=require("./components/Pickaxe/ui/Message/StyledMessageContainer.js"),p=require("./components/Pickaxe/ui/StyledCopyButton.js"),c=require("./components/Pickaxe/ui/Input/StyledInputContainer.js"),x=require("./components/Pickaxe/ui/Input/StyledTextareaWrapper.js"),d=require("./components/Pickaxe/ui/Input/StyledIconButton.js"),k=require("./components/Pickaxe/ui/Input/StyledRemoveButton.js"),l=require("./components/Pickaxe/ui/Input/StyledImagePreview.js"),m=require("./components/Pickaxe/ui/Input/StyledAttachmentGrid.js"),y=require("./components/Pickaxe/ui/Input/StyledInputWrapper.js"),S=require("./components/Pickaxe/ui/StyledIceBreaker.js"),P=require("./components/Icons/file.svg.js"),j=require("./components/Icons/attach-vertical.svg.js"),q=require("./components/Icons/spinner-lines.svg.js"),I=require("./components/Icons/x.svg.js"),C=require("./components/Icons/arrow-right.svg.js"),g=require("./components/Pickaxe/ResponseProvider.js"),v=require("./components/Pickaxe/common/PickaxeMarkdown/index.js"),M=require("./components/Pickaxe/common/PickaxeMarkdown/Renderer.js"),h=require("./hooks/pickaxe/useConversation.js"),B=require("./hooks/pickaxe/useHistory.js"),b=require("./hooks/pickaxe/usePickaxe.js"),w=require("./hooks/pickaxe/useResponseContext.js"),R=require("./hooks/pickaxe/useDimensionContext.js"),D=require("./hooks/pickaxe/useSubmit.js"),W=require("./hooks/pickaxe/useSubmitDocument.js");exports.Pickaxe=e.Pickaxe,exports.PickaxeContext=t.PickaxeContext,exports.PickaxeProvider=t.PickaxeProvider,exports.usePickaxeContext=o.usePickaxeContext,exports.StyledMessage=r.StyledMessage,exports.StyledMessageBubble=s.StyledMessageBubble,exports.StyledLoadingDots=n.StyledLoadingDots,exports.StyledDocumentCard=i.StyledDocumentCard,exports.StyledIconWrapper=a.StyledIconWrapper,exports.StyledMessageContainer=u.StyledMessageContainer,exports.StyledCopyButton=p.StyledCopyButton,exports.StyledInputContainer=c.StyledInputContainer,exports.StyledTextareaWrapper=x.StyledTextareaWrapper,exports.StyledIconButton=d.StyledIconButton,exports.StyledRemoveButton=k.StyledRemoveButton,exports.StyledImagePreview=l.StyledImagePreview,exports.StyledAttachmentGrid=m.StyledAttachmentGrid,exports.StyledInputWrapper=y.StyledInputWrapper,exports.StyledIceBreaker=S.StyledIceBreaker,exports.FileIcon=P.default,exports.AttachVerticalIcon=j.default,exports.SpinnerLinesIcon=q.default,exports.XIcon=I.default,exports.ArrowRightIcon=C.default,exports.ResponseContext=g.ResponseContext,exports.PickaxeMarkdown=v.PickaxeMarkdown,exports.PickaxeMarkdownContext=v.PickaxeMarkdownContext,exports.PickaxeMarkdownRenderer=M.PickaxeMarkdownRenderer,exports.useConversation=h.useConversation,exports.useHistory=B.useHistory,exports.usePickaxe=b.usePickaxe,exports.useResponseContext=w.useResponseContext,exports.useDimensionContext=R.useDimensionContext,exports.useSubmit=D.useSubmit,exports.useSubmitDocument=W.useSubmitDocument;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledAttachmentGridProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ columns?: number;
6
+ }
7
+ export declare const StyledAttachmentGrid: React.FC<StyledAttachmentGridProps>;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledIconButtonProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ onClick?: () => void;
6
+ disabled?: boolean;
7
+ backgroundColor?: string;
8
+ hoverProps?: any;
9
+ }
10
+ export declare const StyledIconButton: React.FC<StyledIconButtonProps>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledImagePreviewProps extends BaseStyleProps {
4
+ src?: string;
5
+ alt?: string;
6
+ size?: string;
7
+ borderRadius?: string | number;
8
+ backgroundColor?: string;
9
+ isLoading?: boolean;
10
+ removeButton?: React.ReactNode;
11
+ }
12
+ export declare const StyledImagePreview: React.FC<StyledImagePreviewProps>;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledInputContainerProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ maxWidth?: string;
6
+ backgroundColor?: string;
7
+ borderColor?: string;
8
+ borderRadius?: string | number;
9
+ padding?: string;
10
+ boxShadow?: boolean;
11
+ gap?: string;
12
+ }
13
+ export declare const StyledInputContainer: React.FC<StyledInputContainerProps>;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledInputWrapperProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ position?: "fixed" | "absolute" | "relative";
6
+ bottom?: string;
7
+ padding?: string;
8
+ width?: string;
9
+ backgroundColor?: string;
10
+ zIndex?: number;
11
+ isRtl?: boolean;
12
+ }
13
+ export declare const StyledInputWrapper: React.FC<StyledInputWrapperProps>;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledRemoveButtonProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ onClick: () => void;
6
+ disabled?: boolean;
7
+ size?: string;
8
+ backgroundColor?: string;
9
+ borderColor?: string;
10
+ position?: "top-right" | "top-left";
11
+ isRtl?: boolean;
12
+ }
13
+ export declare const StyledRemoveButton: React.FC<StyledRemoveButtonProps>;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledTextareaWrapperProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ gap?: string;
6
+ isRtl?: boolean;
7
+ }
8
+ export declare const StyledTextareaWrapper: React.FC<StyledTextareaWrapperProps>;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledIconWrapperProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ size?: string;
6
+ backgroundColor?: string;
7
+ borderRadius?: string | number;
8
+ padding?: string;
9
+ margin?: string;
10
+ }
11
+ export declare const StyledIconWrapper: React.FC<StyledIconWrapperProps>;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledMessageProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ alignment?: "left" | "right";
6
+ maxWidth?: string;
7
+ isRtl?: boolean;
8
+ gap?: string;
9
+ }
10
+ export declare const StyledMessage: React.FC<StyledMessageProps>;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledMessageBubbleProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ backgroundColor?: string;
6
+ textColor?: string;
7
+ padding?: string;
8
+ borderRadius?: number;
9
+ fontSize?: string;
10
+ fontFamily?: string;
11
+ isRtl?: boolean;
12
+ opacity?: number;
13
+ }
14
+ export declare const StyledMessageBubble: React.FC<StyledMessageBubbleProps>;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledMessageContainerProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ direction?: "row" | "row-reverse";
6
+ gap?: string;
7
+ alignItems?: "start" | "center" | "end";
8
+ isRtl?: boolean;
9
+ }
10
+ export declare const StyledMessageContainer: React.FC<StyledMessageContainerProps>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "./types";
3
+ export interface StyledCopyButtonProps extends BaseStyleProps {
4
+ onClick: () => void;
5
+ icon: React.ReactNode;
6
+ label?: string;
7
+ color?: string;
8
+ hoverColor?: string;
9
+ fontSize?: string;
10
+ gap?: string;
11
+ }
12
+ export declare const StyledCopyButton: React.FC<StyledCopyButtonProps>;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "./types";
3
+ export interface StyledDocumentCardProps extends BaseStyleProps {
4
+ icon: React.ReactNode;
5
+ title: string;
6
+ subtitle?: string;
7
+ href?: string;
8
+ target?: string;
9
+ borderColor?: string;
10
+ borderRadius?: string | number;
11
+ backgroundColor?: string;
12
+ textColor?: string;
13
+ titleFontSize?: string;
14
+ subtitleFontSize?: string;
15
+ iconBackgroundColor?: string;
16
+ iconColor?: string;
17
+ iconSize?: string;
18
+ height?: string;
19
+ padding?: string;
20
+ gap?: string;
21
+ maxWidth?: string;
22
+ isRtl?: boolean;
23
+ children?: React.ReactNode;
24
+ }
25
+ export declare const StyledDocumentCard: React.FC<StyledDocumentCardProps>;
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { BaseStyleProps } from "./types";
3
+ import { PickaxeResponsiveBy } from "../Provider";
4
+ export interface StyledIceBreakerProps extends BaseStyleProps {
5
+ colors: {
6
+ primary: string;
7
+ secondary: string;
8
+ secondaryText: string;
9
+ };
10
+ styles: {
11
+ cornerRadius: string | number;
12
+ };
13
+ isHover?: boolean;
14
+ responsiveBy?: PickaxeResponsiveBy;
15
+ forceMobile?: boolean;
16
+ text: string;
17
+ onSend?: (text: string) => void;
18
+ hoverProps?: React.HTMLAttributes<HTMLDivElement>;
19
+ }
20
+ export declare const StyledIceBreaker: React.FC<StyledIceBreakerProps>;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "./types";
3
+ export interface StyledLoadingDotsProps extends BaseStyleProps {
4
+ dotColor?: string;
5
+ dotSize?: string;
6
+ gap?: string;
7
+ animationDuration?: string;
8
+ }
9
+ export declare const StyledLoadingDots: React.FC<StyledLoadingDotsProps>;
@@ -0,0 +1,20 @@
1
+ export { StyledMessage } from "./Message/StyledMessage";
2
+ export { StyledMessageBubble } from "./Message/StyledMessageBubble";
3
+ export { StyledLoadingDots } from "./StyledLoadingDots";
4
+ export { StyledDocumentCard } from "./StyledDocumentCard";
5
+ export { StyledIconWrapper } from "./Message/StyledIconWrapper";
6
+ export { StyledMessageContainer } from "./Message/StyledMessageContainer";
7
+ export { StyledCopyButton } from "./StyledCopyButton";
8
+ export { StyledInputContainer } from "./Input/StyledInputContainer";
9
+ export { StyledTextareaWrapper } from "./Input/StyledTextareaWrapper";
10
+ export { StyledIconButton } from "./Input/StyledIconButton";
11
+ export { StyledRemoveButton } from "./Input/StyledRemoveButton";
12
+ export { StyledImagePreview } from "./Input/StyledImagePreview";
13
+ export { StyledAttachmentGrid } from "./Input/StyledAttachmentGrid";
14
+ export { StyledInputWrapper } from "./Input/StyledInputWrapper";
15
+ export { StyledIceBreaker } from "./StyledIceBreaker";
16
+ export { default as FileIcon } from "@src/components/Icons/file.svg";
17
+ export { default as AttachVerticalIcon } from "@src/components/Icons/attach-vertical.svg";
18
+ export { default as SpinnerLinesIcon } from "@src/components/Icons/spinner-lines.svg";
19
+ export { default as XIcon } from "@src/components/Icons/x.svg";
20
+ export { default as ArrowRightIcon } from "@src/components/Icons/arrow-right.svg";
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export interface BaseStyleProps {
3
+ className?: string;
4
+ style?: React.CSSProperties;
5
+ }
@@ -1,9 +1,11 @@
1
1
  import "./styles/prose.css";
2
2
  export * from "./components/Pickaxe";
3
3
  export * from "./components/Pickaxe/Provider";
4
+ export * from "./components/Pickaxe/Addons/IceBreaker";
4
5
  export * from "./components/Pickaxe/ResponseProvider";
5
6
  export * from "./components/Pickaxe/common/PickaxeMarkdown";
6
7
  export * from "./components/Pickaxe/common/PickaxeMarkdown/Renderer";
8
+ export * from "./components/Pickaxe/ui";
7
9
  export * from "./hooks/pickaxe/useConversation";
8
10
  export * from "./hooks/pickaxe/useHistory";
9
11
  export * from "./hooks/pickaxe/usePickaxe";
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsxs as o,jsx as r}from"react/jsx-runtime";import{useHover as t}from"../../../../hooks/core/useHover.js";import{usePickaxeContext as s}from"../../../../hooks/pickaxe/usePickaxeContext.js";import i from"../../../../common/cn.js";const a=({text:a,onSend:n})=>{const{colors:l,styles:c,forceMobile:x,responsiveBy:d}=s(),m=t(),{isHover:p}=m,u=e(m,["isHover"]);return o("div",Object.assign({className:i("relative text-sm group flex flex-grow cursor-pointer overflow-hidden font-semilight w-full select-none px-[1em] py-[9px] duration-200 transition-colors border w-full ease-in-out","viewport"===d?"min-[767px]:justify-end min-[767px]:max-w-max":"@[767px]/pickaxe-root:justify-end @[767px]/pickaxe-root:max-w-max",x&&"max-w-full"),onClick:()=>null==n?void 0:n(a),style:{background:p?l.secondary:"transparent",borderColor:l.secondaryText+"30",borderRadius:c.cornerRadius}},u,{children:[r("div",{className:"absolute inset-0 backdrop-blur-md z-0",style:{background:p?l.secondary:l.primary+"10",borderRadius:c.cornerRadius}}),r("p",Object.assign({className:i("line-clamp-2 duration-200 transition-colors ease-in-out relative","viewport"===d?"min-[767px]:text-right":"@[767px]/pickaxe-root:text-right",x&&"text-left"),style:{color:p?l.secondaryText:l.secondaryText+"60"}},{children:a}))]}))};export{a as default};
1
+ import{__rest as o}from"../../../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{useHover as r}from"../../../../hooks/core/useHover.js";import{usePickaxeContext as s}from"../../../../hooks/pickaxe/usePickaxeContext.js";import"clsx";import"tailwind-merge";import"react";import{StyledIceBreaker as t}from"../../ui/StyledIceBreaker.js";const i=({text:i,onSend:m})=>{const{colors:c,styles:p,forceMobile:l,responsiveBy:n}=s(),a=r(),{isHover:f}=a,v=o(a,["isHover"]);return e(t,{colors:c,styles:p,isHover:f,responsiveBy:n,forceMobile:l,text:i,onSend:m,hoverProps:v})};export{i as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import s from"../../../../common/cn.js";import{formatBytes as r}from"../../../../common/utils.js";import{useDocumentData as o}from"../../../../hooks/pickaxe/useDocumentData.js";import{usePickaxeContext as a}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as c}from"../../../../hooks/studio/useStyleFontSize.js";import n from"../../../Icons/file.svg.js";const i=({documentId:i})=>{const l=o({documentId:i}),{colors:m,styles:d,isRtl:u}=a(),x=c();return"success"!==l.status?e("div",{}):t("a",Object.assign({href:l.data.storageUrl?l.data.storageUrl:"#",target:"_blank",className:s("gap-x-[10px] w-full max-w-[500px] flex items-center px-2 h-[56px] border",u&&"flex-row-reverse"),style:{borderRadius:d.cornerRadius,borderColor:m.secondary+"50"},rel:"noreferrer"},{children:[e("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:m.accent,borderRadius:d.cornerRadius}},{children:e(n,{className:"w-5 h-5",style:{color:m.accentText}})})),t("div",Object.assign({className:s("flex flex-col justify-center truncate",u?"text-right":"text-left")},{children:[e("p",Object.assign({className:(s(x.b3),"font-medium truncate")},{children:l.data.name})),t("p",Object.assign({className:s(x.b4,"opacity-80 truncate")},{children:[l.data.extension&&l.data.extension.toUpperCase()+", ",r(l.data.size)]}))]}))]}))};export{i as default};
1
+ import{jsx as o}from"react/jsx-runtime";import{formatBytes as t}from"../../../../common/utils.js";import{useDocumentData as e}from"../../../../hooks/pickaxe/useDocumentData.js";import{usePickaxeContext as s}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as r}from"../../../../hooks/studio/useStyleFontSize.js";import i from"../../../Icons/file.svg.js";import"clsx";import"tailwind-merge";import{StyledDocumentCard as a}from"../../ui/StyledDocumentCard.js";import"react";const c=({documentId:c})=>{const n=e({documentId:c}),{colors:m,styles:d,isRtl:l}=s(),u=r();return"success"!==n.status?o("div",{}):o(a,{icon:o(i,{className:"w-5 h-5"}),title:n.data.name,subtitle:`${n.data.extension?n.data.extension.toUpperCase()+", ":""}${t(n.data.size)}`,href:n.data.storageUrl||"#",borderColor:`${m.secondary}50`,borderRadius:d.cornerRadius,iconBackgroundColor:m.accent,iconColor:m.accentText,textColor:m.secondaryText,titleFontSize:u.b3,subtitleFontSize:u.b4,isRtl:l})};export{c as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Fragment as s}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as i}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as c}from"../../common/PickaxeMarkdown/Renderer.js";import n from"../../common/PickaxeIcon.js";import r from"./Document.js";import l from"../../common/PickaxeCopyButton.js";import m from"../../../../common/cn.js";const d=({index:d,message:x,isIntroExpand:p})=>{var h,u;const{formId:f,pickaxe:g,styles:j,colors:v,misc:b,responsiveBy:w,isNewChat:k,isRtl:y}=o(),N=i(),O=null!==(h=null==g?void 0:g.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${f}.png`;return"assistant"===x.role?e("div",Object.assign({className:m("flex w-full",y?"justify-end":"justify-start")},{children:e("div",Object.assign({className:m("flex flex-col",0===d&&k&&"viewport"===w&&"min-[767px]:max-w-[80%]",0===d&&k&&"container"===w&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:t("div",Object.assign({className:m("flex gap-x-3",y&&"flex-row-reverse")},{children:[b.isChatImage&&"NONE"!==O&&e(n,{src:O,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:v.text}),t("div",Object.assign({className:m("flex flex-col",y?"items-end":"items-start")},{children:[e("div",Object.assign({className:m(N.b2,"chat-message pt-3",y?"text-right":"text-left")},{children:e(a,Object.assign({theme:j.theme,accentColor:v.accent,actions:!0},{children:e(c,Object.assign({value:x.content},0===d&&k&&x.content.length>470&&3===(null!==(u=null==g?void 0:g.icebreakers)&&void 0!==u?u:[]).length&&!x.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:p?void 0:12}))}))})),e("div",Object.assign({className:"mt-4 flex gap-3"},{children:e(l,{color:v.accent,text:x.content})}))]}))]}))}))})):"user"===x.role?e("div",Object.assign({className:m("flex w-full",y?"justify-start":"justify-end")},{children:e("div",Object.assign({className:m("flex gap-x-3 max-w-[80%]",y?"pr-9":"pl-9","viewport"===w?y?"min-[767px]:pr-0":"min-[767px]:pl-0":y?"@[767px]/pickaxe-root:pr-0":"@[767px]/pickaxe-root:pl-0")},{children:t("div",Object.assign({className:m(N.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3",y?"text-right":"text-left"),style:{backgroundColor:v.secondary+"80",color:v.secondaryText,borderRadius:j.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e("div",Object.assign({className:m("flex flex-col",y?"items-start":"items-end")},{children:x.documentIds.map((t=>e(s,{children:t.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:j.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${t.split("-")[2]}/${t.split("-")[1]}.${null==t?void 0:t.split("-")[2]}`,alt:""})})):e(r,{documentId:t})},t)))})),e(a,Object.assign({theme:j.theme,accentColor:v.accent},{children:e(c,{value:x.content})}))]}))}))})):e("div",{})};export{d as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Fragment as s}from"react";import{usePickaxeContext as i}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as o}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as n}from"../../common/PickaxeMarkdown/Renderer.js";import c from"../../common/PickaxeIcon.js";import r from"./Document.js";import l from"../../common/PickaxeCopyButton.js";import{StyledMessage as m}from"../../ui/Message/StyledMessage.js";import{StyledMessageBubble as d}from"../../ui/Message/StyledMessageBubble.js";import"clsx";import"tailwind-merge";import{StyledIconWrapper as p}from"../../ui/Message/StyledIconWrapper.js";import{StyledMessageContainer as x}from"../../ui/Message/StyledMessageContainer.js";const h=({index:h,message:g,isIntroExpand:u})=>{var f,j;const{formId:b,pickaxe:k,styles:v,colors:w,misc:O,responsiveBy:y,isNewChat:N,isRtl:C}=i(),I=o(),M=null!==(f=null==k?void 0:k.chaticon)&&void 0!==f?f:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${b}.png`;return"assistant"===g.role?e(m,Object.assign({alignment:"left",isRtl:C,maxWidth:0===h&&N&&"viewport"===y?"min-[767px]:max-w-[80%]":0===h&&N&&"container"===y?"@[767px]/pickaxe-root:max-w-[80%]":"100%"},{children:t(x,Object.assign({isRtl:C,gap:"12px"},{children:[O.isChatImage&&"NONE"!==M&&e(p,Object.assign({size:"24px",margin:"12px 0"},{children:e(c,{src:M,alt:"Assistant",width:24,height:24,className:"h-6 w-6",textColor:w.text})})),t("div",Object.assign({className:"flex flex-col items-start"},{children:[e("div",Object.assign({className:"chat-message pt-3"},{children:e(a,Object.assign({theme:v.theme,accentColor:w.accent,actions:!0},{children:e(n,Object.assign({value:g.content},0===h&&N&&g.content.length>470&&3===(null!==(j=null==k?void 0:k.icebreakers)&&void 0!==j?j:[]).length&&!g.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:u?void 0:12}))}))})),e("div",Object.assign({className:"mt-4 flex gap-3"},{children:e(l,{color:w.accent,text:g.content})}))]}))]}))})):"user"===g.role?e(m,Object.assign({alignment:"right",isRtl:C,maxWidth:"80%",className:""+("viewport"===y?C?"pr-9 min-[767px]:pr-0":"pl-9 min-[767px]:pl-0":C?"pr-9 @[767px]/pickaxe-root:pr-0":"pl-9 @[767px]/pickaxe-root:pl-0")},{children:t(d,Object.assign({backgroundColor:w.secondary,textColor:w.secondaryText,opacity:.5,borderRadius:v.cornerRadius,fontSize:I.b2,isRtl:C},{children:[g.documentIds&&g.documentIds.length>0&&e("div",Object.assign({className:C?"flex flex-col items-start":"flex flex-col items-end"},{children:g.documentIds.map((t=>e(s,{children:t.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:v.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${t.split("-")[2]}/${t.split("-")[1]}.${null==t?void 0:t.split("-")[2]}`,alt:""})})):e(r,{documentId:t})},t)))})),e(a,Object.assign({theme:v.theme,accentColor:w.accent},{children:e(n,{value:g.content})}))]}))})):e("div",{})};export{h as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useMemo as a}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as t}from"../../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as i}from"../../../../hooks/pickaxe/useDimensionContext.js";import{useScrollContext as l}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as n}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as r}from"../../../../hooks/pickaxe/useConversation.js";import c from"../../common/PickaxeIcon.js";import m from"../../../Core/ErrorAlert.js";import d from"../../../Core/Skeleton.js";import p from"../../Addons/Scroll/ScrollLockView.js";import f from"../../common/PickaxeHead.js";import x from"../../common/PickaxeCompactHead.js";import u from"../../common/PickaxeUpgradeCard.js";import h from"./Message.js";import g from"../../common/PickaxeBranding.js";import j from"../../../../common/cn.js";const w=({hideInfo:w,isInputFocused:v})=>{var N;const b=r(),k=n(),{pickaxe:y,colors:C,misc:O,isNewChat:S,isRtl:I,isEmbed:P,setChatId:L}=o(),{scrollContainerRef:E}=l(),{messages:A,status:H,limitData:R,error:$}=t(),{height:z}=i(),D=a((()=>!!b.data&&!(b.data.messages.length<=1)),[b.data]),F=a((()=>!w&&b.isSuccess&&S&&!D),[w,b.isSuccess,S,D]),B=a((()=>{var e,s;return!!A.length&&!(null!==(s=null===(e=null==A?void 0:A[A.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[A]);return e("div",Object.assign({ref:E,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${z}px - 74px)`}},{children:s("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(F||!P)&&!O.isWhiteLabel&&e(g,{className:j("absolute top-4 right-4",!F&&!P&&"top-2"),animateHover:!0}),e(f,{className:j("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",F&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>L("")}),P&&!b.isLoading&&e(x,{className:j("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!F&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>L("")}),e("div",Object.assign({className:j("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",P&&!b.isLoading&&!F&&"mt-0")},{children:b.isLoading&&!(null==y?void 0:y.enablechatresponses)?s("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[S&&s("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e(d,{className:"w-[72px] h-[72px]"}),e(d,{className:"h-[20px] mt-6 w-full"}),e(d,{className:"h-[20px] mt-2 w-full"}),e(d,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e(d,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e(d,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e(d,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):b.isError?e("div",Object.assign({className:"flex w-full justify-center"},{children:s("p",Object.assign({className:j(k.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):b.data?s("div",Object.assign({className:"flex flex-col w-full"},{children:[s("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[b.data.messages.map(((s,a)=>e(h,Object.assign({index:a,message:s},0===a&&{isIntroExpand:v}),a))),A.map(((s,a)=>e(h,{index:b.data.messages.length+a,message:s},a))),"fetching"===H||B?s("div",Object.assign({className:j("flex max-w-[80%] items-center gap-x-3 ",I?"justify-end":"justify-start")},{children:["NONE"!==(null==y?void 0:y.chaticon)&&e(c,{src:null!==(N=null==y?void 0:y.chaticon)&&void 0!==N?N:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==y?void 0:y.formid}.png`,alt:`${null==y?void 0:y.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:C.text}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4"},{children:Array.from({length:3}).map(((s,a)=>e("div",{className:j("h-1.5 w-1.5 animate-dot rounded-full",1===a&&"animate-dot-down"),style:{backgroundColor:C.secondaryText}},a)))}))]})):R?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(u,{})})):$?e("div",Object.assign({className:j("flex items-center gap-x-3",I?"justify-end":"justify-start")},{children:e(m,{error:$})})):null]})),e(p,{className:"w-full"})]})):null}))]}))}))};export{w as default};
1
+ import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useMemo as a}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as o}from"../../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as i}from"../../../../hooks/pickaxe/useDimensionContext.js";import{useScrollContext as l}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as n}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as r}from"../../../../hooks/pickaxe/useConversation.js";import c from"../../common/PickaxeIcon.js";import m from"../../../Core/ErrorAlert.js";import d from"../../../Core/Skeleton.js";import p from"../../Addons/Scroll/ScrollLockView.js";import x from"../../common/PickaxeHead.js";import f from"../../common/PickaxeCompactHead.js";import u from"../../common/PickaxeUpgradeCard.js";import h from"./Message.js";import g from"../../common/PickaxeBranding.js";import j from"../../../../common/cn.js";import{StyledLoadingDots as w}from"../../ui/StyledLoadingDots.js";import{StyledIconWrapper as v}from"../../ui/Message/StyledIconWrapper.js";import{StyledMessageContainer as N}from"../../ui/Message/StyledMessageContainer.js";const b=({hideInfo:b,isInputFocused:k})=>{var y;const C=r(),O=n(),{pickaxe:S,colors:I,misc:L,isNewChat:P,isRtl:E,isEmbed:z,setChatId:H}=t(),{scrollContainerRef:M}=l(),{messages:R,status:A,limitData:D,error:$}=o(),{height:F}=i(),W=a((()=>!!C.data&&!(C.data.messages.length<=1)),[C.data]),B=a((()=>!b&&C.isSuccess&&P&&!W),[b,C.isSuccess,P,W]),T=a((()=>{var e,s;return!!R.length&&!(null!==(s=null===(e=null==R?void 0:R[R.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[R]);return e("div",Object.assign({ref:M,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${F}px - 74px)`}},{children:s("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(B||!z)&&!L.isWhiteLabel&&e(g,{className:j("absolute top-4 right-4",!B&&!z&&"top-2"),animateHover:!0}),e(x,{className:j("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",B&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>H("")}),z&&!C.isLoading&&e(f,{className:j("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!B&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>H("")}),e("div",Object.assign({className:j("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",z&&!C.isLoading&&!B&&"mt-0")},{children:C.isLoading&&!(null==S?void 0:S.enablechatresponses)?s("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[P&&s("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e(d,{className:"w-[72px] h-[72px]"}),e(d,{className:"h-[20px] mt-6 w-full"}),e(d,{className:"h-[20px] mt-2 w-full"}),e(d,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e(d,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e(d,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e(d,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):C.isError?e("div",Object.assign({className:"flex w-full justify-center"},{children:s("p",Object.assign({className:j(O.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):C.data?s("div",Object.assign({className:"flex flex-col w-full"},{children:[s("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[C.data.messages.map(((s,a)=>e(h,Object.assign({index:a,message:s},0===a&&{isIntroExpand:k}),a))),R.map(((s,a)=>e(h,{index:C.data.messages.length+a,message:s},a))),"fetching"===A||T?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3 "+(E?"justify-end":"justify-start")},{children:s(N,Object.assign({isRtl:E,gap:"12px"},{children:["NONE"!==(null==S?void 0:S.chaticon)&&e(v,Object.assign({size:"24px"},{children:e(c,{src:null!==(y=null==S?void 0:S.chaticon)&&void 0!==y?y:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==S?void 0:S.formid}.png`,alt:`${null==S?void 0:S.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:I.text})})),e("div",Object.assign({className:"flex items-center rounded px-4 py-4"},{children:e(w,{dotColor:I.secondaryText,dotSize:"6px",gap:"8px"})}))]}))})):D?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(u,{})})):$?e("div",Object.assign({className:j("flex items-center gap-x-3",E?"justify-end":"justify-start")},{children:e(m,{error:$})})):null]})),e(p,{className:"w-full"})]})):null}))]}))}))};export{b as default};
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as t}from"../../../_virtual/_tslib.js";import{jsx as s,jsxs as o}from"react/jsx-runtime";import{useState as r,useRef as i,useMemo as n,useEffect as l,Fragment as a}from"react";import{usePickaxeContext as c}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as d}from"../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as u}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as m}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as p}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as f}from"../../../hooks/pickaxe/useSubmit.js";import{useDocument as h}from"../Addons/Document/hooks/useDocument.js";import{useScroll as g}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as b}from"../../../hooks/core/useHover.js";import{formatBytes as v}from"../../../common/utils.js";import{allowedFileMimeTypes as x,allowedImageMimeTypes as y}from"../../../common/documents.js";import{createParser as j}from"eventsource-parser";import k from"../../Icons/attach-vertical.svg.js";import w from"../../Icons/spinner-lines.svg.js";import N from"../../Icons/file.svg.js";import I from"../../Icons/x.svg.js";import O from"../../Icons/arrow-right.svg.js";import C from"../Addons/IceBreaker/index.js";import S from"../../Core/Textarea.js";import R from"../../../common/error.js";import A from"../../../common/cn.js";const T=({isFocused:T,onFocus:U,onBlur:B})=>{var D;const{formId:F,isRtl:E,chatId:H,userId:z,studioUserId:L,embedUserId:$,deploymentId:G,pickaxe:J,styles:K,colors:P,responsiveBy:W,isNewChat:_,setIsNewChat:M,setIsShowIceBreaker:q,onGenerateComplete:Q}=c(),{messages:V,status:X,limits:Y,isGenerating:Z,setMessages:ee,setStatus:te,setLimitData:se,setError:oe}=d(),{documents:re,isUploading:ie,isImageUploadAllowed:ne,setDocuments:le,onFileUpload:ae}=h(),{scrollStartSession:ce,scrollEndSession:de,scrollToBottom:ue}=g({auto:!0}),me=p(),pe=f(),[fe,he]=r(""),ge=i(null),be=b(),{isHover:ve}=be,xe=e(be,["isHover"]),ye=b(),{isHover:je}=ye,ke=e(ye,["isHover"]),we=m(),Ne=u(),Ie=n((()=>{var e,t,s;return!!_&&(!!J&&(!me.isLoading&&(!((null!==(t=null===(e=me.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(s=J.icebreakers)||void 0===s?void 0:s.length))))}),[J,_,me.data,me.isLoading]),Oe=e=>t(void 0,void 0,void 0,(function*(){try{if("idle"!==X||ie)return;const t=null!=e?e:fe;if(!t)return;oe(""),se(null),he(""),M(!1),te("fetching"),ce(),ue();const s=re.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),o=s.length?s[s.length-1].documentId:"",r="enduserupload"===(null==J?void 0:J.documentuploadtype)&&o,i=[...Array.from(V),Object.assign({id:V.length+1,role:"user",content:t},r&&{documentIds:[o]})];ee(i),ue(),r&&le([]);const n=(yield pe.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:F,responseId:H,value:t},r&&{documentId:o}),z&&{userId:z}),L&&{studioUserId:L}),$&&{embedUserId:$}),G&&{deploymentId:G}))).body;if(!n)throw new Error("Streaming error");const l=i.length,a=new TextDecoder,c=n.getReader();let d="",u=!0,m=!1;const p=j({onEvent:e=>{if("delta"===e.event){const t=JSON.parse(e.data).token.replace(/\u200B/g,"");d+=t,ee([...i.slice(0,l),{id:V.length+1,role:"assistant",content:d}])}else if("error"===e.event){const t=JSON.parse(e.data);oe(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(u=!1)}});for(;u;){const{value:e,done:t}=yield c.read();if(t){u=!1;break}const s=a.decode(e);s&&(m||(te("streaming"),m=!0),p.feed(s))}null==Q||Q(H)}catch(e){let t=R(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(Y).find((([e])=>t.includes(e)));s?se(s[1]):oe(t)}finally{ue(),te("idle"),de()}}));return l((()=>{q(Ie)}),[Ie]),s("div",Object.assign({className:"px-4 pb-4 w-full flex flex-col items-center absolute bottom-0 left-0 z-1",dir:E?"rtl":"ltr"},{children:o("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[s("div",Object.assign({className:A("absolute bottom-full",E?"left-0":"right-0")},{children:s("div",Object.assign({className:A("flex flex-col gap-2 pb-4 px-2",E?"justify-start":"justify-end","viewport"===W?E?"min-[767px]:items-start":"min-[767px]:items-end":E?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:Ie&&!T&&s(C,{data:(null==J?void 0:J.icebreakers)||[],onSend:Oe})}))})),o("div",Object.assign({className:A("flex flex-col gap-y-2 px-4 py-3","block"===K.formFieldStyle&&"shadow"),style:Ne},{children:["idle"===X&&re.length>0&&s("div",Object.assign({className:A("grid grid-cols-1","viewport"===W?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:re.map((e=>{var t,r,i;return s(a,{children:"document"===e.type?o("div",Object.assign({className:A("relative gap-x-[10px] flex items-center px-2 h-[56px] border",E&&"flex-row-reverse"),style:{borderRadius:Ne.borderRadius,borderColor:P.secondaryText+"50"}},{children:[s("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:P.accent,borderRadius:Ne.borderRadius}},{children:ie?s(w,{className:"w-5 h-5 animate-spin",style:{color:P.accentText}}):s(N,{className:"w-5 h-5",style:{color:P.accentText}})})),o("div",Object.assign({className:A("flex flex-col justify-center truncate",E?"text-right items-end":"text-left items-start")},{children:[s("p",Object.assign({className:(A(we.b3),"font-medium truncate")},{children:e.name})),s("p",Object.assign({className:A(we.b4,"opacity-80 truncate")},{children:v(e.size)}))]})),s("button",Object.assign({type:"button",className:A("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",E?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:P.accent,borderColor:Ne.backgroundColor},disabled:ie||"idle"!==X,onClick:()=>le([])},{children:s(I,{className:"w-4 h-4",style:{color:P.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:Ne.borderRadius}},{children:["finished"===e.status?s("img",{style:{borderRadius:Ne.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(t=e.documentId)||void 0===t?void 0:t.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):s("div",{className:"h-full w-full animate-pulse",style:{borderRadius:Ne.borderRadius,backgroundColor:P.secondary}}),s("button",Object.assign({type:"button",className:A("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",E?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:P.accent,borderColor:Ne.backgroundColor},disabled:ie||"idle"!==X,onClick:()=>le([])},{children:s(I,{className:"w-4 h-4",style:{color:P.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:A("flex items-end gap-x-2",E&&"flex-row-reverse")},{children:[s(S,{className:A(we.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!fe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",E?"text-right":"text-left"),value:fe,placeholder:E?"بماذا تريد أن تتحدث؟":null!==(D=null==J?void 0:J.placeholdertext)&&void 0!==D?D:"What do you want to talk about?",onChange:e=>he(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ie||"idle"!==X||Oe()))},onFocus:U,onBlur:B,dir:E?"rtl":"ltr"}),o("div",Object.assign({className:A("flex items-center gap-x-2")},{children:["enduserupload"===(null==J?void 0:J.documentuploadtype)&&o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:je?P.accent+"10":void 0},disabled:ie||"idle"!==X,onClick:()=>{var e;return null===(e=ge.current)||void 0===e?void 0:e.click()}},ke,{children:[s("input",{id:"file-upload",ref:ge,type:"file",accept:[...x,...ne?y:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){yield ae(Array.from(e.target.files||[])),e.target.value=""}))}),s(k,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:je?P.accent:P.accent+"80"}})]})),s("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(ve||fe.length||re.length&&re.every((e=>"finished"===e.status)))&&!Z?P.accent:P.accent+"10"},disabled:ie||"idle"!==X,onClick:()=>Oe()},xe,{children:s(O,{className:A("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",E&&"transform scale-x-[-1]"),style:{color:(ve||fe.length||re.length&&re.every((e=>"finished"===e.status)))&&!Z?P.accentText:P.accent+"80"}})}))]}))]}))]}))]}))}))};export{T as default};
1
+ import{__rest as e,__awaiter as o}from"../../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as r}from"react/jsx-runtime";import{useState as i,useRef as n,useMemo as a,useEffect as l,Fragment as d}from"react";import{usePickaxeContext as c}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as m}from"../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as u}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as p}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as g}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as h}from"../../../hooks/pickaxe/useSubmit.js";import{useDocument as f}from"../Addons/Document/hooks/useDocument.js";import{useScroll as v}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as b}from"../../../hooks/core/useHover.js";import{formatBytes as x}from"../../../common/utils.js";import{allowedFileMimeTypes as j,allowedImageMimeTypes as y}from"../../../common/documents.js";import{createParser as k}from"eventsource-parser";import I from"../../Icons/attach-vertical.svg.js";import C from"../../Icons/spinner-lines.svg.js";import w from"../../Icons/file.svg.js";import S from"../../Icons/x.svg.js";import O from"../../Icons/arrow-right.svg.js";import N from"../Addons/IceBreaker/index.js";import R from"../../Core/Textarea.js";import B from"../../../common/error.js";import A from"../../../common/cn.js";import{StyledDocumentCard as T}from"../ui/StyledDocumentCard.js";import{StyledInputContainer as F}from"../ui/Input/StyledInputContainer.js";import{StyledTextareaWrapper as D}from"../ui/Input/StyledTextareaWrapper.js";import{StyledIconButton as U}from"../ui/Input/StyledIconButton.js";import{StyledRemoveButton as $}from"../ui/Input/StyledRemoveButton.js";import{StyledImagePreview as z}from"../ui/Input/StyledImagePreview.js";import{StyledAttachmentGrid as E}from"../ui/Input/StyledAttachmentGrid.js";import{StyledInputWrapper as H}from"../ui/Input/StyledInputWrapper.js";const P=({isFocused:P,onFocus:L,onBlur:W})=>{var G;const{formId:J,isRtl:K,chatId:_,userId:M,studioUserId:q,embedUserId:Q,deploymentId:V,pickaxe:X,styles:Y,colors:Z,responsiveBy:ee,isNewChat:oe,setIsNewChat:te,setIsShowIceBreaker:se,onGenerateComplete:re}=c(),{messages:ie,status:ne,limits:ae,isGenerating:le,setMessages:de,setStatus:ce,setLimitData:me,setError:ue}=m(),{documents:pe,isUploading:ge,isImageUploadAllowed:he,setDocuments:fe,onFileUpload:ve}=f(),{scrollStartSession:be,scrollEndSession:xe,scrollToBottom:je}=v({auto:!0}),ye=g(),ke=h(),[Ie,Ce]=i(""),we=n(null),Se=b(),{isHover:Oe}=Se,Ne=e(Se,["isHover"]),Re=b(),{isHover:Be}=Re,Ae=e(Re,["isHover"]),Te=p(),Fe=u(),De=a((()=>{var e,o,t;return!!oe&&(!!X&&(!ye.isLoading&&(!((null!==(o=null===(e=ye.data)||void 0===e?void 0:e.messages.length)&&void 0!==o?o:0)>1)&&!!(null===(t=X.icebreakers)||void 0===t?void 0:t.length))))}),[X,oe,ye.data,ye.isLoading]),Ue=e=>o(void 0,void 0,void 0,(function*(){try{if("idle"!==ne||ge)return;const o=null!=e?e:Ie;if(!o)return;ue(""),me(null),Ce(""),te(!1),ce("fetching"),be(),je();const t=pe.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),s=t.length?t[t.length-1].documentId:"",r="enduserupload"===(null==X?void 0:X.documentuploadtype)&&s,i=[...Array.from(ie),Object.assign({id:ie.length+1,role:"user",content:o},r&&{documentIds:[s]})];de(i),je(),r&&fe([]);const n=(yield ke.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:J,responseId:_,value:o},r&&{documentId:s}),M&&{userId:M}),q&&{studioUserId:q}),Q&&{embedUserId:Q}),V&&{deploymentId:V}))).body;if(!n)throw new Error("Streaming error");const a=i.length,l=new TextDecoder,d=n.getReader();let c="",m=!0,u=!1;const p=k({onEvent:e=>{if("delta"===e.event){const o=JSON.parse(e.data).token.replace(/\u200B/g,"");c+=o,de([...i.slice(0,a),{id:ie.length+1,role:"assistant",content:c}])}else if("error"===e.event){const o=JSON.parse(e.data);ue(o.error||"Something went wrong, please try again.")}else"stop"===e.event&&(m=!1)}});for(;m;){const{value:e,done:o}=yield d.read();if(o){m=!1;break}const t=l.decode(e);t&&(u||(ce("streaming"),u=!0),p.feed(t))}null==re||re(_)}catch(e){let o=B(e)||"";o&&!o.includes("Unexpected token 'A',")||(o="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(ae).find((([e])=>o.includes(e)));t?me(t[1]):ue(o)}finally{je(),ce("idle"),xe()}}));return l((()=>{se(De)}),[De]),t(H,Object.assign({position:"absolute",bottom:"0",padding:"16px",isRtl:K,zIndex:1},{children:s("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[t("div",Object.assign({className:A("absolute bottom-full",K?"left-0":"right-0")},{children:t("div",Object.assign({className:A("flex flex-col gap-2 pb-4 px-2",K?"justify-start":"justify-end","viewport"===ee?K?"min-[767px]:items-start":"min-[767px]:items-end":K?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:De&&!P&&t(N,{data:(null==X?void 0:X.icebreakers)||[],onSend:Ue})}))})),s(F,Object.assign({backgroundColor:Fe.backgroundColor,borderColor:Fe.borderColor,borderRadius:Fe.borderRadius,padding:"12px 16px",boxShadow:"block"===Y.formFieldStyle,gap:"8px"},{children:["idle"===ne&&pe.length>0&&t(E,Object.assign({columns:2},{children:pe.map((e=>{var o,s,r;return t(d,{children:"document"===e.type?t(T,Object.assign({icon:ge?t(C,{className:"w-5 h-5 animate-spin"}):t(w,{className:"w-5 h-5"}),title:e.name,subtitle:x(e.size),borderColor:`${Z.secondaryText}50`,borderRadius:Fe.borderRadius,iconBackgroundColor:Z.accent,iconColor:Z.accentText,textColor:Z.secondaryText,titleFontSize:Te.b3,subtitleFontSize:Te.b4,isRtl:K,style:{position:"relative"}},{children:t($,Object.assign({onClick:()=>fe([]),disabled:ge||"idle"!==ne,backgroundColor:Z.accent,borderColor:Fe.backgroundColor,isRtl:K},{children:t(S,{className:"w-4 h-4",style:{color:Z.accentText}})}))})):"image"===e.type?t(z,{src:"finished"===e.status?`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(o=e.documentId)||void 0===o?void 0:o.split("-")[2]}/${null===(s=e.documentId)||void 0===s?void 0:s.split("-")[1]}.${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[2]}`:void 0,isLoading:"finished"!==e.status,borderRadius:Fe.borderRadius,backgroundColor:Z.secondary,removeButton:t($,Object.assign({onClick:()=>fe([]),disabled:ge||"idle"!==ne,backgroundColor:Z.accent,borderColor:Fe.backgroundColor,isRtl:K},{children:t(S,{className:"w-4 h-4",style:{color:Z.accentText}})}))}):null},e.id)}))})),s(D,Object.assign({isRtl:K,gap:"8px"},{children:[t(R,{className:A(Te.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!Ie.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",K?"text-right":"text-left"),value:Ie,placeholder:K?"بماذا تريد أن تتحدث؟":null!==(G=null==X?void 0:X.placeholdertext)&&void 0!==G?G:"What do you want to talk about?",onChange:e=>Ce(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ge||"idle"!==ne||Ue()))},onFocus:L,onBlur:W,dir:K?"rtl":"ltr"}),s("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==X?void 0:X.documentuploadtype)&&s(r,{children:[t("input",{id:"file-upload",ref:we,type:"file",accept:[...j,...he?y:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>o(void 0,void 0,void 0,(function*(){yield ve(Array.from(e.target.files||[])),e.target.value=""}))}),t(U,Object.assign({onClick:()=>{var e;return null===(e=we.current)||void 0===e?void 0:e.click()},disabled:ge||"idle"!==ne,backgroundColor:Be?Z.accent+"10":void 0,hoverProps:Ae},{children:t(I,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:Be?Z.accent:`${Z.accent}80`}})}))]}),t(U,Object.assign({onClick:()=>Ue(),disabled:ge||"idle"!==ne,backgroundColor:(Oe||Ie.length||pe.length&&pe.every((e=>"finished"===e.status)))&&!le?Z.accent:`${Z.accent}10`,hoverProps:Ne},{children:t(O,{className:A("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",K&&"transform scale-x-[-1]"),style:{color:(Oe||Ie.length||pe.length&&pe.every((e=>"finished"===e.status)))&&!le?Z.accentText:`${Z.accent}80`}})}))]}))]}))]}))]}))}))};export{P as default};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";import s from"../../../../common/cn.js";const m=({children:m,columns:r=1,className:t,style:c})=>e("div",Object.assign({className:s("grid",t),style:Object.assign({gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},c)},{children:m}));export{m as StyledAttachmentGrid};
@@ -0,0 +1 @@
1
+ import{jsx as o}from"react/jsx-runtime";import e from"../../../../common/cn.js";const r=({children:r,onClick:n,disabled:t=!1,backgroundColor:i,hoverProps:s})=>o("button",Object.assign({onClick:n,disabled:t,className:e("outline-none disabled:cursor-default flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out"),style:{backgroundColor:i,width:"2rem",height:"2rem"}},s,{children:r}));export{r as StyledIconButton};
@@ -0,0 +1 @@
1
+ import{jsxs as e,jsx as s}from"react/jsx-runtime";import l from"../../../../common/cn.js";const r=({src:r,alt:o="",size:a="56px",borderRadius:t=4,backgroundColor:i="#F3F4F6",isLoading:c=!1,removeButton:d,className:m,style:n})=>e("div",Object.assign({className:l("relative bg-stone-100",m),style:Object.assign({width:a,height:a,borderRadius:t},n)},{children:[c?s("div",{className:"h-full w-full animate-pulse",style:{borderRadius:t,backgroundColor:i}}):r?s("img",{src:r,alt:o,className:"object-cover w-full h-full",style:{borderRadius:t}}):null,d]}));export{r as StyledImagePreview};
@@ -0,0 +1 @@
1
+ import{jsx as o}from"react/jsx-runtime";import r from"../../../../common/cn.js";const d=({children:d,maxWidth:a="800px",backgroundColor:e="#FFFFFF",borderColor:s="#E5E7EB",borderRadius:i=8,padding:c="12px 16px",boxShadow:l=!1,gap:t="8px",className:n,style:m})=>o("div",Object.assign({className:r("flex flex-col",l&&"shadow",n),style:Object.assign({maxWidth:a,width:"100%",backgroundColor:e,borderColor:s,borderRadius:i,padding:c,gap:t},m)},{children:d}));export{d as StyledInputContainer};
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import o from"../../../../common/cn.js";const e=({children:e,position:i="absolute",bottom:n="0",padding:r="16px",width:s="100%",backgroundColor:l="transparent",zIndex:a=1,isRtl:c=!1,className:d,style:m})=>t("div",Object.assign({className:o("flex flex-col items-center left-0",d),style:Object.assign({position:i,bottom:n,padding:r,width:s,backgroundColor:l,zIndex:a},m),dir:c?"rtl":"ltr"},{children:e}));export{e as StyledInputWrapper};
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import o from"../../../../common/cn.js";const e=({children:e,onClick:r,disabled:i=!1,size:l="20px",backgroundColor:s="#228DD7",borderColor:n="#FFFFFF",position:a="top-right",isRtl:c=!1,className:d,style:u})=>t("button",Object.assign({type:"button",onClick:r,disabled:i,className:o("absolute rounded-full flex items-center justify-center border outline-none disabled:cursor-default",d),style:Object.assign(Object.assign({width:l,height:l,backgroundColor:s,borderColor:n,top:"-0.5rem"},c?{left:"top-right"===a?"-0.5rem":"auto",right:"top-left"===a?"-0.5rem":"auto"}:{right:"top-right"===a?"-0.5rem":"auto",left:"top-left"===a?"-0.5rem":"auto"}),u)},{children:e}));export{e as StyledRemoveButton};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";import s from"../../../../common/cn.js";const t=({children:t,gap:i="8px",isRtl:r=!1,className:c,style:n})=>e("div",Object.assign({className:s("flex items-end",c),style:Object.assign(Object.assign({gap:i},n),r?{flexDirection:"row-reverse"}:{})},{children:t}));export{t as StyledTextareaWrapper};
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";import e from"../../../../common/cn.js";const i=({children:i,size:s="24px",backgroundColor:n="transparent",borderRadius:t="50%",padding:a="0",margin:o="0",className:c,style:d})=>r("div",Object.assign({className:e("flex items-center justify-center shrink-0",c),style:Object.assign({width:s,height:s,backgroundColor:n,borderRadius:t,padding:a,margin:o},d)},{children:i}));export{i as StyledIconWrapper};
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import s from"../../../../common/cn.js";const e=({children:e,alignment:i="left",maxWidth:l="100%",isRtl:a=!1,gap:c="12px",className:m,style:n})=>t("div",Object.assign({className:s("flex w-full","right"===i?a?"justify-start":"justify-end":a?"justify-end":"justify-start",m),style:n},{children:t("div",Object.assign({className:"flex flex-col",style:{maxWidth:l,gap:c}},{children:e}))}));export{e as StyledMessage};
@@ -0,0 +1 @@
1
+ import{jsx as o}from"react/jsx-runtime";import t from"../../../../common/cn.js";const r=({children:r,backgroundColor:e="#f0f0f0",textColor:l="#000000",padding:a="12px 16px",borderRadius:i=4,fontSize:n="16px",fontFamily:c,isRtl:s=!1,opacity:d=1,className:f,style:m})=>o("div",Object.assign({className:t("overflow-x-auto overflow-y-hidden scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3",s?"text-right":"text-left",f),style:Object.assign({backgroundColor:d<1?`${e}${Math.round(255*d).toString(16)}`:e,color:l,padding:a,borderRadius:i,fontSize:n,fontFamily:c},m)},{children:r}));export{r as StyledMessageBubble};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";import r from"../../../../common/cn.js";const t=({children:t,direction:s="row",gap:i="12px",alignItems:o="start",isRtl:a=!1,className:c,style:m})=>e("div",Object.assign({className:r("flex",a&&"row"===s?"flex-row-reverse":"row"===s?"flex-row":"flex-row-reverse","start"===o?"items-start":"center"===o?"items-center":"items-end",c),style:Object.assign({gap:i},m)},{children:t}));export{t as StyledMessageContainer};
@@ -0,0 +1 @@
1
+ import{jsxs as o,jsx as e}from"react/jsx-runtime";import t from"react";import n from"../../../common/cn.js";const r=({onClick:r,icon:s,label:c,color:i="#228DD7",hoverColor:a,fontSize:l="14px",gap:m="4px",className:p,style:u})=>{const[f,x]=t.useState(!1);return o("button",Object.assign({onClick:r,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),className:n("flex items-center transition-colors duration-200",p),style:Object.assign({color:f&&a?a:i,fontSize:l,gap:m},u)},{children:[s,c&&e("span",{children:c})]}))};export{r as StyledCopyButton};
@@ -0,0 +1 @@
1
+ import{jsxs as e,Fragment as t,jsx as r}from"react/jsx-runtime";import i from"../../../common/cn.js";const s=({icon:s,title:o,subtitle:n,href:l="#",target:a="_blank",borderColor:c="#00000010",borderRadius:d=4,backgroundColor:g="transparent",textColor:b="#000000",titleFontSize:h="14px",subtitleFontSize:m="12px",iconBackgroundColor:x="#228DD7",iconColor:p="#FFFFFF",iconSize:f="40px",height:u="56px",padding:j="8px",gap:y="10px",maxWidth:O="500px",isRtl:v=!1,children:C,className:F,style:N})=>{const k=e(t,{children:[r("div",Object.assign({className:"flex items-center justify-center shrink-0",style:{backgroundColor:x,borderRadius:d,width:f,height:f,color:p}},{children:s})),e("div",Object.assign({className:i("flex flex-col justify-center truncate",v?"text-right":"text-left"),style:{color:b}},{children:[r("p",Object.assign({className:"font-medium truncate",style:{fontSize:h}},{children:o})),n&&r("p",Object.assign({className:"truncate",style:{fontSize:m,opacity:.8}},{children:n}))]}))]}),z=Object.assign({borderRadius:d,borderColor:c,backgroundColor:g,height:u,padding:j,gap:y,maxWidth:O,width:"100%",position:"relative"},N);return l&&"#"!==l?e("a",Object.assign({href:l,target:a,rel:"noreferrer",className:i("relative flex items-center border",F),style:Object.assign(Object.assign({},z),v?{flexDirection:"row-reverse"}:{})},{children:[k,C]})):e("div",Object.assign({className:i("relative flex items-center border",v&&"flex-row-reverse",F),style:z},{children:[k,C]}))};export{s as StyledDocumentCard};
@@ -0,0 +1 @@
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import r from"../../../common/cn.js";const t=({colors:t,styles:i,isHover:n,responsiveBy:a,forceMobile:s,text:d,onSend:l,hoverProps:c})=>e("div",Object.assign({className:r("relative text-sm group flex flex-grow cursor-pointer overflow-hidden font-semilight w-full select-none duration-200 transition-colors border ease-in-out","viewport"===a?"min-[767px]:justify-end min-[767px]:max-w-max":"@[767px]/pickaxe-root:justify-end @[767px]/pickaxe-root:max-w-max",s&&"max-w-full"),onClick:()=>null==l?void 0:l(d),style:{background:n?t.secondary:"transparent",borderColor:t.secondaryText+"30",borderRadius:i.cornerRadius,paddingTop:"9px",paddingRight:"1em",paddingBottom:"9px",paddingLeft:"1em",justifyContent:"flex-end",maxWidth:"max-content"}},c,{children:[o("div",{className:"absolute inset-0 backdrop-blur-md z-0",style:{background:n?t.secondary:t.primary+"10",borderRadius:i.cornerRadius}}),o("p",Object.assign({className:r("line-clamp-2 duration-200 transition-colors ease-in-out relative","viewport"===a?"min-[767px]:text-right":"@[767px]/pickaxe-root:text-right",s&&"text-left"),style:{color:n?t.secondaryText:t.secondaryText+"60"}},{children:d}))]}));export{t as StyledIceBreaker};
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import i from"../../../common/cn.js";const o=({dotColor:o="#4A4A4B",dotSize:e="6px",gap:n="8px",animationDuration:a="0.8s",className:s,style:r})=>t("div",Object.assign({className:i("flex items-center",s),style:Object.assign({gap:n},r)},{children:Array.from({length:3}).map(((i,n)=>t("div",{className:"rounded-full",style:{backgroundColor:o,width:e,height:e,animation:1===n?`dot-down ${a} infinite`:`dot ${a} infinite`}},n)))}));export{o as StyledLoadingDots};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- export{Pickaxe}from"./components/Pickaxe/index.js";export{PickaxeContext,PickaxeProvider}from"./components/Pickaxe/Provider.js";export{ResponseContext}from"./components/Pickaxe/ResponseProvider.js";export{PickaxeMarkdown,PickaxeMarkdownContext}from"./components/Pickaxe/common/PickaxeMarkdown/index.js";export{PickaxeMarkdownRenderer}from"./components/Pickaxe/common/PickaxeMarkdown/Renderer.js";export{useConversation}from"./hooks/pickaxe/useConversation.js";export{useHistory}from"./hooks/pickaxe/useHistory.js";export{usePickaxe}from"./hooks/pickaxe/usePickaxe.js";export{usePickaxeContext}from"./hooks/pickaxe/usePickaxeContext.js";export{useResponseContext}from"./hooks/pickaxe/useResponseContext.js";export{useDimensionContext}from"./hooks/pickaxe/useDimensionContext.js";export{useSubmit}from"./hooks/pickaxe/useSubmit.js";export{useSubmitDocument}from"./hooks/pickaxe/useSubmitDocument.js";
1
+ export{Pickaxe}from"./components/Pickaxe/index.js";export{PickaxeContext,PickaxeProvider}from"./components/Pickaxe/Provider.js";import"react/jsx-runtime";import"./_virtual/_tslib.js";import"react";export{usePickaxeContext}from"./hooks/pickaxe/usePickaxeContext.js";export{StyledMessage}from"./components/Pickaxe/ui/Message/StyledMessage.js";export{StyledMessageBubble}from"./components/Pickaxe/ui/Message/StyledMessageBubble.js";export{StyledLoadingDots}from"./components/Pickaxe/ui/StyledLoadingDots.js";export{StyledDocumentCard}from"./components/Pickaxe/ui/StyledDocumentCard.js";export{StyledIconWrapper}from"./components/Pickaxe/ui/Message/StyledIconWrapper.js";export{StyledMessageContainer}from"./components/Pickaxe/ui/Message/StyledMessageContainer.js";export{StyledCopyButton}from"./components/Pickaxe/ui/StyledCopyButton.js";export{StyledInputContainer}from"./components/Pickaxe/ui/Input/StyledInputContainer.js";export{StyledTextareaWrapper}from"./components/Pickaxe/ui/Input/StyledTextareaWrapper.js";export{StyledIconButton}from"./components/Pickaxe/ui/Input/StyledIconButton.js";export{StyledRemoveButton}from"./components/Pickaxe/ui/Input/StyledRemoveButton.js";export{StyledImagePreview}from"./components/Pickaxe/ui/Input/StyledImagePreview.js";export{StyledAttachmentGrid}from"./components/Pickaxe/ui/Input/StyledAttachmentGrid.js";export{StyledInputWrapper}from"./components/Pickaxe/ui/Input/StyledInputWrapper.js";export{StyledIceBreaker}from"./components/Pickaxe/ui/StyledIceBreaker.js";export{default as FileIcon}from"./components/Icons/file.svg.js";export{default as AttachVerticalIcon}from"./components/Icons/attach-vertical.svg.js";export{default as SpinnerLinesIcon}from"./components/Icons/spinner-lines.svg.js";export{default as XIcon}from"./components/Icons/x.svg.js";export{default as ArrowRightIcon}from"./components/Icons/arrow-right.svg.js";export{ResponseContext}from"./components/Pickaxe/ResponseProvider.js";export{PickaxeMarkdown,PickaxeMarkdownContext}from"./components/Pickaxe/common/PickaxeMarkdown/index.js";export{PickaxeMarkdownRenderer}from"./components/Pickaxe/common/PickaxeMarkdown/Renderer.js";export{useConversation}from"./hooks/pickaxe/useConversation.js";export{useHistory}from"./hooks/pickaxe/useHistory.js";export{usePickaxe}from"./hooks/pickaxe/usePickaxe.js";export{useResponseContext}from"./hooks/pickaxe/useResponseContext.js";export{useDimensionContext}from"./hooks/pickaxe/useDimensionContext.js";export{useSubmit}from"./hooks/pickaxe/useSubmit.js";export{useSubmitDocument}from"./hooks/pickaxe/useSubmitDocument.js";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledAttachmentGridProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ columns?: number;
6
+ }
7
+ export declare const StyledAttachmentGrid: React.FC<StyledAttachmentGridProps>;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledIconButtonProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ onClick?: () => void;
6
+ disabled?: boolean;
7
+ backgroundColor?: string;
8
+ hoverProps?: any;
9
+ }
10
+ export declare const StyledIconButton: React.FC<StyledIconButtonProps>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledImagePreviewProps extends BaseStyleProps {
4
+ src?: string;
5
+ alt?: string;
6
+ size?: string;
7
+ borderRadius?: string | number;
8
+ backgroundColor?: string;
9
+ isLoading?: boolean;
10
+ removeButton?: React.ReactNode;
11
+ }
12
+ export declare const StyledImagePreview: React.FC<StyledImagePreviewProps>;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledInputContainerProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ maxWidth?: string;
6
+ backgroundColor?: string;
7
+ borderColor?: string;
8
+ borderRadius?: string | number;
9
+ padding?: string;
10
+ boxShadow?: boolean;
11
+ gap?: string;
12
+ }
13
+ export declare const StyledInputContainer: React.FC<StyledInputContainerProps>;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledInputWrapperProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ position?: "fixed" | "absolute" | "relative";
6
+ bottom?: string;
7
+ padding?: string;
8
+ width?: string;
9
+ backgroundColor?: string;
10
+ zIndex?: number;
11
+ isRtl?: boolean;
12
+ }
13
+ export declare const StyledInputWrapper: React.FC<StyledInputWrapperProps>;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledRemoveButtonProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ onClick: () => void;
6
+ disabled?: boolean;
7
+ size?: string;
8
+ backgroundColor?: string;
9
+ borderColor?: string;
10
+ position?: "top-right" | "top-left";
11
+ isRtl?: boolean;
12
+ }
13
+ export declare const StyledRemoveButton: React.FC<StyledRemoveButtonProps>;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledTextareaWrapperProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ gap?: string;
6
+ isRtl?: boolean;
7
+ }
8
+ export declare const StyledTextareaWrapper: React.FC<StyledTextareaWrapperProps>;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledIconWrapperProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ size?: string;
6
+ backgroundColor?: string;
7
+ borderRadius?: string | number;
8
+ padding?: string;
9
+ margin?: string;
10
+ }
11
+ export declare const StyledIconWrapper: React.FC<StyledIconWrapperProps>;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledMessageProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ alignment?: "left" | "right";
6
+ maxWidth?: string;
7
+ isRtl?: boolean;
8
+ gap?: string;
9
+ }
10
+ export declare const StyledMessage: React.FC<StyledMessageProps>;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledMessageBubbleProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ backgroundColor?: string;
6
+ textColor?: string;
7
+ padding?: string;
8
+ borderRadius?: number;
9
+ fontSize?: string;
10
+ fontFamily?: string;
11
+ isRtl?: boolean;
12
+ opacity?: number;
13
+ }
14
+ export declare const StyledMessageBubble: React.FC<StyledMessageBubbleProps>;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "../types";
3
+ export interface StyledMessageContainerProps extends BaseStyleProps {
4
+ children: React.ReactNode;
5
+ direction?: "row" | "row-reverse";
6
+ gap?: string;
7
+ alignItems?: "start" | "center" | "end";
8
+ isRtl?: boolean;
9
+ }
10
+ export declare const StyledMessageContainer: React.FC<StyledMessageContainerProps>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "./types";
3
+ export interface StyledCopyButtonProps extends BaseStyleProps {
4
+ onClick: () => void;
5
+ icon: React.ReactNode;
6
+ label?: string;
7
+ color?: string;
8
+ hoverColor?: string;
9
+ fontSize?: string;
10
+ gap?: string;
11
+ }
12
+ export declare const StyledCopyButton: React.FC<StyledCopyButtonProps>;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "./types";
3
+ export interface StyledDocumentCardProps extends BaseStyleProps {
4
+ icon: React.ReactNode;
5
+ title: string;
6
+ subtitle?: string;
7
+ href?: string;
8
+ target?: string;
9
+ borderColor?: string;
10
+ borderRadius?: string | number;
11
+ backgroundColor?: string;
12
+ textColor?: string;
13
+ titleFontSize?: string;
14
+ subtitleFontSize?: string;
15
+ iconBackgroundColor?: string;
16
+ iconColor?: string;
17
+ iconSize?: string;
18
+ height?: string;
19
+ padding?: string;
20
+ gap?: string;
21
+ maxWidth?: string;
22
+ isRtl?: boolean;
23
+ children?: React.ReactNode;
24
+ }
25
+ export declare const StyledDocumentCard: React.FC<StyledDocumentCardProps>;
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { BaseStyleProps } from "./types";
3
+ import { PickaxeResponsiveBy } from "../Provider";
4
+ export interface StyledIceBreakerProps extends BaseStyleProps {
5
+ colors: {
6
+ primary: string;
7
+ secondary: string;
8
+ secondaryText: string;
9
+ };
10
+ styles: {
11
+ cornerRadius: string | number;
12
+ };
13
+ isHover?: boolean;
14
+ responsiveBy?: PickaxeResponsiveBy;
15
+ forceMobile?: boolean;
16
+ text: string;
17
+ onSend?: (text: string) => void;
18
+ hoverProps?: React.HTMLAttributes<HTMLDivElement>;
19
+ }
20
+ export declare const StyledIceBreaker: React.FC<StyledIceBreakerProps>;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { BaseStyleProps } from "./types";
3
+ export interface StyledLoadingDotsProps extends BaseStyleProps {
4
+ dotColor?: string;
5
+ dotSize?: string;
6
+ gap?: string;
7
+ animationDuration?: string;
8
+ }
9
+ export declare const StyledLoadingDots: React.FC<StyledLoadingDotsProps>;
@@ -0,0 +1,20 @@
1
+ export { StyledMessage } from "./Message/StyledMessage";
2
+ export { StyledMessageBubble } from "./Message/StyledMessageBubble";
3
+ export { StyledLoadingDots } from "./StyledLoadingDots";
4
+ export { StyledDocumentCard } from "./StyledDocumentCard";
5
+ export { StyledIconWrapper } from "./Message/StyledIconWrapper";
6
+ export { StyledMessageContainer } from "./Message/StyledMessageContainer";
7
+ export { StyledCopyButton } from "./StyledCopyButton";
8
+ export { StyledInputContainer } from "./Input/StyledInputContainer";
9
+ export { StyledTextareaWrapper } from "./Input/StyledTextareaWrapper";
10
+ export { StyledIconButton } from "./Input/StyledIconButton";
11
+ export { StyledRemoveButton } from "./Input/StyledRemoveButton";
12
+ export { StyledImagePreview } from "./Input/StyledImagePreview";
13
+ export { StyledAttachmentGrid } from "./Input/StyledAttachmentGrid";
14
+ export { StyledInputWrapper } from "./Input/StyledInputWrapper";
15
+ export { StyledIceBreaker } from "./StyledIceBreaker";
16
+ export { default as FileIcon } from "@src/components/Icons/file.svg";
17
+ export { default as AttachVerticalIcon } from "@src/components/Icons/attach-vertical.svg";
18
+ export { default as SpinnerLinesIcon } from "@src/components/Icons/spinner-lines.svg";
19
+ export { default as XIcon } from "@src/components/Icons/x.svg";
20
+ export { default as ArrowRightIcon } from "@src/components/Icons/arrow-right.svg";
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export interface BaseStyleProps {
3
+ className?: string;
4
+ style?: React.CSSProperties;
5
+ }
@@ -1,9 +1,11 @@
1
1
  import "./styles/prose.css";
2
2
  export * from "./components/Pickaxe";
3
3
  export * from "./components/Pickaxe/Provider";
4
+ export * from "./components/Pickaxe/Addons/IceBreaker";
4
5
  export * from "./components/Pickaxe/ResponseProvider";
5
6
  export * from "./components/Pickaxe/common/PickaxeMarkdown";
6
7
  export * from "./components/Pickaxe/common/PickaxeMarkdown/Renderer";
8
+ export * from "./components/Pickaxe/ui";
7
9
  export * from "./hooks/pickaxe/useConversation";
8
10
  export * from "./hooks/pickaxe/useHistory";
9
11
  export * from "./hooks/pickaxe/usePickaxe";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "2.2.4",
3
+ "version": "2.3.0",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",