1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7263],{7263:(e,t,i)=>{i.d(t,{QuickSend:()=>g});var s=i(95155),n=i(12115),l=i(47650),r=i(86272),a=i(9005),o=i(76721),c=i(92571),d=i(75796),x=i(24551),p=i(1275),u=i(99314),m=i(9383),h=i(64577),b=i(21600),v=i(9339);let f=(0,v.createServerReference)("40537946340d806587c1c7aa4872589ceaaab05df8",v.callServer,void 0,v.findSourceMapURL,"loadQuickSendPreview"),k=(0,v.createServerReference)("40a0160d98512ca92d8b8de998b28cc42a57733583",v.callServer,void 0,v.findSourceMapURL,"sendQuickSendEmailAction");var j=i(60260);function g({customerId:e,inquiryId:t,inquiryOptions:i=[],variant:l="primary",defaultAction:a}){let[o,c]=(0,n.useState)(!1),d="primary"===l?(0,s.jsxs)("button",{type:"button",onClick:()=>c(!0),className:"inline-flex h-9 items-center gap-1.5 rounded-[10px] bg-gradient-to-br from-violet-500 to-orange-500 px-3.5 text-[12.5px] font-semibold text-white shadow-[0_10px_30px_-12px_rgba(124,58,237,0.6)] transition-transform hover:-translate-y-[1px]",children:[(0,s.jsx)(r.A,{className:"h-3.5 w-3.5",strokeWidth:2.25}),"Quick Send"]}):(0,s.jsxs)("button",{type:"button",onClick:()=>c(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-[8px] border border-line bg-paper-card px-2.5 text-[11.5px] font-medium text-ink-700 transition-colors hover:border-violet-400 hover:bg-violet-50/60",children:[(0,s.jsx)(r.A,{className:"h-3 w-3 text-violet-600",strokeWidth:2.25}),"Quick Send"]});return(0,s.jsxs)(s.Fragment,{children:[d,o?(0,s.jsx)(y,{customerId:e,inquiryId:t,inquiryOptions:i,defaultAction:a,onClose:()=>c(!1)}):null]})}function y({customerId:e,inquiryId:t,inquiryOptions:i,defaultAction:v,onClose:g}){let N,S,{initialInquiryId:C,requiresCaseSelection:A,sendStageAvailable:W}=(N=1===i.length?i[0]?.id:void 0,{initialInquiryId:S=t??N??null,requiresCaseSelection:!t&&i.length>1,sendStageAvailable:null!==S}),[_,E]=(0,n.useState)(C),[q,I]=(0,n.useState)(W?v?"channel":"action":"case"),[Q,L]=(0,n.useState)(v??null),[P,U]=(0,n.useState)(null),[F,R]=(0,n.useState)(null),[T,B]=(0,n.useState)(null),[z,M]=(0,n.useState)(""),[O,D]=(0,n.useState)(""),[G,H]=(0,n.useState)(!!v),[Y,J]=(0,n.useTransition)(),[K,V]=(0,n.useState)(null),[X]=(0,n.useState)(()=>crypto.randomUUID());function Z(){"preview"===q?I("channel"):"channel"===q&&(I("action"),L(null),U(null),H(!1),B(null),D(""),V(null))}async function $(){try{await navigator.clipboard.writeText(O),(0,b.o)({tone:"success",title:"Copied",detail:"Paste it wherever you need."})}catch{(0,b.o)({tone:"error",title:"Couldn't copy",detail:"Your browser blocked the clipboard."})}}return(0,n.useEffect)(()=>{function e(e){"Escape"===e.key&&g()}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g]),(0,n.useEffect)(()=>{if(!Q||!_)return;let t=!1;return f({category:Q,customerId:e,inquiryId:_}).then(e=>{if(!t){if(H(!1),"error"in e)return void V(e.error);B(e.template.id),D(e.rendered),R(e.customer),M(e.reviewLink)}},()=>{t||(H(!1),V("Couldn't load the preview. Please try again."))}),()=>{t=!0}},[Q,e,_]),"u"<typeof document?null:(0,l.createPortal)((0,s.jsx)("div",{style:{position:"fixed",top:0,right:0,bottom:0,left:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem",backgroundColor:"rgba(0,0,0,0.4)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:g,children:(0,s.jsxs)("div",{className:"w-full max-w-lg rounded-[16px] border border-line bg-paper-card shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between border-b border-line px-5 py-3.5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(r.A,{className:"h-4 w-4 text-violet-600",strokeWidth:2.25}),(0,s.jsx)("p",{className:"font-display text-[15px] font-semibold text-ink-900",children:"Quick Send"})]}),(0,s.jsx)("button",{type:"button",onClick:g,className:"rounded-[6px] p-1 text-ink-500 hover:bg-ink-50","aria-label":"Close",children:(0,s.jsx)(a.A,{className:"h-4 w-4",strokeWidth:2})})]}),"case"===q?(0,s.jsxs)("div",{className:"px-5 py-4",children:[(0,s.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-widest text-violet-700",children:"Choose a case"}),(0,s.jsx)("p",{className:"mt-1 text-[11.5px] text-ink-500",children:"Qu
1ick Send will attach the email to this exact conversation."}),i.length>0?(0,s.jsx)("ul",{className:"mt-3 space-y-2",children:i.map(e=>(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",onClick:()=>(function(e){if(E(e),V(null),v){H(!0),I("channel");return}I("action")})(e.id),className:"group flex w-full items-start justify-between gap-3 rounded-[10px] border border-line bg-paper p-3 text-left transition-colors hover:border-violet-400 hover:bg-violet-50/60",children:[(0,s.jsxs)("span",{className:"min-w-0",children:[(0,s.jsx)("span",{className:"block text-[12.5px] font-semibold text-ink-900",children:e.label}),(0,s.jsx)("span",{className:"mt-0.5 block truncate text-[11.5px] text-ink-500",children:e.subject??"Untitled case"})]}),(0,s.jsx)(o.A,{className:"mt-1 h-4 w-4 shrink-0 text-ink-400 transition-transform group-hover:translate-x-0.5 group-hover:text-violet-600",strokeWidth:2})]})},e.id))}):(0,s.jsx)("p",{className:"mt-3 rounded-[8px] border border-amber-300 bg-amber-50 px-3 py-2 text-[12px] text-amber-800",children:"Open or create a case before using Quick Send."})]}):null,"action"===q?(0,s.jsxs)(s.Fragment,{children:[A?(0,s.jsx)("div",{className:"border-b border-line px-5 py-2.5",children:(0,s.jsx)("button",{type:"button",onClick:()=>I("case"),className:"text-[11.5px] font-medium text-ink-500 hover:text-ink-800",children:"â Change case"})}):null,(0,s.jsx)("ul",{className:"divide-y divide-line",children:j.n0.map(e=>(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",onClick:()=>{var t;return t=e.category,void(H(!0),V(null),B(null),L(t),I("channel"))},className:"group flex w-full items-center justify-between gap-3 px-5 py-3 text-left transition-colors hover:bg-violet-50/60",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-[13.5px] font-semibold text-ink-900",children:e.label}),(0,s.jsx)("p",{className:"mt-0.5 text-[11.5px] text-ink-500",children:e.blurb})]}),(0,s.jsx)(o.A,{className:"h-4 w-4 text-ink-400 transition-transform group-hover:translate-x-0.5 group-hover:text-violet-600",strokeWidth:2})]})},e.category))})]}):null,"channel"===q?(0,s.jsxs)("div",{className:"px-5 py-4",children:[G?(0,s.jsxs)("p",{className:"flex items-center gap-2 text-[12.5px] text-ink-500",children:[(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2}),"Loadingâ¦"]}):K?(0,s.jsx)("p",{className:"rounded-[8px] border border-coral-300 bg-coral-50 px-3 py-2 text-[12px] text-coral-700",children:K}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-widest text-violet-700",children:"How do they hear from you?"}),(0,s.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,s.jsx)(w,{icon:d.A,title:"Email",detail:F?.email??"No email on file",disabled:!F?.email,onClick:()=>{U("email"),I("preview")}}
1),(0,s.jsx)(w,{icon:x.A,title:"WhatsApp",detail:F?.whatsapp??"No verified WhatsApp identity",sub:"Unavailable here until the unified reply capability can authorize the exact WhatsApp thread.",disabled:!0,onClick:()=>void 0})]}),"review_request"!==Q||z?null:(0,s.jsxs)("p",{className:"mt-3 flex items-start gap-1.5 rounded-[8px] border border-amber-300 bg-amber-50 px-3 py-2 text-[11.5px] text-amber-800",children:[(0,s.jsx)(p.A,{className:"mt-0.5 h-3 w-3 shrink-0",strokeWidth:2.25}),(0,s.jsxs)("span",{children:["No review link set yet. Add one in Settings â Channels â Review links so ","{{review_link}}"," resolves."]})]})]}),(0,s.jsx)("div",{className:"mt-4 flex justify-between",children:(0,s.jsx)("button",{type:"button",onClick:Z,className:"text-[12px] font-medium text-ink-500 hover:text-ink-800",children:"â Back"})})]}):null,"preview"===q&&P&&Q?(0,s.jsxs)("div",{className:"px-5 py-4",children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,s.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-widest text-violet-700",children:"Preview \xb7 Email"}),(0,s.jsxs)("p",{className:"text-[11px] text-ink-500",children:["To ",F?.name??F?.email??F?.whatsapp]})]}),(0,s.jsx)("textarea",{value:O,onChange:e=>D(e.target.value),rows:9,maxLength:8e3,className:"block w-full rounded-[10px] border border-line bg-paper px-3 py-2.5 text-[13px] leading-relaxed text-ink-900 focus:border-violet-400 focus:outline-none focus:ring-1 focus:ring-violet-400/40"}),(0,s.jsx)("p",{className:"mt-1 text-[10.5px] text-ink-500",children:"Edits here don't save back to the template. To update the default, edit it in Templates."}),K?(0,s.jsx)("p",{className:"mt-2 rounded-[8px] border border-coral-300 bg-coral-50 px-3 py-2 text-[12px] text-coral-700",children:K}):null,(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:Z,className:"text-[12px] font-medium text-ink-500 hover:text-ink-800",children:"â Back"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("button",{type:"button",onClick:$,className:"inline-flex h-9 items-center gap-1.5 rounded-[10px] border border-line bg-paper-card px-3 text-[12px] font-medium text-ink-700 hover:bg-paper-cloud",children:[(0,s.jsx)(u.A,{className:"h-3.5 w-3.5",strokeWidth:2}),"Copy"]}),(0,s.jsxs)("button",{type:"button",onClick:function(){Q&&T&&_&&(V(null),J(async()=>{let t=await k({requestId:X,templateId:T,customerId:e,inquiryId:_,category:Q,body:O.trim()});t.error?V(t.error):((0,b.o)({tone:"success",title:"Sent",detail:t.detail??"Email on its way."}),g())}))},disabled:Y||!O.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-[10px] bg-gradient-to-br from-violet-500 to-violet-700 px-4 text-[12px] font-semibold text-white shadow-[0_10px_30px_-12px_rgba(124,58,237,0.6)] disabled:cursor-not-allowed disabled:opacity-60",children:[Y?(0,s.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2.25}):(0,s.jsx)(m.A,{className:"h-3.5 w-3.5",strokeWidth:2.25}),"Send email"]})]})]})]}):null,"review_request"===Q?(0,s.jsxs)("div",{className:"border-t border-line bg-violet-50/50 px-5 py-2.5 text-[10.5px] text-violet-800",children:[(0,s.jsx)(h.A,{className:"mr-1 inline-block h-3 w-3",strokeWidth:2.25}),"Send to every customer who finished a service, not just the happy ones. Selective requests violate Google's terms."]}):null]})}),document.body)}function w({icon:e,title:t,detail:i,sub:n,disabled:l,onClick:r}){return(0,s.jsxs)("button",{type:"button",onClick:r,disabled:l,className:"group flex w-full items-start gap-3 rounded-[10px] border border-line bg-paper p-3 text-left transition-colors hover:border-violet-400 hover:bg-violet-50/60 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,s.jsx)("span",{className:"inline-flex h-9 w-9 items-center justify-center rounded-[8px] bg-violet-100 text-violet-700",children:(0,s.jsx)(e,{className:"h-4 w-4",strokeWidth:2})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-[13px] font-semibold text-ink-900",children:t}),(0,s.jsx)("p",{className:"text-[11.5px] text-ink-600",children:i}),n?(0,s.jsx)("p",{className:"mt-0.5 text-[10.5px] text-ink-500",children:n}):null]}),(0,s.jsx)(o.A,{className:"mt-1 h-4 w-4 text-ink-400 transition-transform group-hover:translate-x-0.5 group-hover:text-violet-600",strokeWidth:2})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.