feat(ip): protect persona 'formula' — secret fields only super_admin sees/edits

IP protection so casual copying yields inferior results:
- SECRET_PERSONA_FIELDS (pains/objections/negotiation_levers/opener/tolerance +
  pain rootCause/resolutionConditions): only super_admin can view/edit them.
- list_personas/get_persona/update_persona/get_group strip these for role=admin (and
  hide sales_kit + pain-fit report from admins too).
- update_persona rejects admin attempts to set secret fields (403).
- PersonaForm hides the 'การขาย' recipe section for non-super-admin (shows locked note);
  auth.isSuperAdmin getter added.
Rebuilt dist. Added test_ip_protection.
This commit is contained in:
Macky
2026-08-09 07:22:50 +07:00
parent a04bc2add8
commit e1d61e1e1e
29 changed files with 156 additions and 39 deletions

View File

@@ -0,0 +1,6 @@
import{c as e,a as o,b as l,l as n,u as i,m as s,t as r,i as a,D as u,o as d}from"./index-BCax2GDh.js";import{B as g}from"./book-open-C7SxBVkN.js";import{L as p}from"./layout-dashboard-Djj77ueX.js";import{T as m}from"./target-BFC5gbdb.js";import{S as y}from"./sparkles-E3Xd6eY7.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 h=e("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),k={class:"card"},v={style:{"margin-top":"0"}},x={class:"card"},f={style:{"margin-top":"0"}},c={class:"card"},w={style:{"margin-top":"0"}},z={class:"card"},_={style:{"margin-top":"0"}},L={__name:"Guide",setup(B){return(S,t)=>(d(),o("div",null,[l("h2",null,[n(i(g),{size:22,"stroke-width":1.8,style:{"vertical-align":"-4px"}}),s(" "+r(i(a).t("guideTitle")),1)]),t[8]||(t[8]=l("p",{class:"muted"},"คู่มือสั้นๆ สำหรับพนักงานใหม่ — เข้าใจระบบได้ใน 5 นาที",-1)),l("div",k,[l("h3",v,[n(i(p),{size:18,"stroke-width":1.8,style:{"vertical-align":"-3px"}}),t[0]||(t[0]=s(" 1. หน้า 3 แท็บ (menu ด้านบน)",-1))]),t[1]||(t[1]=l("ul",{style:{"line-height":"1.9"}},[l("li",null,[l("strong",null,"ภาพรวมผู้ดูแล"),s(" — เฉพาะ admin ดูสถิติผลการฝึกของทีม + กรองตามช่วงเวลา")]),l("li",null,[l("strong",null,"ภาพรวมผลการฝึก"),s(" — ของตัวคุณเอง: ชนะ/แพ้/ยังไม่ได้ฝึก")]),l("li",null,[l("strong",null,"การฝึก"),s(" — เลือกสินค้า → เลือกลูกค้า (บุคคลต้นแบบ) → เริ่มแชท")]),l("li",null,[l("strong",null,"การตั้งค่า (⚙︎)"),s(" — แก้ชื่อ/อีเมล, เปลี่ยนรหัสผ่าน, เปลี่ยนภาษา")])],-1))]),l("div",x,[l("h3",f,[n(i(m),{size:18,"stroke-width":1.8,style:{"vertical-align":"-3px"}}),t[2]||(t[2]=s(" 2. วิธีฝึก (start a session)",-1))]),t[3]||(t[3]=l("ol",{style:{"line-height":"1.9","padding-left":"20px"}},[l("li",null,[s("เข้าแท็บ "),l("strong",null,"การฝึก"),s(" → เลือกสินค้าที่อยากฝึก")]),l("li",null,"เลือกลูกค้า (บุคคลต้นแบบ) — ระดับ A ง่ายสุด / C ยากสุด (ดูดาวความยาก)"),l("li",null,[s("เลือก "),l("strong",null,"สถานการณ์"),s(": โซเชียล (ลูกค้าทักก่อน) / พบหน้า-โทร (คุณทักก่อน) / กลับมาติดต่อ")]),l("li",null,"แชทกับลูกค้า — ฝึกปิดการขาย ลูกค้าจะตัดสินใจเองว่าซื้อหรือไม่ซื้อ"),l("li",null,"หลังจบ ดูผล + ข้อเสนอแนะ + ข้อมูลลูกค้าที่ถูกซ่อนไว้")],-1))]),l("div",c,[l("h3",w,[n(i(y),{size:18,"stroke-width":1.8,style:{"vertical-align":"-3px"}}),t[4]||(t[4]=s(" 3. เคล็ดลับ",-1))]),t[5]||(t[5]=l("ul",{style:{"line-height":"1.9"}},[l("li",null,[s('ลูกค้าแต่ละคน หรือ "บุคคลต้นแบบ" ฝึกได้ '),l("strong",null,"คนละครั้ง"),s(" (one-shot) — ฝึกจนจบแล้วลองคนอื่น")]),l("li",null,"ถ้าออกกลางคัน กลับมาได้ คุยต่อจากเดิม (ยังไม่นับว่าจบ)"),l("li",null,"ปิดการขาย = แก้ปัญหาจริงของลูกค้า + รับมือข้อโต้แย้ง + ปิดราคา")],-1))]),l("div",z,[l("h3",_,[n(i(h),{size:18,"stroke-width":1.8,style:{"vertical-align":"-3px"}}),t[6]||(t[6]=s(" 4. สำหรับ Admin",-1))]),t[7]||(t[7]=u('<ul style="line-height:1.9;"><li>ปุ่ม <strong>เพิ่มสินค้า</strong> (หน้า การฝึก) → สร้างกลุ่มบุคคลต้นแบบใหม่</li><li>หน้า <strong>จัดการบุคคลต้นแบบ</strong> → แก้ไขรายละเอียดลูกค้าแต่ละคน แล้วเปิดใช้งาน</li><li>หน้า <strong>ผู้ใช้งาน</strong> → สร้างบัญชีให้ทีม (username + รหัสผ่านเริ่มต้น)</li><li>ปุ่ม <strong>CSV</strong> (หน้า ภาพรวม) → ดาวน์โหลดผลการฝึกทั้งหมด</li></ul>',1))])]))}};export{L as default};