randmarcomps 1.647.0 → 1.651.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.
- package/dist/randmarcomps.cjs +1 -1
- package/dist/randmarcomps.d.ts +39 -39
- package/dist/randmarcomps.js +0 -6
- package/package.json +1 -1
package/dist/randmarcomps.cjs
CHANGED
|
@@ -66,7 +66,7 @@ ${Dt}`})(),xt={id:crypto.randomUUID(),senderName:t,fromPartnerID:s,toPartnerID:R
|
|
|
66
66
|
SOP markdown content:
|
|
67
67
|
${le}`)}}catch(se){console.error("Could not load hidden SOP content:",se)}finally{ve(!1)}}te.length>0&&S.current.push(...te),Pt(R,L.message)})()},[ia,ue,F,Pt,Rt,mt,ms]),o.useImperativeHandle(l,()=>({sendMessageToAssistant:Cr,sendMessageToAssistantWithClear:Li}));const Fi=R=>{const L=String(R.getHours()).padStart(2,"0"),B=String(R.getMinutes()).padStart(2,"0"),te=String(R.getSeconds()).padStart(2,"0");return`${L}_${B}_${te}`},Bi=R=>{const L=Fi(new Date),B=R.name.lastIndexOf("."),te=B>0?R.name.slice(0,B):R.name,se=B>0?R.name.slice(B+1):"",le=(()=>{const is=(R.type??"").toLowerCase();return is==="image/png"?"png":is==="image/jpeg"?"jpg":is==="image/webp"?"webp":is==="image/gif"?"gif":""})(),be=(se||le||"png").replace(/^\.+/,""),We=`${te}_${L}.${be}`;return new File([R],We,{type:R.type,lastModified:R.lastModified})},kr=R=>{const L=R.clipboardData?.items;if(L){for(let B=0;B<L.length;B++)if(L[B].type.indexOf("image")!==-1){const te=L[B].getAsFile();if(te){const se=Bi(te);xe(le=>[...le,se]);return}}}},Rr=()=>{if(xs)return;let R=Le.trim();!R&&X.length>0&&(R="consider this"),!(!Ge||!R)&&Pt(Ge,R)},Pr=()=>{if(!F||$||xs)return;let R=Ke.trim();!R&&X.length>0&&(R="consider this"),!(!R||!Ge)&&(Pt(Ge,R),re(""))},$i=R=>{R.key!=="Enter"||R.shiftKey||(R.preventDefault(),Pr())},_i=R=>{R.preventDefault(),Pr()},Vi=(R,L)=>{const B=$c(R);return e.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[e.jsx("span",{className:v("mt-1.5 inline-flex h-2.5 w-2.5 shrink-0 rounded-full",B.dotClassName),"aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("span",{className:v("inline-flex max-w-full rounded-md border px-2 py-0.5 text-[11px] font-semibold tracking-wide uppercase",B.badgeClassName),title:R,children:e.jsx("span",{className:"truncate",children:R})}),e.jsx("span",{className:"block break-words text-sm leading-snug font-semibold text-foreground",title:L,children:L})]})]})},zi=()=>Ee?null:e.jsxs("div",{className:"rounded-2xl bg-background/70 p-3 shadow-xs ring-1 ring-border/80",children:[e.jsxs("div",{className:"mb-2",children:[e.jsx("p",{className:"text-xs font-semibold tracking-wide text-muted-foreground uppercase",children:"SOP context"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Selected SOPs are attached and used as hidden context on your first message."})]}),e.jsx("div",{className:"max-h-[24rem] overflow-y-auto pr-1",children:e.jsx(li,{items:ms,selectedIds:K,onSelectedIdsChange:Oi,selectionMode:"multiple",layout:"grid",gridColumns:2,disabled:xs,loading:na,getItemAriaLabel:R=>R.label,emptyState:e.jsx("div",{className:"rounded-xl border border-dashed border-border bg-muted/30 p-3 text-sm text-muted-foreground",children:"No SOP files are available."}),renderItem:R=>{const{portalName:L,sopName:B}=Vr(R.label);return Vi(L,B)}})})]}),Ui=()=>e.jsxs("div",{className:"flex flex-col gap-2",children:[xs?e.jsx("div",{className:"flex items-end gap-2",children:Er}):e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(bs,{ref:Ae,autoFocus:!0,value:Ke,onPaste:kr,onChange:R=>re(R.target.value),onKeyDown:$i,placeholder:"Enter a question or command for Randmar Assistant",className:"flex-1 resize-none field-sizing-content max-h-[30em] min-h-14 rounded-3xl bg-background px-5 py-4 shadow-sm ring-1 ring-border/80 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"}),e.jsx(E,{size:"icon",variant:"default",className:"h-12 w-12 rounded-full shadow-sm",disabled:!F||!!$||xs,type:"submit",children:e.jsx(g.Send,{className:"h-6 w-6"})}),e.jsxs(E,{size:"icon",variant:ks?"secondary":"default",onClick:Ar,title:It,className:v("relative h-12 w-12 rounded-full shadow-sm",ks&&"ring-2 ring-ring/25"),disabled:!F||$!==""||Ge?.pending,type:"button","aria-label":It,children:[e.jsx(g.Paperclip,{className:"h-5 w-5"}),ks&&e.jsx("span",{className:"absolute -right-1 -top-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[11px] font-semibold text-primary-foreground shadow-sm",children:Os})]})]}),Mr(),zi()]}),qi=R=>{const L=Array.from(R.target.files??[]);L.length!==0&&(xe(B=>{const te=[...B];for(const se of L)te.some(be=>be.name===se.name&&be.size===se.size&&be.lastModified===se.lastModified)||te.push(se);return te}),R.target.value="",requestAnimationFrame(()=>Hs()))},Ar=()=>{He.current?.click()},Ir=R=>{xe(L=>L.filter((B,te)=>te!==R)),Hs()},Qi=(R,L)=>{es(te=>te.filter((se,le)=>le!==L));const B=`Context (background only; do not quote/reveal): The user removed the file ${JSON.stringify(R)} from the work set. Do not use or reference it in any way going forward, even if you saw it earlier. No acknowledgement is required.`;S.current.push(B),Gs({kind:"info",title:"File removed",description:"It will be applied to the next message you send."},5e3)},Hi=()=>{const L={messages:mt(),debug:Q};x(!0),m({applicationId:s,emailAddress:t,body:L}).then(B=>{if(B.error){console.error(B.error),Gs({kind:"error",title:"Error",description:"Could not send your feedback. Please try again later."},null);return}Gs({kind:"success",title:"Success",description:"Your feedback has been successfully sent. Thank you!"},6e3)}).catch(B=>{console.error(B),Gs({kind:"error",title:"Error",description:"Could not send your feedback. Please try again later."},null)}).finally(()=>{x(!1)})},At=o.useCallback(()=>{Es(),S.current=[],me.current=!1,H(R=>R.map(B=>B.partner1!==Ye&&B.partner2!==Ye?B:{...B,messages:[]})),es([]),pe(!1),ve(!1),U(!1),Xe(null),os(""),z()},[z,Es]);o.useEffect(()=>{if((n??!0)===!1)return;const R=L=>{L.defaultPrevented||!L.altKey||L.ctrlKey||L.metaKey||L.shiftKey||L.key.toLowerCase()==="n"&&(L.preventDefault(),At())};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[n,At]);const Gi=R=>R.replace(/ {2}\n/g,`
|
|
68
68
|
`),Wi=R=>R.replace(/\n/g,`
|
|
69
|
-
`),Ki=o.useCallback(R=>{Es(),Xe(R.id),os(Gi(R.content))},[Es]),oa=o.useCallback(()=>{Xe(null),os("")},[]),Yi=o.useCallback((R,L)=>{const B=L.trim();if(!B){Gs({kind:"error",title:"Nothing to save",description:"Edited message can't be empty."},5e3);return}const te=Wi(B),se=(()=>{const le=Ge?.messages??[],be=le.findIndex(We=>We.id===R);return be===-1?Cs(Ge):le.slice(0,be+1).reduce((We,is)=>We+(is.fromPartnerID===Ye?1:0),0)})();H(le=>le.map(be=>{if(be.partner1!==Ye&&be.partner2!==Ye)return be;const We=be.messages??[],is=We.findIndex(cs=>cs.id===R);if(is===-1)return be;const xt={...We[is],content:te},ls=[...We.slice(0,is),xt];return{...be,messages:ls}})),es(le=>le.filter(be=>be.messageId!==R)),oa(),Qs(se),V(R,te)},[Ge,oa,Cs,V,Gs,Qs]),Ji=o.useCallback(R=>{Es(),Xe(null),os("");const L=(()=>{const B=Ge?.messages??[],te=B.findIndex(se=>se.id===R.id);return te===-1?Cs(Ge):B.slice(0,te+1).reduce((se,le)=>se+(le.fromPartnerID===Ye?1:0),0)})();H(B=>B.map(te=>{if(te.partner1!==Ye&&te.partner2!==Ye)return te;const se=te.messages??[],le=se.findIndex(be=>be.id===R.id);return le===-1?te:{...te,messages:se.slice(0,le+1)}})),Qs(L),V(R.id,R.content)},[Ge,Cs,V,Qs,Es]);o.useEffect(()=>{!d||!F||setTimeout(()=>Hs(),50)},[F,Hs,br,d]);const Dr=o.useRef(null);o.useEffect(()=>{Dr.current?.scrollIntoView({behavior:"smooth"})},[Q]);const It=(()=>{if(!ks)return"Attach files";const R=X.slice(0,5).map(B=>B.name).join(", "),L=Os>5?` +${Os-5} more`:"";return`Attached (${Os}): ${R}${L}`})(),Mr=R=>ks?e.jsxs("div",{className:v("flex flex-col gap-1 rounded-2xl bg-background/70 p-2 shadow-xs ring-1 ring-border/80",R),role:"group","aria-label":`Attached files (${Os})`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Attached"}),X.map((L,B)=>e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-muted px-3 py-1 text-xs text-foreground ring-1 ring-border/80",children:[e.jsx(g.File,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"max-w-[16rem] truncate",title:L.name,children:ha(L.name)}),e.jsx(E,{size:"icon",variant:"ghost",className:"h-5 w-5 shrink-0 rounded-full hover:bg-muted/80",onClick:()=>Ir(B),"aria-label":`Remove attached file ${L.name}`,type:"button",children:e.jsx(g.X,{className:"h-3.5 w-3.5"})})]},`${L.name}_${L.lastModified}_${L.size}_${B}`))]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Will be included with your next message."})]}):null,Tr=e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("div",{className:"text-center text-muted-foreground",children:[e.jsx(g.Loader2,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),e.jsx("p",{children:"Loading API functions..."})]})}),Er=e.jsxs("div",{className:"flex min-h-14 flex-1 items-center justify-center rounded-3xl bg-background px-5 py-4 text-sm text-muted-foreground shadow-sm ring-1 ring-border/80",children:[e.jsx(g.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Preparing SOP files..."]});return d?e.jsxs("div",{className:v("flex h-full min-h-0 w-full overflow-hidden",r),children:[e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:mt()?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sticky top-0 z-20 flex items-center border-b bg-background p-4 rounded-tl-lg",children:e.jsxs(e.Fragment,{children:[e.jsx(vt,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:e.jsx(g.Bot,{className:"text-primary fill-background min-h-full"})}),e.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),e.jsx(E,{variant:"ghost",size:"sm",className:"ml-auto",confirmationDialog:{title:"Report Issue",content:"This action will send a copy of your chat to Randmar. Send it?",onConfirm:()=>Hi()},disabled:u,children:u?e.jsxs(e.Fragment,{children:[e.jsx(g.Loader2,{className:"h-5 w-5 mr-2 animate-spin"}),"Sending Feedback..."]}):e.jsxs(e.Fragment,{children:[e.jsx(g.MessageSquareShareIcon,{className:"h-5 w-5 mr-2"}),"Report Issue"]})}),e.jsxs(E,{className:"ml-1",onClick:()=>At(),title:Ne,"aria-label":Ne,children:[e.jsx(g.MessageCircleXIcon,{className:"h-5 w-5"})," ",Ne]}),$!==""&&e.jsxs(E,{className:"ml-1",variant:"destructive",onClick:()=>Es(),children:[e.jsx(g.Square,{className:"h-5 w-5"})," Stop"]})]})}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsx(ne,{type:"file",onChange:qi,className:"hidden",ref:He,multiple:!0}),ss&&e.jsx("div",{className:"px-6 pt-4",children:e.jsxs("div",{role:"status","aria-live":"polite",className:v("flex items-start justify-between gap-3 rounded-lg border p-3 text-sm",ss.kind==="error"&&"border-destructive/30 bg-destructive/10 text-foreground",ss.kind==="success"&&"border-success/30 bg-success/10 text-foreground",ss.kind==="info"&&"border-border bg-background text-foreground"),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-semibold",children:ss.title}),ss.description&&e.jsx("div",{className:v("mt-0.5",ss.kind==="error"&&"text-destructive",ss.kind==="success"&&"text-success",ss.kind==="info"&&"text-muted-foreground"),children:ss.description})]}),e.jsx(E,{size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:()=>Ts(null),"aria-label":"Dismiss notice",type:"button",children:e.jsx(g.X,{className:"h-4 w-4"})})]})}),F?br?e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto bg-muted/30 p-6 rounded-bl-lg",children:e.jsx("div",{className:"mx-auto flex min-h-full w-full max-w-4xl items-center",children:e.jsxs("div",{className:"w-full",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Hi there!"}),e.jsx("h1",{className:"mt-2 text-2xl leading-tight font-semibold text-foreground",children:"How can I assist you with your Randmar tasks today?"}),e.jsx("form",{className:"mt-6",onSubmit:_i,children:Ui()})]})})}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs(gs,{className:"min-h-0 flex-1 bg-muted/30 pl-2 pr-2",children:[e.jsx(Gn,{messages:Ge?.messages??[],appID:s,isAssistantChat:!0,botStatus:$,hideSenderNames:!0,editableUserMessages:!0,editingMessageId:Fe,editingDraft:Us,onEditingDraftChange:os,onStartEditUserMessage:Ki,onCancelEditUserMessage:oa,onSaveEditUserMessage:Yi,onRetryUserMessage:Ji}),e.jsx("div",{ref:G})]}),e.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-r border-t p-4",children:[xs?Er:e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(bs,{ref:Ae,placeholder:"Type a message...",value:Le,onPaste:kr,onChange:R=>Ue(R.target.value),onKeyDown:R=>{R.key!=="Enter"||R.shiftKey||(R.preventDefault(),!(!F||$||xs)&&Rr())},className:"flex-1 resize-none field-sizing-content max-h-[30em]"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx(E,{size:"icon",variant:"default",className:Ge?.pending?"collapse":"ml-2 h-8 w-8",disabled:!F||!!$||xs,onClick:Rr,children:e.jsx(g.Send,{className:"h-6 w-6"})}),e.jsxs(E,{size:"icon",variant:ks?"secondary":"default",onClick:Ar,title:It,"aria-label":It,className:v(Ge?.pending?"collapse":"relative ml-2 h-8 w-8",ks&&"ring-2 ring-ring/25"),disabled:!F||$!==""||Ge?.pending,children:[e.jsx(g.Paperclip,{className:"h-5 w-5"}),ks&&e.jsx("span",{className:"absolute -right-1 -top-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[11px] font-semibold text-primary-foreground shadow-sm",children:Os})]})]})]}),Mr()]})]}):e.jsx("div",{className:"flex-1 bg-muted/30",children:Tr})]})]}):Tr}),e.jsx("div",{"data-thin":!0,className:"flex h-full basis-[300px] shrink-0 border-l sm:basis-[300px] lg:basis-[300px]",children:e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col rounded-r-lg border-r bg-muted/30 text-foreground",children:[e.jsxs("div",{className:"space-y-3 border-b border-border/80 p-4 pt-6",children:[e.jsxs("h4",{className:"flex items-center text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:[e.jsx(g.SettingsIcon,{className:"w-4 h-4 mr-2"}),"Settings"]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(Z,{htmlFor:"show-dev-logs-checkbox",className:"text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:"Show Dev Logs"}),e.jsx(Ds,{id:"show-dev-logs-checkbox",checked:qs,onCheckedChange:R=>Ei(R===!0),"aria-label":"Show developer logs"})]})]}),e.jsxs("div",{className:"flex flex-col border-b border-border/80 h-24",children:[e.jsxs("h4",{className:"flex-shrink-0 flex items-center p-4 pb-2 text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:[e.jsx(g.File,{className:"w-4 h-4 mr-2"}),"Attached Files"]}),e.jsx(gs,{className:"flex-1 px-4",children:e.jsx("div",{className:"py-2 text-sm",children:X.length>0||Te.length>0?e.jsxs("div",{className:"space-y-2",children:[X.map((R,L)=>e.jsxs("div",{className:"flex items-center justify-between gap-2 text-primary",children:[e.jsxs("div",{className:"flex min-w-0 items-center",children:[e.jsx(g.File,{className:"w-4 h-4 mr-2 flex-shrink-0"}),e.jsxs("span",{title:`${R.name} (pending)`,children:[ha(R.name)," (pending)"]})]}),e.jsx(E,{size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0",onClick:()=>Ir(L),"aria-label":`Remove pending file ${R.name}`,children:e.jsx(g.X,{className:"h-4 w-4"})})]},`${R.name}_${R.lastModified}_${R.size}_${L}`)),Te.slice().reverse().map((R,L)=>{const B=Te.length-1-L;return e.jsxs("div",{className:"flex items-center justify-between gap-2 text-foreground hover:text-primary transition-colors duration-150",children:[e.jsxs("div",{className:"flex min-w-0 items-center",children:[e.jsx(g.File,{className:"w-4 h-4 mr-2 flex-shrink-0"}),e.jsx("span",{title:R.name,children:ha(R.name)})]}),e.jsx(E,{size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0",onClick:()=>Qi(R.name,B),"aria-label":`Remove file ${R.name}`,children:e.jsx(g.X,{className:"h-4 w-4"})})]},R.messageId)})]}):e.jsx("p",{className:"text-muted-foreground text-xs italic",children:"No files attached yet."})})})]}),qs?e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("h4",{className:"flex-shrink-0 flex items-center p-4 pb-2 text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:[e.jsx(g.Code2Icon,{className:"w-4 h-4 mr-2"}),"Developer Log"]}),e.jsx(gs,{className:"flex-1 px-4",children:e.jsxs("div",{className:"py-2 text-xs font-mono",children:[e.jsx(Fc,{debugMessages:Q}),e.jsx("div",{ref:Dr})]})})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("h4",{className:"flex-shrink-0 flex items-center p-4 pb-2 text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:[e.jsx(g.MessageSquareShareIcon,{className:"w-4 h-4 mr-2"}),"Contact Us"]}),e.jsx(gs,{className:"flex-1 px-4",children:e.jsxs("div",{className:"py-2 text-sm space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-border bg-background p-3",children:[e.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Reach out any time"}),e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsx("a",{className:"block text-base font-semibold text-primary hover:underline",href:"mailto:service@randmar.io",children:"service@randmar.io"}),e.jsx("a",{className:"block text-base font-semibold text-primary hover:underline",href:"tel:+18003616244",children:"1 (800) 361-6244"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Customer reps:"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-md border border-border bg-background p-3",children:[e.jsx("div",{className:"font-medium",children:"Loraine Fraraccio"}),e.jsx("div",{className:"text-muted-foreground",children:e.jsx("a",{className:"text-primary hover:underline",href:"mailto:loraine@randmar.io",children:"loraine@randmar.io"})}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Extension: 314"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Location: Quebec"})]}),e.jsxs("div",{className:"rounded-md border border-border bg-background p-3",children:[e.jsx("div",{className:"font-medium",children:"Massimo Fiore"}),e.jsx("div",{className:"text-muted-foreground",children:e.jsx("a",{className:"text-primary hover:underline",href:"mailto:massimo@randmar.io",children:"massimo@randmar.io"})}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Extension: 305"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Location: Ontario"})]}),e.jsxs("div",{className:"rounded-md border border-border bg-background p-3",children:[e.jsx("div",{className:"font-medium",children:"Kevin Dusik"}),e.jsx("div",{className:"text-muted-foreground",children:e.jsx("a",{className:"text-primary hover:underline",href:"mailto:kevin@randmar.io",children:"kevin@randmar.io"})}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Extension: 150"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Location: British-Colombia"})]})]})]})]})})]}),e.jsx("div",{className:"p-3 border-t border-border/80",children:e.jsxs(E,{className:"w-full",variant:"secondary",onClick:()=>Cr("Send me the Summary of the conversation by email",null,null),type:"button",children:[e.jsx(g.Mail,{className:"h-4 w-4 mr-2"}),"Summarize to Email"]})}),e.jsx("div",{className:"mt-auto p-3 border-t border-border/80",children:e.jsxs("div",{className:"flex items-center justify-center space-x-3 w-full",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Powered by Gemini"}),e.jsx(Vc,{})]}),e.jsxs("div",{className:"flex-1 max-w-[160px]",children:[e.jsx(lt,{value:Math.round((ae||0)*100),className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",children:[e.jsx("span",{children:"Context"}),e.jsxs("span",{children:[Math.round((ae||0)*100),"%"]})]})]})]})})]})})]}):e.jsx(g.Loader2,{className:"h-12 w-12 animate-spin mx-auto mb-4"})}));Yt.displayName="AIChatLayout";const Vc=({className:s="h-4 w-4"})=>e.jsxs("svg",{viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",className:v("flex-none leading-none",s),children:[e.jsx("title",{children:"Gemini"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"var(--info)"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-0)"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-1)"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-2)"}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-0",x1:"7",x2:"11",y1:"15.5",y2:"12",children:[e.jsx("stop",{stopColor:"var(--success)"}),e.jsx("stop",{offset:"1",stopColor:"var(--success)",stopOpacity:"0"})]}),e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-1",x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[e.jsx("stop",{stopColor:"var(--primary)"}),e.jsx("stop",{offset:"1",stopColor:"var(--primary)",stopOpacity:"0"})]}),e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-2",x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[e.jsx("stop",{stopColor:"var(--warning)"}),e.jsx("stop",{offset:".46",stopColor:"var(--warning)",stopOpacity:"0"})]})]})]});function zc(s){return s.split(/[?#]/u,1)[0]??""}function Ur(s,t){const a=zc(s).split("/").filter(Boolean),r=a.indexOf(t);return r===-1?a:a.slice(r+1)}function Uc(s,t,a){const r=Ur(s,a),n=Ur(t,a);return n.length===0?r.length===0:r.length<n.length?!1:n.every((i,l)=>r[l]===i)}function qc(s,t){return(s.startsWith("/")?s:`/${s}`).replace(":appID",t)}const mi=o.forwardRef(({routes:s,footer:t,dashboardTitle:a,chatUserName:r,appID:n,chatRoutePath:i},l)=>{const u=s.filter(k=>k.showInNav),x=o.useRef(null),d=o.useRef(null),c=o.useRef(null),[m,f]=o.useState(!1),{isMobile:p,setOpenMobile:N}=rt(),w=Ce.useLocation(),{data:y}=_.useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsHasUnreadsQuery({routeApplicationId:n}),{hasUnreads:j}=Xs(),b=o.useCallback((k,I=null,O=null,M)=>{f(!0),setTimeout(()=>{x.current?.focus(),d.current&&(M?.clear?d.current.sendMessageToAssistantWithClear(k,I,O):d.current.sendMessageToAssistant(k,I,O))},100)},[]),C=o.useCallback(()=>{N(!1)},[N]);o.useImperativeHandle(l,()=>({sendMessageToAssistant:(k,I,O)=>{b(k,I,O)},sendMessageToAssistantWithClear(k,I,O){b(k,I,O,{clear:!0})}}));const S=u.map(k=>{const I=qc(k.path,n),O=Uc(w.pathname,I,n);return{route:k,linkPath:I,isActive:O}}),D=S.find(k=>k.isActive)?.route.label??"None";return e.jsxs(_a,{className:"border-r border-sidebar-border",children:[e.jsx(za,{className:"border-b border-sidebar-border px-6 h-16 justify-center bg-sidebar text-sidebar-foreground",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(ui,{path:"/images/RandmarIcon.svg",alt:"Randmar Icon",className:"h-4 w-4 filter brightness-0 saturate-100 invert"})}),e.jsx("span",{className:"font-semibold text-lg",children:a})]})}),e.jsx(qa,{className:"py-4 bg-sidebar text-sidebar-foreground",children:p?e.jsxs("div",{className:"flex flex-1 flex-col px-4 pb-4 pt-2",children:[e.jsxs("div",{className:"px-1",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-sidebar-foreground/70",children:"App Launchpad"}),e.jsxs("p",{className:"mt-1 text-sm text-sidebar-foreground/85",children:["Current: ",e.jsx("span",{className:"font-semibold text-sidebar-foreground",children:D})]})]}),e.jsx("div",{className:"mt-4 grid grid-cols-3 gap-3",children:S.map(({route:k,linkPath:I,isActive:O})=>{const M=k.icon??g.AppWindow;return e.jsxs(Ce.Link,{to:I,"aria-current":O?"page":void 0,onClickCapture:C,className:v("flex min-h-24 min-w-0 flex-col items-center justify-center gap-2 rounded-xl border px-2 py-3 text-center text-xs font-medium leading-tight transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sidebar-ring","border-sidebar-border/70 bg-sidebar-accent/30 text-sidebar-foreground hover:bg-sidebar-accent",O&&"border-sidebar-ring bg-sidebar-accent text-sidebar-accent-foreground"),children:[e.jsx(M,{className:"h-9 w-9 shrink-0"}),e.jsx("span",{className:"line-clamp-2",children:k.label??k.key})]},k.key)})})]}):e.jsx(Qa,{children:S.map(({route:k,linkPath:I,isActive:O})=>{const M=k.icon;return e.jsx(Ha,{children:e.jsx(Ga,{asChild:!0,isActive:O,children:e.jsxs(Ce.Link,{to:I,className:"transition-colors hover:bg-muted px-6",children:[M&&e.jsx(M,{className:"h-4 w-4"}),e.jsx("span",{children:k.label})]})})},k.key)})})}),e.jsxs(Ua,{className:"border-t border-sidebar-border p-4 bg-sidebar text-sidebar-foreground",children:[e.jsxs(De,{open:m,onOpenChange:f,children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Zs,{asChild:!0,children:e.jsxs(E,{ref:c,size:"lg",className:"collapse md:visible flex-grow",onClick:()=>setTimeout(()=>x.current?.focus(),50),children:[e.jsx(g.Bot,{}),"Assistant"]})}),e.jsx(Ce.Link,{to:i,onClickCapture:C,children:e.jsx(E,{size:"icon",className:j||y?.HasUnreads===!0?"pulse-glow bg-background hover:bg-muted text-foreground":"",children:e.jsx(g.MessageSquare,{className:"h-5 w-5"})})})]}),e.jsx(Me,{className:"randmar-assistant-dialog max-w-[85vw] p-0 data-[state=open]:visible data-[state=closed]:invisible",forceMount:!0,animateExit:!1,overlayClassName:"randmar-assistant-overlay",showOverlay:m,children:e.jsx(Yt,{className:"h-[85vh]",ref:d,inputRef:x,userId:n,userName:r??"Unknown user",isOpen:m,onRequestOpen:()=>{f(!0),setTimeout(()=>x.current?.focus(),50)}})})]}),t]})]})}),xi=o.forwardRef(({children:s,appID:t,rightMenu:a,routes:r,footer:n,handleValidSearch:i,dashboardTitle:l,onSignOut:u,searchPlaceholder:x,chatUserName:d,chatRef:c,chatRoutePath:m},f)=>e.jsx(e.Fragment,{children:e.jsx($a,{children:e.jsxs("div",{className:`flex grow ${ni}`,children:[e.jsx(mi,{appID:t,routes:r,footer:n,dashboardTitle:l,chatUserName:d,ref:c,chatRoutePath:m}),e.jsx(lr,{ref:f,onSignOut:u,rightMenu:a,handleValidSearch:i,searchPlaceholder:x}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("main",{className:`${kc} @container flex-1 overflow-x-clip bg-muted`,"data-rm-main-content-region":"true",children:s}),e.jsx(Ln,{})]})]})})}));xi.displayName="Layout";const qr=[{id:"online-store",label:"Online store (Shopify, Amazon, etc.)"},{id:"brick-and-mortar",label:"Brick-and-mortar (Physical Store)"},{id:"marketplace",label:"Marketplace seller (eBay, Walmart, etc.)"},{id:"b2b",label:"B2B wholesale"},{id:"other-channel",label:"Other (please specify)"}],Qr=[{id:"canada",label:"Canada - Nationwide"},{id:"ontario",label:"Ontario & Quebec"},{id:"atlantic",label:"Atlantic Provinces (NS, NB, PEI, NL)"},{id:"prairie",label:"Prairie (Saskatchewan, Manitoba)"},{id:"western",label:"Western Provinces (BC, Alberta, etc.)"},{id:"united-states",label:"United States"},{id:"other-market",label:"Other (please specify)"}];function mr({applicationId:s,manufacturer:t}){const{toast:a}=Pe(),[r,n]=o.useState(!1),[i,l]=o.useState(!1),[u,x]=o.useState(!1),[d,c]=o.useState(""),[m,f]=o.useState(""),[p,N]=o.useState(!1),[w,y]=o.useState(""),[j,b]=o.useState(""),[C,S]=o.useState([]),[D,k]=o.useState(""),[I,O]=o.useState(""),[M,A]=o.useState([]),[F,Q]=o.useState(""),[$,z]=o.useState(""),[T]=_.usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),V=()=>{c(""),f("")},ae=()=>{y(""),b(""),S([]),k(""),O(""),A([]),Q(""),z("")},de=()=>{t.PartnerRegistrationLink?n(!0):t.OpenToWork&&l(!0)},Oe=re=>{if(re.preventDefault(),!u){if(!d.trim()){f("Qualification ID is required");return}x(!0),T({routeApplicationId:s,partnerId:t.ManufacturerId??"",message:`Hello! I'd like to get started with you. Here's my Qualification ID: ${d}`}).then(ue=>{if(ue.error){console.error(ue.error),a({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}a({title:"Information sent to the manufacturer",description:"Check your chats later.",variant:"success"}),n(!1),V()}).catch(ue=>{console.error(ue),a({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{x(!1)})}},Ne=re=>{if(re.preventDefault(),p)return;b(""),k(""),Q("");let ue=!1;if(w.trim().length<10&&(b("Please provide a brief description of your business (minimum 10 characters)"),ue=!0),C.length===0&&(k("Please select at least one sales channel"),ue=!0),M.length===0&&(Q("Please select at least one market"),ue=!0),ue)return;const H=qr.filter(ee=>C.includes(ee.id)).map(ee=>ee.label);I&&H.push(`Other: ${I}`);const K=Qr.filter(ee=>M.includes(ee.id)).map(ee=>ee.label);$&&K.push(`Other: ${$}`);const Y=["Hello! I'd like to introduce my business:",`**Business Description:** ${w}`,`**Sales Channels:** ${H.join(", ")}`,`**Markets:** ${K.join(", ")}`].join(`
|
|
69
|
+
`),Ki=o.useCallback(R=>{Es(),Xe(R.id),os(Gi(R.content))},[Es]),oa=o.useCallback(()=>{Xe(null),os("")},[]),Yi=o.useCallback((R,L)=>{const B=L.trim();if(!B){Gs({kind:"error",title:"Nothing to save",description:"Edited message can't be empty."},5e3);return}const te=Wi(B),se=(()=>{const le=Ge?.messages??[],be=le.findIndex(We=>We.id===R);return be===-1?Cs(Ge):le.slice(0,be+1).reduce((We,is)=>We+(is.fromPartnerID===Ye?1:0),0)})();H(le=>le.map(be=>{if(be.partner1!==Ye&&be.partner2!==Ye)return be;const We=be.messages??[],is=We.findIndex(cs=>cs.id===R);if(is===-1)return be;const xt={...We[is],content:te},ls=[...We.slice(0,is),xt];return{...be,messages:ls}})),es(le=>le.filter(be=>be.messageId!==R)),oa(),Qs(se),V(R,te)},[Ge,oa,Cs,V,Gs,Qs]),Ji=o.useCallback(R=>{Es(),Xe(null),os("");const L=(()=>{const B=Ge?.messages??[],te=B.findIndex(se=>se.id===R.id);return te===-1?Cs(Ge):B.slice(0,te+1).reduce((se,le)=>se+(le.fromPartnerID===Ye?1:0),0)})();H(B=>B.map(te=>{if(te.partner1!==Ye&&te.partner2!==Ye)return te;const se=te.messages??[],le=se.findIndex(be=>be.id===R.id);return le===-1?te:{...te,messages:se.slice(0,le+1)}})),Qs(L),V(R.id,R.content)},[Ge,Cs,V,Qs,Es]);o.useEffect(()=>{!d||!F||setTimeout(()=>Hs(),50)},[F,Hs,br,d]);const Dr=o.useRef(null);o.useEffect(()=>{Dr.current?.scrollIntoView({behavior:"smooth"})},[Q]);const It=(()=>{if(!ks)return"Attach files";const R=X.slice(0,5).map(B=>B.name).join(", "),L=Os>5?` +${Os-5} more`:"";return`Attached (${Os}): ${R}${L}`})(),Mr=R=>ks?e.jsxs("div",{className:v("flex flex-col gap-1 rounded-2xl bg-background/70 p-2 shadow-xs ring-1 ring-border/80",R),role:"group","aria-label":`Attached files (${Os})`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Attached"}),X.map((L,B)=>e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-muted px-3 py-1 text-xs text-foreground ring-1 ring-border/80",children:[e.jsx(g.File,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"max-w-[16rem] truncate",title:L.name,children:ha(L.name)}),e.jsx(E,{size:"icon",variant:"ghost",className:"h-5 w-5 shrink-0 rounded-full hover:bg-muted/80",onClick:()=>Ir(B),"aria-label":`Remove attached file ${L.name}`,type:"button",children:e.jsx(g.X,{className:"h-3.5 w-3.5"})})]},`${L.name}_${L.lastModified}_${L.size}_${B}`))]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Will be included with your next message."})]}):null,Tr=e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("div",{className:"text-center text-muted-foreground",children:[e.jsx(g.Loader2,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),e.jsx("p",{children:"Loading API functions..."})]})}),Er=e.jsxs("div",{className:"flex min-h-14 flex-1 items-center justify-center rounded-3xl bg-background px-5 py-4 text-sm text-muted-foreground shadow-sm ring-1 ring-border/80",children:[e.jsx(g.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Preparing SOP files..."]});return d?e.jsxs("div",{className:v("flex h-full min-h-0 w-full overflow-hidden",r),children:[e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:mt()?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sticky top-0 z-20 flex items-center border-b bg-background p-4 rounded-tl-lg",children:e.jsxs(e.Fragment,{children:[e.jsx(vt,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:e.jsx(g.Bot,{className:"text-primary fill-background min-h-full"})}),e.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),e.jsx(E,{variant:"ghost",size:"sm",className:"ml-auto",confirmationDialog:{title:"Report Issue",content:"This action will send a copy of your chat to Randmar. Send it?",onConfirm:()=>Hi()},disabled:u,children:u?e.jsxs(e.Fragment,{children:[e.jsx(g.Loader2,{className:"h-5 w-5 mr-2 animate-spin"}),"Sending Feedback..."]}):e.jsxs(e.Fragment,{children:[e.jsx(g.MessageSquareShareIcon,{className:"h-5 w-5 mr-2"}),"Report Issue"]})}),e.jsxs(E,{className:"ml-1",onClick:()=>At(),title:Ne,"aria-label":Ne,children:[e.jsx(g.MessageCircleXIcon,{className:"h-5 w-5"})," ",Ne]}),$!==""&&e.jsxs(E,{className:"ml-1",variant:"destructive",onClick:()=>Es(),children:[e.jsx(g.Square,{className:"h-5 w-5"})," Stop"]})]})}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsx(ne,{type:"file",onChange:qi,className:"hidden",ref:He,multiple:!0}),ss&&e.jsx("div",{className:"px-6 pt-4",children:e.jsxs("div",{role:"status","aria-live":"polite",className:v("flex items-start justify-between gap-3 rounded-lg border p-3 text-sm",ss.kind==="error"&&"border-destructive/30 bg-destructive/10 text-foreground",ss.kind==="success"&&"border-success/30 bg-success/10 text-foreground",ss.kind==="info"&&"border-border bg-background text-foreground"),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-semibold",children:ss.title}),ss.description&&e.jsx("div",{className:v("mt-0.5",ss.kind==="error"&&"text-destructive",ss.kind==="success"&&"text-success",ss.kind==="info"&&"text-muted-foreground"),children:ss.description})]}),e.jsx(E,{size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:()=>Ts(null),"aria-label":"Dismiss notice",type:"button",children:e.jsx(g.X,{className:"h-4 w-4"})})]})}),F?br?e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto bg-muted/30 p-6 rounded-bl-lg",children:e.jsx("div",{className:"mx-auto flex min-h-full w-full max-w-4xl items-center",children:e.jsxs("div",{className:"w-full",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Hi there!"}),e.jsx("h1",{className:"mt-2 text-2xl leading-tight font-semibold text-foreground",children:"How can I assist you with your Randmar tasks today?"}),e.jsx("form",{className:"mt-6",onSubmit:_i,children:Ui()})]})})}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs(gs,{className:"min-h-0 flex-1 bg-muted/30 pl-2 pr-2",children:[e.jsx(Gn,{messages:Ge?.messages??[],appID:s,isAssistantChat:!0,botStatus:$,hideSenderNames:!0,editableUserMessages:!0,editingMessageId:Fe,editingDraft:Us,onEditingDraftChange:os,onStartEditUserMessage:Ki,onCancelEditUserMessage:oa,onSaveEditUserMessage:Yi,onRetryUserMessage:Ji}),e.jsx("div",{ref:G})]}),e.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-r border-t p-4",children:[xs?Er:e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(bs,{ref:Ae,placeholder:"Type a message...",value:Le,onPaste:kr,onChange:R=>Ue(R.target.value),onKeyDown:R=>{R.key!=="Enter"||R.shiftKey||(R.preventDefault(),!(!F||$||xs)&&Rr())},className:"flex-1 resize-none field-sizing-content max-h-[30em]"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx(E,{size:"icon",variant:"default",className:Ge?.pending?"collapse":"ml-2 h-8 w-8",disabled:!F||!!$||xs,onClick:Rr,children:e.jsx(g.Send,{className:"h-6 w-6"})}),e.jsxs(E,{size:"icon",variant:ks?"secondary":"default",onClick:Ar,title:It,"aria-label":It,className:v(Ge?.pending?"collapse":"relative ml-2 h-8 w-8",ks&&"ring-2 ring-ring/25"),disabled:!F||$!==""||Ge?.pending,children:[e.jsx(g.Paperclip,{className:"h-5 w-5"}),ks&&e.jsx("span",{className:"absolute -right-1 -top-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[11px] font-semibold text-primary-foreground shadow-sm",children:Os})]})]})]}),Mr()]})]}):e.jsx("div",{className:"flex-1 bg-muted/30",children:Tr})]})]}):Tr}),e.jsx("div",{"data-thin":!0,className:"flex h-full basis-[300px] shrink-0 border-l sm:basis-[300px] lg:basis-[300px]",children:e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col rounded-r-lg border-r bg-muted/30 text-foreground",children:[e.jsxs("div",{className:"space-y-3 border-b border-border/80 p-4 pt-6",children:[e.jsxs("h4",{className:"flex items-center text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:[e.jsx(g.SettingsIcon,{className:"w-4 h-4 mr-2"}),"Settings"]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(Z,{htmlFor:"show-dev-logs-checkbox",className:"text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:"Show Dev Logs"}),e.jsx(Ds,{id:"show-dev-logs-checkbox",checked:qs,onCheckedChange:R=>Ei(R===!0),"aria-label":"Show developer logs"})]})]}),e.jsxs("div",{className:"flex flex-col border-b border-border/80 h-24",children:[e.jsxs("h4",{className:"flex-shrink-0 flex items-center p-4 pb-2 text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:[e.jsx(g.File,{className:"w-4 h-4 mr-2"}),"Attached Files"]}),e.jsx(gs,{className:"flex-1 px-4",children:e.jsx("div",{className:"py-2 text-sm",children:X.length>0||Te.length>0?e.jsxs("div",{className:"space-y-2",children:[X.map((R,L)=>e.jsxs("div",{className:"flex items-center justify-between gap-2 text-primary",children:[e.jsxs("div",{className:"flex min-w-0 items-center",children:[e.jsx(g.File,{className:"w-4 h-4 mr-2 flex-shrink-0"}),e.jsxs("span",{title:`${R.name} (pending)`,children:[ha(R.name)," (pending)"]})]}),e.jsx(E,{size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0",onClick:()=>Ir(L),"aria-label":`Remove pending file ${R.name}`,children:e.jsx(g.X,{className:"h-4 w-4"})})]},`${R.name}_${R.lastModified}_${R.size}_${L}`)),Te.slice().reverse().map((R,L)=>{const B=Te.length-1-L;return e.jsxs("div",{className:"flex items-center justify-between gap-2 text-foreground hover:text-primary transition-colors duration-150",children:[e.jsxs("div",{className:"flex min-w-0 items-center",children:[e.jsx(g.File,{className:"w-4 h-4 mr-2 flex-shrink-0"}),e.jsx("span",{title:R.name,children:ha(R.name)})]}),e.jsx(E,{size:"icon",variant:"ghost",className:"h-6 w-6 shrink-0",onClick:()=>Qi(R.name,B),"aria-label":`Remove file ${R.name}`,children:e.jsx(g.X,{className:"h-4 w-4"})})]},R.messageId)})]}):e.jsx("p",{className:"text-muted-foreground text-xs italic",children:"No files attached yet."})})})]}),qs?e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("h4",{className:"flex-shrink-0 flex items-center p-4 pb-2 text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:[e.jsx(g.Code2Icon,{className:"w-4 h-4 mr-2"}),"Developer Log"]}),e.jsx(gs,{className:"flex-1 px-4",children:e.jsxs("div",{className:"py-2 text-xs font-mono",children:[e.jsx(Fc,{debugMessages:Q}),e.jsx("div",{ref:Dr})]})})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("h4",{className:"flex-shrink-0 flex items-center p-4 pb-2 text-xs font-semibold tracking-wider text-muted-foreground uppercase",children:[e.jsx(g.MessageSquareShareIcon,{className:"w-4 h-4 mr-2"}),"Contact Us"]}),e.jsx(gs,{className:"flex-1 px-4",children:e.jsxs("div",{className:"py-2 text-sm space-y-4",children:[e.jsxs("div",{className:"rounded-md border border-border bg-background p-3",children:[e.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Reach out any time"}),e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsx("a",{className:"block text-base font-semibold text-primary hover:underline",href:"mailto:service@randmar.io",children:"service@randmar.io"}),e.jsx("a",{className:"block text-base font-semibold text-primary hover:underline",href:"tel:+18003616244",children:"1 (800) 361-6244"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Customer reps:"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-md border border-border bg-background p-3",children:[e.jsx("div",{className:"font-medium",children:"Loraine Fraraccio"}),e.jsx("div",{className:"text-muted-foreground",children:e.jsx("a",{className:"text-primary hover:underline",href:"mailto:loraine@randmar.io",children:"loraine@randmar.io"})}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Extension: 314"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Location: Quebec"})]}),e.jsxs("div",{className:"rounded-md border border-border bg-background p-3",children:[e.jsx("div",{className:"font-medium",children:"Kevin Dusik"}),e.jsx("div",{className:"text-muted-foreground",children:e.jsx("a",{className:"text-primary hover:underline",href:"mailto:kevin@randmar.io",children:"kevin@randmar.io"})}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Extension: 150"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Location: British-Colombia"})]})]})]})]})})]}),e.jsx("div",{className:"p-3 border-t border-border/80",children:e.jsxs(E,{className:"w-full",variant:"secondary",onClick:()=>Cr("Send me the Summary of the conversation by email",null,null),type:"button",children:[e.jsx(g.Mail,{className:"h-4 w-4 mr-2"}),"Summarize to Email"]})}),e.jsx("div",{className:"mt-auto p-3 border-t border-border/80",children:e.jsxs("div",{className:"flex items-center justify-center space-x-3 w-full",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Powered by Gemini"}),e.jsx(Vc,{})]}),e.jsxs("div",{className:"flex-1 max-w-[160px]",children:[e.jsx(lt,{value:Math.round((ae||0)*100),className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",children:[e.jsx("span",{children:"Context"}),e.jsxs("span",{children:[Math.round((ae||0)*100),"%"]})]})]})]})})]})})]}):e.jsx(g.Loader2,{className:"h-12 w-12 animate-spin mx-auto mb-4"})}));Yt.displayName="AIChatLayout";const Vc=({className:s="h-4 w-4"})=>e.jsxs("svg",{viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",className:v("flex-none leading-none",s),children:[e.jsx("title",{children:"Gemini"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"var(--info)"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-0)"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-1)"}),e.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z",fill:"url(#lobe-icons-gemini-fill-2)"}),e.jsxs("defs",{children:[e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-0",x1:"7",x2:"11",y1:"15.5",y2:"12",children:[e.jsx("stop",{stopColor:"var(--success)"}),e.jsx("stop",{offset:"1",stopColor:"var(--success)",stopOpacity:"0"})]}),e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-1",x1:"8",x2:"11.5",y1:"5.5",y2:"11",children:[e.jsx("stop",{stopColor:"var(--primary)"}),e.jsx("stop",{offset:"1",stopColor:"var(--primary)",stopOpacity:"0"})]}),e.jsxs("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-gemini-fill-2",x1:"3.5",x2:"17.5",y1:"13.5",y2:"12",children:[e.jsx("stop",{stopColor:"var(--warning)"}),e.jsx("stop",{offset:".46",stopColor:"var(--warning)",stopOpacity:"0"})]})]})]});function zc(s){return s.split(/[?#]/u,1)[0]??""}function Ur(s,t){const a=zc(s).split("/").filter(Boolean),r=a.indexOf(t);return r===-1?a:a.slice(r+1)}function Uc(s,t,a){const r=Ur(s,a),n=Ur(t,a);return n.length===0?r.length===0:r.length<n.length?!1:n.every((i,l)=>r[l]===i)}function qc(s,t){return(s.startsWith("/")?s:`/${s}`).replace(":appID",t)}const mi=o.forwardRef(({routes:s,footer:t,dashboardTitle:a,chatUserName:r,appID:n,chatRoutePath:i},l)=>{const u=s.filter(k=>k.showInNav),x=o.useRef(null),d=o.useRef(null),c=o.useRef(null),[m,f]=o.useState(!1),{isMobile:p,setOpenMobile:N}=rt(),w=Ce.useLocation(),{data:y}=_.useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsHasUnreadsQuery({routeApplicationId:n}),{hasUnreads:j}=Xs(),b=o.useCallback((k,I=null,O=null,M)=>{f(!0),setTimeout(()=>{x.current?.focus(),d.current&&(M?.clear?d.current.sendMessageToAssistantWithClear(k,I,O):d.current.sendMessageToAssistant(k,I,O))},100)},[]),C=o.useCallback(()=>{N(!1)},[N]);o.useImperativeHandle(l,()=>({sendMessageToAssistant:(k,I,O)=>{b(k,I,O)},sendMessageToAssistantWithClear(k,I,O){b(k,I,O,{clear:!0})}}));const S=u.map(k=>{const I=qc(k.path,n),O=Uc(w.pathname,I,n);return{route:k,linkPath:I,isActive:O}}),D=S.find(k=>k.isActive)?.route.label??"None";return e.jsxs(_a,{className:"border-r border-sidebar-border",children:[e.jsx(za,{className:"border-b border-sidebar-border px-6 h-16 justify-center bg-sidebar text-sidebar-foreground",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(ui,{path:"/images/RandmarIcon.svg",alt:"Randmar Icon",className:"h-4 w-4 filter brightness-0 saturate-100 invert"})}),e.jsx("span",{className:"font-semibold text-lg",children:a})]})}),e.jsx(qa,{className:"py-4 bg-sidebar text-sidebar-foreground",children:p?e.jsxs("div",{className:"flex flex-1 flex-col px-4 pb-4 pt-2",children:[e.jsxs("div",{className:"px-1",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-sidebar-foreground/70",children:"App Launchpad"}),e.jsxs("p",{className:"mt-1 text-sm text-sidebar-foreground/85",children:["Current: ",e.jsx("span",{className:"font-semibold text-sidebar-foreground",children:D})]})]}),e.jsx("div",{className:"mt-4 grid grid-cols-3 gap-3",children:S.map(({route:k,linkPath:I,isActive:O})=>{const M=k.icon??g.AppWindow;return e.jsxs(Ce.Link,{to:I,"aria-current":O?"page":void 0,onClickCapture:C,className:v("flex min-h-24 min-w-0 flex-col items-center justify-center gap-2 rounded-xl border px-2 py-3 text-center text-xs font-medium leading-tight transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sidebar-ring","border-sidebar-border/70 bg-sidebar-accent/30 text-sidebar-foreground hover:bg-sidebar-accent",O&&"border-sidebar-ring bg-sidebar-accent text-sidebar-accent-foreground"),children:[e.jsx(M,{className:"h-9 w-9 shrink-0"}),e.jsx("span",{className:"line-clamp-2",children:k.label??k.key})]},k.key)})})]}):e.jsx(Qa,{children:S.map(({route:k,linkPath:I,isActive:O})=>{const M=k.icon;return e.jsx(Ha,{children:e.jsx(Ga,{asChild:!0,isActive:O,children:e.jsxs(Ce.Link,{to:I,className:"transition-colors hover:bg-muted px-6",children:[M&&e.jsx(M,{className:"h-4 w-4"}),e.jsx("span",{children:k.label})]})})},k.key)})})}),e.jsxs(Ua,{className:"border-t border-sidebar-border p-4 bg-sidebar text-sidebar-foreground",children:[e.jsxs(De,{open:m,onOpenChange:f,children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Zs,{asChild:!0,children:e.jsxs(E,{ref:c,size:"lg",className:"collapse md:visible flex-grow",onClick:()=>setTimeout(()=>x.current?.focus(),50),children:[e.jsx(g.Bot,{}),"Assistant"]})}),e.jsx(Ce.Link,{to:i,onClickCapture:C,children:e.jsx(E,{size:"icon",className:j||y?.HasUnreads===!0?"pulse-glow bg-background hover:bg-muted text-foreground":"",children:e.jsx(g.MessageSquare,{className:"h-5 w-5"})})})]}),e.jsx(Me,{className:"randmar-assistant-dialog max-w-[85vw] p-0 data-[state=open]:visible data-[state=closed]:invisible",forceMount:!0,animateExit:!1,overlayClassName:"randmar-assistant-overlay",showOverlay:m,children:e.jsx(Yt,{className:"h-[85vh]",ref:d,inputRef:x,userId:n,userName:r??"Unknown user",isOpen:m,onRequestOpen:()=>{f(!0),setTimeout(()=>x.current?.focus(),50)}})})]}),t]})]})}),xi=o.forwardRef(({children:s,appID:t,rightMenu:a,routes:r,footer:n,handleValidSearch:i,dashboardTitle:l,onSignOut:u,searchPlaceholder:x,chatUserName:d,chatRef:c,chatRoutePath:m},f)=>e.jsx(e.Fragment,{children:e.jsx($a,{children:e.jsxs("div",{className:`flex grow ${ni}`,children:[e.jsx(mi,{appID:t,routes:r,footer:n,dashboardTitle:l,chatUserName:d,ref:c,chatRoutePath:m}),e.jsx(lr,{ref:f,onSignOut:u,rightMenu:a,handleValidSearch:i,searchPlaceholder:x}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("main",{className:`${kc} @container flex-1 overflow-x-clip bg-muted`,"data-rm-main-content-region":"true",children:s}),e.jsx(Ln,{})]})]})})}));xi.displayName="Layout";const qr=[{id:"online-store",label:"Online store (Shopify, Amazon, etc.)"},{id:"brick-and-mortar",label:"Brick-and-mortar (Physical Store)"},{id:"marketplace",label:"Marketplace seller (eBay, Walmart, etc.)"},{id:"b2b",label:"B2B wholesale"},{id:"other-channel",label:"Other (please specify)"}],Qr=[{id:"canada",label:"Canada - Nationwide"},{id:"ontario",label:"Ontario & Quebec"},{id:"atlantic",label:"Atlantic Provinces (NS, NB, PEI, NL)"},{id:"prairie",label:"Prairie (Saskatchewan, Manitoba)"},{id:"western",label:"Western Provinces (BC, Alberta, etc.)"},{id:"united-states",label:"United States"},{id:"other-market",label:"Other (please specify)"}];function mr({applicationId:s,manufacturer:t}){const{toast:a}=Pe(),[r,n]=o.useState(!1),[i,l]=o.useState(!1),[u,x]=o.useState(!1),[d,c]=o.useState(""),[m,f]=o.useState(""),[p,N]=o.useState(!1),[w,y]=o.useState(""),[j,b]=o.useState(""),[C,S]=o.useState([]),[D,k]=o.useState(""),[I,O]=o.useState(""),[M,A]=o.useState([]),[F,Q]=o.useState(""),[$,z]=o.useState(""),[T]=_.usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),V=()=>{c(""),f("")},ae=()=>{y(""),b(""),S([]),k(""),O(""),A([]),Q(""),z("")},de=()=>{t.PartnerRegistrationLink?n(!0):t.OpenToWork&&l(!0)},Oe=re=>{if(re.preventDefault(),!u){if(!d.trim()){f("Qualification ID is required");return}x(!0),T({routeApplicationId:s,partnerId:t.ManufacturerId??"",message:`Hello! I'd like to get started with you. Here's my Qualification ID: ${d}`}).then(ue=>{if(ue.error){console.error(ue.error),a({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}a({title:"Information sent to the manufacturer",description:"Check your chats later.",variant:"success"}),n(!1),V()}).catch(ue=>{console.error(ue),a({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{x(!1)})}},Ne=re=>{if(re.preventDefault(),p)return;b(""),k(""),Q("");let ue=!1;if(w.trim().length<10&&(b("Please provide a brief description of your business (minimum 10 characters)"),ue=!0),C.length===0&&(k("Please select at least one sales channel"),ue=!0),M.length===0&&(Q("Please select at least one market"),ue=!0),ue)return;const H=qr.filter(ee=>C.includes(ee.id)).map(ee=>ee.label);I&&H.push(`Other: ${I}`);const K=Qr.filter(ee=>M.includes(ee.id)).map(ee=>ee.label);$&&K.push(`Other: ${$}`);const Y=["Hello! I'd like to introduce my business:",`**Business Description:** ${w}`,`**Sales Channels:** ${H.join(", ")}`,`**Markets:** ${K.join(", ")}`].join(`
|
|
70
70
|
|
|
71
71
|
`);N(!0),T({routeApplicationId:s,partnerId:t.ManufacturerId??"",message:Y}).then(ee=>{if(ee.error){console.error(ee.error),a({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"});return}a({title:"Information sent to the manufacturer",description:"Check your chats later.",variant:"success"}),l(!1),ae()}).catch(ee=>{console.error(ee),a({title:"Could not initiate chat",description:"Try again later.",variant:"destructive"})}).finally(()=>{N(!1)})},Ve=(re,ue)=>{S(H=>ue?[...H,re]:H.filter(K=>K!==re)),k("")},Le=(re,ue)=>{A(H=>ue?[...H,re]:H.filter(K=>K!==re)),Q("")},Ue=C.includes("other-channel"),Ke=M.includes("other-market");return e.jsxs(e.Fragment,{children:[!t.Qualification&&e.jsxs(E,{onClick:de,disabled:!t.PartnerRegistrationLink&&!t.OpenToWork,children:[e.jsx(g.Check,{className:"mr-2 h-4 w-4"}),"Get Started"]}),t.PartnerRegistrationLink&&e.jsx(De,{open:r,onOpenChange:re=>{n(re)},children:e.jsxs(Me,{className:"sm:max-w-[400px]",children:[e.jsxs($e,{children:[e.jsx(_e,{children:t.PublicName}),e.jsxs(ze,{children:[e.jsx("span",{className:"font-bold",children:"Already qualified?"})," Provide your Qualification ID."]})]}),e.jsxs("form",{onSubmit:Oe,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"qualificationId",children:"Qualification ID"}),e.jsx(ne,{id:"qualificationId",placeholder:"Enter your qualification ID",value:d,onChange:re=>{c(re.target.value),f("")}}),m&&e.jsx("p",{className:"text-sm font-medium text-destructive",children:m})]}),e.jsx(qe,{children:e.jsx(E,{type:"submit",className:"w-full",disabled:u,children:u?e.jsxs(e.Fragment,{children:[e.jsx(g.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Applying..."]}):e.jsxs(e.Fragment,{children:[e.jsx(g.Check,{className:"mr-2 h-4 w-4"}),"Apply for Qualification"]})})})]}),e.jsx(Nt,{className:"my-4"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Don't have a qualification ID?"}),e.jsx(Ce.Link,{to:t.PartnerRegistrationLink,target:"_blank",children:e.jsxs(E,{variant:"outline",className:"w-full",disabled:!t.PartnerRegistrationLink,children:[e.jsx(g.ExternalLink,{className:"mr-2 h-4 w-4"}),"Register here"]})})]})]})}),e.jsx(De,{open:i,onOpenChange:re=>{l(re)},children:e.jsxs(Me,{className:"sm:max-w-[768px]",children:[e.jsx($e,{children:e.jsx(_e,{children:"Introduce Yourself"})}),e.jsxs("form",{onSubmit:Ne,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Z,{htmlFor:"businessDescription",children:["Tell Us About Your Business ",e.jsx("span",{className:"text-sm text-muted-foreground",children:"(Briefly describe your business)"})]}),e.jsx(bs,{id:"businessDescription",placeholder:"We are an online retailer specializing in office supplies, serving businesses since 2018...",className:"min-h-[100px]",value:w,onChange:re=>{y(re.target.value),b("")}}),j&&e.jsx("p",{className:"text-sm font-medium text-destructive",children:j})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Z,{children:["Sales Channel(s) ",e.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select where you currently sell your products)"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:qr.map(re=>e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(Ds,{id:`channel-${re.id}`,checked:C.includes(re.id),onCheckedChange:ue=>Ve(re.id,ue===!0)}),e.jsx(Z,{htmlFor:`channel-${re.id}`,className:"text-sm font-normal",children:re.label})]},re.id))}),Ue&&e.jsx(ne,{placeholder:"Please specify",value:I,onChange:re=>O(re.target.value)}),D&&e.jsx("p",{className:"text-sm font-medium text-destructive",children:D})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Z,{children:["Your Primary Market(s) ",e.jsx("span",{className:"text-sm text-muted-foreground",children:"(Multi-Select which regions you sell to)"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Qr.map(re=>e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx(Ds,{id:`market-${re.id}`,checked:M.includes(re.id),onCheckedChange:ue=>Le(re.id,ue===!0)}),e.jsx(Z,{htmlFor:`market-${re.id}`,className:"text-sm font-normal",children:re.label})]},re.id))}),Ke&&e.jsx(ne,{placeholder:"Please specify",value:$,onChange:re=>z(re.target.value)}),F&&e.jsx("p",{className:"text-sm font-medium text-destructive",children:F})]}),e.jsx(qe,{children:e.jsx(E,{type:"submit",disabled:p,children:p?e.jsxs(e.Fragment,{children:[e.jsx(g.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Submitting..."]}):"Submit"})})]})]})})]})}const fa=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function hi({manufacturer:s,onSave:t,loading:a=!1,saving:r=!1,readonly:n=!1}){const[i,l]=o.useState({...s}),[u,x]=o.useState({...s});o.useEffect(()=>{x({...s}),l({...s})},[s]);const d=(j,b)=>{n||l(C=>({...C,[j]:b}))},c=(j,b)=>{n||l(C=>({...C,[j]:b}))},m=(j,b)=>{n||l(C=>({...C,[j]:b}))},f=()=>{const j={};return Object.keys(i).forEach(b=>{const C=b;JSON.stringify(i[C])!==JSON.stringify(u[C])&&(j[C]=i[C])}),j},p=()=>{if(!r&&!n){const j=f();Object.keys(j).length>0&&t(j)}},N=j=>j===-1?"ASAP":j===void 0||j<0||j>6?"Sunday":fa[j],w=j=>j==="ASAP"?-1:fa.indexOf(j),y=Object.keys(f()).length>0;return e.jsxs(q,{children:[e.jsxs(J,{children:[a?e.jsx(h,{className:"h-8 w-32"}):e.jsx(ce,{className:"text-lg font-bold",children:"Reordering"}),a?e.jsx(h,{className:"h-4 w-full mt-2"}):e.jsx(it,{className:"text-sm",children:"Adjust your reordering settings to control lead times, stocking weeks, minimum orders, and reorder dates, enhancing efficiency in restocking processes."})]}),e.jsx(W,{className:"space-y-6",children:a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(h,{className:"h-5 w-10"}),e.jsx(h,{className:"h-5 w-40"})]}),e.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-5 w-40"}),e.jsx(h,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-5 w-40"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx(h,{className:"h-10 w-full"}),e.jsx("div",{className:"ml-2 w-12"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-5 w-40"}),e.jsx(h,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-5 w-40"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx(h,{className:"h-10 w-full"}),e.jsx("div",{className:"ml-2 w-12"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-5 w-40"}),e.jsx(h,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-5 w-40"}),e.jsx(h,{className:"h-10 w-full"})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(nt,{id:"automatic-reordering",checked:i.AutoUpdate,onCheckedChange:j=>d("AutoUpdate",j),disabled:r||n}),e.jsx(Z,{htmlFor:"automatic-reordering",children:"Automatic Reordering"})]}),e.jsxs("div",{className:"grid grid-cols-1 @md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"reorder-date",children:"Automatic Reorder Date"}),e.jsxs(As,{value:N(i.AutoReorderDate),onValueChange:j=>c("AutoReorderDate",w(j)),disabled:r||n,children:[e.jsx(ys,{id:"reorder-date",children:e.jsx(Is,{placeholder:"Select day"})}),e.jsxs(Ns,{children:[e.jsx(as,{value:"ASAP",children:"ASAP"}),fa.map(j=>e.jsx(as,{value:j,children:j},j))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"weeks-stocking",children:"Default Weeks of Stocking"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx(ne,{id:"weeks-stocking",type:"number",value:i.DefaultWeeksOfStocking||"",onChange:j=>c("DefaultWeeksOfStocking",Number(j.target.value)),disabled:r||n}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"weeks"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"minimum-order",children:"Default Minimum Order"}),e.jsxs("div",{className:"flex items-center relative",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),e.jsx(ne,{id:"minimum-order",type:"number",className:"pl-6",value:i.DefaultMinimumOrder||"",onChange:j=>c("DefaultMinimumOrder",Number(j.target.value)),disabled:r||n})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"lead-time",children:"Default Lead Time"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx(ne,{id:"lead-time",type:"number",value:i.DefaultLeadTime||"",onChange:j=>c("DefaultLeadTime",Number(j.target.value)),disabled:r||n}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:"days"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"maximum-inventory-value",children:"Default Maximum Inventory Value"}),e.jsxs("div",{className:"flex items-center relative",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:"$"}),e.jsx(ne,{id:"maximum-inventory-value",type:"number",className:"pl-6",value:i.DefaultMaxInventoryValue||"",onChange:j=>c("DefaultMaxInventoryValue",Number(j.target.value)),disabled:r||n})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Z,{htmlFor:"order-confirmations",children:"Send Order Confirmations To"}),e.jsx(ne,{id:"order-confirmations",type:"email",value:i.POEmail||"",onChange:j=>m("POEmail",j.target.value),placeholder:"email@example.com",disabled:r||n})]})]})]})}),!n&&e.jsx(fs,{className:"flex justify-end",children:a?e.jsx(h,{className:"h-10 w-20"}):e.jsxs(E,{onClick:p,disabled:r||!y,children:[r&&e.jsx(g.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})})]})}const St=Ys.Root,Ct=Ys.Trigger,Qc=Ys.Anchor,ot=P.forwardRef(({className:s,align:t="center",sideOffset:a=4,...r},n)=>e.jsx(Ys.Portal,{children:e.jsx(Ys.Content,{ref:n,align:t,sideOffset:a,className:v("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",s),...r})}));ot.displayName=Ys.Content.displayName;function fi({options:s,selected:t,onChange:a,placeholder:r="Select items...",disabled:n=!1}){const[i,l]=P.useState(!1),[u,x]=P.useState(""),d=P.useRef(null),[c,m]=P.useState(void 0),f=P.useCallback(()=>{d.current&&m(d.current.offsetWidth)},[]);P.useLayoutEffect(()=>{f()},[f]),P.useEffect(()=>(window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)),[f]);const p=y=>{a(t.filter(j=>j!==y))},N=y=>{l(!1),t.includes(y)?a(t.filter(j=>j!==y)):a([...t,y])},w=y=>{y.key==="Enter"&&u&&!s.includes(u)&&!t.includes(u)&&(y.preventDefault(),N(u),x(""))};return e.jsxs(St,{open:i,onOpenChange:l,children:[e.jsx(Ct,{asChild:!0,children:e.jsxs(E,{ref:d,variant:"outline",role:"combobox","aria-expanded":i,className:"w-full justify-between h-auto min-h-[40px] py-2",disabled:n,children:[e.jsx("div",{className:"flex flex-wrap gap-1 items-center",children:t.length>0?t.map(y=>e.jsxs(he,{variant:"outline",className:"mr-1 mb-1",children:[y,e.jsx("span",{className:"ml-1 cursor-pointer rounded-full outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",onClick:j=>{j.preventDefault(),j.stopPropagation(),p(y)},children:e.jsx(g.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},y)):e.jsx("span",{className:"text-muted-foreground",children:r})}),e.jsx(g.ChevronsUpDown,{className:"h-4 w-4 shrink-0 opacity-50 ml-2"})]})}),e.jsx(ot,{className:"w-full p-0",style:{width:c},children:e.jsxs(Kt,{onKeyDown:w,children:[e.jsx(or,{placeholder:"Search or add custom item...",value:u,onValueChange:x}),e.jsxs(cr,{children:[e.jsx(dr,{children:"No item found."}),e.jsxs(ur,{children:[s.filter(y=>!t.includes(y)).map(y=>e.jsxs(qt,{onSelect:()=>N(y),children:[e.jsx(g.Check,{className:v("mr-2 h-4 w-4",t.includes(y)?"opacity-100":"opacity-0")}),y]},y)),u&&!s.includes(u)&&!t.includes(u)&&e.jsxs(qt,{onSelect:()=>N(u),children:['Add "',u,'"']})]})]})]})})]})}const Hc={sm:100,md:200,lg:300,xl:400};function Gc(s){return s==null?null:Array.isArray(s)?s:s&&typeof s=="object"&&"Images"in s&&Array.isArray(s.Images)?s.Images:[]}function Ia(s,t,a){try{const r=new URL(s);return r.searchParams.set("width",String(Math.round(t))),r.searchParams.set("height",String(Math.round(a))),r.toString()}catch{return s}}function Hr({apiOrigin:s,randmarSKU:t,image:a,width:r,height:n}){const i=(a.Url??"").trim();if(i){if(i.startsWith("data:"))return i;try{const x=new URL(js(i,s)),d=x.pathname.split("/").filter(Boolean),c=t.trim().toLowerCase(),m=w=>{try{return decodeURIComponent(w).toLowerCase()===c}catch{return w.toLowerCase()===c}},f=d.slice(-3),p=d.slice(-4);return f.length===3&&f[0]?.toLowerCase()==="product"&&m(f[1]??"")&&f[2]?.toLowerCase()==="image"||p.length===4&&p[0]?.toLowerCase()==="product"&&m(p[1]??"")&&p[2]?.toLowerCase()==="image"?Ia(x.toString(),r,n):x.toString()}catch{}}const u=a.ImageId!==void 0&&a.ImageId!==null&&String(a.ImageId).trim()!==""?`/Product/${encodeURIComponent(t)}/Image/${encodeURIComponent(String(a.ImageId))}`:`/Product/${encodeURIComponent(t)}/Image`;return Ia(js(u,s),r,n)}function Wc({apiOrigin:s,randmarSKU:t,width:a,height:r}){return Ia(js(`/Product/${encodeURIComponent(t)}/Image`,s),a,r)}const Gr=({size:s,alt:t})=>e.jsx("div",{className:"rounded-md bg-muted flex items-center justify-center",style:{width:s,height:s},"aria-label":t,children:e.jsx(g.ImageOff,{className:"h-1/2 w-1/2 text-muted-foreground"})});function Kc({randmarSKU:s,size:t="md",alt:a,className:r,fallback:n}){const i=Hc[t],l=P.useRef(null),u=Ht({elementRef:l,threshold:.1,rootMargin:"100px"}),x=wt(),{data:d,isError:c,isFetching:m}=_.useGetProductByRandmarSkuImagesQuery({randmarSku:s},{skip:!s||!u,refetchOnMountOrArgChange:!0}),f=P.useMemo(()=>Gc(d),[d]),[p,N]=P.useState(0),[w,y]=P.useState(!1),j=P.useRef(!1),b=P.useRef(new Set);P.useEffect(()=>{N(0),y(!1),j.current=!1,b.current.clear()},[s]);const C=P.useMemo(()=>f?[...f].sort((T,V)=>{const ae=T.SortOrder??Number.POSITIVE_INFINITY,de=V.SortOrder??Number.POSITIVE_INFINITY;if(ae!==de)return ae-de;const Oe=T.IsPrimary===!0?0:1,Ne=V.IsPrimary===!0?0:1;return Oe-Ne}):null,[f]),S=P.useMemo(()=>{if(!C?.length)return 0;const T=C.findIndex(V=>V.IsPrimary===!0);return T>=0?T:0},[C]);P.useEffect(()=>{C?.length&&(j.current||(N(S),j.current=!0))},[S,C]);const D=C?.length??0,k=P.useMemo(()=>{const T=(a??"").trim();return T?`${T} (Product ${s})`:`Product ${s}`},[a,s]),I=P.useCallback(T=>D>1?`${k} image ${T+1}`:k,[k,D]),O=C?.[p],M=P.useMemo(()=>O?Hr({apiOrigin:x,randmarSKU:s,image:O,width:i*1.5,height:i*1.5}):null,[O,x,i,s]),A=P.useCallback(T=>{if(D<=0)return;const V=(T%D+D)%D;N(V)},[D]),F=P.useCallback(()=>A(p-1),[p,A]),Q=P.useCallback(()=>A(p+1),[p,A]),$=P.useCallback(T=>{if(!(D<=1))switch(T.key){case"ArrowLeft":T.preventDefault(),F();break;case"ArrowRight":T.preventDefault(),Q();break;case"Home":T.preventDefault(),A(0);break;case"End":T.preventDefault(),A(D-1);break}},[Q,F,A,D]);if(P.useEffect(()=>{if(!C?.length||D<=1)return;const T=(p-1+D)%D,V=(p+1)%D,ae=[T,V];for(const de of ae){const Oe=C[de];if(!Oe)continue;const Ne=Hr({apiOrigin:x,randmarSKU:s,image:Oe,width:i*1.5,height:i*1.5});if(b.current.has(Ne))continue;b.current.add(Ne);const Ve=new Image;Ve.src=Ne}},[p,x,i,s,D,C]),c)return e.jsx(e.Fragment,{children:n??null});if(f===null&&u&&m)return e.jsx("div",{className:r,ref:l,children:e.jsx(h,{className:"rounded-md",style:{width:i,height:i}})});if(C&&C.length===0){if(n!=null)return e.jsx(e.Fragment,{children:n});const T=Wc({apiOrigin:x,randmarSKU:s,width:i*1.5,height:i*1.5});return e.jsx("div",{className:r,ref:l,children:e.jsx("div",{className:"relative rounded-md overflow-hidden bg-muted",style:{width:i,height:i},"aria-label":k,children:w?e.jsx(Gr,{size:i,alt:k}):e.jsx("img",{alt:k,className:"w-full h-full object-contain",src:T,width:i,height:i,loading:"eager",onError:()=>y(!0)})})})}return M?e.jsx("div",{className:r,ref:l,children:e.jsxs("div",{className:"group relative rounded-md overflow-hidden bg-muted",style:{width:i,height:i},role:"region","aria-roledescription":"carousel","aria-label":`Product images for ${s}`,tabIndex:D>1?0:-1,onKeyDown:$,children:[e.jsx("img",{alt:I(p),className:"w-full h-full object-contain",src:M,width:i,height:i,loading:"eager"}),D>1&&e.jsxs(e.Fragment,{children:[e.jsx(E,{type:"button",variant:"secondary",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 text-foreground shadow-sm ring-1 ring-border/50 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100",onClick:F,"aria-label":"Previous image",children:e.jsx(g.ChevronLeft,{className:"h-4 w-4"})}),e.jsx(E,{type:"button",variant:"secondary",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/80 text-foreground shadow-sm ring-1 ring-border/50 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100",onClick:Q,"aria-label":"Next image",children:e.jsx(g.ChevronRight,{className:"h-4 w-4"})}),e.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 flex items-center gap-1 rounded-full bg-background/80 px-2 py-1",children:Array.from({length:D}).map((T,V)=>{const ae=V===p;return e.jsx("button",{type:"button",className:["h-1.5 w-1.5 rounded-full transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",ae?"bg-foreground":"bg-muted-foreground/40 hover:bg-muted-foreground/60"].join(" "),onClick:()=>A(V),"aria-label":`Go to image ${V+1} of ${D}`,"aria-current":ae?"true":void 0},V)})})]})]})}):e.jsx("div",{className:r,ref:l,children:e.jsx(Gr,{size:i,alt:k})})}function pi({applicationId:s,randmarSku:t,inventory:a,buttonSize:r="default",buttonClassName:n}){const i=o.useRef(null),l=Ht({elementRef:i,threshold:.1,rootMargin:"100px",freezeOnceVisible:!0}),{toast:u}=Pe(),[x,d]=o.useState(!1),[c,m]=o.useState(!1),[f,p]=o.useState(!1),{data:N,isLoading:w,isFetching:y}=_.useGetV4PartnerByApplicationIdAccountQuery({applicationId:s},{skip:!s||!l}),{data:j,isLoading:b,isFetching:C}=_.useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:s,randmarSku:t,withSpecification:!1},{skip:!!a||!l}),[S]=_.usePutV4ResellerByRouteResellerIdProductAndRandmarSkuRequisitionMutation(),D=a??j?.Distribution?.Inventory;o.useEffect(()=>{d(!1)},[t]);const{inventoryQuantity:k,totalIncomingQuantity:I}=o.useMemo(()=>{if(!D||D.length===0)return{inventoryQuantity:0,totalIncomingQuantity:0};const F=D.reduce(($,z)=>$+(z.AvailableQuantity||0),0),Q=D.reduce(($,z)=>$+(z.PurchaseOrderQuantity||0),0);return{inventoryQuantity:F,totalIncomingQuantity:Q}},[D]);if(w||y||b||C)return e.jsx("div",{ref:i,children:e.jsx(h,{className:v("h-10 w-36 rounded-md",n)})});const M=()=>{f||!N?.IsReseller||(p(!0),S({routeResellerId:s??"",randmarSku:t??""}).then(F=>{F.error||F.data===!1?u({title:"Warning",description:"Reorder is pending or requires manual approval. Contact the Randmar team for details.",variant:"warning"}):u({title:"Success",description:"Qualification successfully submitted.",variant:"success"}),m(!1)}).catch(F=>{console.error(F),u({title:"Error",description:"Error submitting your qualification.",variant:"destructive"})}).finally(()=>{p(!1)}))};if(!D)return e.jsx("div",{ref:i,children:e.jsx(ye,{children:e.jsxs(ge,{children:[e.jsx(je,{asChild:!0,children:e.jsx("span",{tabIndex:0,children:e.jsxs(E,{disabled:!0,size:r,variant:"outline",className:v("text-sm",n),children:[e.jsx(g.LucideWarehouse,{size:"16",className:"mr-2"}),"No data"]})})}),e.jsx(fe,{children:e.jsx("p",{children:"No inventory data could be found for this product."})})]})})});if(N?.IsReseller&&k<=0&&I<=0)return e.jsx("div",{ref:i,children:e.jsxs(De,{open:c,onOpenChange:m,children:[e.jsx(Zs,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:r,className:v("text-sm text-primary",n),children:[e.jsx(g.LucideWarehouse,{size:"16",className:"mr-2"}),"Request to stock"]})}),e.jsxs(Me,{className:"max-w-md",children:[e.jsx($e,{children:e.jsx(_e,{children:"Request to stock"})}),e.jsx("p",{className:"py-4",children:"Are you sure you want to request this product to be stocked?"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(E,{variant:"outline",onClick:()=>m(!1),disabled:f,children:"Cancel"}),e.jsx(E,{onClick:M,disabled:f,children:f?e.jsxs(e.Fragment,{children:[e.jsx(g.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),"Requesting..."]}):"Confirm"})]})]})]})});const A=k<=0&&I>0;return e.jsx("div",{ref:i,children:e.jsxs(De,{open:x,onOpenChange:d,children:[e.jsx(Zs,{asChild:!0,children:e.jsxs(E,{variant:"outline",size:r,className:v("text-sm",A?"text-info":k>0?"text-success":"text-destructive",n),children:[e.jsx(g.LucideWarehouse,{size:"16",className:"mr-2"}),A?e.jsxs(e.Fragment,{children:[ds(I)," Incoming"]}):k>0?e.jsxs(e.Fragment,{children:[ds(k)," in stock"]}):e.jsx(e.Fragment,{children:"Out of stock"})]})}),e.jsxs(Me,{className:"max-w-4xl",children:[e.jsx($e,{children:e.jsxs(_e,{className:"flex items-center",children:[e.jsx(g.LucideWarehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),e.jsx(La,{inventory:D})]})]})})}const gi=()=>new Date().toISOString().split("T")[0],Yc=s=>s.StartDate?s.StartDate.split("T")[0]>gi():!1,Wr=s=>{if(s.Active!==!0)return!1;const t=gi();return!(s.EndDate&&s.EndDate.split("T")[0]<t||s.StartDate&&s.StartDate.split("T")[0]>t)};function Qt({applicationId:s,product:t,viewProductLink:a,defaultOpportunityNumber:r="",onAddToCart:n,addingToCart:i=!1,shopifyHostname:l,customAction:u=e.jsx(e.Fragment,{}),showUsdLabelOnCost:x=!1}){const d=Ce.useNavigate(),{toast:c}=Pe(),[m,f]=o.useState(1),[p,N]=o.useState(null),[w,y]=o.useState(0),[j,b]=o.useState(!1),[C]=_.usePostV4ResellerByRouteResellerIdProductAndRandmarSkuShopifyMutation(),[S,D]=o.useState(!1),[k,I]=o.useState(null),[O,M]=o.useState("idle"),[A,F]=o.useState(null),[Q]=_.useLazyGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery(),$=t?.Distribution?.Cost||0,z=t?.Distribution?.RegularPrice||0,T=t?.Distribution?.Price||0,V=!!(s&&t?.RandmarSKU);o.useEffect(()=>{f(1),N(null),y(0)},[t?.RandmarSKU]),o.useEffect(()=>{if(t&&r){const U=t.Opportunities?.find(me=>me.BidNumber==r);U&&Wr(U)&&N(U)}},[t,r]),o.useEffect(()=>{if(!t)return;const U=p?.Price?p.Price:T;y(z>0?Math.round((z-U)/z*100):0)},[t,p,T,z]),o.useEffect(()=>{i||f(1)},[i]),o.useEffect(()=>{if(!S){I(null),M("idle"),F(null);return}if(!s||!t?.RandmarSKU){M("error"),F("Missing identifiers to load performance data.");return}let U=!1;const me=t.RandmarSKU;return(async()=>{M("summary"),F(null);try{const Se=await Q({routeApplicationId:s,randmarSku:me,withSpecification:!1});if(U)return;if("error"in Se&&Se.error)throw Se.error;I(Se.data??null),M("detailed");const Fe=await Q({routeApplicationId:s,randmarSku:me,withSpecification:!0});if(U)return;if("error"in Fe&&Fe.error)throw Fe.error;I(Fe.data??Se.data??null),M("complete")}catch(Se){if(U)return;console.error("Failed to load performance data for product modal",Se),M("error"),F("We couldn't load the performance details. Please try again.")}})(),()=>{U=!0}},[s,Q,S,t?.RandmarSKU]);const ae=U=>U>=90?{label:"Top 10% Bestseller",color:"text-primary",bgColor:"bg-primary/10"}:U>=75?{label:"Bestseller",color:"text-info",bgColor:"bg-info/10"}:U>=33?{label:"Popular",color:"text-success",bgColor:"bg-success/10"}:{label:"Rising",color:"text-muted-foreground",bgColor:"bg-muted/30"},de=O!=="complete"&&O!=="error",Oe=O==="summary"?40:O==="detailed"?80:10,Ne=k?.SalesStatistics??[],Ve=de?[]:Ne,Le=k?.RandmarTitle??t?.RandmarTitle??t?.RandmarSKU??"this product",Ue=k?.RandmarSKU??t?.RandmarSKU,Ke=s&&t?.ManufacturerId?`/${encodeURIComponent(s)}/Partner/${encodeURIComponent(t.ManufacturerId)}?tab=manufacturer-overview`:null;if(!t)return e.jsx(q,{className:"flex h-full w-full flex-col",children:e.jsxs(W,{className:"flex h-full flex-col p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsx(h,{className:"h-7 w-3/4"}),e.jsx("div",{className:"h-10 w-24 flex items-center justify-end ml-4",children:e.jsx(h,{className:"h-10 w-24 rounded-md"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsx(h,{className:"h-6 w-20 rounded-full"}),e.jsx(h,{className:"h-6 w-24 rounded-full"}),e.jsx(h,{className:"h-6 w-28 rounded-full"})]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 flex-1",children:[e.jsxs("div",{children:[e.jsx(h,{className:"h-4 w-12 mb-1"}),e.jsx(h,{className:"h-5 w-20"})]}),e.jsxs("div",{children:[e.jsx(h,{className:"h-4 w-12 mb-1"}),e.jsx(h,{className:"h-5 w-24"})]}),e.jsxs("div",{children:[e.jsx(h,{className:"h-4 w-20 mb-1"}),e.jsx(h,{className:"h-5 w-16"})]}),e.jsxs("div",{children:[e.jsx(h,{className:"h-4 w-12 mb-1"}),e.jsx(h,{className:"h-5 w-20"})]})]}),e.jsx("div",{className:"flex flex-col",children:e.jsx("div",{className:"w-60 h-40",children:e.jsx(h,{className:"w-full h-full rounded-lg"})})})]}),e.jsxs("div",{className:"flex gap-6 mt-4",children:[e.jsx("div",{className:"flex flex-1",children:e.jsxs("div",{className:"w-full",children:[e.jsx(h,{className:"h-4 w-24 mb-3"}),e.jsx(h,{className:"h-16 w-full rounded-md"})]})}),e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(h,{className:"h-10 w-32 rounded-md"}),e.jsx(h,{className:"h-5 w-24 mt-4"})]})]}),e.jsxs("div",{className:"flex gap-6 mt-4",children:[e.jsxs("div",{className:"flex flex-col items-start gap-1 mb-2",children:[e.jsx(h,{className:"h-8 w-32"}),e.jsx(h,{className:"h-6 w-24"})]}),e.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[e.jsx(h,{className:"h-10 w-24 rounded-md"}),e.jsx(h,{className:"h-10 flex-1 rounded-md"})]})]})]})});const re=t?.Opportunities||[],ue=re.length>0,H=()=>{if(m==null){f(1);return}m>1&&f(m-1)},K=()=>{if(m==null){f(1);return}f(m+1)},Y=U=>{const me=Number.parseInt(U.target.value,10);if(!isNaN(me)&&me>0){f(me);return}f(void 0)},ee=()=>{(m==null||m<1)&&f(1)},pe=U=>{try{return new Date(U).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(me){return console.error(me),U.split("T")[0]||"N/A"}},Re=U=>{const me=typeof t?.MSRP=="number"&&t.MSRP>0?t.MSRP:typeof t?.MAP=="number"&&t.MAP>0?t.MAP:null;if(me===null)return null;const we=U.Price??t?.Distribution?.Price;if(typeof we!="number")return null;const Se=U.Rebate??0,Fe=Math.max(we-Se,0);return me-Fe},ve=()=>{typeof n<"u"&&n({quantity:m??1,bidNumber:p?.BidNumber??null})},Ee=()=>{j||!l||(b(!0),C({routeResellerId:s??"",randmarSku:t.RandmarSKU??"",shopifyHostName:l}).then(U=>{if(U.error){console.error("Error syncing to Shopify:",U.error),c({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"});return}c({title:"Product synced",description:"Product synced to Shopify successfully",variant:"success"})}).catch(U=>{console.error("Error syncing to Shopify:",U),c({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"})}).finally(()=>{b(!1)}))};return e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"flex h-full w-full flex-col hover:shadow-lg transition-shadow @container",children:e.jsxs(W,{className:"flex h-full flex-col p-6",children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-4",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsx("h3",{className:"font-semibold text-xl",children:t.Title||t.RandmarTitle}),e.jsx("div",{className:"w-24 h-10 flex items-center justify-end ml-4 flex-shrink-0",children:Ke?e.jsx(Ce.Link,{to:Ke,"aria-label":`Open manufacturer overview for ${t.ManufacturerName??"this manufacturer"}`,className:"block h-full w-full",children:e.jsx(hs,{id:t.ManufacturerId,name:t.ManufacturerName,width:96,height:40,className:"cursor-pointer"},`partner_logo_${t.ManufacturerId}`)}):e.jsx(hs,{id:t.ManufacturerId,name:t.ManufacturerName,width:96,height:40},`partner_logo_${t.ManufacturerId}`)})]}),e.jsxs("div",{className:"flex flex-col @[36rem]:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1 @[36rem]:order-1 order-2 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 items-center justify-center @[36rem]:items-start @[36rem]:justify-start",children:[t.State&&e.jsxs(he,{variant:t.State==="Active"?"success":"destructive",className:"rounded-full px-3",children:[e.jsx(g.CheckIcon,{size:"12",className:"mr-1.5"})," ",t.State]}),e.jsxs(he,{variant:t.SerialNumber?"success":"warning",className:"rounded-full px-3",children:[e.jsx(g.QrCodeIcon,{size:"12",className:"mr-1.5"})," ",t.SerialNumber?"Serialized":"Unserialized"]}),t.TransparencyCode&&e.jsxs(he,{variant:"info",className:"rounded-full px-3",children:[e.jsx(g.CircleDashedIcon,{size:"12",className:"mr-1.5"})," Transparency Code"]}),t.AvailableToBuy!==void 0&&e.jsxs(he,{variant:t.AvailableToBuy?"success":"destructive",className:"rounded-full px-3",children:[e.jsx(g.ShoppingCart,{size:"12",className:"mr-1.5"})," ",t.AvailableToBuy?"Available":"Unavailable"]}),t.ManufacturerCategory!==void 0&&t.ManufacturerCategory?.QualificationRequired&&e.jsxs(he,{variant:t.ManufacturerCategory?.QualificationRequired?"info":"secondary",className:"rounded-full px-3",children:[e.jsx(g.ShieldCheckIcon,{size:"12",className:"mr-1.5"})," ",t.ManufacturerCategory?.QualificationRequired?"Qualified Only":"Available to all"]}),t.OpportunityOnly&&e.jsxs(he,{variant:"info",className:"rounded-full px-3",children:[e.jsx(g.ShieldCheckIcon,{size:"12",className:"mr-1.5"})," ","Requires Opportunity"]}),t.ManufacturerId&&e.jsxs(he,{variant:t.AutoUpdate?"info":"secondary",className:"rounded-full px-3",children:[e.jsx(g.RefreshCwIcon,{size:"12",className:"mr-1.5"})," ",t.AutoUpdate?`Automatic Reorder (${t.MasterCarton})`:"Manually Reorders"]}),e.jsxs(he,{variant:t.BodyHTML&&t.Title&&t.MAP?"success":"warning",className:"rounded-full px-3",children:[e.jsx(g.StoreIcon,{size:"12",className:"mr-1.5"})," ",t.BodyHTML&&t.Title&&t.MAP?"Shopify Ready":"Not Shopify Ready"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4 flex-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"MPN"}),e.jsx("div",{className:"font-medium",children:t.MPN||"N/A"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"UPC"}),e.jsx("div",{className:"font-medium",children:t.UPC||"N/A"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Unit Weight"}),e.jsx("div",{className:"font-medium",children:t.UnitWeight?`${ds(t.UnitWeight)} lbs`:"N/A"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["MAP",e.jsx("span",{className:"text-primary",children:" / "}),"MSRP"]}),e.jsxs("div",{className:"font-medium",children:[t.MAP?oe(t.MAP):"N/A",e.jsx("span",{className:"text-primary",children:" / "}),t.MSRP?oe(t.MSRP):"N/A"]})]}),!!t.OverallPercentileRank&&!!t.ManufacturerPercentileRank&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"Bestseller Status"}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{children:[e.jsx("span",{children:"Global: "}),e.jsx(ye,{children:e.jsxs(ge,{children:[e.jsx(je,{asChild:!0,children:e.jsx(he,{variant:"outline",className:`rounded-full px-3 w-fit ${ae(t.OverallPercentileRank).bgColor} ${ae(t.OverallPercentileRank).color} hover:${ae(t.OverallPercentileRank).bgColor}`,children:ae(t.OverallPercentileRank).label})}),e.jsx(fe,{children:e.jsxs("p",{children:["Percentile Rank: ",t.OverallPercentileRank]})})]})})]}),e.jsxs("div",{children:[e.jsxs("span",{children:[t.ManufacturerName,": "]}),e.jsx(ye,{children:e.jsxs(ge,{children:[e.jsx(je,{asChild:!0,children:e.jsx(he,{variant:"outline",className:`rounded-full px-3 w-fit ${ae(t.ManufacturerPercentileRank).bgColor} ${ae(t.ManufacturerPercentileRank).color} hover:${ae(t.ManufacturerPercentileRank).bgColor}`,children:ae(t.ManufacturerPercentileRank).label})}),e.jsx(fe,{children:e.jsxs("p",{children:["Percentile Rank: ",t.ManufacturerPercentileRank]})})]})})]})]})]}),t.CountryCodeOfOrigin&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Origin"}),e.jsxs("div",{className:"font-medium flex items-center",children:[e.jsx(di,{countryCode:t.CountryCodeOfOrigin,className:"mr-2"}),t.CountryCodeOfOrigin]})]})]})]}),e.jsx("div",{className:"flex flex-col @[36rem]:order-2 order-1 items-center",children:e.jsx(Kc,{randmarSKU:t.RandmarSKU||"",alt:t.RandmarTitle||"",fallback:e.jsx(xr,{randmarSKU:t.RandmarSKU||"",alt:t.RandmarTitle||"",sceneName:t.SceneName},`product_image_fallback_${t.RandmarSKU}`)},`product_image_${t.RandmarSKU}`)})]}),e.jsx("div",{className:"flex flex-col @[36rem]:flex-row gap-6 mt-4",children:e.jsx("div",{className:"flex flex-1 @[36rem]:order-1 order-2",children:ue&&t.Distribution&&e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:"flex items-center",children:"You have "+re.length+(re.length>1?" opportunities":" opportunity")+" for this product:"}),e.jsx(ye,{children:e.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:re.map((U,me)=>{const we=Re(U);return Wr(U)?e.jsxs("div",{className:`flex justify-between items-center rounded-lg transition-colors py-2 px-4 border cursor-pointer ${U.BidNumber==p?.BidNumber?"bg-primary/10 border-2 border-primary":"bg-background border-border hover:bg-muted/30"}`,onClick:()=>{N(U.BidNumber!==p?.BidNumber?U:null)},children:[e.jsx("div",{className:"flex items-center",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-sm",children:U.Opportunity}),e.jsx("span",{className:"text-xs text-foreground",children:U.BidNumber})]})}),e.jsxs("div",{className:"flex flex-col items-end",children:[e.jsx("span",{className:"font-semibold",children:oe(U.Price??0)}),U.Rebate&&U.Rebate>0&&e.jsxs("span",{className:"text-xs text-success",children:["Rebate: ",oe(U.Rebate)]}),we!==null&&e.jsxs("span",{className:"text-xs text-info",children:["Potential Revenue: ",oe(we)]}),U.EndDate&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Ends: ",pe(U.EndDate)]})]})]},me):e.jsxs(ge,{children:[e.jsx(je,{asChild:!0,children:e.jsxs("div",{className:"flex justify-between items-center rounded-lg transition-colors py-2 px-4 bg-muted/30 border border-border cursor-pointer hover:bg-muted/40",onClick:()=>{U.BidNumber&&d(`/${s}/Opportunity/${U.ManufacturerId}/${U.BidNumber}`)},children:[e.jsx("div",{className:"flex items-center",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-sm",children:U.Opportunity}),e.jsxs("span",{className:"text-xs text-foreground",children:[U.BidNumber," ",e.jsx(he,{variant:"secondary",className:"text-xs mx-1 h-5",children:Yc(U)&&U.StartDate?`Starts ${pe(U.StartDate)}`:"Currently unavailable"})]})]})}),e.jsxs("div",{className:"flex flex-col items-end",children:[e.jsx("span",{className:"font-semibold",children:oe(U.Price??0)}),U.Rebate&&U.Rebate>0&&e.jsxs("span",{className:"text-xs text-success",children:["Rebate: ",oe(U.Rebate)]}),we!==null&&e.jsxs("span",{className:"text-xs text-info",children:["Potential Revenue: ",oe(we)]}),U.EndDate&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Ends: ",pe(U.EndDate)]})]})]})}),e.jsx(fe,{children:e.jsx("p",{children:"View Opportunity"})})]},me)})})})]})})})]}),e.jsxs("div",{className:"mt-4 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-row flex-wrap justify-between items-end gap-4",children:[e.jsx("div",{className:"flex flex-col gap-3 flex-1",children:t.Distribution&&e.jsx("div",{className:"flex flex-col gap-1",children:$>0?e.jsx("div",{className:"flex items-center",children:e.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:["Cost: ",oe($),x?" USD":""]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center flex-wrap",children:[z>0&&e.jsx(e.Fragment,{children:e.jsx("span",{className:"text-2xl font-bold whitespace-nowrap",children:oe((p?t.Opportunities?.find(U=>U.BidNumber==p.BidNumber)?.Price:T)??0)})}),w>0&&e.jsx("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:oe(z)})]}),w>0&&e.jsx("div",{className:"flex items-center",children:e.jsxs(he,{variant:"info",className:"rounded-full px-3 whitespace-nowrap",children:[e.jsxs("span",{children:[w,"% OFF"]}),t.InstantRebate?.EndDate&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",t.InstantRebate.EndDate.split("T")[0]]}),p?.EndDate&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",p.EndDate.split("T")[0]]})]})})]})})}),e.jsxs("div",{className:"flex flex-col justify-center @[36rem]:justify-end items-end gap-2 w-full @[36rem]:w-auto",children:[l&&e.jsx(E,{className:"gap-2 whitespace-nowrap",onClick:Ee,disabled:j,children:j?e.jsxs(e.Fragment,{children:[e.jsx(g.Loader2,{className:"h-4 w-4 animate-spin"}),"Syncing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(g.ShoppingCartIcon,{className:"mr-2"}),"Sync to Shopify"]})}),u,typeof n<"u"&&e.jsxs("div",{className:"flex gap-2 whitespace-nowrap",children:[e.jsxs("div",{className:"flex items-center border rounded-md",children:[e.jsx(E,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:H,disabled:typeof m<"u"&&(m<=1||!t.AvailableToBuy||i),children:"-"}),e.jsx("input",{value:m,onChange:Y,onBlur:ee,onClick:U=>U.currentTarget.select(),className:`w-6 @[36rem]:w-12 text-center border-0 bg-transparent text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${!t.AvailableToBuy||i?"text-muted-foreground":""}`,disabled:!t.AvailableToBuy||i}),e.jsx(E,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:K,disabled:!t.AvailableToBuy||i,children:"+"})]}),e.jsx(E,{className:"gap-2 whitespace-nowrap",onClick:ve,disabled:!t.AvailableToBuy||i,children:i?e.jsxs(e.Fragment,{children:[e.jsx(g.Loader2,{className:"h-4 w-4 animate-spin"}),"Adding..."]}):e.jsxs(e.Fragment,{children:[e.jsx(g.ShoppingCartIcon,{className:"mr-2"}),"Add to Cart"]})})]})]})]}),e.jsxs("div",{className:"flex w-full flex-col gap-2 @[36rem]:flex-row",children:[e.jsx("div",{className:"flex-1 min-w-[10rem]",children:e.jsxs(E,{variant:"outline",type:"button",className:"h-11 px-4 text-sm font-medium justify-start w-full",onClick:()=>D(!0),disabled:!V,children:[e.jsx(g.LineChart,{className:"mr-2"}),"View statistics"]})}),e.jsx("div",{className:"flex-1 min-w-[10rem]",children:e.jsx(pi,{applicationId:s??"",randmarSku:t.RandmarSKU??"",inventory:t.Distribution?.Inventory,buttonSize:"lg",buttonClassName:"w-full h-11 justify-start"})}),a&&e.jsx(Ce.Link,{to:a,className:"flex-1 min-w-[10rem]",children:e.jsxs(E,{variant:"outline",className:"h-11 px-4 text-sm font-medium justify-start w-full",children:[e.jsx(g.LucideEye,{className:"mr-2"}),"View Product"]})})]})]})]})}),e.jsx(De,{open:S,onOpenChange:D,children:e.jsxs(Me,{className:"w-[min(95vw,1100px)] max-w-5xl space-y-6",children:[e.jsxs($e,{children:[e.jsx(_e,{children:"Monthly Sales Performance"}),e.jsxs(ze,{children:["Expanded product insights for ",Le,Ue?` (SKU ${Ue})`:""]})]}),e.jsx("div",{className:"space-y-6",children:A?e.jsxs(vs,{variant:"destructive",children:[e.jsx(ws,{children:"Unable to load details"}),e.jsx(Ss,{children:A})]}):e.jsxs("div",{className:"rounded-xl border bg-background p-4",children:[e.jsxs("div",{className:"mb-4 space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Rolling 12-month sales dollars and units sold pulled from the detailed endpoint."}),de&&e.jsx("div",{"aria-live":"polite","aria-busy":"true",children:e.jsx(lt,{value:Oe,className:"h-2 w-full animate-pulse","aria-label":"Loading performance data"})})]}),e.jsx(zs,{statistics:Ve,mode:"month",chartHeight:320}),de&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Gathering product summary and sales statistics..."})]})})]})})]})}const Jc={sm:100,md:200,lg:300,xl:400},Zc=({size:s})=>e.jsx("div",{className:"rounded-md bg-muted flex items-center justify-center",style:{width:s,height:s},"aria-label":"Image not available",children:e.jsx(g.ImageOff,{className:"h-1/2 w-1/2 text-muted-foreground"})}),Xc=()=>e.jsx(h,{className:"w-full",style:{aspectRatio:"16/9"}});function xr({randmarSKU:s,sceneName:t,size:a="md",alt:r,secondaryContent:n}){const[i,l]=P.useState(!1),[u,x]=P.useState(!1),{sendMessageWithClear:d}=Xs(),c=wt(),m=Jc[a],f=o.useRef(null),p=Ht({elementRef:f,threshold:.1,rootMargin:"100px"}),{data:N,isFetching:w}=_.useGetProductByProductNumberImageExistsQuery({productNumber:s},{skip:!s||!p}),{data:y,isFetching:j}=_.useGetProductByRandmarSkuImageQuery({randmarSku:s,width:m*1.5,height:m*1.5},{skip:!N}),{data:b}=_.useGetProductByProductNumberVideoExistsQuery({productNumber:s},{skip:!s||!p}),{data:C,isFetching:S}=_.useGetProductByProductNumberVideoQuery({productNumber:s},{skip:!b||!i}),D=w||j;function k(){if(C)try{const A=document.createElement("a");A.href=C,A.download=`${s||"product"}-video.mp4`,A.target="_blank",A.rel="noopener noreferrer",document.body.appendChild(A),A.click(),document.body.removeChild(A)}catch(A){console.error("Error downloading video:",A)}}function I(){const A=`/Product/${encodeURIComponent(s)}/Video`;navigator.clipboard.writeText(js(A,c)),x(!0),setTimeout(()=>x(!1),2e3)}function O(){b&&l(!0)}const M=P.useCallback(()=>{if(!y)return;const A=(t??"").trim(),F=A?`Use this concept as a background/stage scene: "${A}".`:"Use a modern and clean office as the background/stage, with no people present.";d(`Help me generate product images for (Randmar SKU: ${s}).
|
|
72
72
|
|
package/dist/randmarcomps.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { ForwardRefExoticComponent } from 'react';
|
|
|
15
15
|
import { GeneralDocumentOld } from 'randmar-api-client';
|
|
16
16
|
import { GoogleChartOptions } from 'react-google-charts';
|
|
17
17
|
import { Inventory } from 'randmar-api-client';
|
|
18
|
-
import { JSX } from 'react
|
|
18
|
+
import { JSX } from 'react';
|
|
19
19
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
20
20
|
import { LucideIcon } from 'lucide-react';
|
|
21
21
|
import { Manufacturer } from 'randmar-api-client';
|
|
@@ -103,12 +103,12 @@ export declare const AlertDialogContent: React_2.ForwardRefExoticComponent<Omit<
|
|
|
103
103
|
export declare const AlertDialogDescription: React_2.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React_2.RefAttributes<HTMLParagraphElement>, "ref"> & React_2.RefAttributes<HTMLParagraphElement>>;
|
|
104
104
|
|
|
105
105
|
export declare const AlertDialogFooter: {
|
|
106
|
-
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
106
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): React_2.JSX.Element;
|
|
107
107
|
displayName: string;
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
export declare const AlertDialogHeader: {
|
|
111
|
-
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
111
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): React_2.JSX.Element;
|
|
112
112
|
displayName: string;
|
|
113
113
|
};
|
|
114
114
|
|
|
@@ -118,7 +118,7 @@ export declare const AlertDialogTrigger: React_2.ForwardRefExoticComponent<Alert
|
|
|
118
118
|
|
|
119
119
|
export declare const AlertTitle: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLHeadingElement> & React_2.RefAttributes<HTMLParagraphElement>>;
|
|
120
120
|
|
|
121
|
-
export declare function ApiImage({ path, origin, ...props }: ApiImageProps): JSX.Element;
|
|
121
|
+
export declare function ApiImage({ path, origin, ...props }: ApiImageProps): React_2.JSX.Element;
|
|
122
122
|
|
|
123
123
|
export declare type ApiImageProps = Omit<React_2.ImgHTMLAttributes<HTMLImageElement>, "src" | "alt"> & {
|
|
124
124
|
path: string;
|
|
@@ -209,7 +209,7 @@ export declare const buttonVariants: (props?: ({
|
|
|
209
209
|
|
|
210
210
|
export declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, formatters, components, ...props }: React_2.ComponentProps<typeof DayPicker> & {
|
|
211
211
|
buttonVariant?: React_2.ComponentProps<typeof Button>["variant"];
|
|
212
|
-
}): JSX.Element;
|
|
212
|
+
}): React_2.JSX.Element;
|
|
213
213
|
|
|
214
214
|
export declare const Card: React_2.ForwardRefExoticComponent<React_2.HTMLAttributes<HTMLDivElement> & React_2.RefAttributes<HTMLDivElement>>;
|
|
215
215
|
|
|
@@ -246,7 +246,7 @@ export declare const ChatProvider: default_2.FC<{
|
|
|
246
246
|
|
|
247
247
|
export declare const Checkbox: React_2.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
|
|
248
248
|
|
|
249
|
-
export declare function CheckboxCardList({ items, selectedIds, onSelectedIdsChange, disabled, loading, selectionMode, layout, gridColumns, emptyState, loadingState, getItemAriaLabel, renderItem, className, ...props }: CheckboxCardListProps): JSX.Element;
|
|
249
|
+
export declare function CheckboxCardList({ items, selectedIds, onSelectedIdsChange, disabled, loading, selectionMode, layout, gridColumns, emptyState, loadingState, getItemAriaLabel, renderItem, className, ...props }: CheckboxCardListProps): React_2.JSX.Element;
|
|
250
250
|
|
|
251
251
|
export declare interface CheckboxCardListItem {
|
|
252
252
|
id: string;
|
|
@@ -296,7 +296,7 @@ export declare const Command: React_2.ForwardRefExoticComponent<Omit<{
|
|
|
296
296
|
vimBindings?: boolean;
|
|
297
297
|
} & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
298
298
|
|
|
299
|
-
export declare const CommandDialog: ({ children, ...props }: DialogProps) => JSX.Element;
|
|
299
|
+
export declare const CommandDialog: ({ children, ...props }: DialogProps) => React_2.JSX.Element;
|
|
300
300
|
|
|
301
301
|
export declare const CommandEmpty: React_2.ForwardRefExoticComponent<Omit<{
|
|
302
302
|
children?: React_2.ReactNode;
|
|
@@ -360,7 +360,7 @@ export declare const CommandSeparator: React_2.ForwardRefExoticComponent<Omit<Pi
|
|
|
360
360
|
} & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
361
361
|
|
|
362
362
|
export declare const CommandShortcut: {
|
|
363
|
-
({ className, ...props }: React_2.HTMLAttributes<HTMLSpanElement>): JSX.Element;
|
|
363
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLSpanElement>): React_2.JSX.Element;
|
|
364
364
|
displayName: string;
|
|
365
365
|
};
|
|
366
366
|
|
|
@@ -396,7 +396,7 @@ export declare interface DataPoint {
|
|
|
396
396
|
[key: string]: string | number | null;
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
export declare function DataRefreshAssistantCluster({ onAssistantClick, assistantPromptOptions, onAssistantUnavailable, ...refreshClusterProps }: DataRefreshAssistantClusterProps): JSX.Element;
|
|
399
|
+
export declare function DataRefreshAssistantCluster({ onAssistantClick, assistantPromptOptions, onAssistantUnavailable, ...refreshClusterProps }: DataRefreshAssistantClusterProps): React_2.JSX.Element;
|
|
400
400
|
|
|
401
401
|
export declare interface DataRefreshAssistantClusterProps extends Omit<RefreshClusterProps, "onAssistantClick"> {
|
|
402
402
|
onAssistantClick?: () => void;
|
|
@@ -404,7 +404,7 @@ export declare interface DataRefreshAssistantClusterProps extends Omit<RefreshCl
|
|
|
404
404
|
onAssistantUnavailable?: () => void;
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
-
export declare function DataTable<TData, TValue>({ columns, data, uniqueValues, tableClass, loading, initialSort, }: DataTableProps<TData, TValue>): JSX.Element;
|
|
407
|
+
export declare function DataTable<TData, TValue>({ columns, data, uniqueValues, tableClass, loading, initialSort, }: DataTableProps<TData, TValue>): default_2.JSX.Element;
|
|
408
408
|
|
|
409
409
|
declare interface DataTableProps<TData, TValue> {
|
|
410
410
|
columns: ColumnDef<TData, TValue>[];
|
|
@@ -418,7 +418,7 @@ declare interface DataTableProps<TData, TValue> {
|
|
|
418
418
|
/**
|
|
419
419
|
* A reusable date picker component with a masked input and a calendar popover.
|
|
420
420
|
*/
|
|
421
|
-
export declare function DatePicker({ date, onDateChange, label, id, className, }: DatePickerProps): JSX.Element;
|
|
421
|
+
export declare function DatePicker({ date, onDateChange, label, id, className, }: DatePickerProps): React_2.JSX.Element;
|
|
422
422
|
|
|
423
423
|
declare interface DatePickerProps {
|
|
424
424
|
/** The currently selected date. */
|
|
@@ -434,7 +434,7 @@ declare interface DatePickerProps {
|
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
export declare const Dialog: {
|
|
437
|
-
({ modal, ...props }: DialogPrimitive.DialogProps): JSX.Element;
|
|
437
|
+
({ modal, ...props }: DialogPrimitive.DialogProps): React_2.JSX.Element;
|
|
438
438
|
displayName: string | undefined;
|
|
439
439
|
};
|
|
440
440
|
|
|
@@ -449,12 +449,12 @@ export declare const DialogContent: React_2.ForwardRefExoticComponent<Omit<Dialo
|
|
|
449
449
|
export declare const DialogDescription: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React_2.RefAttributes<HTMLParagraphElement>, "ref"> & React_2.RefAttributes<HTMLParagraphElement>>;
|
|
450
450
|
|
|
451
451
|
export declare const DialogFooter: {
|
|
452
|
-
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
452
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): React_2.JSX.Element;
|
|
453
453
|
displayName: string;
|
|
454
454
|
};
|
|
455
455
|
|
|
456
456
|
export declare const DialogHeader: {
|
|
457
|
-
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
457
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): React_2.JSX.Element;
|
|
458
458
|
displayName: string;
|
|
459
459
|
};
|
|
460
460
|
|
|
@@ -491,7 +491,7 @@ export declare const DropdownMenuRadioItem: React_2.ForwardRefExoticComponent<Om
|
|
|
491
491
|
export declare const DropdownMenuSeparator: React_2.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
492
492
|
|
|
493
493
|
export declare const DropdownMenuShortcut: {
|
|
494
|
-
({ className, ...props }: React_2.HTMLAttributes<HTMLSpanElement>): JSX.Element;
|
|
494
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLSpanElement>): React_2.JSX.Element;
|
|
495
495
|
displayName: string;
|
|
496
496
|
};
|
|
497
497
|
|
|
@@ -585,15 +585,15 @@ export declare const Input: React_2.ForwardRefExoticComponent<Omit<InputProps, "
|
|
|
585
585
|
|
|
586
586
|
export declare function InputOTP({ className, containerClassName, ...props }: React_2.ComponentProps<typeof OTPInput> & {
|
|
587
587
|
containerClassName?: string;
|
|
588
|
-
}): JSX.Element;
|
|
588
|
+
}): React_2.JSX.Element;
|
|
589
589
|
|
|
590
|
-
export declare function InputOTPGroup({ className, ...props }: React_2.ComponentProps<"div">): JSX.Element;
|
|
590
|
+
export declare function InputOTPGroup({ className, ...props }: React_2.ComponentProps<"div">): React_2.JSX.Element;
|
|
591
591
|
|
|
592
|
-
export declare function InputOTPSeparator({ ...props }: React_2.ComponentProps<"div">): JSX.Element;
|
|
592
|
+
export declare function InputOTPSeparator({ ...props }: React_2.ComponentProps<"div">): React_2.JSX.Element;
|
|
593
593
|
|
|
594
594
|
export declare function InputOTPSlot({ index, className, ...props }: React_2.ComponentProps<"div"> & {
|
|
595
595
|
index: number;
|
|
596
|
-
}): JSX.Element;
|
|
596
|
+
}): React_2.JSX.Element;
|
|
597
597
|
|
|
598
598
|
export declare interface InputProps extends Omit<React_2.ComponentProps<"input">, "onChange"> {
|
|
599
599
|
mask?: MaskType;
|
|
@@ -624,7 +624,7 @@ declare interface IProps_2 {
|
|
|
624
624
|
loadFullAfterSummary?: boolean;
|
|
625
625
|
}
|
|
626
626
|
|
|
627
|
-
export declare function Label({ className, ...props }: React_2.ComponentProps<typeof LabelPrimitive.Root>): JSX.Element;
|
|
627
|
+
export declare function Label({ className, ...props }: React_2.ComponentProps<typeof LabelPrimitive.Root>): React_2.JSX.Element;
|
|
628
628
|
|
|
629
629
|
export declare const Layout: ForwardRefExoticComponent<LayoutProps & RefAttributes<HTMLInputElement>>;
|
|
630
630
|
|
|
@@ -643,7 +643,7 @@ declare interface LayoutProps {
|
|
|
643
643
|
chatRoutePath: string;
|
|
644
644
|
}
|
|
645
645
|
|
|
646
|
-
export declare function ManufacturerCard({ manufacturer, link, linkNewTab, actions, mainAction, loading, appID, }: ManufacturerCardProps): JSX.Element;
|
|
646
|
+
export declare function ManufacturerCard({ manufacturer, link, linkNewTab, actions, mainAction, loading, appID, }: ManufacturerCardProps): default_2.JSX.Element;
|
|
647
647
|
|
|
648
648
|
export declare interface ManufacturerCardProps {
|
|
649
649
|
manufacturer?: Manufacturer;
|
|
@@ -672,7 +672,7 @@ declare interface ManufacturerOverviewPageProps {
|
|
|
672
672
|
manufacturer?: Manufacturer;
|
|
673
673
|
}
|
|
674
674
|
|
|
675
|
-
export declare function ManufacturerReorderingCard({ manufacturer, onSave, loading, saving, readonly, }: ManufacturerReorderingCardProps): JSX.Element;
|
|
675
|
+
export declare function ManufacturerReorderingCard({ manufacturer, onSave, loading, saving, readonly, }: ManufacturerReorderingCardProps): default_2.JSX.Element;
|
|
676
676
|
|
|
677
677
|
declare interface ManufacturerReorderingCardProps {
|
|
678
678
|
manufacturer: Manufacturer;
|
|
@@ -684,7 +684,7 @@ declare interface ManufacturerReorderingCardProps {
|
|
|
684
684
|
|
|
685
685
|
declare type MaskType = "phone" | "postal-code-ca" | "zip-code-us";
|
|
686
686
|
|
|
687
|
-
export declare function MultiSelect({ options, selected, onChange, placeholder, disabled }: MultiSelectProps): JSX.Element;
|
|
687
|
+
export declare function MultiSelect({ options, selected, onChange, placeholder, disabled }: MultiSelectProps): React_2.JSX.Element;
|
|
688
688
|
|
|
689
689
|
declare interface MultiSelectProps {
|
|
690
690
|
options: string[];
|
|
@@ -767,7 +767,7 @@ declare interface PartnerCardProps {
|
|
|
767
767
|
withVoice?: boolean;
|
|
768
768
|
}
|
|
769
769
|
|
|
770
|
-
export declare function PartnerPageShell({ header, children, className, contentClassName, contentProps, ...props }: PartnerPageShellProps): JSX.Element;
|
|
770
|
+
export declare function PartnerPageShell({ header, children, className, contentClassName, contentProps, ...props }: PartnerPageShellProps): React_2.JSX.Element;
|
|
771
771
|
|
|
772
772
|
export declare interface PartnerPageShellProps extends Omit<React_2.ComponentProps<"section">, "children"> {
|
|
773
773
|
header: React_2.ReactNode;
|
|
@@ -813,7 +813,7 @@ export declare interface PreloaderProps {
|
|
|
813
813
|
className?: string;
|
|
814
814
|
}
|
|
815
815
|
|
|
816
|
-
export declare function ProductCard({ applicationId, product, viewProductLink, defaultOpportunityNumber, onAddToCart, addingToCart, shopifyHostname, customAction, showUsdLabelOnCost, }: ProductCardProps): JSX.Element;
|
|
816
|
+
export declare function ProductCard({ applicationId, product, viewProductLink, defaultOpportunityNumber, onAddToCart, addingToCart, shopifyHostname, customAction, showUsdLabelOnCost, }: ProductCardProps): default_2.JSX.Element;
|
|
817
817
|
|
|
818
818
|
export declare interface ProductCardProps {
|
|
819
819
|
applicationId?: string;
|
|
@@ -835,7 +835,7 @@ export declare interface ProductCardProps {
|
|
|
835
835
|
* can be clicked to open a video player in a dialog.
|
|
836
836
|
* It efficiently lazy-loads all assets and displays skeleton loaders.
|
|
837
837
|
*/
|
|
838
|
-
export declare function ProductImage({ randmarSKU, sceneName, size, alt, secondaryContent }: ProductImageProps): JSX.Element;
|
|
838
|
+
export declare function ProductImage({ randmarSKU, sceneName, size, alt, secondaryContent }: ProductImageProps): React_2.JSX.Element;
|
|
839
839
|
|
|
840
840
|
/**
|
|
841
841
|
* Props for the ProductImage component.
|
|
@@ -878,7 +878,7 @@ export declare function RandmarApiConfigProvider({ swaggerJsonUrl, children, }:
|
|
|
878
878
|
children: ReactNode;
|
|
879
879
|
}): JSX.Element;
|
|
880
880
|
|
|
881
|
-
export declare function RefreshCluster({ lastRefreshAt, onRefresh, onProgressiveRefresh, onAssistantClick, isRefreshing, refreshLabel, assistantLabel, className, disabled, }: RefreshClusterProps): JSX.Element;
|
|
881
|
+
export declare function RefreshCluster({ lastRefreshAt, onRefresh, onProgressiveRefresh, onAssistantClick, isRefreshing, refreshLabel, assistantLabel, className, disabled, }: RefreshClusterProps): React_2.JSX.Element;
|
|
882
882
|
|
|
883
883
|
export declare interface RefreshClusterProps {
|
|
884
884
|
lastRefreshAt?: RefreshDateValue;
|
|
@@ -894,7 +894,7 @@ export declare interface RefreshClusterProps {
|
|
|
894
894
|
|
|
895
895
|
declare type RefreshDateValue = Date | string | number | null | undefined;
|
|
896
896
|
|
|
897
|
-
export declare function ResellerBillingOverviewCard({ reseller, actions, loading }: ResellerBillingOverviewCardProps): JSX.Element;
|
|
897
|
+
export declare function ResellerBillingOverviewCard({ reseller, actions, loading }: ResellerBillingOverviewCardProps): default_2.JSX.Element;
|
|
898
898
|
|
|
899
899
|
declare interface ResellerBillingOverviewCardProps {
|
|
900
900
|
reseller?: Reseller;
|
|
@@ -941,7 +941,7 @@ declare interface ReturnsTableProps {
|
|
|
941
941
|
loading?: boolean;
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
-
export declare function RichTextEditor({ id, name, value, onChange, placeholder, className, ...props }: RichTextEditorProps): JSX.Element | null;
|
|
944
|
+
export declare function RichTextEditor({ id, name, value, onChange, placeholder, className, ...props }: RichTextEditorProps): default_2.JSX.Element | null;
|
|
945
945
|
|
|
946
946
|
export declare interface RichTextEditorProps extends Omit<default_2.InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
947
947
|
value: string;
|
|
@@ -949,11 +949,11 @@ export declare interface RichTextEditorProps extends Omit<default_2.InputHTMLAtt
|
|
|
949
949
|
placeholder?: string;
|
|
950
950
|
}
|
|
951
951
|
|
|
952
|
-
export declare function RmBodyZone({ className, children, ...props }: RmBodyZoneProps): JSX.Element;
|
|
952
|
+
export declare function RmBodyZone({ className, children, ...props }: RmBodyZoneProps): React_2.JSX.Element;
|
|
953
953
|
|
|
954
954
|
export declare type RmBodyZoneProps = React_2.ComponentProps<"section">;
|
|
955
955
|
|
|
956
|
-
export declare function RmPageHeader({ title, subtitle, breadcrumbs, rightTopActions, rightBottomActions, secondaryRow, sticky, stickyClassName, className, cardClassName, contentClassName, }: RmPageHeaderProps): JSX.Element;
|
|
956
|
+
export declare function RmPageHeader({ title, subtitle, breadcrumbs, rightTopActions, rightBottomActions, secondaryRow, sticky, stickyClassName, className, cardClassName, contentClassName, }: RmPageHeaderProps): React_2.JSX.Element;
|
|
957
957
|
|
|
958
958
|
export declare interface RmPageHeaderBreadcrumbItem {
|
|
959
959
|
label: React_2.ReactNode;
|
|
@@ -1014,7 +1014,7 @@ export declare interface ScrollAreaProps extends React_2.ComponentPropsWithoutRe
|
|
|
1014
1014
|
|
|
1015
1015
|
export declare const ScrollBar: React_2.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
|
|
1016
1016
|
|
|
1017
|
-
export declare function SearchNoResultsCard({ query, subtitle, tips, onReloadSearch, onAssistantClick, reloadLabel, assistantLabel, icon, className, }: SearchNoResultsCardProps): JSX.Element;
|
|
1017
|
+
export declare function SearchNoResultsCard({ query, subtitle, tips, onReloadSearch, onAssistantClick, reloadLabel, assistantLabel, icon, className, }: SearchNoResultsCardProps): React_2.JSX.Element;
|
|
1018
1018
|
|
|
1019
1019
|
export declare interface SearchNoResultsCardProps {
|
|
1020
1020
|
query: string;
|
|
@@ -1039,7 +1039,7 @@ export declare const SearchPage: React_2.FC<SearchPageProps>;
|
|
|
1039
1039
|
* It display a responsive grid layout and leaves the rendering of individual items
|
|
1040
1040
|
* to the consuming application via the `renderItem` prop.
|
|
1041
1041
|
*/
|
|
1042
|
-
export declare const SearchPageGrid: <T>({ results, groupBy, renderItem, }: SearchPageGridProps<T>) => JSX.Element;
|
|
1042
|
+
export declare const SearchPageGrid: <T>({ results, groupBy, renderItem, }: SearchPageGridProps<T>) => default_2.JSX.Element;
|
|
1043
1043
|
|
|
1044
1044
|
declare interface SearchPageGridProps<T> {
|
|
1045
1045
|
/**
|
|
@@ -1080,7 +1080,7 @@ export declare interface SearchPageResultGroup<T> {
|
|
|
1080
1080
|
gridCols?: ResponsiveCols;
|
|
1081
1081
|
}
|
|
1082
1082
|
|
|
1083
|
-
export declare function SearchResultsHeader({ query, title, subtitle, actions, children, className, contentClassName, }: SearchResultsHeaderProps): JSX.Element;
|
|
1083
|
+
export declare function SearchResultsHeader({ query, title, subtitle, actions, children, className, contentClassName, }: SearchResultsHeaderProps): React_2.JSX.Element;
|
|
1084
1084
|
|
|
1085
1085
|
export declare interface SearchResultsHeaderProps {
|
|
1086
1086
|
query?: string;
|
|
@@ -1157,12 +1157,12 @@ declare interface SheetContentProps extends React_2.ComponentPropsWithoutRef<typ
|
|
|
1157
1157
|
export declare const SheetDescription: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React_2.RefAttributes<HTMLParagraphElement>, "ref"> & React_2.RefAttributes<HTMLParagraphElement>>;
|
|
1158
1158
|
|
|
1159
1159
|
export declare const SheetFooter: {
|
|
1160
|
-
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
1160
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): React_2.JSX.Element;
|
|
1161
1161
|
displayName: string;
|
|
1162
1162
|
};
|
|
1163
1163
|
|
|
1164
1164
|
export declare const SheetHeader: {
|
|
1165
|
-
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
1165
|
+
({ className, ...props }: React_2.HTMLAttributes<HTMLDivElement>): React_2.JSX.Element;
|
|
1166
1166
|
displayName: string;
|
|
1167
1167
|
};
|
|
1168
1168
|
|
|
@@ -1271,7 +1271,7 @@ export declare interface SimpleNode {
|
|
|
1271
1271
|
|
|
1272
1272
|
export declare function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
1273
1273
|
|
|
1274
|
-
export declare function SummaryOverviewCard({ icon: Icon, contentType, identifier, description, fields, actions, highlightedHeader, className, ...props }: SummaryOverviewCardProps): JSX.Element;
|
|
1274
|
+
export declare function SummaryOverviewCard({ icon: Icon, contentType, identifier, description, fields, actions, highlightedHeader, className, ...props }: SummaryOverviewCardProps): React_2.JSX.Element;
|
|
1275
1275
|
|
|
1276
1276
|
export declare interface SummaryOverviewCardField {
|
|
1277
1277
|
label: string;
|
|
@@ -1312,7 +1312,7 @@ export declare interface SystemLogEntry {
|
|
|
1312
1312
|
payload: string;
|
|
1313
1313
|
}
|
|
1314
1314
|
|
|
1315
|
-
export declare function SystemLogFeed<TEntry extends SystemLogEntry>({ entries, emptyStateText, className, formatDayLabel, formatTimeLabel, }: SystemLogFeedProps<TEntry>): JSX.Element;
|
|
1315
|
+
export declare function SystemLogFeed<TEntry extends SystemLogEntry>({ entries, emptyStateText, className, formatDayLabel, formatTimeLabel, }: SystemLogFeedProps<TEntry>): React_2.JSX.Element;
|
|
1316
1316
|
|
|
1317
1317
|
export declare interface SystemLogFeedProps<TEntry extends SystemLogEntry = SystemLogEntry> {
|
|
1318
1318
|
entries: readonly TEntry[];
|
|
@@ -1404,7 +1404,7 @@ export declare interface TopbarProps {
|
|
|
1404
1404
|
searchPlaceholder?: string;
|
|
1405
1405
|
}
|
|
1406
1406
|
|
|
1407
|
-
export declare const TopPercentTreemap: ({ data, topPercent, title, loading, ...props }: TopPercentTreemapProps) => JSX.Element;
|
|
1407
|
+
export declare const TopPercentTreemap: ({ data, topPercent, title, loading, ...props }: TopPercentTreemapProps) => React_2.JSX.Element;
|
|
1408
1408
|
|
|
1409
1409
|
declare interface TopPercentTreemapProps {
|
|
1410
1410
|
data: SimpleNode[];
|
package/dist/randmarcomps.js
CHANGED
|
@@ -9237,12 +9237,6 @@ ${de}`
|
|
|
9237
9237
|
/* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: "Extension: 314" }),
|
|
9238
9238
|
/* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: "Location: Quebec" })
|
|
9239
9239
|
] }),
|
|
9240
|
-
/* @__PURE__ */ a("div", { className: "rounded-md border border-border bg-background p-3", children: [
|
|
9241
|
-
/* @__PURE__ */ e("div", { className: "font-medium", children: "Massimo Fiore" }),
|
|
9242
|
-
/* @__PURE__ */ e("div", { className: "text-muted-foreground", children: /* @__PURE__ */ e("a", { className: "text-primary hover:underline", href: "mailto:massimo@randmar.io", children: "massimo@randmar.io" }) }),
|
|
9243
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: "Extension: 305" }),
|
|
9244
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: "Location: Ontario" })
|
|
9245
|
-
] }),
|
|
9246
9240
|
/* @__PURE__ */ a("div", { className: "rounded-md border border-border bg-background p-3", children: [
|
|
9247
9241
|
/* @__PURE__ */ e("div", { className: "font-medium", children: "Kevin Dusik" }),
|
|
9248
9242
|
/* @__PURE__ */ e("div", { className: "text-muted-foreground", children: /* @__PURE__ */ e("a", { className: "text-primary hover:underline", href: "mailto:kevin@randmar.io", children: "kevin@randmar.io" }) }),
|