PageSourceSearch

https://www.cashback.com.tw/assets/js/SupportCenter-BUh8kCqI.js

js cashback.com.tw collected 2026-10-06 23:50:32 UTC 28,918 bytes, 1 lines download raw bytes

1import{r as a,b2 as G,cu as Ge,j as e,b4 as Ke,b5 as Z,cz as oe,b6 as Y,cr as X,cs as Ze,n as Pe,ah as Je,I as P,M as H,av as Qe,aw as et,ax as tt,dY as rt,O as ve,ay as st,C as ot,a as at,aA as nt,aB as lt,aC as ct,aD as it,X as we,cP as dt,aj as Se,a_ as ut}from"./index-Ra6VjJ-9.js";import{p as ht}from"./purify.es-CGs5VtEq.js";import{f as mt,a as de,g as J,b as Q,R as ye,s as ft,P as xt,u as pt,c as bt}from"./ReportDialog-CaBg2RtX.js";import{B as je}from"./badge-CjqAsro2.js";import{e as gt,S as vt,a as wt,b as St,c as yt,d as jt}from"./select-CpM4qiyQ.js";import{T as Nt}from"./textarea-DtyofcjL.js";import{F as Ct}from"./file-text-B5lV3iaK.js";import"./form-components-6gQIQHFP.js";import"./react-datepicker-C6ArA17A.js";import"./format-MJbfjqpZ.js";import"./parseISO-BhCIVzrq.js";import"./circle-check-Bh-i6FxX.js";import"./zh-TW-DlkT9htZ.js";function Pt(t,n){return a.useReducer((s,o)=>n[s][o]??s,t)}var he="ScrollArea",[Te,er]=Ke(he),[Tt,T]=Te(he),ke=a.forwardRef((t,n)=>{const{__scopeScrollArea:s,type:o="hover",dir:l,scrollHideDelay:c=600,...i}=t,[d,h]=a.useState(null),[f,m]=a.useState(null),[p,x]=a.useState(null),[v,j]=a.useState(null),[B,O]=a.useState(null),[_,z]=a.useState(0),[K,k]=a.useState(0),[$,R]=a.use
vendor: 9,354 bytes, line 1
1State(!1),[w,N]=a.useState(!1),S=G(n,A=>h(A)),y=Ge(l);return e.jsx(Tt,{scope:s,type:o,dir:y,scrollHideDelay:c,scrollArea:d,viewport:f,onViewportChange:m,content:p,onContentChange:x,scrollbarX:v,onScrollbarXChange:j,scrollbarXEnabled:$,onScrollbarXEnabledChange:R,scrollbarY:B,onScrollbarYChange:O,scrollbarYEnabled:w,onScrollbarYEnabledChange:N,onCornerWidthChange:z,onCornerHeightChange:k,children:e.jsx(Z.div,{dir:y,...i,ref:S,style:{position:"relative","--radix-scroll-area-corner-width":_+"px","--radix-scroll-area-corner-height":K+"px",...t.style}})})});ke.displayName=he;var Ae="ScrollAreaViewport",Ee=a.forwardRef((t,n)=>{const{__scopeScrollArea:s,children:o,nonce:l,...c}=t,i=T(Ae,s),d=a.useRef(null),h=G(n,d,i.onViewportChange);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),e.jsx(Z.div,{"data-radix-scroll-area-viewport":"",...c,ref:h,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});Ee.displayName=Ae;var I="ScrollAreaScrollbar",me=a.forwardRef((t,n)=>{const{forceMount:s,...o}=t,l=T(I,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:i}=l,d=t.orientation==="horizontal";return a.useEffect(()=>(d?c(!0):i(!0),()=>{d?c(!1):i(!1)}),[d,c,i]),l.type==="hover"?e.jsx(kt,{...o,ref:n,forceMount:s}):l.type==="scroll"?e.jsx(At,{...o,ref:n,forceMount:s}):l.type==="auto"?e.jsx(Re,{...o,ref:n,forceMount:s}):l.type==="always"?e.jsx(fe,{...o,ref:n}):null});me.displayName=I;var kt=a.forwardRef((t,n)=>{const{forceMount:s,...o}=t,l=T(I,t.__scopeScrollArea),[c,i]=a.useState(!1);return a.useEffect(()=>{const d=l.scrollArea;let h=0;if(d){const f=()=>{window.clearTimeout(h),i(!0)},m=()=>{h=window.setTimeout(()=>i(!1),l.scrollHideDelay)};return d.addEventListener("pointerenter",f),d.addEventListener("pointerleave",m),()=>{window.clearTimeout(h),d.removeEventListener("pointerenter",f),d.removeEventListener("pointerleave",m)}}},[l.scrollArea,l.scrollHideDelay]),e.jsx(oe,{present:s||c,children:e.jsx(Re,{"data-state":c?"visible":"hidden",...o,ref:n})})}),At=a.forwardRef((t,n)=>{const{forceMount:s,...o}=t,l=T(I,t.__scopeScrollArea),c=t.orientation==="horizontal",i=ne(()=>h("SCROLL_END"),100),[d,h]=Pt("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return a.useEffect(()=>{if(d==="idle"){const f=window.setTimeout(()=>h("HIDE"),l.scrollHideDelay);return()=>window.clearTimeout(f)}},[d,l.scrollHideDelay,h]),a.useEffect(()=>{const f=l.viewport,m=c?"scrollLeft":"scrollTop";if(f){let p=f[m];const x=()=>{const v=f[m];p!==v&&(h("SCROLL"),i()),p=v};return f.addEventListener("scroll",x),()=>f.removeEventListener("scroll",x)}},[l.viewport,c,h,i]),e.jsx(oe,{present:s||d!=="hidden",children:e.jsx(fe,{"data-state":d==="hidden"?"hidden":"visible",...o,ref:n,onPointerEnter:Y(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:Y(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),Re=a.forwardRef((t,n)=>{const s=T(I,t.__scopeScrollArea),{forceMount:o,...l}=t,[c,i]=a.useState(!1),d=t.orientation==="horizontal",h=ne(()=>{if(s.viewport){const f=s.viewport.offsetWidth<s.viewport.scrollWidth,m=s.viewport.offsetHeight<s.viewport.scrollHeight;i(d?f:m)}},10);return q(s.viewport,h),q(s.content,h),e.jsx(oe,{present:o||c,children:e.jsx(fe,{"data-state":c?"visible":"hidden",...l,ref:n})})}),fe=a.forwardRef((t,n)=>{const{orientation:s="vertical",...o}=t,l=T(I,t.__scopeScrollArea),c=a.useRef(null),i=a.useRef(0),[d,h]=a.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),f=Oe(d.viewport,d.content),m={...o,sizes:d,onSizesChange:h,hasThumb:f>0&&f<1,onThumbChange:x=>c.current=x,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:x=>i.current=x};function p(x,v){return Lt(x,i.current,d,v)}return s==="horizontal"?e.jsx(Et,{...m,ref:n,onThumbPositionChange:()=>{if(l.viewport&&c.current){const x=l.viewport.scrollLeft,v=Ne(x,d,l.dir);c.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:x=>{l.viewport&&(l.viewport.scrollLeft=x)},onDragScroll:x=>{l.viewport&&(l.viewport.scrollLeft=p(x,l.dir))}}):s==="vertical"?e.jsx(Rt,{...m,ref:n,onThumbPositionChange:()=>{if(l.viewport&&c.current){const x=l.viewport.scrollTop,v=Ne(x,d);c.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:x=>{l.viewport&&(l.viewport.scrollTop=x)},onDragScroll:x=>{l.viewport&&(l.viewport.scrollTop=p(x))}}):null}),Et=a.forwardRef((t,n)=>{const{sizes:s,onSizesChange:o,...l}=t,c=T(I,t.__scopeScrollArea),[i,d]=a.useState(),h=a.useRef(null),f=G(n,h,c.onScrollbarXChange);return a.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),e.jsx(Ie,{"data-orientation":"horizontal",...l,ref:f,sizes:s,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ae(s)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.x),onDragScroll:m=>t.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(c.viewport){const x=c.viewport.scrollLeft+m.deltaX;t.onWheelScroll(x),Me(x,p)&&m.preventDefault()}},onResize:()=>{h.current&&c.viewport&&i&&o({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:se(i.paddingLeft),paddingEnd:se(i.paddingRight)}})}})}),Rt=a.forwardRef((t,n)=>{const{sizes:s,onSizesChange:o,...l}=t,c=T(I,t.__scopeScrollArea),[i,d]=a.useState(),h=a.useRef(null),f=G(n,h,c.onScrollbarYChange);return a.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),e.jsx(Ie,{"data-orientation":"vertical",...l,ref:f,sizes:s,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ae(s)+"px",...t.style},onThumbPointerDown:m=>t.onThumbPointerDown(m.y),onDragScroll:m=>t.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(c.viewport){const x=c.viewport.scrollTop+m.deltaY;t.onWheelScroll(x),Me(x,p)&&m.preventDefault()}},onResize:()=>{h.current&&c.viewport&&i&&o({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:se(i.paddingTop),paddingEnd:se(i.paddingBottom)}})}})}),[Dt,De]=Te(I),Ie=a.forwardRef((t,n)=>{const{__scopeScrollArea:s,sizes:o,hasThumb:l,onThumbChange:c,onThumbPointerUp:i,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:f,onWheelScroll:m,onResize:p,...x}=t,v=T(I,s),[j,B]=a.useState(null),O=G(n,S=>B(S)),_=a.useRef(null),z=a.useRef(""),K=v.viewport,k=o.content-o.viewport,$=X(m),R=X(h),w=ne(p,10);function N(S){if(_.current){const y=S.clientX-_.current.left,A=S.clientY-_.current.top;f({x:y,y:A})}}return a.useEffect(()=>{const S=y=>{const A=y.target;j?.contains(A)&&$(y,k)};return document.addEventListener("wheel",S,{passive:!1}),()=>document.removeEventListener("wheel",S,{passive:!1})},[K,j,k,$]),a.useEffect(R,[o,R]),q(j,w),q(v.content,w),e.jsx(Dt,{scope:s,scrollbar:j,hasThumb:l,onThumbChange:X(c),onThumbPointerUp:X(i),onThumbPositionChange:R,onThumbPointerDown:X(d),children:e.jsx(Z.div,{...x,ref:O,style:{position:"absolute",...x.style},onPointerDown:Y(t.onPointerDown,S=>{S.button===0&&(S.target.setPointerCapture(S.pointerId),_.current=j.getBoundingClientRect(),z.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),N(S))}),onPointerMove:Y(t.onPointerMove,N),onPointerUp:Y(t.onPointerUp,S=>{const y=S.target;y.hasPointerCapture(S.pointerId)&&y.releasePointerCapture(S.pointerId),document.body.style.webkitUserSelect=z.current,v.viewport&&(v.viewport.style.scrollBehavior=""),_.current=null})})})}),re="ScrollAreaThumb",_e=a.forwardRef((t,n)=>{const{forceMount:s,...o}=t,l=De(re,t.__scopeScrollArea);return e.jsx(oe,{present:s||l.hasThumb,children:e.jsx(It,{ref:n,...o})})}),It=a.forwardRef((t,n)=>{const{__scopeScrollArea:s,style:o,...l}=t,c=T(re,s),i=De(re,s),{onThumbPositionChange:d}=i,h=G(n,p=>i.onThumbChange(p)),f=a.useRef(void 0),m=ne(()=>{f.current&&(f.current(),f.current=void 0)},100);return a.useEffect(()=>{const p=c.viewport;if(p){const x=()=>{if(m(),!f.current){const v=Ot(p,d);f.current=v,d()}};return d(),p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[c.viewport,m,d]),e.jsx(Z.div,{"data-state":i.hasThumb?"visible":"hidden",...l,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:Y(t.onPointerDownCapture,p=>{const v=p.target.getBoundingClientRect(),j=p.clientX-v.left,B=p.clientY-v.top;i.onThumbPointerDown({x:j,y:B})}),onPointerUp:Y(t.onPointerUp,i.onThumbPointerUp)})});_e.displayName=re;var xe="ScrollAreaCorner",Le=a.forwardRef((t,n)=>{const s=T(xe,t.__scopeScrollArea),o=!!(s.scrollbarX&&s.scrollbarY);return s.type!=="scroll"&&o?e.jsx(_t,{...t,ref:n}):null});Le.displayName=xe;var _t=a.forwardRef((t,n)=>{const{__scopeScrollArea:s,...o}
1=t,l=T(xe,s),[c,i]=a.useState(0),[d,h]=a.useState(0),f=!!(c&&d);return q(l.scrollbarX,()=>{const m=l.scrollbarX?.offsetHeight||0;l.onCornerHeightChange(m),h(m)}),q(l.scrollbarY,()=>{const m=l.scrollbarY?.offsetWidth||0;l.onCornerWidthChange(m),i(m)}),f?e.jsx(Z.div,{...o,ref:n,style:{width:c,height:d,position:"absolute",right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function se(t){return t?parseInt(t,10):0}function Oe(t,n){const s=t/n;return isNaN(s)?0:s}function ae(t){const n=Oe(t.viewport,t.content),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=(t.scrollbar.size-s)*n;return Math.max(o,18)}function Lt(t,n,s,o="ltr"){const l=ae(s),c=l/2,i=n||c,d=l-i,h=s.scrollbar.paddingStart+i,f=s.scrollbar.size-s.scrollbar.paddingEnd-d,m=s.content-s.viewport,p=o==="ltr"?[0,m]:[m*-1,0];return ze([h,f],p)(t)}function Ne(t,n,s="ltr"){const o=ae(n),l=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,c=n.scrollbar.size-l,i=n.content-n.viewport,d=c-o,h=s==="ltr"?[0,i]:[i*-1,0],f=gt(t,h);return ze([0,i],[0,d])(f)}function ze(t,n){return s=>{if(t[0]===t[1]||n[0]===n[1])return n[0];const o=(n[1]-n[0])/(t[1]-t[0]);return n[0]+o*(s-t[0])}}function Me(t,n){return t>0&&t<n}var Ot=(t,n=()=>{})=>{let s={left:t.scrollLeft,top:t.scrollTop},o=0;return(function l(){const c={left:t.scrollLeft,top:t.scrollTop},i=s.left!==c.left,d=s.top!==c.top;(i||d)&&n(),s=c,o=window.requestAnimationFrame(l)})(),()=>window.cancelAnimationFrame(o)};function ne(t,n){const s=X(t),o=a.useRef(0);return a.useEffect(()=>()=>window.clearTimeout(o.current),[]),a.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(s,n)},[s,n])}function q(t,n){const s=X(n);Ze(()=>{let o=0;if(t){const l=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(s)});return l.observe(t),()=>{window.cancelAnimationFrame(o),l.unobserve(t)}}},[t,s])}var He=ke,zt=Ee,Mt=Le;const Be=a.forwardRef(({className:t,children:n,...s},o)=>e.jsxs(He,{ref:o,className:Pe("relative overflow-hidden",t),...s,children:[e.jsx(zt,{className:"h-full w-full rounded-[inherit]",children:n}),e.jsx(Ue,{}),e.jsx(Mt,{})]}));Be.displayName=He.displayName;const Ue=a.forwardRef(({className:t,orientation:n="vertical",...s},o)=>e.jsx(me,{ref:o,orientation:n,className:Pe("flex touch-none select-none transition-colors",n==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",n==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px",t),...s,children:e.jsx(_e,{className:"relative flex-1 rounded-full bg-border"})}));Ue.displayName=me.displayName;const ue=[{value:"all",label:"全部"},{value:"open",label:"待處理"},{value:"pending_customer",label:"待補充資訊"},{value:"in_progress",label:"處理中"},{value:"resolved",label:"已解決"},{value:"closed",label:"已關閉"}],Ce={open:"bg-amber-50 text-amber-700 border-0 font-normal hover:bg-amber-50",pending_customer:"bg-blue-50 text-blue-700 border-0 font-normal hover:bg-blue-50",in_progress:"bg-green-50 text-green-700 border-0 font-normal hover:bg-green-50",resolved:"bg-gray-50 text-gray-600 border-0 font-normal hover:bg-gray-50",closed:"bg-gray-100 text-gray-500 border-0 font-normal hover:bg-gray-100"},ee=5,Ht=10*1024*1024,Bt=["image/jpeg","image/jpg","image/png","application/pdf"],te=t=>{if(!t)return"-";const n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleString("zh-TW",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})},tr=()=>{const[t]=Je(),[n,s]=a.useState([]),[o,l]=a.useState({Page:1,PageSize:10}
1),[c,i]=a.useState("all"),[d,h]=a.useState(""),[f,m]=a.useState(""),[p,x]=a.useState(!1),[v,j]=a.useState(null),[B,O]=a.useState(!1),[_,z]=a.useState(!1),[K,k]=a.useState(!1),[$,R]=a.useState(!1),[w,N]=a.useState(null),[S,y]=a.useState([]),[A,F]=a.useState(""),[V,M]=a.useState([]),[U,pe]=a.useState(!1),[le,We]=a.useState(!1),[ce,ie]=a.useState({});a.useEffect(()=>{const r=window.setTimeout(()=>{m(d.trim())},400);return()=>{window.clearTimeout(r)}},[d]);const W=a.useCallback(async()=>{x(!0),j(null);try{const r=c==="all"?void 0:c,u=await mt({...r?{Status:r}:{},...f?{Search:f}:{},Page:o.Page,PageSize:o.PageSize});s(u.Tickets??[]),l(u.Pagination??{Page:1,PageSize:10})}catch(r){console.error("無法取得客服案件列表",r),s([]),j(r instanceof Error?r.message:"取得客服案件列表失敗")}finally{x(!1)}},[c,f,o.Page,o.PageSize]);a.useEffect(()=>{W()},[W]);const Xe=async r=>{k(!0),R(!0),N(null),y([]),M([]),F("");try{const u=await de(r.TicketId);if(N(u.Ticket),y(u.Messages??[]),typeof window<"u"){const g=new URL(window.location.href);g.searchParams.set("ticketId",r.TicketId),window.history.replaceState({},"",g.toString())}}catch(u){console.error("無法取得客服案件詳情",u),P.error("無法取得客服案件詳情"),N(null),y([]),k(!1)}finally{R(!1)}},be=a.useCallback(async r=>{k(!0),R(!0),N(null),y([]),M([]),F("");try{const u=await de(r);N(u.Ticket),y(u.Messages??[])}catch(u){console.error("無法取得客服案件詳情",u),P.error("無法取得客服案件詳情"),N(null),y([]),k(!1)}finally{R(!1)}},[]);a.useEffect(()=>{const r=t.get("open")==="true",u=t.get("orderNumber")||void 0,g=t.get("merchantName")||void 0,b=t.get("ticketId")||void 0;if(r){const D={};u&&(D.OrderNumber=u),g&&(D.StoreName=g),ie(D),O(!0);const L=new URL(window.location.href);L.searchParams.delete("open"),L.searchParams.delete("orderNumber"),L.searchParams.delete("merchantName"),window.history.replaceState({},"",L.toString())}b&&be(b)},[t,be]);const Ye=()=>{if(k(!1),N(null),y([]),M([]),F(""),typeof window<"u"){const r=new URL(window.location.href);r.searchParams.delete("ticketId"),window.history.replaceState({},"",r.toString())}},$e=r=>{const u=r.target.files;if(!u)return;const g=[];Array.from(u).forEach(b=>{if(!Bt.includes(b.type)){P.error(`${b.name} 格式不支援`);return}if(b.size>Ht){P.error(`${b.name} 超過 10MB 限制`);return}g.push({id:typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random()}`,file:b,status:"pending",error:null})}),g.length>0&&M(b=>{const D=ee-b.length;if(D<=0)return P.warning(`最多可附加 ${ee} 個檔案`),b;const L=g.slice(0,D);return g.length>D&&P.warning(`僅保留前 ${D} 個檔案`),[...b,...L]}),r.target.value=""},Fe=r=>{M(u=>{const g=u.find(b=>b.id===r);return g?g.status==="uploading"?(P.error("附件正在上傳,請稍後再移除"),u):g.status==="success"?(P.error("已上傳的附件無法在此移除"),u):u.filter(b=>b.id!==r):u})},ge=(r,u)=>{M(g=>g.map(b=>b.id===r?{...b,...u}:b))},Ve=async r=>{if(r.preventDefault(),!!w&&!U){if(!A.trim()){P.error("請輸入回覆內容");return}try{pe(!0);let u=0;const g=[],b=new Set;if(V.length>0){M(E=>E.map(C=>C.status==="success"?C:{...C,status:"uploading",error:null}));for(const E of V){if(E.status==="success"&&E.attachmentId){g.push(E.attachmentId);continue}try{const C=await pt(w.TicketId,E.file);g.push(C.AttachmentId),ge(E.id,{status:"success",error:null,attachmentId:C.AttachmentId})}catch(C){u+=1,b.add(E.id);const qe=C instanceof Error?C.message:"附件上傳失敗";ge(E.id,{status:"error",error:qe})}}}const D=g.length>0?{Body:A.trim(),AttachmentIds:g}:{Body:A.trim()};if(u>0&&g.length===0){P.error(`有 ${u} 個附件上傳失敗,請重試後再送出回覆`);return}await bt(w.TicketId,D);const L=await de(w.TicketId);N(L.Ticket),y(L.Messages??[]),F(""),M(E=>u>0?E.filter(C=>b.has(C.id)).map(C=>({...C,status:"pending",error:null})):[]),W(),u>0?P.warning(`回覆已送出,但有 ${u} 個附件上傳失敗,可重新輸入說明後補上`):P.success("回覆已送出")}catch(u){console.error("回覆客服案件失敗",u),P.error(u instanceof Error?u.message:"回覆客服案件失敗")}finally{pe(!1)}}};return e.jsxs("div",{className:"bg-gray-50 min-h-screen",children:[e.jsxs("div",{className:"container mx-auto px-4 py-10",children:[e.jsxs("div",{className:"flex flex-row items-center justify-between",children:[e.jsx("div",{children:e.jsx("h1",{className:"text-2xl font-bold text-black",children:"客服中心"})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(H,{variant:"outline",className:"border-black text-black hover:bg-black/5",onClick:()=>z(!0),children:"回報返利回饋遺失"}),e.jsx(H,{className:"bg-black text-white hover:bg-black/85",onClick:()=>O(!0),children:"新增問題"})]})]}),e.jsxs(Qe,{className:"mt-8 border shadow-xs bg-white",children:[e.jsx(et,{className:"border-b border-gray-100",children:e.jsxs(tt,{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[e.jsxs(vt,{value:c,onValueChange:r=>{i(r),l(u=>({...u,Page:1}))},children:[e.jsx(wt,{className:"h-10 text-sm font-normal w-full md:w-[180px]",children:e.jsx(St,{placeholder:"選擇狀態"})}),e.jsx(yt,{children:ue.map(r=>e.jsx(jt,{value:r.value,children:r.label},r.value))})]}),e.jsxs("div",{className:"relative w-full md:w-64",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-black/40",children:e.jsx(rt,{className:"h-4 w-4"})}),e.jsx(ve,{placeholder:"搜尋案件編號或關鍵字",className:"h-10 text-sm pl-9",value:d,onChange:r=>{h(r.target.value),l(u=>({...u,Page:1}))}})]})]})}),e.jsxs(st,{className:"p-0",children:[p?e.jsx("div",{className:"py-20 px-6 text-center text-sm text-black/50",children:"載入中..."}):n.length===0?e.jsx("div",{className:"py-20 px-6 text-center text-sm text-black/50",children:"尚無客服案件紀錄,您可以透過「新增問題」告訴我們。"}):e.jsx("div",{className:"divide-y divide-gray-100",children:n.map(r=>e.jsxs("div",{className:"flex flex-col gap-4 px-6 py-5 transition-colors hover:bg-gray-50 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 md:gap-2 md:justify-start",children:[e.jsx("span",{className:"text-sm font-medium text-black",children:r.TicketNumber}),e.jsx(je,{className:Ce[r.Status]??"bg-gray-100 text-gray-600",children:ue.find(u=>u.value===r.Status)?.label??r.Status})]}),e.jsx("div",{className:"text-base font-medium text-black",children:J(r.Category)||"未分類"}),e.jsx("div",{className:"text-xs text-black/60",children:Q(r.Category,r.IssueType)||"-"}),e.jsxs("div",{className:"text-xs text-black/50",children:["建立時間:",te(r.CreatedAt)," · 最近更新:",te(r.UpdatedAt)]})]}),e.jsx(H,{variant:"outline",className:"w-full md:w-auto",onClick:()=>Xe(r),children:"檢視詳情"})]},r.TicketId))}),v&&!p&&e.jsx("div",{className:"border-t border-red-100 bg-red-50 px-4 py-3 text-sm text-red-600",children:v}),!p&&n.length>0&&e.jsxs("div",{className:"border-t border-gray-100 px-4 py-4",children:[e.jsxs("div",{className:"mb-4 text-sm text-black/60",children:["共 ",o.Total??n.length," 筆 · 第 ",o.Page," /"," ",o.TotalPages??"?"," 頁"]}),(o.TotalPages??1)>1&&e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[e.jsxs("button",{onClick:()=>l(r=>({...r,Page:Math.max(1,r.Page-1)})),disabled:o.Page<=1,className:`flex items-center px-3 py-2 rounded text-sm transition-colors ${o.Page<=1?"text-black/30 cursor-not-allowed":"text-black/60 hover:text-black hover:bg-black/5"}`,children:[e.jsx(ot,{className:"h-4 w-4 mr-1"}),"上一頁"]}),e.jsx("div",{className:"flex space-x-1",children:Array.from({length:o.TotalPages??1},(r,u)=>u+1).map(r=>e.jsx("button",{onClick:()=>l(u=>({...u,Page:r})),className:`px-3 py-2 rounded text-sm transition-colors ${o.Page===r?"bg-black text-white":"text-black/60 hover:text-black hover:bg-black/5"}`,children:r},r))}),e.jsxs("button",{onClick:()=>l(r=>({...r,Page:Math.min(o.TotalPages??1,r.Page+1)})),disabled:o.TotalPages?o.Page>=o.TotalPages:!1,className:`flex items-center px-3 py-2 rounded text-sm transition-colors ${o.TotalPages&&o.Page>=o.TotalPages?"text-black/30 cursor-not-allowed":"text-black/60 hover:text-black hover:bg-black/5"}`,children:["下一頁",e.jsx(at,{className:"h-4 w-4 ml-1"})]})]})]})]})]})]}),e.jsx(ye,{mode:"cashbackMissing",isOpen:_,onClose:()=>z(!1),metadata:{Source:"consumer-frontend/support-page/cashback-missing"},contextPath:"/support",...typeof window<"u"&&window.location.href?{contextUrl:window.location.href}:{},onSubmitted:()=>{z(!1),W()},onTicketCreated:()=>{W()}}),e.jsx(ye,{isOpen:B,onClose:()=>{O(!1),ie({})},metadata:{Source:"consumer-frontend/support-page"},contextPath:"/support",...ce.OrderNumber||ce.StoreName?{prefill:ce}:{},...typeof window<"u"&&window.location.href?{contextUrl:window.location.href}:{},onSubmitted:()=>{O(!1),ie({}),W()},onTicketCreated:()=>{W()}}),e.jsx(nt,{open:K,onOpenChange:r=>{r&&k(!0)},children:e.jsxs(lt,{className:`${ft} flex flex-col [&>button]:hidden md:!w-[48rem] md:!max-w-[calc(100vw-2rem)]`,onPointerDownOutside:r=>r.preventDefault(),onInteractOutside:r=>r.preventDefault(),onEscapeKeyDown:r=>r.preventDefault(),children:[e.jsx(ct,{className:"flex-shrink-0 space-y-2 border-b px-4 py-4 text-left md:px-6",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(it,{className:"pr-2 text-xl font-semibold text-black",children:w?`客服案件 ${w.TicketNumber}`:"客服案件詳情"}),e.jsxs(H,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",onClick:()=>Ye(),children:[e.jsx(we,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"關閉"})]})]})}),e.jsx("div",{className:"min-h-0 flex-1 space-y-6 overflow-y-auto px-4 py-4 md:px-6",children:$?e.jsx("div",{className:"py-16 text-center text-sm text-black/50",children:"載入詳情中..."}
1):w?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 flex-1",children:[e.jsx(je,{className:Ce[w.Status]??"bg-gray-100 text-gray-600",children:ue.find(r=>r.value===w.Status)?.label??w.Status}),e.jsxs("span",{className:"text-sm text-black/60",children:["建立於 ",te(w.CreatedAt)]})]}),e.jsx(H,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>We(!le),children:e.jsx(dt,{className:`h-4 w-4 transition-transform duration-200 ${le?"":"-rotate-90"}`})})]}),le&&e.jsx(e.Fragment,{children:(J(w.Category)||Q(w.Category,w.IssueType))&&e.jsxs("div",{className:"mt-3 space-y-1 text-sm text-black/70",children:[J(w.Category)&&e.jsxs("div",{children:["分類:",J(w.Category)]}),Q(w.Category,w.IssueType)&&e.jsxs("div",{children:["主題:",Q(w.Category,w.IssueType)]})]})})]}),e.jsx(Be,{className:"h-[400px] rounded-md border border-gray-200",children:e.jsxs("div",{className:"space-y-4 p-4",children:[S.length===0&&e.jsx("div",{className:"py-6 text-center text-sm text-black/50",children:"尚無訊息紀錄"}),S.map(r=>{const u=r.BodyHtml?ht.sanitize(r.BodyHtml):null,g=r.AuthorType==="consumer";return e.jsxs("div",{className:`mb-4 flex items-end gap-2 ${g?"flex-row-reverse":"flex-row"}`,children:[!g&&e.jsx("img",{src:"/media/CashBack-logo-circle.png",alt:"客服",className:"h-8 w-8 flex-shrink-0 rounded-full object-cover"}),e.jsx("div",{className:`relative ${g?"max-w-[85%]":"max-w-[75%]"}`,children:e.jsxs("div",{className:`rounded-2xl px-4 py-3 ${g?"rounded-br-sm bg-gray-100 text-black":"rounded-bl-sm bg-gray-300 text-black"}`,children:[e.jsx("div",{className:"text-sm leading-relaxed",children:u?e.jsx("div",{className:"markdown",dangerouslySetInnerHTML:{__html:u}}):e.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:r.Body})}),r.Attachments&&r.Attachments.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:r.Attachments.map(b=>e.jsxs("a",{href:b.CdnUrl||b.ObjectPath,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-black/70 hover:text-black",children:[e.jsx(Ct,{className:"h-4 w-4"}),e.jsx("span",{children:b.FileName})]},b.AttachmentId))}),e.jsx("div",{className:"mt-2 text-xs text-black/50",children:te(r.CreatedAt)})]})})]},r.MessageId)})]})})]}):e.jsx("div",{className:"py-16 text-center text-sm text-black/50",children:"無法載入客服案件資訊"})}),e.jsx("form",{onSubmit:Ve,className:"border-t bg-background px-4 py-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] md:px-6",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{children:e.jsx(Nt,{placeholder:"請輸入回覆內容...",value:A,onChange:r=>F(r.target.value),rows:4,disabled:U})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ve,{id:"support-reply-attachment",type:"file",accept:".jpg,.jpeg,.png,.pdf",multiple:!0,className:"hidden",onChange:$e,disabled:U}),e.jsxs(H,{type:"button",variant:"outline",className:"gap-2",onClick:()=>document.getElementById("support-reply-attachment")?.click(),disabled:U||V.length>=ee,children:[e.jsx(xt,{className:"h-4 w-4"}),"附加檔案"]}),e.jsxs("span",{className:"text-xs text-black/50",children:[V.length,"/",ee]})]}),V.length>0&&e.jsx("div",{className:"space-y-2",children:V.map(r=>e.jsxs("div",{className:"flex items-center justify-between rounded-md border border-gray-200 bg-gray-50 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm text-black",children:r.file.name}),e.jsxs("span",{className:"text-xs text-black/50",children:[(r.file.size/1024/1024).toFixed(2)," MB"]}),r.status==="uploading"&&e.jsxs("span",{className:"mt-1 flex items-center gap-1 text-xs text-blue-600",children:[e.jsx(Se,{className:"h-3 w-3 animate-spin"})," 上傳中"]}),r.status==="success"&&e.jsx("span",{className:"mt-1 text-xs text-green-600",children:"已上傳"}),r.status==="error"&&e.jsxs("span",{className:"mt-1 flex items-center gap-1 text-xs text-red-600",children:[e.jsx(ut,{className:"h-3 w-3"}),r.error??"上傳失敗"]}),r.status==="pending"&&e.jsx("span",{className:"mt-1 text-xs text-black/50",children:"尚未上傳"})]}),e.jsx(H,{type:"button",variant:"ghost",size:"icon",onClick:()=>Fe(r.id),disabled:r.status==="uploading"||r.status==="success"||U,children:e.jsx(we,{className:"h-4 w-4"})})]},r.id))})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(H,{type:"submit",className:"bg-black text-white hover:bg-black/85",disabled:U,children:[U&&e.jsx(Se,{className:"mr-2 h-4 w-4 animate-spin"}),"發送回覆"]})})]})})]})})]})};export{tr as default};

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.