Files
sales-trainer/frontend/dist/assets/Chat-Bo6laZZd.js
Macky 8670addcc3 ui(icons): replace colored emoji with modern single-color line icons (lucide-vue-next)
Add lucide-vue-next (stroke-based, single-color, currentColor) and swap emoji icons
across nav + all main views: Settings/LogOut (App), BarChart3/Users/Plus (Analytics),
LayoutDashboard (MyBoard), Sparkles/Users/Pencil (GroupEdit), Box/ListChecks/Paperclip/
PlusCircle/ArrowLeft (GroupBuilder), Target/ArrowLeft/Search (Chat/Personas/Training),
User/Lock/Globe (Settings), Users/UserPlus/Info (AdminUsers).
- Buttons become inline-flex for icon+text alignment.
- Icons inherit currentColor (single color, modern line style).
- Rebuild dist with lucide.
2026-08-08 10:55:45 +07:00

7 lines
5.4 KiB
JavaScript

import{k as G,_ as K,l as M,s as w,c as l,m as f,n as V,u as a,a as s,j as p,t,i as o,A as T,e as u,F as j,q as L,w as P,v as q,b as H,h as J,r as c,C as O,x as R,o as n}from"./index-C0Orcg9B.js";import{T as U}from"./target-qgda8bhm.js";import{A as $}from"./arrow-left-BoUMQ_f_.js";/**
* @license lucide-vue-next v1.0.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Q=G("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),W={class:"card guide"},X={style:{margin:"6px 0 0","line-height":"1.7"}},Y={class:"row",style:{"align-items":"center","margin-bottom":"12px"}},Z={style:{margin:"0"}},ee={key:0,class:"muted"},se=["disabled"],te={key:0,class:"spinner",style:{"margin-right":"4px"}},ae={key:0,class:"card task"},le={key:0},ne={key:0,class:"bubble msg-customer muted"},oe={key:2,class:"composer"},ie=["disabled","placeholder"],re=["disabled"],ue={key:3,class:"card debrief"},ce={key:0},de={key:0,class:"reveal-grid"},ve={class:"rk"},pe={class:"rv"},he={class:"primary",style:{"margin-top":"12px"}},_e={__name:"Chat",setup(me){const S=J(),g=S.params.gid,y=S.params.pid,r=c(null),b=c(!1),h=c([]),_=c(""),d=c(!1),i=c(null),C=c(""),z=c(null);function A(){O(()=>{k.value&&(k.value.scrollTop=k.value.scrollHeight)})}const k=c(null);M(async()=>{r.value=(await w.getPersona(g,y)).persona;const e=await w.chatStart(g,y);z.value=e.session.id,e.session.task&&(C.value=e.session.task),h.value=e.session.messages||[],b.value=!0,h.value.length&&A()});async function I(){if(_.value.trim()){d.value=!0;try{const e=await w.chatSend(g,y,_.value.trim());h.value=e.messages,_.value="",A()}catch(e){alert(e.message)}finally{d.value=!1}}}async function B(){if(confirm(o.t("finish")+"?")){d.value=!0;try{const e=await w.chatFinish(g,y);i.value=e.debrief,h.value=e.session.messages}catch(e){alert(e.message)}finally{d.value=!1}}}const D={name:"ชื่อ",tier:"ระดับ",difficulty:"ความยาก",profession:"อาชีพ",age_group:"ช่วงอายุ",location:"พื้นที่",income:"รายได้",budget:"งบประมาณ",lifestyle:"ไลฟ์สไตล์",background:"ภูมิหลัง",personality:"บุคลิก",communication_style:"สไตล์การสื่อสาร",goal:"เป้าหมาย",decision_timeline:"กรอบตัดสินใจ",pains:"ปัญหา (Pain)",objections:"ข้อโต้แย้ง",negotiation_levers:"สิ่งที่ใช้ต่อรอง",opener:"บทเปิดบทสนทนา",channel:"ช่องทาง",initiation_mode:"ใครเริ่มก่อน",product_context:"บริบทสินค้า"};function F(e){return D[e]||e}function E(e){return Array.isArray(e)?e.join(", "):e&&typeof e=="object"?JSON.stringify(e):String(e??"—")}return(e,x)=>{const N=R("router-link");return n(),l("div",null,[f(N,{to:`/groups/${a(g)}/personas`,class:"btn-back"},{default:V(()=>[f(a($),{size:16,"stroke-width":2}),p(" "+t(a(o).t("personas")),1)]),_:1},8,["to"]),s("div",W,[s("strong",null,[f(a(U),{size:17,"stroke-width":1.8,style:{"vertical-align":"-3px"}}),p(" "+t(a(o).t("chatGuideTitle")),1)]),s("p",X,t(a(o).t("chatGuideText")),1)]),s("div",Y,[s("h2",Z,t(r.value?r.value.name:"..."),1),s("span",{class:T(["badge",r.value&&r.value.channel])},t(r.value?r.value.channel:""),3),r.value?(n(),l("span",ee,t(r.value.profession)+" · "+t(r.value.age_group),1)):u("",!0),s("button",{class:"danger",style:{"margin-left":"auto"},onClick:B,disabled:h.value.length===0||!!i.value},[d.value?(n(),l("span",te)):u("",!0),p(t(a(o).t("finish")),1)],8,se)]),b.value?u("",!0):(n(),l("div",ae,[s("strong",null,"📣 "+t(a(o).t("sellerInitiated")),1),C.value?(n(),l("div",le,t(C.value),1)):u("",!0)])),b.value?(n(),l("div",{key:1,class:"thread",ref_key:"thread",ref:k},[(n(!0),l(j,null,L(h.value,(v,m)=>(n(),l("div",{key:m,class:T(["bubble",v.role==="seller"?"msg-seller":"msg-customer"])},t(v.text),3))),128)),d.value?(n(),l("div",ne,"...")):u("",!0)],512)):u("",!0),b.value&&!i.value?(n(),l("div",oe,[P(s("input",{"onUpdate:modelValue":x[0]||(x[0]=v=>_.value=v),onKeyup:H(I,["enter"]),disabled:d.value,placeholder:a(o).t("send")},null,40,ie),[[q,_.value]]),s("button",{class:"primary",onClick:I,disabled:d.value||!_.value.trim()},t(a(o).t("send")),9,re)])):u("",!0),i.value?(n(),l("div",ue,[s("h3",null,t(a(o).t("debrief")),1),s("p",null,[s("span",{class:T(["badge",i.value.outcome])},t(i.value.outcome==="won"?a(o).t("won"):a(o).t("lost")),3),p(" — "+t(a(o).t("score"))+": ",1),s("strong",null,t(i.value.score),1)]),s("p",null,[s("strong",null,t(a(o).t("pain"))+":",1),p(" "+t(i.value.pain||"—"),1)]),s("p",null,[s("strong",null,t(a(o).t("why"))+":",1),p(" "+t(i.value.why),1)]),i.value.coaching&&i.value.coaching.length?(n(),l("div",ce,[x[1]||(x[1]=s("strong",null,"Coaching:",-1)),s("ul",null,[(n(!0),l(j,null,L(i.value.coaching,(v,m)=>(n(),l("li",{key:m},t(v),1))),128))])])):u("",!0),s("details",null,[s("summary",null,[f(a(Q),{size:15,"stroke-width":1.8,style:{"vertical-align":"-2px"}}),p(" "+t(a(o).t("reveal")),1)]),i.value.revealed_persona?(n(),l("div",de,[(n(!0),l(j,null,L(i.value.revealed_persona,(v,m)=>(n(),l("div",{key:m,class:"rev"},[s("span",ve,t(F(m)),1),s("span",pe,t(E(v)),1)]))),128))])):u("",!0)]),f(N,{to:"/"},{default:V(()=>[s("button",he,t(a(o).t("dashboard")),1)]),_:1})])):u("",!0)])}}},be=K(_e,[["__scopeId","data-v-b21475ac"]]);export{be as default};