@pickaxeproject/react 1.3.9 → 1.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Pickaxe/Chat/History/Message.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/Questions/Document.js +1 -1
- package/dist/cjs/components/Pickaxe/Provider.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/History/Message.js +1 -1
- package/dist/esm/components/Pickaxe/Form/Questions/Document.js +1 -1
- package/dist/esm/components/Pickaxe/Provider.js +1 -1
- package/package.json +1 -1
|
@@ -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/studio/useStyleFontSize.js"),c=require("../../common/PickaxeMarkdown/index.js"),i=require("../../common/PickaxeMarkdown/Renderer.js"),o=require("../../common/PickaxeIcon.js"),
|
|
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/studio/useStyleFontSize.js"),c=require("../../common/PickaxeMarkdown/index.js"),i=require("../../common/PickaxeMarkdown/Renderer.js"),o=require("../../common/PickaxeIcon.js"),n=require("./Document.js"),r=require("../../common/PickaxeCopyButton.js"),l=require("../../../../common/cn.js");exports.default=({index:d,message:x})=>{var m;const{formId:u,pickaxe:j,styles:p,colors:h,misc:k,responsiveBy:f,isNewChat:v}=a.usePickaxeContext(),[g,w]=s.useState(!1),b=t.useStyleFontSize(),y=null!==(m=null==j?void 0:j.chaticon)&&void 0!==m?m:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${u}.png`;return"assistant"===x.role?e.jsx("div",Object.assign({className:l.default("flex flex-col",0===d&&v&&"viewport"===f&&"min-[767px]:max-w-[80%]",0===d&&v&&"container"===f&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:e.jsxs("div",Object.assign({className:"flex gap-x-3"},{children:[k.isChatImage&&"NONE"!==y&&e.jsx(o.default,{src:y,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:h.text}),e.jsxs("div",Object.assign({className:"flex flex-col"},{children:[e.jsx("div",Object.assign({className:l.default(b.b2,"chat-message pt-3")},{children:e.jsx(c.PickaxeMarkdown,Object.assign({theme:p.theme,accentColor:h.accent,linkPreviews:!0,actions:!0},{children:e.jsx(i.PickaxeMarkdownRenderer,Object.assign({value:x.content},0===d&&v&&!x.content.includes(`${process.env.NEXT_PUBLIC_API_UTILS_URL}/api/fn/result`)&&{maxLines:g?void 0:4,onExpandClick:()=>w(!0)}))}))})),e.jsx("div",Object.assign({className:"mt-4 flex gap-3"},{children:e.jsx(r.default,{color:h.accent,text:x.content})}))]}))]}))})):"user"===x.role?e.jsx("div",Object.assign({className:l.default("flex gap-x-3 justify-self-end pl-9","viewport"===f?"min-[767px]:max-w-[80%] min-[767px]:pl-0":"@[767px]/pickaxe-root:max-w-[80%] @[767px]/pickaxe-root:pl-0")},{children:e.jsxs("div",Object.assign({className:l.default(b.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"),style:{backgroundColor:h.secondary+"80",color:h.secondaryText,borderRadius:p.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e.jsx("div",Object.assign({className:"flex flex-col items-end"},{children:x.documentIds.map((a=>e.jsx(s.Fragment,{children:a.startsWith("IMAGE-")?e.jsx("div",Object.assign({className:"max-w-[300px]"},{children:e.jsx("img",{style:{borderRadius:p.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${a.split("-")[2]}/${a.split("-")[1]}.${null==a?void 0:a.split("-")[2]}`,alt:""})})):e.jsx(n.default,{documentId:a})},a)))})),e.jsx(c.PickaxeMarkdown,Object.assign({theme:p.theme,accentColor:h.accent},{children:e.jsx(i.PickaxeMarkdownRenderer,{value:x.content})}))]}))})):e.jsx("div",{})};
|
|
@@ -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"),l=require("../../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../../../hooks/studio/useStyleInput.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),o=require("../../Addons/Document/hooks/useDocument.js"),i=require("../../../../hooks/core/useHover.js"),n=require("../../../../common/documents.js"),c=require("../../../../common/utils.js"),d=require("../../../Icons/attach-vertical.svg.js"),u=require("../../../Icons/check.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),l=require("../../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../../../hooks/studio/useStyleInput.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),o=require("../../Addons/Document/hooks/useDocument.js"),i=require("../../../../hooks/core/useHover.js"),n=require("../../../../common/documents.js"),c=require("../../../../common/utils.js"),d=require("../../../Icons/attach-vertical.svg.js"),u=require("../../../Icons/check.svg.js"),b=require("../../../Icons/spinner-lines.svg.js"),m=require("../../../Icons/file.svg.js"),x=require("../../../Icons/x.svg.js"),j=require("../../../Icons/link.svg.js"),f=require("../../../Core/ErrorAlert.js"),p=require("../../../../common/cn.js");exports.default=({field:h,update:g})=>{var y;const v=r.useStyleFontSize(),{colors:w,styles:N,translations:k,responsiveBy:O}=l.usePickaxeContext(),C=i.useHover(),{isHover:q}=C,I=e.__rest(C,["isHover"]),{documents:R,documentError:T,websiteLink:_,isUploading:D,isImageUploadAllowed:F,upsertDocuments:S,setDocumentError:A,setWebsiteLink:U,onFileUpload:z,onWebsiteUpload:E}=o.useDocument({onQuestionChange:e=>{g(Object.assign(Object.assign({},h),e))}}),[H,P]=t.useState(!1),B=t.useRef(null),L=a.useStyleInput();return s.jsxs("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[s.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s.jsxs("div",Object.assign({className:"flex items-center gap-1"},{children:[s.jsx("p",Object.assign({className:p.default(v.b3,"font-semibold opacity-70")},{children:h.main})),h.isRequired&&s.jsx("span",Object.assign({className:"select-none font-semibold",style:{color:w.error}},{children:"*"}))]})),s.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s.jsx("input",{ref:B,type:"file",accept:[...n.allowedFileMimeTypes,...F?n.allowedImageMimeTypes:[]].join(", "),id:h.id,hidden:!0,multiple:!1,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield z(Array.from(s.target.files||[])),s.target.value=""})),disabled:D}),s.jsxs("div",Object.assign({className:p.default("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all",H&&"block"===N.formFieldStyle&&"shadow","block"===N.formFieldStyle&&"shadow hover:shadow-none"),style:L},{children:[s.jsx("input",{type:"text",value:_,className:p.default(v.i1,"w-full outline-none ring-0 bg-transparent placeholder:text-inherit placeholder:opacity-50"),placeholder:null!==(y=null==k?void 0:k["form-doc-placeholder"])&&void 0!==y?y:"Paste a website/video link or drag a file",onChange:e=>U(e.target.value),onDrop:s=>e.__awaiter(void 0,void 0,void 0,(function*(){s.preventDefault(),yield z(Array.from(s.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),E(_))},onFocus:()=>P(!0),onBlur:()=>P(!1)}),s.jsx("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:_.length>0?s.jsxs(s.Fragment,{children:[s.jsx("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:D,onClick:()=>E(_)},{children:s.jsx(u.default,{className:"h-5 w-5 shrink-0",style:{color:w.accent}})})),s.jsx("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:D,onClick:()=>{U(""),A("")}},{children:s.jsx(x.default,{className:"h-6 w-6 shrink-0",style:{color:w.accent}})}))]}):s.jsx("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",disabled:D,onClick:()=>{var e;null===(e=B.current)||void 0===e||e.click()},style:{backgroundColor:q?w.accent+"10":void 0}},I,{children:s.jsx(d.default,{className:"h-6 w-6 shrink-0",style:{color:q?w.accent:w.accent+"80"}})}))}))]}))]}))]})),R.length>0&&s.jsx("div",Object.assign({className:p.default("flex gap-4","viewport"===O?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:R.map((e=>{var l,a,r;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:L},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:w.accent,borderRadius:L.borderRadius}},{children:D?s.jsx(b.default,{className:"w-5 h-5 animate-spin",style:{color:w.accentText}}):s.jsx(m.default,{className:"w-5 h-5",style:{color:w.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(p.default(v.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:p.default(v.b4,"opacity-80 truncate")},{children:c.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:w.accent,borderColor:L.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:w.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:L.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:L.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[2]}/${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[1]}.${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:L.borderRadius,backgroundColor:w.secondary}}),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:w.accent,borderColor:L.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:w.accentText}})}))]})):"website"===e.type?s.jsxs("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:L},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:w.accent,borderRadius:L.borderRadius}},{children:D?s.jsx(b.default,{className:"w-5 h-5 animate-spin",style:{color:w.accentText}}):s.jsx(j.default,{className:"w-5 h-5",style:{color:w.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(p.default(v.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),s.jsx("p",Object.assign({className:p.default(v.b4,"opacity-80 truncate")},{children:(null==k?void 0:k.website)||"Website"}))]})),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:w.accent,borderColor:L.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:w.accentText}})}))]})):null},e.id)}))})),T&&s.jsx(f.default,{error:T,className:"mt-3"})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("./Addons/Document/Provider.js"),i=require("./ResponseProvider.js"),r=require("./DimensionProvider.js");const o=t.createContext({});exports.PickaxeContext=o,exports.PickaxeProvider=({children:a,userId:n="",studioUserId:d="",deploymentId:c="",embedUserId:l="",styles:u,colors:p,limits:h={},misc:m={isWhiteLabel:!0,isProfileImage:!0,isChatImage:!0,isTitle:!0,isDescription:!0,isHistory:!0},translations:F,chatInput:I="",responsiveBy:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("./Addons/Document/Provider.js"),i=require("./ResponseProvider.js"),r=require("./DimensionProvider.js");const o=t.createContext({});exports.PickaxeContext=o,exports.PickaxeProvider=({children:a,userId:n="",studioUserId:d="",deploymentId:c="",embedUserId:l="",styles:u,colors:p,limits:h={},misc:m={isWhiteLabel:!0,isProfileImage:!0,isChatImage:!0,isTitle:!0,isDescription:!0,isHistory:!0},translations:F,chatInput:I="",responsiveBy:b="viewport",loadFont:x=!0,forceMobile:y=!1,isEmbed:f=!1,onGenerateComplete:g})=>{const[S,j]=t.useState(""),[P,v]=t.useState(""),[w,k]=t.useState(null),[C,O]=t.useState(!1),[q,D]=t.useState(!0),[H,U]=t.useState(!0),[B,E]=t.useState(!1);return t.useEffect((()=>{O(!1)}),[null==u?void 0:u.font]),e.jsx(o.Provider,Object.assign({value:Object.assign({formId:S,chatId:P,userId:n,studioUserId:d,deploymentId:c,embedUserId:l,pickaxe:w,styles:Object.assign({theme:"light",font:"Real Head Pro",fontSize:"md",formFieldStyle:"box",btnStyle:"filled",outlineThickness:1,cornerRadius:4},u),colors:Object.assign({primary:"#F6F8FA",text:"#000000",secondary:"#FFFFFF",secondaryText:"#000000",accent:"#228DD7",accentText:"#FFFFFF",error:"#EF4444"},p),misc:m,translations:Object.assign({"new-chat":"New chat","see-history":"See history","see-input":"See input","hide-input":"Hide input",processing:"Processing...",uploading:"Uploading...",loading:"Loading...","powered-by-pickaxe":"Powered by Pickaxe","form-doc-placeholder":"Paste a website/video link or drag a file",website:"Website"},F),chatInput:I,responsiveBy:b,isFontLoaded:C,isNewChat:q,isShowIceBreaker:H,isShowHistory:B,loadFont:x,forceMobile:y,isEmbed:f,setIsFontLoaded:O,setFormId:j,setChatId:v,setPickaxe:k,setIsNewChat:D,setIsShowIceBreaker:U,setIsShowHistory:E},g&&{onGenerateComplete:g})},{children:e.jsx(i.default,Object.assign({limits:h},{children:e.jsx(r.default,{children:e.jsx(s.default,{children:a})})}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useState as o,Fragment as t}from"react";import{usePickaxeContext as
|
|
1
|
+
import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useState as o,Fragment as t}from"react";import{usePickaxeContext as c}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as a}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as i}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as n}from"../../common/PickaxeMarkdown/Renderer.js";import r from"../../common/PickaxeIcon.js";import l from"./Document.js";import m from"../../common/PickaxeCopyButton.js";import d from"../../../../common/cn.js";const p=({index:p,message:x})=>{var h;const{formId:u,pickaxe:f,styles:g,colors:v,misc:j,responsiveBy:b,isNewChat:w}=c(),[k,N]=o(!1),y=a(),O=null!==(h=null==f?void 0:f.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${u}.png`;return"assistant"===x.role?e("div",Object.assign({className:d("flex flex-col",0===p&&w&&"viewport"===b&&"min-[767px]:max-w-[80%]",0===p&&w&&"container"===b&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:s("div",Object.assign({className:"flex gap-x-3"},{children:[j.isChatImage&&"NONE"!==O&&e(r,{src:O,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:v.text}),s("div",Object.assign({className:"flex flex-col"},{children:[e("div",Object.assign({className:d(y.b2,"chat-message pt-3")},{children:e(i,Object.assign({theme:g.theme,accentColor:v.accent,linkPreviews:!0,actions:!0},{children:e(n,Object.assign({value:x.content},0===p&&w&&!x.content.includes(`${process.env.NEXT_PUBLIC_API_UTILS_URL}/api/fn/result`)&&{maxLines:k?void 0:4,onExpandClick:()=>N(!0)}))}))})),e("div",Object.assign({className:"mt-4 flex gap-3"},{children:e(m,{color:v.accent,text:x.content})}))]}))]}))})):"user"===x.role?e("div",Object.assign({className:d("flex gap-x-3 justify-self-end pl-9","viewport"===b?"min-[767px]:max-w-[80%] min-[767px]:pl-0":"@[767px]/pickaxe-root:max-w-[80%] @[767px]/pickaxe-root:pl-0")},{children:s("div",Object.assign({className:d(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"),style:{backgroundColor:v.secondary+"80",color:v.secondaryText,borderRadius:g.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e("div",Object.assign({className:"flex flex-col items-end"},{children:x.documentIds.map((s=>e(t,{children:s.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:g.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${s.split("-")[2]}/${s.split("-")[1]}.${null==s?void 0:s.split("-")[2]}`,alt:""})})):e(l,{documentId:s})},s)))})),e(i,Object.assign({theme:g.theme,accentColor:v.accent},{children:e(n,{value:x.content})}))]}))})):e("div",{})};export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e,__awaiter as s}from"../../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as r,Fragment as
|
|
1
|
+
import{__rest as e,__awaiter as s}from"../../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as r,Fragment as i}from"react";import{usePickaxeContext as n}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleInput as c}from"../../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as d}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as u}from"../../Addons/Document/hooks/useDocument.js";import{useHover as m}from"../../../../hooks/core/useHover.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as p}from"../../../../common/documents.js";import{formatBytes as f}from"../../../../common/utils.js";import h from"../../../Icons/attach-vertical.svg.js";import g from"../../../Icons/check.svg.js";import y from"../../../Icons/spinner-lines.svg.js";import v from"../../../Icons/file.svg.js";import x from"../../../Icons/x.svg.js";import j from"../../../Icons/link.svg.js";import w from"../../../Core/ErrorAlert.js";import N from"../../../../common/cn.js";const k=({field:k,update:O})=>{var C;const R=d(),{colors:I,styles:D,translations:T,responsiveBy:F}=n(),A=m(),{isHover:S}=A,U=e(A,["isHover"]),{documents:E,documentError:z,websiteLink:H,isUploading:L,isImageUploadAllowed:W,upsertDocuments:$,setDocumentError:B,setWebsiteLink:P,onFileUpload:_,onWebsiteUpload:q}=u({onQuestionChange:e=>{O(Object.assign(Object.assign({},k),e))}}),[K,Q]=a(!1),G=r(null),J=c();return t("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[t("div",Object.assign({className:"flex items-center gap-1"},{children:[o("p",Object.assign({className:N(R.b3,"font-semibold opacity-70")},{children:k.main})),k.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:I.error}},{children:"*"}))]})),t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[o("input",{ref:G,type:"file",accept:[...b,...W?p:[]].join(", "),id:k.id,hidden:!0,multiple:!1,className:"hidden",onChange:e=>s(void 0,void 0,void 0,(function*(){yield _(Array.from(e.target.files||[])),e.target.value=""})),disabled:L}),t("div",Object.assign({className:N("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all",K&&"block"===D.formFieldStyle&&"shadow","block"===D.formFieldStyle&&"shadow hover:shadow-none"),style:J},{children:[o("input",{type:"text",value:H,className:N(R.i1,"w-full outline-none ring-0 bg-transparent placeholder:text-inherit placeholder:opacity-50"),placeholder:null!==(C=null==T?void 0:T["form-doc-placeholder"])&&void 0!==C?C:"Paste a website/video link or drag a file",onChange:e=>P(e.target.value),onDrop:e=>s(void 0,void 0,void 0,(function*(){e.preventDefault(),yield _(Array.from(e.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),q(H))},onFocus:()=>Q(!0),onBlur:()=>Q(!1)}),o("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:H.length>0?t(l,{children:[o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:L,onClick:()=>q(H)},{children:o(g,{className:"h-5 w-5 shrink-0",style:{color:I.accent}})})),o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:L,onClick:()=>{P(""),B("")}},{children:o(x,{className:"h-6 w-6 shrink-0",style:{color:I.accent}})}))]}):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",disabled:L,onClick:()=>{var e;null===(e=G.current)||void 0===e||e.click()},style:{backgroundColor:S?I.accent+"10":void 0}},U,{children:o(h,{className:"h-6 w-6 shrink-0",style:{color:S?I.accent:I.accent+"80"}})}))}))]}))]}))]})),E.length>0&&o("div",Object.assign({className:N("flex gap-4","viewport"===F?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:E.map((e=>{var s,l,a;return o(i,{children:"document"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:J},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:I.accent,borderRadius:J.borderRadius}},{children:L?o(y,{className:"w-5 h-5 animate-spin",style:{color:I.accentText}}):o(v,{className:"w-5 h-5",style:{color:I.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(N(R.b3),"font-medium truncate")},{children:e.name})),o("p",Object.assign({className:N(R.b4,"opacity-80 truncate")},{children:f(e.size)}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):"image"===e.type?t("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:J.borderRadius}},{children:["finished"===e.status?o("img",{style:{borderRadius:J.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(s=e.documentId)||void 0===s?void 0:s.split("-")[2]}/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[1]}.${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[2]}`,alt:""}):o("div",{className:"h-full w-full animate-pulse",style:{borderRadius:J.borderRadius,backgroundColor:I.secondary}}),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):"website"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:J},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:I.accent,borderRadius:J.borderRadius}},{children:L?o(y,{className:"w-5 h-5 animate-spin",style:{color:I.accentText}}):o(j,{className:"w-5 h-5",style:{color:I.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(N(R.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),o("p",Object.assign({className:N(R.b4,"opacity-80 truncate")},{children:(null==T?void 0:T.website)||"Website"}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):null},e.id)}))})),z&&o(w,{error:z,className:"mt-3"})]}))};export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{createContext as s,useState as i,useEffect as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{createContext as s,useState as i,useEffect as t}from"react";import o from"./Addons/Document/Provider.js";import r from"./ResponseProvider.js";import n from"./DimensionProvider.js";const d=s({}),a=({children:s,userId:a="",studioUserId:c="",deploymentId:l="",embedUserId:m="",styles:p,colors:h,limits:F={},misc:I={isWhiteLabel:!0,isProfileImage:!0,isChatImage:!0,isTitle:!0,isDescription:!0,isHistory:!0},translations:b,chatInput:u="",responsiveBy:y="viewport",loadFont:f=!0,forceMobile:g=!1,isEmbed:w=!1,onGenerateComplete:P})=>{const[j,v]=i(""),[x,S]=i(""),[k,C]=i(null),[O,D]=i(!1),[H,U]=i(!0),[B,L]=i(!0),[T,E]=i(!1);return t((()=>{D(!1)}),[null==p?void 0:p.font]),e(d.Provider,Object.assign({value:Object.assign({formId:j,chatId:x,userId:a,studioUserId:c,deploymentId:l,embedUserId:m,pickaxe:k,styles:Object.assign({theme:"light",font:"Real Head Pro",fontSize:"md",formFieldStyle:"box",btnStyle:"filled",outlineThickness:1,cornerRadius:4},p),colors:Object.assign({primary:"#F6F8FA",text:"#000000",secondary:"#FFFFFF",secondaryText:"#000000",accent:"#228DD7",accentText:"#FFFFFF",error:"#EF4444"},h),misc:I,translations:Object.assign({"new-chat":"New chat","see-history":"See history","see-input":"See input","hide-input":"Hide input",processing:"Processing...",uploading:"Uploading...",loading:"Loading...","powered-by-pickaxe":"Powered by Pickaxe","form-doc-placeholder":"Paste a website/video link or drag a file",website:"Website"},b),chatInput:u,responsiveBy:y,isFontLoaded:O,isNewChat:H,isShowIceBreaker:B,isShowHistory:T,loadFont:f,forceMobile:g,isEmbed:w,setIsFontLoaded:D,setFormId:v,setChatId:S,setPickaxe:C,setIsNewChat:U,setIsShowIceBreaker:L,setIsShowHistory:E},P&&{onGenerateComplete:P})},{children:e(r,Object.assign({limits:F},{children:e(n,{children:e(o,{children:s})})}))}))};export{d as PickaxeContext,a as PickaxeProvider};
|