1import{g as A,u as N,j as e}from"./index-CmawXwhp.js";import{a0 as l,S as F,k as K,Y as M,U as w}from"./vendor-icons-CmtbFRhB.js";import{P as L}from"./PageHeader-B_xdAc5E.js";import{C as S}from"./Card-DE-byskL.js";import{S as v}from"./StatCard-DkK21lWb.js";import{L as $}from"./LoadErrorCard-D9EmSEbm.js";import{D}from"./DataProvider-D8exVQeK.js";import{g as P,a as z,C as E,X as W,Y as I,T as V,A as G}from"./vendor-charts-DvBYz3sx.js";import"./Badge-Cvwwqv1A.js";const f=n=>n==null?"â":Number(n).toLocaleString(),H=n=>n==null?"â":`Â¥${Number(n).toLocaleString()}`,O=n=>n==null?"â":`${Number(n).toFixed(2)}%`;function se(){const{lang:n}=A(),r=n==="ja";N(r?"UUã»CVRã»å£²ä¸ æ¨ç§» | SyncBridge":"Access Trends | SyncBridge",r?"鱿¬¡ã»ææ¬¡ã§UU/CVR/売ä¸ä»¶æ°/売ä¸é¡ã®æ¨ç§»ãè¦ãã":"UU/CVR/order-count/sales trends across weekly or monthly periods.");const[o,k]=l.useState("month"),[j,U]=l.useState(""),[i,b]=l.useState(""),[C,h]=l.useState(!0),[c,_]=l.useState(null);l.useEffect(()=>{h(!0),D.getActiveProvider().getAccessTrendSeries(o,i||void 0).then(t=>{_(t),h(!1)}).catch(t=>{console.error("Failed to load access trends:",t),h(!1)})},[o,i]);const p=(c==null?void 0:c.points)||[],g=p.length>0,u=l.useMemo(()=>{if(!g)return[];if(i)return p.map(s=>({...s,label:s.period_start}));const t=new Map;return p.forEach(s=>{const y=s.period_start,d=t.get(y)||{period_start:s.period_start,period_end:s.period_end,uu:0,sales_count:0,sales_amount:0,cvrSum:0,cvrN:0};d.uu+=s.uu,d.sales_count+=s.sales_count,d.sales_amount+=s.sales_amount,s.cvr!=null&&(d.cvrSum+=s.cvr,d.cvrN+=1),t.set(y,d)}),[...t.values()].sort((s,y)=>s.period_start.localeCompare(y.period_start)).map(s=>({...s,cvr:s.cvrN?s.cvrSum/s.cvrN:null,label:s.period_start}))},[p,g,i]),a=u[u.length-1],m=u[u.length-2],x=a&&m&&m.uu?(a.uu-m.uu)/m.uu*100:null,T=x!=null&&x>=0,R=t=>o==="month"?t.slice(0,7):t.slice(5);return e.jsxs(e.Fragment,{children:[e.jsx(L,{title:r?"UUã»CVRã»å£²ä¸ æ¨ç§» / Access Trends":"Access Trends",statusText:i?r?`対象SKU: ${i}`:`SKU: ${i}`:r?"å
¨SKUåç®":"All SKUs, aggregated",helpLink:"/sales/rms-fetch"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-6)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-4)",flexWrap:"wrap"},children:[e.jsx("div",{style:{display:"flex",gap:"var(--space-2)"},children:[{key:"month",ja:"ææ¬¡",en:"Monthly"},{key:"week",ja:"鱿¬¡",en:"Weekly"}].map(t=>{const s=t.key===o;return e.jsx("button",{onClick:()=>k(t.key),"aria-label":r?t.ja:t.en,style:{minHeight:"36px",padding:"0 var(--space-4)",fontSize:"13px",fontWeight:600,cursor:"pointer",borderRadius:"18px",border:s?"1px solid var(--lysin-accent)":"1px solid var(--lysin-border)",backgroundColor:s?"var(--lysin-accent)":"var(--lysin-surface)",color:s?"#fff":"var(--lysin-text)"},children:r?t.ja:t.en},t.key)})}),e.jsxs("form",{onSubmit:t=>{t.preventDefault(),b(j.trim())},style:{display:"flex",alignItems:"center",gap:"var(--space-2)"},children:[e.jsx(F,{size:14,style:{color:"var(--lysin-text-muted)"}}),e.jsx("input",{type:"text",value:j,onChange:t=>U(t.target.value),placeholder:r?"SKUï¼ç©ºæ¬=å
¨ä½ï¼":"SKU (blank = all)",style:{padding:"6px 10px",borderRadius:6,border:"1px solid var(--lysin-border)",background:"var(--lysin-surface)",color:"var(--lysin-text)",fontSize:13,width:160}})]})]}),C?e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"250px",color:"var(--lysin-text-muted)",fontFamily:"monospace"},children:[e.jsx(K,{size:16,style:{marginRight:8,animation:"spin 2s linear infinite"}})," Loadingâ¦"]}):c!=null&&c.load_error?e.jsx($,{}):g?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"var(--space-4)"},children:[e.jsx(v,{title:"UU",value:f(a==null?void 0:a.uu),icon:M,description:x!=null?`${T?"â²":"â¼"} ${Math.abs(x).toFixed(1)}% ${o==="month"?"MoM":"WoW"}`:void 0}),e.jsx(v,{title:"CVR",value:O(a==null?void 0:a.cvr),icon:w}),e.jsx(v,{title:r?"売ä¸ä»¶æ°":"Orders",value:f(a==null?void 0:a.sales_count)}),e.jsx(v,{title:r?"売ä¸é¡":"Sales",value:H(a==null?void 0:a.sales_amount)})]}),e.jsx(S,{title:r?"UU æ¨ç§»":"UU Trend",subtitle:r?`${o==="month"?"ææ¬¡":"鱿¬¡"}
1 · rakuten_access_analysis ããç´æ¥ç®åºï¼NEåæ³¨ã§ã¯ãªã楽天ç¬èªã®å®ç¸¾å¤ï¼`:`${o==="month"?"Monthly":"Weekly"} · derived directly from rakuten_access_analysis (Rakuten's own attributed figures, not NE order revenue)`,children:e.jsx("div",{style:{width:"100%",height:260},children:e.jsx(P,{children:e.jsxs(z,{data:u,margin:{top:8,right:12,left:0,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"accessTrendUu",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--lysin-accent)",stopOpacity:.28}),e.jsx("stop",{offset:"100%",stopColor:"var(--lysin-accent)",stopOpacity:.02})]})}),e.jsx(E,{strokeDasharray:"3 3",stroke:"var(--lysin-border)",vertical:!1}),e.jsx(W,{dataKey:"label",tickFormatter:R,stroke:"var(--lysin-text-muted)",fontSize:11,tickLine:!1}),e.jsx(I,{tickFormatter:t=>f(t),stroke:"var(--lysin-text-muted)",fontSize:11,tickLine:!1,width:52}),e.jsx(V,{contentStyle:{backgroundColor:"var(--lysin-card)",borderColor:"var(--lysin-border)"},formatter:t=>[f(t),"UU"]}),e.jsx(G,{type:"monotone",dataKey:"uu",name:"UU",stroke:"var(--lysin-accent)",strokeWidth:2.2,fill:"url(#accessTrendUu)"})]})})})})]}):e.jsx(S,{title:r?"ãã¼ã¿ãããã¾ãã":"No data yet",children:e.jsx("div",{style:{fontSize:14,color:"var(--lysin-text-muted)",lineHeight:1.7},children:r?"æå®ããç²åº¦ã»SKUã§åååæãã¼ã¿ãè¦ã¤ããã¾ãããRMSåå¾ããã«ããã¢ãããã¼ãããã¨è¡¨ç¤ºããã¾ãã":"No åååæ data for this grain/SKU. Upload via the RMS Fetch Panel and it appears here."})})]})]})}export{se 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.