PageSourceSearch

https://www.pockest.com/assets/AnalyticsOverviewPanel-BhVZmpS0.js

js pockest.com collected 2026-09-24 14:50:18 UTC 11,152 bytes, 13 lines download raw bytes

1import{c as e,r as s,j as a,h as t,i as l,S as r}from"./main-DnEwdPd8.js";import{a as n}from"./clickLogs-DURmdQvH.js";import{G as i}from"./globe-WSwsd6nC.js";import{T as c}from"./triangle-alert-B1iHYsKt.js";
2/**
3 * @license lucide-react v0.460.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const d=e("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]),o=e("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),m=e("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]),x=e("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]),h=e("WalletCards",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]]),p=[{label:"최근 7일",value:"7d"},{label:"최근 30일",value:"30d"},{label:"최근 90일",value:"90d"}],u=Array.from({length:24},(e,s)=>`${String(s).padStart(2,"0")}시`),g=e=>"7d"===e?7:"90d"===e?90:30,j=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,y=(e,s)=>0===s?0===e?0:100:(e-s)/s*100,f=({value:e})=>{const s=e>=0,t=s?o:d;return a.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-semibold "+(s?"text-emerald-600":"text-red-600"),children:[a.jsx(t,{className:"w-3.5 h-3.5"}),Math.abs(e).toFixed(1),"%"]})};
8/**
9 * @license lucide-react v0.460.0 - ISC
10 *
11 * This source code is licensed under the ISC license.
12 * See the LICENSE file in the root directory of this source tree.
13 */function N({platforms:e}){const[d,o]=s.useState("30d"),[N,b]=s.useState(!1),[v,w]=s.useState(""),[k,S]=s.useState([]),[M,D]=s.useState([]);s.useEffect(()=>{(async()=>{b(!0),w("");try{const e=g(d),s=Date.now(),a=864e5,t=new Date(s-e*a).toISOString(),l=new Date(s-2*e*a).toISOString(),{currentLogs:r,previousLogs:i}=await n(t,l);S(r),D(i)}catch(e){(e instanceof Error?e.message:String(e)).toLowerCase().includes("row-level security")?w("통계 조회 권한이 없습니다. click_logs SELECT 정책을 확인해주세요."):w("통계 데이터를 불러오지 못했습니다. 잠시 후 다시 시도해주세요.")}finally{b(!1)}})()},[d]);const C=s.useMemo(()=>new Map(e.map(e=>[e.id,e.name])),[e]),L=s.useMemo(()=>{const e=k.length,s=M.length,a=new Set(k.map(e=>e.user_id).filter(Boolean)).size,t=new Set(M.map(e=>e.user_id).filter(Boolean)).size,l=k.filter(e=>Boolean(e.platform_id)).length,r=M.filter(e=>Boolean(e.platform_id)).length,n=e>0?l/e*100:0,i=s>0?r/s*100:0,c=new Set(k.map(e=>e.item_id).filter(Boolean)).size,d=new Set(M.map(e=>e.item_id).filter(Boolean)).size;return{totalClicks:e,totalClicksDelta:y(e,s),uniqueUsers:a,uniqueUsersDelta:y(a,t),mappedRate:n,mappedRateDelta:y(n,i),uniqueItems:c,uniqueItemsDelta:y(c,d)}},[k,M]),_=s.useMemo(()=>{const e=new Map;
13k.forEach(s=>{const a=s.platform_id||"unmapped";e.set(a,(e.get(a)||0)+1)});const s=k.length||1;return Array.from(e.entries()).map(([e,a])=>({platformId:e,name:"unmapped"===e?"미매핑":C.get(e)||"알 수 없는 플랫폼",count:a,rate:a/s*100})).sort((e,s)=>s.count-e.count).slice(0,6)},[k,C]),q=s.useMemo(()=>{const e=new Map;return k.forEach(s=>{const a=(e=>{if(!e)return"알 수 없음";try{return new URL(e).hostname.replace(/^www\./,"")}catch{return"알 수 없음"}})(s.original_url);e.set(a,(e.get(a)||0)+1)}),Array.from(e.entries()).map(([e,s])=>({domain:e,count:s})).sort((e,s)=>s.count-e.count).slice(0,8)},[k]),R=s.useMemo(()=>{const e=g(d),s=new Date,a=new Map;for(let r=e-1;r>=0;r-=1){const e=new Date(s.getTime()-24*r*60*60*1e3),t=j(e);a.set(t,0)}k.forEach(e=>{const s=j(new Date(e.clicked_at));a.has(s)&&a.set(s,(a.get(s)||0)+1)});const t=Array.from(a.entries()).map(([e,s])=>({date:e,label:e.slice(5),count:s})),l=Math.max(...t.map(e=>e.count),1);return{points:t,maxCount:l}},[k,d]),z=s.useMemo(()=>{const e=Array.from({length:24},()=>0);
13k.forEach(s=>{const a=new Date(s.clicked_at).getHours();e[a]+=1});const s=Math.max(...e,1);return e.map((e,a)=>({hour:a,label:u[a],count:e,ratio:e/s*100}))},[k]),A=s.useMemo(()=>{const e=[];return L.mappedRate<60&&e.push("제휴 매핑률이 60% 미만입니다. 도메인 매칭/활성 플랫폼 설정을 점검하세요."),L.totalClicksDelta<-20&&e.push("이전 기간 대비 클릭수가 20% 이상 감소했습니다. 최근 등록 쇼핑몰/상품 클릭 동선을 점검하세요."),L.uniqueUsersDelta<-15&&e.push("활성 사용자 수가 감소 중입니다. 신규 유입(저장 버튼 노출/온보딩) 개선이 필요합니다."),0===e.length&&e.push("현재 주요 지표가 안정적입니다. 상위 플랫폼/도메인 성과를 유지하세요."),e},[L]);return N?a.jsx(t,{children:a.jsx(l,{className:"p-6 text-sm text-gray-600",children:"통계 데이터를 불러오는 중입니다..."})}):v?a.jsx(t,{children:a.jsx(l,{className:"p-6",children:a.jsx("div",{className:"rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700",children:v})})}):a.jsxs("div",{className:"space-y-4",children:[a.jsx(t,{children:a.jsxs(l,{className:"p-6 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-gray-900",children:"운영 통계 개요"}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"GA 핵심 지표를 운영 관점으로 단순화해 제공합니다."})]}),a.jsx("div",{className:"w-40",children:a.jsx(r,{value:d,onChange:o,options:p})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-3",children:[a.jsx(t,{className:"border-gray-200",children:a.jsxs(l,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"총 클릭 이벤트"}),a.jsx(m,{className:"w-4 h-4 text-primary-500"})]}),a.jsx("div",{className:"text-2xl font-bold text-gray-900",children:L.totalClicks.toLocaleString()}),a.jsx(f,{value:L.totalClicksDelta})]})}),a.jsx(t,{className:"border-gray-200",children:a.jsxs(l,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"활성 사용자"}),a.jsx(x,{className:"w-4 h-4 text-indigo-500"})]}),a.jsx("div",{className:"text-2xl font-bold text-gray-900",children:L.uniqueUsers.toLocaleString()}),a.jsx(f,{value:L.uniqueUsersDelta})]})}),a.jsx(t,{className:"border-gray-200",children:a.jsxs(l,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"제휴 매핑률"}),a.jsx(h,{className:"w-4 h-4 text-emerald-500"})]}),a.jsxs("div",{className:"text-2xl font-bold text-gray-900",children:[L.mappedRate.toFixed(1),"%"]}),a.jsx(f,{value:L.mappedRateDelta})]})}),a.jsx(t,{className:"border-gray-200",children:a.jsxs(l,{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-xs text-gray-500",children:"클릭된 상품 수"}),a.jsx(i,{className:"w-4 h-4 text-amber-500"})]}),a.jsx("div",{className:"text-2xl font-bold text-gray-900",children:L.uniqueItems.toLocaleString()}),a.jsx(f,{value:L.uniqueItemsDelta})]})})]})]})}),a.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[a.jsx(t,{children:a.jsxs(l,{className:"p-6",children:[a.jsx("h3",{className:"text-base font-bold text-gray-900 mb-4",children:"일자별 클릭 추세"}),a.jsx("div",{className:"space-y-2",children:R.points.map(e=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"w-14 text-xs text-gray-500",children:e.label}),a.jsx("div",{className:"flex-1 h-2.5 bg-gray-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-primary-500 rounded-full",style:{width:e.count/R.maxCount*100+"%"}})}),a.jsx("span",{className:"w-10 text-right text-xs font-semibold text-gray-700",children:e.count})]},e.date))})]})}),a.jsx(t,{children:a.jsxs(l,{className:"p-6",children:[a.jsx("h3",{className:"text-base font-bold text-gray-900 mb-4",children:"상위 플랫폼 기여도"}),a.jsxs("div",{className:"space-y-3",children:[0===_.length&&a.jsx("div",{className:"text-sm text-gray-500",children:"표시할 데이터가 없습니다."}),_.map(e=>a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsx("span",{className:"font-medium text-gray-800",children:e.name}),a.jsxs("span",{className:"text-gray-600",children:[e.count.toLocaleStr
13ing()," (",e.rate.toFixed(1),"%)"]})]}),a.jsx("div",{className:"h-2.5 bg-gray-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-indigo-500 rounded-full",style:{width:`${e.rate}%`}})})]},e.platformId))]})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[a.jsx(t,{children:a.jsxs(l,{className:"p-6",children:[a.jsx("h3",{className:"text-base font-bold text-gray-900 mb-4",children:"시간대별 클릭 분포"}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:z.map(e=>a.jsxs("div",{className:"rounded-lg border border-gray-200 p-2",children:[a.jsx("div",{className:"text-xs text-gray-500 mb-1",children:e.label}),a.jsx("div",{className:"h-1.5 bg-gray-100 rounded-full overflow-hidden mb-1",children:a.jsx("div",{className:"h-full bg-emerald-500 rounded-full",style:{width:`${e.ratio}%`}})}),a.jsx("div",{className:"text-xs font-semibold text-gray-700",children:e.count})]},e.hour))})]})}),a.jsx(t,{children:a.jsxs(l,{className:"p-6",children:[a.jsx("h3",{className:"text-base font-bold text-gray-900 mb-4",children:"상위 유입 도메인"}),a.jsxs("div",{className:"space-y-2",children:[0===q.length&&a.jsx("div",{className:"text-sm text-gray-500",children:"표시할 데이터가 없습니다."}),q.map(e=>a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-gray-200 px-3 py-2 text-sm",children:[a.jsx("span",{className:"font-medium text-gray-800",children:e.domain}),a.jsx("span",{className:"text-gray-600",children:e.count.toLocaleString()})]},e.domain))]})]})})]}),a.jsx(t,{children:a.jsxs(l,{className:"p-6",children:[a.jsx("h3",{className:"text-base font-bold text-gray-900 mb-3",children:"운영 인사이트"}),a.jsx("div",{className:"space-y-2",children:A.map((e,s)=>a.jsxs("div",{className:"flex items-start gap-2 text-sm text-gray-700",children:[a.jsx(c,{className:"w-4 h-4 mt-0.5 text-amber-500"}),a.jsx("span",{children:e})]},`${e}-${s}`))})]})})]})}export{N as AnalyticsOverviewPanel};

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.