- recontact persona now opens as a NORMAL customer (no 'I asked before' in the opening); the mid-chat time-lapse system note (turn 2) makes them re-engage warmer instead. - channel default changed facebook->social everywhere (create/analyze/store/simulator/me). - 15 personas auto-generated (TARGET=15); removed the 'สร้างบุคคลต้นแบบเพิ่มเติม' button/guide. All 9 backend suites pass. Rebuilt dist.
15 lines
12 KiB
JavaScript
15 lines
12 KiB
JavaScript
import{c as q,_ as E,I as F,o as u,a as d,b as t,t as a,w as o,v as i,H as G,u as f,h as M,g as A,J as I,r as g,p as D,l as k,q as T,m as C,i as B,G as J,F as j,x as z,D as H,k as R,y as N,z as K,C as O}from"./index-yErsUbD6.js";import{U as Q}from"./users-BK4yWB6N.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 W=q("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);/**
|
|
* @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 X=q("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),Y={class:"persona-form"},Z={class:"muted"},h={class:"sec"},ee={class:"row"},te={class:"f"},le={class:"f"},ne={class:"f"},se={class:"row"},oe={class:"f"},ie={class:"f"},ae={class:"f"},re={class:"sec"},ue={class:"row"},de={class:"f"},me={class:"f"},ve={class:"f"},fe={key:0,class:"sec"},ge={key:1,class:"sec locked"},ye={key:2,class:"sec"},be={class:"muted"},ce={class:"row actions"},ke=["disabled"],pe={__name:"PersonaForm",props:{persona:{type:Object,required:!0}},emits:["save","cancel"],setup(p,{emit:P}){const c=p,V=P,s=I({name:"",difficulty:1,tier:"B",profession:"",age_group:"",location:"",income:"",budget:"",lifestyle:"",background:"",personality:"",communication_style:"",goal:"",decision_timeline:"",opener:"",channel:"line",initiation_mode:"customer",special:""}),y=g(""),b=g(""),m=g(""),x=g(!1);function w(l){return l?Array.isArray(l)?l.map(e=>typeof e=="string"?e:e&&e.description||e&&e.text||"").filter(Boolean).join(`
|
|
`):String(l):""}function U(l){return l.split(`
|
|
`).map(e=>e.trim()).filter(Boolean)}F(()=>c.persona,l=>{Object.assign(s,{name:(l==null?void 0:l.name)||"",difficulty:(l==null?void 0:l.difficulty)??1,tier:(l==null?void 0:l.tier)||"B",profession:(l==null?void 0:l.profession)||"",age_group:(l==null?void 0:l.age_group)||"",location:(l==null?void 0:l.location)||"",income:(l==null?void 0:l.income)||"",budget:(l==null?void 0:l.budget)||"",lifestyle:(l==null?void 0:l.lifestyle)||"",background:(l==null?void 0:l.background)||"",personality:(l==null?void 0:l.personality)||"",communication_style:(l==null?void 0:l.communication_style)||"",goal:(l==null?void 0:l.goal)||"",decision_timeline:(l==null?void 0:l.decision_timeline)||"",opener:(l==null?void 0:l.opener)||"",channel:(l==null?void 0:l.channel)||"line",initiation_mode:(l==null?void 0:l.initiation_mode)||"customer",special:(l==null?void 0:l.special)||""}),y.value=w(l==null?void 0:l.pains),b.value=w(l==null?void 0:l.objections),m.value=w(l==null?void 0:l.negotiation_levers)},{immediate:!0});function S(){V("save",{...s,pains:U(y.value).map(l=>({description:l})),objections:U(b.value),negotiation_levers:U(m.value)})}return(l,e)=>(u(),d("div",Y,[t("h3",null,a(p.persona.name||"New persona"),1),t("p",Z,a(p.persona.profession)+" · "+a(p.persona.personality),1),t("div",h,[e[28]||(e[28]=t("h4",null,"👤 ข้อมูลพื้นฐาน",-1)),t("div",ee,[t("div",te,[e[21]||(e[21]=t("label",null,"ชื่อ",-1)),o(t("input",{"onUpdate:modelValue":e[0]||(e[0]=n=>s.name=n)},null,512),[[i,s.name]])]),t("div",le,[e[22]||(e[22]=t("label",null,"ระดับความยาก (1-5)",-1)),o(t("input",{"onUpdate:modelValue":e[1]||(e[1]=n=>s.difficulty=n),type:"number",min:"1",max:"5"},null,512),[[i,s.difficulty,void 0,{number:!0}]])]),t("div",ne,[e[24]||(e[24]=t("label",null,"ระดับลูกค้า",-1)),o(t("select",{"onUpdate:modelValue":e[2]||(e[2]=n=>s.tier=n)},[...e[23]||(e[23]=[t("option",{value:"A"},"A — พร้อมตัดสินใจซื้อ",-1),t("option",{value:"B"},"B — ยังไม่แน่ใจ",-1),t("option",{value:"C"},"C — ไม่สนใจแต่มีปัญหา",-1)])],512),[[G,s.tier]])])]),t("div",se,[t("div",oe,[e[25]||(e[25]=t("label",null,"อาชีพ",-1)),o(t("input",{"onUpdate:modelValue":e[3]||(e[3]=n=>s.profession=n)},null,512),[[i,s.profession]])]),t("div",ie,[e[26]||(e[26]=t("label",null,"ช่วงอายุ",-1)),o(t("input",{"onUpdate:modelValue":e[4]||(e[4]=n=>s.age_group=n)},null,512),[[i,s.age_group]])]),t("div",ae,[e[27]||(e[27]=t("label",null,"พื้นที่",-1)),o(t("input",{"onUpdate:modelValue":e[5]||(e[5]=n=>s.location=n)},null,512),[[i,s.location]])])])]),t("div",re,[e[32]||(e[32]=t("h4",null,"💼 ข้อมูลลูกค้า",-1)),t("div",ue,[t("div",de,[e[29]||(e[29]=t("label",null,"รายได้/สถานะการเงิน",-1)),o(t("input",{"onUpdate:modelValue":e[6]||(e[6]=n=>s.income=n)},null,512),[[i,s.income]])]),t("div",me,[e[30]||(e[30]=t("label",null,"งบประมาณ",-1)),o(t("input",{"onUpdate:modelValue":e[7]||(e[7]=n=>s.budget=n)},null,512),[[i,s.budget]])]),t("div",ve,[e[31]||(e[31]=t("label",null,"ไลฟ์สไตล์",-1)),o(t("input",{"onUpdate:modelValue":e[8]||(e[8]=n=>s.lifestyle=n)},null,512),[[i,s.lifestyle]])])]),e[33]||(e[33]=t("label",null,"ภูมิหลัง",-1)),o(t("textarea",{"onUpdate:modelValue":e[9]||(e[9]=n=>s.background=n)},null,512),[[i,s.background]]),e[34]||(e[34]=t("label",null,"บุคลิก / วิธีพูดคุย",-1)),o(t("textarea",{"onUpdate:modelValue":e[10]||(e[10]=n=>s.personality=n)},null,512),[[i,s.personality]]),e[35]||(e[35]=t("label",null,"สไตล์การสื่อสาร",-1)),o(t("textarea",{"onUpdate:modelValue":e[11]||(e[11]=n=>s.communication_style=n)},null,512),[[i,s.communication_style]])]),f(M).isSuperAdmin?(u(),d("div",fe,[e[36]||(e[36]=t("h4",null,"🎯 การขาย",-1)),e[37]||(e[37]=t("label",null,"เป้าหมาย",-1)),o(t("textarea",{"onUpdate:modelValue":e[12]||(e[12]=n=>s.goal=n)},null,512),[[i,s.goal]]),e[38]||(e[38]=t("label",null,"กรอบเวลาในการตัดสินใจ",-1)),o(t("input",{"onUpdate:modelValue":e[13]||(e[13]=n=>s.decision_timeline=n)},null,512),[[i,s.decision_timeline]]),e[39]||(e[39]=t("label",null,"Pain (ปัญหา) แบบ 1 ต่อบรรทัด",-1)),o(t("textarea",{"onUpdate:modelValue":e[14]||(e[14]=n=>y.value=n),placeholder:`เช่น ต้นทุนสูงเกินไป
|
|
ระบบล้าสมัย`},null,512),[[i,y.value]]),e[40]||(e[40]=t("label",null,"ข้อโต้แย้ง (Objections) 1 ต่อบรรทัด",-1)),o(t("textarea",{"onUpdate:modelValue":e[15]||(e[15]=n=>b.value=n)},null,512),[[i,b.value]]),e[41]||(e[41]=t("label",null,"สิ่งที่ใช้ต่อรอง (เช่น ส่วนลด, ฟรีติดตั้ง)",-1)),o(t("textarea",{"onUpdate:modelValue":e[16]||(e[16]=n=>m.value=n)},null,512),[[i,m.value]]),e[42]||(e[42]=t("label",null,"ช่องทางสำหรับลูกค้าเปิดบทสนทนา (opener)",-1)),o(t("textarea",{"onUpdate:modelValue":e[17]||(e[17]=n=>s.opener=n)},null,512),[[i,s.opener]])])):(u(),d("div",ge,[e[43]||(e[43]=t("h4",null,"🔒 ส่วนสูตรการขาย",-1)),e[44]||(e[44]=t("p",{class:"muted"},"ปิดการแก้ไข — เฉพาะผู้ดูแลระดับสูงเท่านั้นที่ดู/แก้ได้ (เพื่อรักษาความได้เปรียบ)",-1)),e[45]||(e[45]=t("label",null,"เป้าหมาย",-1)),o(t("textarea",{"onUpdate:modelValue":e[18]||(e[18]=n=>s.goal=n)},null,512),[[i,s.goal]]),e[46]||(e[46]=t("label",null,"กรอบเวลาในการตัดสินใจ",-1)),o(t("input",{"onUpdate:modelValue":e[19]||(e[19]=n=>s.decision_timeline=n)},null,512),[[i,s.decision_timeline]])])),f(M).isSuperAdmin&&s.special?(u(),d("div",ye,[t("label",be,"พิเศษ: "+a(s.special),1)])):A("",!0),t("div",ce,[t("button",{class:"primary",onClick:S,disabled:x.value},a(x.value?"กำลังบันทึก…":"💾 บันทึกบุคคลต้นแบบ"),9,ke),t("button",{onClick:e[20]||(e[20]=n=>l.$emit("cancel"))},"ปิด")])]))}},Ve=E(pe,[["__scopeId","data-v-59429170"]]),xe={class:"row",style:{"align-items":"center","margin-bottom":"8px"}},we={style:{margin:"0"}},Ue={key:0,class:"muted"},$e={key:1,class:"error",style:{margin:"12px 0"}},Ce={key:2,class:"card empty-state"},Be={class:"grid"},Ae={class:"row",style:{"justify-content":"space-between","align-items":"center"}},Se={class:"diff"},_e={class:"muted"},je={class:"muted"},ze={class:"row",style:{gap:"8px","margin-top":"auto"}},Ne={class:"primary",style:{width:"100%"}},Pe=["onClick"],Le={class:"modal"},Me={__name:"GroupEdit",setup(p){const c=R().params.gid,V=g(null),s=g([]),y=g(!1),b=g(""),m=g(null);async function x(){const n=await N.getGroup(c);V.value=n.group,s.value=(await N.listPersonas(c)).personas}function w(n){return s.value.filter(r=>r.tier===n)}function U(n){return B.t(n==="A"?"tierA":n==="B"?"tierB":"tierC")}function S(n){return{A:"tier-a",B:"tier-b",C:"tier-c"}[n]||""}function l(n){m.value=JSON.parse(JSON.stringify(n))}async function e(n){y.value=!0;try{await N.updatePersona(c,m.value.id,n),m.value=null,await x()}catch(r){b.value=r.message}finally{y.value=!1}}return D(x),(n,r)=>{const L=K("router-link");return u(),d("div",null,[k(L,{to:"/training",class:"btn-back"},{default:T(()=>[C("← "+a(f(B).t("training")),1)]),_:1}),t("div",xe,[t("h2",we,[k(f(Q),{size:22,"stroke-width":1.8,style:{"vertical-align":"-4px"}}),C(" "+a(f(B).t("managePersonas")),1)])]),V.value?(u(),d("p",Ue,[r[2]||(r[2]=C("สินค้า: ",-1)),t("strong",null,a(V.value.title),1)])):A("",!0),b.value?(u(),d("div",$e,a(b.value),1)):A("",!0),r[4]||(r[4]=J('<div class="card guide" data-v-c3e7f19c><strong data-v-c3e7f19c>วิธีใช้หน้านี้</strong><ol style="margin:8px 0 0;padding-left:20px;line-height:1.8;" data-v-c3e7f19c><li data-v-c3e7f19c>ระบบสร้างบุคคลต้นแบบ 15 คนให้อัตโนมัติแล้ว หลังกดสร้าง</li><li data-v-c3e7f19c>แต่ละการ์ดคือลูกค้าจำลอง 1 คน — กด <strong data-v-c3e7f19c>✏️ แก้ไข</strong> เพื่อปรับรายละเอียดให้ตรงใจ</li><li data-v-c3e7f19c><strong data-v-c3e7f19c>วิธีเริ่มฝึก:</strong> ไปที่แท็บ <strong data-v-c3e7f19c>การฝึก</strong> → เลือกสินค้านี้ → เลือกลูกค้าจำลอง 1 คน → กด <strong data-v-c3e7f19c>แชท</strong> → เลือกสถานการณ์ → เริ่มคุย</li></ol></div>',1)),s.value.length===0&&!y.value?(u(),d("div",Ce,[...r[3]||(r[3]=[t("strong",null,"ยังไม่มีบุคคลต้นแบบ",-1),t("span",null,'กด "สร้างบุคคลต้นแบบเพิ่มเติม" เพื่อให้ระบบสร้างลูกค้าจำลองให้',-1)])])):A("",!0),(u(),d(j,null,z(["A","B","C"],$=>t("div",{key:$,style:{"margin-bottom":"20px"}},[t("h4",null,a(U($)),1),t("div",Be,[(u(!0),d(j,null,z(w($),v=>(u(),d("div",{key:v.id,class:"card pcard"},[t("div",Ae,[t("strong",null,a(v.name),1),t("span",{class:O(["badge",S(v.tier)])},a(v.tier),3)]),t("div",Se,[(u(),d(j,null,z(5,_=>t("span",{key:_,class:O(["star",{on:_<=(v.difficulty||1)}])},"★",2)),64))]),t("div",_e,a(v.profession)+" · "+a(v.age_group)+" · "+a(v.location),1),t("div",je,a(v.personality),1),t("div",ze,[k(L,{to:`/groups/${f(c)}/chat/${v.id}`,style:{flex:"1","text-decoration":"none"}},{default:T(()=>[t("button",Ne,[k(f(W),{size:16,"stroke-width":1.8}),C(" "+a(f(B).t("chat")),1)])]),_:1},8,["to"]),t("button",{class:"edit-btn",onClick:_=>l(v)},[k(f(X),{size:15,"stroke-width":1.8}),C(" "+a(f(B).t("edit")),1)],8,Pe)])]))),128))])])),64)),m.value?(u(),d("div",{key:3,class:"modal-backdrop",onClick:r[1]||(r[1]=H($=>m.value=null,["self"]))},[t("div",Le,[k(Ve,{persona:m.value,onSave:e,onCancel:r[0]||(r[0]=$=>m.value=null)},null,8,["persona"])])])):A("",!0)])}}},qe=E(Me,[["__scopeId","data-v-c3e7f19c"]]);export{qe as default};
|