PageSourceSearch

https://smilebot.ai/_next/static/chunks/app/auto-replies/page-cf81d6c6f321affa.js

js smilebot.ai collected 2026-10-05 15:07:57 UTC 13,305 bytes, 1 lines download raw bytes

1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="44f6c762-f2ee-490d-8ecc-5b1ee99f5cda",e._sentryDebugIdIdentifier="sentry-dbid-44f6c762-f2ee-490d-8ecc-5b1ee99f5cda")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6857],{24094:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>g});var s=a(95155),r=a(92584),l=a(31610),n=a(35625),i=a(26708),o=a(48934),d=a(73321),u=a(12115),c=a(66609),x=a(34875),p=a(40785),b=a(25555),m=a(23181);function g(){let e=(0,b.kj)(),t=(0,d.useRouter)(),a=(0,n.jE)(),{isAuthenticated:g,isLoading:k}=(0,m.nc)(),[v,f]=(0,u.useState)(null),[j,N]=(0,u.useState)("");(0,u.useEffect)(()=>{k||g||t.replace("/auth/login")},[k,g,t]);let{data:w,isPending:R}=(0,i.I)({queryKey:["automation-rules"],queryFn:()=>p.g.list(),enabled:g}),{data:S}=(0,i.I)({queryKey:["automation-rules","safety"],queryFn:()=>p.g.safety(),enabled:g}),C=(0,o.n)({mutationFn:e=>p.g.preview(e)}),P=(0,o.n)({mutationFn:e=>p.g.remove(e),onSuccess:()=>a.invalidateQueries({queryKey:["automation-rules"]}),onError:()=>c.toast.error(e.autoReplies.failed)});if(k)return(0,s.jsx)("div",{className:"sb-sky min-h-dvh"});let K=w?.rules??[];return(0,s.jsxs)("div",{className:"sb-sky min-h-dvh pb-(--bottomnav-h)",children:[(0,s.jsxs)("header",{className:"flex items-center justify-between gap-3 px-5",style:{paddingTop:"calc(env(safe-area-inset-top, 0px) + 18px)"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[13px] text-slate-ink",children:e.autoReplies.subtitle}),(0,s.jsx)("h1",{className:"font-display text-2xl font-extrabold text-ink",children:e.autoReplies.title})]}),(0,s.jsxs)("button",{type:"button",onClick:()=>f("new"),className:"inline-flex items-center gap-1.5 rounded-full bg-gradient-to-br from-[var(--sb-primary)] to-[var(--sb-primary-deep)] px-4 py-2.5 text-[13px] font-bold text-white shadow-[0_10px_24px_rgba(47,107,255,0.32)] transition active:scale-[0.98]",children:[(0,s.jsx)(l.gc,{icon:r.QLR,className:"h-4 w-4"}),e.autoReplies.add]})]}),(0,s.jsxs)("main",{className:"px-5 py-6",children:[(0,s.jsxs)("p",{className:"mb-4 flex items-start gap-2 rounded-2xl border border-emerald-200 bg-emerald-50/70 px-4 py-3 text-[13px] leading-relaxed text-emerald-900 dark:border-emerald-400/25 dark:bg-emerald-400/10 dark:text-emerald-200",children:[(0,s.jsx)(l.gc,{icon:r.fLc,className:"mt-0.5 h-4 w-4 shrink-0"}),e.autoReplies.safetyNotice.replace("{n}",String(S?.redFlagCount??0))]}),(0,s.jsx)(h,{}),(0,s.jsxs)("section",{className:"mb-5 rounded-2xl sb-card p-4",children:[(0,s.jsx)("p",{className:"mb-2 text-[13px] font-semibold text-slate-ink",children:e.autoReplies.testTitle}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{value:j,onChange:e=>N(e.target.value),placeholder:e.autoReplies.testPlaceholder,className:"min-w-0 flex-1 rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink outline-none focus:border-[var(--sb-primary)] dark:bg-white/5"}),(0,s.jsx)("button",{type:"button",disabled:""===j.trim()||C.isPending,onClick:()=>C.mutate(j),className:"shrink-0 rounded-full bg-blue-50/80 px-3.5 py-2 text-[13px] font-semibold text-slate-ink disabled:opacity-40 dark:bg-white/10",children:e.autoReplies.test})]}),C.data&&(0,s.jsxs)("p",{className:`mt-2 flex items-start gap-2 rounded-lg px-3 py-2 text-[13px] ${C.data.vetoed?"bg-amber-50/70 text-amber-900 dark:bg-amber-400/10 dark:text-amber-200":"bg-blue-50/70 text-slate-ink dark:bg-white/5"}`,children:[C.data.vetoed&&(0,s.jsx)(l.gc,{icon:r.JAe,className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),C.data.vetoed?e.autoReplies.wouldBlock:e.autoReplies.wouldAllow]})]}),v&&(0,s.jsx)(y,{rule:"new"===v?null:v,onDone:()=>{f(null),a.invalidateQueries({queryKey:["automation-rules"]})},onCancel:()=>f(null)}),R?(0,s.jsx)("div",{className:"space-y-2","aria-hidden":!0,children:[0,1].map(e=>(0,s.jsx)("div",{className:"h-20 animate-pulse rounded-2xl sb-card"},e))}):0!==K.length||v?(0,s.jsx)("div",{className:"space-y-2",children:K.map(t=>(0,s.jsxs)("article",{className:"rounded-2xl sb-card p-4",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h2",{className:"truncate font-display text-[15px] font-bold text-ink",children:t.name}),(0,s.jsx)("p",{className:"mt-0.5 flex flex-wrap gap-1",children:t.keywords.map(e=>(0,s.jsx)("span",{className:"rounded-full bg-blue-50/80 px-2 py-0.5 text-[11px] text-slate-ink dark:bg-white/10",children:e},e))})]}),(0,s.jsxs)("div",{className:"flex shrink-0 gap-1.5",children:[(0,s.jsx)("button",{type:"button",onClick:()=>f(t),className:"rounded-full bg-blue-50/80 px-3 py-1.5 text-[13px] font-semibold text-slate-ink dark:bg-white/10",children:e.autoReplies.edit}),(0,s.jsx)("button",{type:"button",onClick:()=>P.mutate(t.id),"aria-label":e.autoReplies.remove,className:"grid h-8 w-8 place-items-center rounded-full bg-blue-50/80 text-slate-ink dark:bg-white/10",children:(0,s.jsx)(l.gc,{icon:r.yLS,className:"h-3.5 w-3.5"})})]})]}),(0,s.jsx)("p",{className:"mt-2 line-clamp-2 text-[13px] text-slate-ink",children:t.reply})]},t.id))}):(0,s.jsx)("p",{className:"rounded-2xl sb-card px-6 py-12 text-center text-[14px] text-slate-ink",children:e.autoReplies.empty})]}),(0,s.jsx)(x.l,{})]})}function h(){let e=(0,b.kj)(),t=(0,n.jE)(),{data:a}=(0,i.I)({queryKey:["agent-config"],queryFn:()=>p.g.getAgent()}),r=a?.agent,[l,d]=(0,u.useState)(""),[x,m]=(0,u.useState)(null),[g,h]=(0,u.useState)(null),[y,k]=(0,u.useState)(null),v=x??r?.persona??"",f=g??r?.model??"",j=y??String(r?.cooldownMin??15),N=(0,o.n)({mutationFn:e=>p.g.saveAgent(e),onSuccess:()=>{c.toast.success(e.autoReplies.agentSaved),d(""),t.invalidateQueries({queryKey:["agent-config"]})},onError:()=>c.toast.error(e.autoReplies.failed)}),w=(e={})=>N.mutate({...l.trim()?{apiKey:l.trim()}:{},persona:v,model:f.trim(),cooldownMin:Math.max(0,Number(j)||0),...e});return r?r.available?(0,s.jsxs)("section",{className:"mb-5 space-y-3 rounded-2xl sb-card p-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[15px] font-bold text-ink",children:e.autoReplies.agentTitle}),(0,s.jsx)("p",{className:"mt-1 text-[13px] leading-relaxed text-slate-ink",children:e.autoReplies.agentDesc})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"agentKe
1y",className:"mb-1.5 block text-[12px] font-medium text-slate-ink",children:e.autoReplies.agentKeyLabel}),(0,s.jsx)("input",{id:"agentKey",type:"password",autoComplete:"off",value:l,onChange:e=>d(e.target.value),placeholder:e.autoReplies.agentKeyPlaceholder,className:"w-full rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink outline-none focus:border-[var(--sb-primary)] dark:bg-white/5"}),r.hasKey&&(0,s.jsx)("p",{className:"mt-1 text-[12px] text-slate-ink",children:r.keyHint?e.autoReplies.agentKeyStored.replace("{hint}",r.keyHint):e.autoReplies.agentKeyLost})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"agentPersona",className:"mb-1.5 block text-[12px] font-medium text-slate-ink",children:e.autoReplies.agentPersonaLabel}),(0,s.jsx)("textarea",{id:"agentPersona",rows:4,maxLength:4e3,value:v,onChange:e=>m(e.target.value),placeholder:e.autoReplies.agentPersonaPlaceholder,className:"w-full resize-y rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] leading-relaxed text-ink outline-none focus:border-[var(--sb-primary)] dark:bg-white/5"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{value:f,onChange:e=>h(e.target.value),placeholder:r.defaultModel,className:"w-44 rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink dark:bg-white/5"}),(0,s.jsx)("span",{className:"text-[12px] text-slate-ink",children:e.autoReplies.agentModelLabel})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{value:j,onChange:e=>k(e.target.value),type:"number",min:0,className:"w-24 rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink dark:bg-white/5"}),(0,s.jsx)("span",{className:"text-[12px] text-slate-ink",children:e.autoReplies.agentCooldownHint})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[(0,s.jsx)("button",{type:"button",disabled:N.isPending,onClick:()=>w(),className:"rounded-full bg-[var(--sb-primary)] px-4 py-2 text-[13px] font-bold text-white disabled:opacity-60",children:e.common.save}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-[13px] text-ink",children:[(0,s.jsx)("input",{type:"checkbox",checked:r.isActive,onChange:e=>w({isActive:e.target.checked}),disabled:N.isPending||!r.hasKey&&!l.trim(),className:"h-4 w-4 accent-[var(--sb-primary)]"}),e.autoReplies.agentActive]})]})]}):(0,s.jsxs)("section",{className:"mb-5 rounded-2xl sb-card p-4",children:[(0,s.jsx)("p",{className:"mb-1 text-[15px] font-bold text-ink",children:e.autoReplies.agentTitle}),(0,s.jsx)("p",{className:"text-[13px] leading-relaxed text-slate-ink",children:e.autoReplies.agentUnavailable})]}):null}function y({rule:e,onDone:t,onCancel:a}){let r=(0,b.kj)(),[l,n]=(0,u.useState)(e?.name??""),[i,d]=(0,u.useState)((e?.keywords??[]).join(", ")),[x,m]=(0,u.useState)(e?.reply??""),[g,h]=(0,u.useState)(String(e?.cooldownMin??240)),[k,v]=(0,u.useState)(String(e?.humanLookbackHours??0)),f=(0,o.n)({mutationFn:()=>{let t={name:l.trim(),keywords:i.split(",").map(e=>e.trim()).filter(Boolean),reply:x.trim(),cooldownMin:Math.max(0,Number(g)||0),humanLookbackHours:Math.max(0,Number(k)||0)};return e?p.g.update(e.id,t):p.g.create(t)},onSuccess:()=>{c.toast.success(r.autoReplies.saved),t()},onError:()=>c.toast.error(r.autoReplies.failed)});return(0,s.jsxs)("form",{onSubmit:e=>{e.preventDefault(),""===l.trim()||""===x.trim()||f.isPending||f.mutate()},className:"mb-5 space-y-2 rounded-2xl sb-card p-4",children:[(0,s.jsx)("input",{value:l,onChange:e=>n(e.target.value),placeholder:r.autoReplies.namePlaceholder,maxLength:120,required:!0,className:"w-full rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink outline-none focus:border-[var(--sb-primary)] dark:bg-white/5"}),(0,s.jsx)("input",{value:i,onChange:e=>d(e.target.value),placeholder:r.autoReplies.keywordsPlaceholder,className:"w-full rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink outline-none focus:border-[var(--sb-primary)] dark:bg-white/5"}),(0,s.jsx)("p",{className:"text-[12px] text-slate-ink",children:r.autoReplies.keywordsHint}),(0,s.jsx)("textarea",{value:x,onChange:e=>m(e.target.value),placeholder:r.autoReplies.replyPlaceholder,rows:4,maxLength:2e3,required:!0,className:"w-full resize-y rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] leading-relaxed text-ink outline-none focus:border-[var(--sb-primary)] dark:bg-white/5"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{value:g,onChange:e=>h(e.target.value),type:"number",min:0,className:"w-24 rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink dark:bg-white/5"}),(0,s.jsx)("span",{className:"text-[12px] text-slate-ink",children:r.autoReplies.cooldownHint})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{value:k,onChange:e=>v(e.target.value),type:"number",min:0,max:720,className:"w-24 rounded-lg border border-[var(--sb-card-border)] bg-[var(--sb-sky-2)] px-2.5 py-2 text-[14px] text-ink dark:bg-white/5"}),(0,s.jsx)("span",{className:"text-[12px] text-slate-ink",children:r.autoReplies.humanLookbackHint})]}),(0,s.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,s.jsx)("button",{type:"submit",disabled:f.isPending||""===l.trim()||""===x.trim(),className:"flex-1 rounded-full bg-[var(--sb-primary)] px-4 py-2.5 text-[14px] font-bold text-white disabled:opacity-40",children:r.autoReplies.save}),(0,s.jsx)("button",{type:"button",onClick:a,className:"rounded-full bg-blue-50/80 px-4 py-2.5 text-[14px] font-semibold text-slate-ink dark:bg-white/10",children:r.autoReplies.cancel})]})]})}},36530:(e,t,a)=>{Promise.resolve().then(a.bind(a,24094))},40785:(e,t,a)=>{"use strict";a.d(t,{g:()=>r});var s=a(22356);let r={getAgent:()=>(0,s.nr)("/api/automation-rules/agent",{auth:!0}),saveAgent:e=>(0,s.nr)("/api/automation-rules/agent",{method:"PUT",auth:!0,body:JSON.stringify(e)}),list:()=>(0,s.nr)("/api/automation-rules",{auth:!0}),create:e=>(0,s.nr)("/api/automation-rules",{method:"POST",auth:!0,body:JSON.stringify(e)}),update:(e,t)=>
1(0,s.nr)(`/api/automation-rules/${e}`,{method:"PUT",auth:!0,body:JSON.stringify(t)}),remove:e=>(0,s.nr)(`/api/automation-rules/${e}`,{method:"DELETE",auth:!0}),safety:()=>(0,s.nr)("/api/automation-rules/safety",{auth:!0}),preview:e=>(0,s.nr)("/api/automation-rules/preview",{method:"POST",auth:!0,body:JSON.stringify({text:e})})}}},e=>{e.O(0,[2266,8058,804,1610,8500,3747,6708,7805,3501,7538,6609,8934,5555,3394,4875,5449,9793,8441,5642,7358],()=>e(e.s=36530)),_N_E=e.O()}]);

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.