1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9726],{4482:()=>{},7649:(e,t,a)=>{"use strict";a.d(t,{v:()=>r});var l=a(37876),s=a(57586);function r(e,t="USD"){return"USD"===t?(0,l.jsxs)("span",{className:"Currency",children:[(0,l.jsx)("span",{className:"Symbol",children:"$"}),(0,s.zJ)(e,2,!0)]}):"CAD"===t?(0,l.jsxs)("span",{className:"Currency",children:[(0,l.jsx)("span",{className:"Symbol",children:"$"}),(0,s.zJ)(e,2,!0),(0,l.jsx)("span",{className:"Code",children:t})]}):(0,l.jsxs)("span",{className:"Currency",children:[(0,s.zJ)(e,2,!0),(0,l.jsx)("span",{className:"Code",children:t})]})}},16548:(e,t,a)=>{"use strict";a.d(t,{b:()=>l});var l,s=a(58076);(l||(l={})).call=async e=>await s.u.fetch("zazzle/royalty/list",e)},23842:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>z});var l,s=a(37876),r=a(17328),o=a(89099),n=a(23091),i=a(16548),c=a(65507),d=a(57586),u=a(13902),p=a(14232),m=a(84989),h=a(40530),y=a(89555),g=a(90617),f=a(26683),x=a(72102),v=a(47040),j=a(58076);(l||(l={})).call=async e=>await j.u.fetch("zazzle/royalty/summary",e);var w=a(7649),S=a(70630),C=a(95386),b=a(99136),_=a(32702);function z(){let e=(0,o.useRouter)().query.acode,[t,a]=(0,p.useState)(1),j=(0,r.s)({fetch:()=>n.P.call({code:e,includeDisabled:!0}),suppress:()=>!e},[e]),z=j.data?.item,N=z?.id,F=(0,r.s)({fetch:()=>l.call({agencyId:N}),suppress:()=>!N},[N,t]),k=(0,r.s)({fetch:e=>i.b.call({...e,agencyId:N,take:1}),suppress:()=>!N},[N,t]),I=(0,r.s)({fetch:e=>i.b.call({...e,agencyId:N,fromDate:(0,u.lY)(new Date)?.toISOString(),take:1}),suppress:()=>!N},[N,t]),D=(0,r.s)({fetch:e=>i.b.call({...e,agencyId:N,fromDate:(0,u.GS)(new Date)?.toISOString(),take:1}),suppress:()=>!N},[N,t]),T=(0,u.GS)(new Date),P=(0,u.GS)((0,u.fi)(T,-1)),J=(0,r.s)({fetch:e=>i.b.call({...e,agencyId:N,fromDate:P.toISOString(),toDate:(0,u.ps)(T,-1)?.toISOString(),take:1}),suppress:()=>!N},[N,t]),U=(0,r.s)({fetch:()=>g.K.call({groupByTime:"year",groupBySeries:"store",agencyId:N,fromDate:new Date().toISOString(),toDate:new Date().toISOString()}),suppress:()=>!N},[N,t]),R=(0,r.s)({fetch:()=>g.K.call({groupByTime:"month",groupBySeries:"store",agencyId:N,fromDate:T.toISOString(),toDate:T.toISOString()}),suppress:()=>!N},[N,t]),$=(0,r.s)({fetch:()=>g.K.call({groupByTime:"month",groupBySeries:"store",agencyId:N,fromDate:P.toISOString(),toDate:P.toISOString()}),suppress:()=>!N},[N,t]);function E(e,t){return t?(0,s.jsx)(c.F,{title:e,collapsable:!0,children:(0,s.jsxs)("div",{className:"WrappedControls",children:[(0,s.jsx)(x.n,{title:"All royalties",tooltip:"Cleared + pending + canceled royalties",prefix:"$",width:"8rem",value:(0,d.zJ)(t.total_royalties,2,!0)}),(0,s.jsx)(x.n,{title:"Canceled",tooltip:"Canceled or refunded orders",prefix:"$",suffix:" ",marginRight:!0,width:"8rem",value:(0,d.zJ)(t.canceled_royalties,2,!0)}),(0,s.jsx)(x.n,{title:"Cleared",tooltip:"Royalties earned that have passed the customer refund period",prefix:"$",suffix:" +",marginLeft:!0,width:"8rem",value:(0,d.zJ)(t.cleared_royalties,2,!0)}),(0,s.jsx)(x.n,{title:"Pending",tooltip:"Royalties that are still pending possible customer refunds",prefix:"$",suffix:" =",width:"8rem",value:(0,d.zJ)(t.pending_royalties,2,!0)}),(0,s.jsx)(x.n,{title:"Actual",tooltip:"Cleared + pending royalties",prefix:"$",width:"8rem",value:(0,d.zJ)(t.cleared_royalties+t.pending_royalties,2,!0)})]})}):(0,s.jsx)(c.F,{title:e,collapsable:!0,children:(0,s.jsx)(m.y,{})})}function O(e,t){if(!t)return(0,s.jsx)(c.F,{title:e,collapsable:!0,children:(0,s.jsx)(m.y,{})});let a=t?.listSeries.rows.filter(e=>e.royalty_local>0).sort((e,t)=>t.royalty_local-e.royalty_local).map(e=>({label:e.series,value:+e.royalty_local}))??[];return a=(0,v.y)(a,.05),(0,s.jsx)(c.F,{title:e,collapsable:!0,children:a.length?(0,s.jsx)(f.r,{data:a,style:{height:"20rem"}}):(0,s.jsx)("div",{children:(0,s.jsx)("i",{children:"empty"})})})}return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(y.M,{agencyCode:e,agencyName:z?.name,title:"Sales summary",loading:j.loading,notFound:j.data?void 0:"No such agency",currentTab:"Summary",toolbarButtons:(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(h.ImportZazzleRoyalties,{title:"Import royaltyHistory.csv",agencyId:N,onFreshen:()=>a(e=>e+1)})}),children:[(0,s.jsxs)(c.F,{title:"Royalties qualified for pro level",collapsable:!0,children:[(0,s.jsx)("div",{className:"SmallText BottomMargin",children:(0,s.jsx)("i",{children:"Includes all purchases made in US dollars that have already cleared"})}),F.loading?(0,s.jsx)(m.y,{}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"WrappedControls",children:[(0,s.jsx)(x.n,{title:"Cleared",prefix:"$",width:"8rem",value:(0,d.zJ)(F.data?.cleared_dollar_royalties,2,!0)}),(0,s.jsx)(x.n,{title:"Qualified for",value:F.data?.badge})]})})]}),k.data&&k.data?.list.rows.length>0&&(0,s.jsx)(c.F,{title:"Most recent sale",collapsable:!0,children:(0,s.jsxs)("div",{className:"WrappedControls",children:[(0,s.jsx)(x.n,{title:"Days back",value:(0,d.zJ)((0,u.YM)(k.data.list.rows[0].ordered_at,(0,u.Gq)()))}),(0,s.jsx)(x.n,{title:"Date",value:(0,u.AU)(k.data.list.rows[0].ordered_at)}),(0,s.jsx)(x.n,{title:"Amount",value:(0,w.v)(k.data.list.rows[0].royalty_local,k.data.list.rows[0].local_currency)}),(0,s.jsx)(x.n,{title:"Store",value:k.data.list.rows[0].store_name,afterInput:(0,s.jsx)(S.$,{icon:C.P.HiExternalLink,tooltip:"Edit",onClick:b.JZ.storeEdit(e,k.data.list.rows[0].store_code)})}),(0,s.jsx)(x.n,{title:"Product",value:k.data.list.rows[0].product_name??k.data.list.rows[0].product_type_original_name,afterInput:(0,s.jsx)(S.$,{icon:C.P.HiExternalLink,tooltip:"Edit",onClick:k.data.list.rows[0].product_code?b.JZ.productEdit(e,k.data.list.rows[0].product_code):_.$.productUrl(k.data.list.rows[0].zazzle_product_id)})}),k.data.list.rows[0].product_code&&(0,s.jsx)("img",{alt:"Product thumbnail",src:k.data.list.rows[0].product_thumbnail_url,style:{width:"3rem",marginLeft:"0.25rem",marginBottom:"-0.525rem"}})]})}),E("All-time totals",k.data),E("This year",I.data),E("This month ("+(0,u.g6)(T)+")",D.data),E("Last month ("+(0,u.g6)(P)+")",J.data),O("Royalties per store this year",U.data),O("Royalties per store this month ("+(0,u.g6)(T)+")",R.data),O("Royalties per store last month ("+(0,u.g6)(P)+")",$.data)]})})}},26683:(e,t,a)=>{"use strict";a.d(t,{r:()=>d});var l=a(37876);a(90579);var s=a(14232),r=a(81047),o=a(31134),n=a(39903),i=a(9230),c=a(36365);function d(e){let t=(0,i.hJ)(),a=(0,c.A)(),r=t?"white":void 0,d=(0,s.useMemo)(()=>({color:r,responsive:!0,maintainAspectRatio:!1,style:{outerWidth:"100%"},plugins:{legend:{position:e.legendPosition??"top"},title:{display:!!e.title,text:e.title,color:r}}}),[e.legendPosition,e.title,r]),u=(0,s.useMemo)(()=>({labels:e.data.map(e=>e.label),datasets:[{data:e.data.map(e=>e.value),backgroundColor:e.data.map((e,t)=>e.color??a(t))}]}),[e.data,a]);return(0,l.jsx)("div",{className:"PieChart"+(0,n.cn)(e.className),style:e.style,children:(0,l.jsx)(o.Fq,{options:d,data:u,updateMode:"resize"})})}r.t1.register(r.Bs,r.m_,r.s$)},28564:()=>{},36365:(e,t,a)=>{"use strict";a.d(t,{A:()=>n});var l=a(14232),s=a(9230),r=a(15584),o=a.n(r);function n(){let e=(0,s.Ay)("(prefers-color-scheme: dark)");return(0,l.useCallback)(t=>{if(e){let e=o()("rgb(150, 200, 255)");return(e=e.rotate(77*t).darken(t%30*.03)).string()}{let e=o()("rgb(0, 0, 160)");return(e=e.rotate(77*t).lighten(t%30*.06)).string()}},[e])}},40530:(e,t,a)=>{"use strict";a.r(t),a.d(t,{ImportZazzleRoyalties:()=>f,default:()=>x});var l,s=a(37876);a(88194);var r=a(58076);(l||(l={})).call=async e=>await r.u.fetch("zazzle/royalty/import",e);var o=a(70630),n=a(51562),i=a(84989),c=a(95386),d=a(17405),u=a(99522),p=a(80247),m=a(57586),h=a(62302),y=a(32702),g=a(14232);
1function f(e){let[t,a]=(0,g.useState)(!1),[r,d]=(0,g.useState)(!1);async function f(t){d(!0);try{let s=await t.text(),r=await l.call({agencyId:e.agencyId,content:s});d(!1),r.failure?(0,h.o)("Error",r.failure):((0,h.o)("Success",`Imported ${(0,m.zJ)(r.totalRows)} sales. 2${0===r.newRows?"No new ones found.":1===r.newRows?"One new one found.":(0,m.zJ)(r.newRows)+" new ones found."}`),r.warningUnknownStores&&(0,h.o)("Warning",`Ignored ${(0,m.zJ)(r.warningUnknownStores)} records from unknown stores`),r.warningUnverifiedStores&&(0,h.o)("Warning",`Ignored ${(0,m.zJ)(r.warningUnverifiedStores)} records from unverified stores`),a(!1),e.onFreshen())}catch(e){p.v.error(e),(0,h.o)("Error",e.message),d(!1)}}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.$,{title:e.title,icon:c.P.FaFileUpload,onClick:()=>a(!0)}),(0,s.jsxs)(u.l,{title:"Import royalty history file",show:t,onHide:()=>a(!1),hideOnMaskClick:!0,className:"ImportZazzleRoyalties",actionBar:(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(o.$,{title:"Cancel",icon:c.P.FaTimes,onClick:()=>a(!1)})}),children:[r&&(0,s.jsx)("div",{className:"Importing",children:(0,s.jsx)(i.y,{})}),!r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"CenteredText",children:"Step 1: Export Royalty History from Zazzle"}),(0,s.jsx)("div",{className:"CenteredText",children:(0,s.jsx)(o.$,{flavor:"Solid",title:"Download from Zazzle",icon:c.P.LuImport,linkTarget:"_blank",onClick:y.$.royaltyHistory()+"#page_zWidget4-bottom"})}),(0,s.jsxs)("p",{className:"CenteredText",children:["Step 2: Import ",(0,s.jsx)("b",{children:"royaltyHistory.csv"})," file"]}),(0,s.jsx)("div",{className:"CenteredText",children:(0,s.jsx)(n.g,{flavor:"Solid",title:"Upload to SHD",tooltip:"You can drop the file on me",icon:c.P.FaFileUpload,onFilesUploaded:e=>f(e[0])})})]})]})]})}let x=(0,d.w)()},47040:(e,t,a)=>{"use strict";a.d(t,{y:()=>s});var l=a(57586);function s(e,t=0,a=0,r="Other {value}"){let o=0,n=0,i=(e=[...e]).reduce((e,t)=>e+t.value,0);if(e.length>=3&&(e[e.length-1].value+e[e.length-2].value)/i<=t)for(let l=e.length-1;l>1;l--){let s=e[l];if((!a||l<a)&&(o+s.value)/i>t)break;n++,o+=s.value,e.splice(l,1)}return n&&e.push({label:r.replace("{value}",(0,l.zJ)(n)),value:o,color:"rgba(100, 100, 100, 0.2)"}),e}},48759:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/a/[acode]/edit/sales",function(){return a(23842)}])},51562:(e,t,a)=>{"use strict";a.d(t,{g:()=>d});var l=a(37876),s=a(14232),r=a(70630);a(69778);var o=a(39903),n=a(95386);function i(e){return(0,l.jsx)("div",{className:"FileDropTarget"+(0,o.cn)("Shown",e.show),onDragOverCapture:e=>{e.preventDefault()},onDragLeave:t=>{t.preventDefault(),e.setShow(!1)},onDrop:t=>{if(t.preventDefault(),e.setShow(!1),!t.dataTransfer.files||!t.dataTransfer.files.length)return;let a=[];for(let e=0;e<t.dataTransfer.files.length;e++)a.push(t.dataTransfer.files[e]);e.onFilesDropped(a)},children:(0,l.jsx)("div",{children:(0,l.jsx)(n.P.LuImport,{size:"1.3rem"})})})}let c=1;
2function d(e){let t=function(e){let[t,a]=(0,s.useState)(!1),r=(0,s.useMemo)(()=>({draggable:!0,onDragEnter:e=>{e.preventDefault(),a(!0)}}),[]),o=(0,s.useCallback)(()=>(0,l.jsx)(i,{show:t,setShow:a,onFilesDropped:e}),[t]);return(0,s.useMemo)(()=>({targetProps:r,renderPopup:o}),[o,r])}(e.onFilesUploaded),a=(0,s.useRef)(0),n="FileUploadButton_"+a.current,[d,u]=(0,s.useState)();return(0,s.useEffect)(()=>{let e=document.getElementById(n);if(u(e),!e)return}),(0,s.useEffect)(()=>{a.current=++c},[]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("input",{type:"file",id:n,accept:e.acceptMimeTypes,multiple:e.allowMultipleFiles,style:{display:"none"},onChange:function(t){let a=t.target.files,l=[];for(let e=0;e<a.length;e++)l.push(a[e]);d.value="",e.onFilesUploaded(l)}}),(0,l.jsx)(r.$,{...e,onClick:function(){d?.click()},extraProps:t.targetProps,extraContent:t.renderPopup(),className:"FileUploadButton"+(0,o.cn)(e.className)})]})}},69778:()=>{},72102:(e,t,a)=>{"use strict";a.d(t,{n:()=>o});var l=a(37876);a(4482);var s=a(23500),r=a(39903);function o(e){let t="StaticTextBox"+(0,r.cn)(e.className);return(0,l.jsx)(s.P,{bordered:!0,...e,className:t,autoWidth:void 0===e.autoWidth||e.autoWidth,children:(0,l.jsx)("span",{className:"TextContent"+(0,r.cn)("AllowWrap",e.allowWrap),children:e.value})})}},88194:()=>{},89555:(e,t,a)=>{"use strict";a.d(t,{M:()=>p});var l=a(37876);a(28564);var s=a(39903),r=a(17405),o=a(69186),n=a(95386),i=a(99136),c=a(97105),d=a(57249),u=a(49539);function p(e){let t=e.agencyCode;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.e,{title:(e.agencyName?e.agencyName+" - ":"")+e.title,accessControl:!0}),(0,l.jsxs)(r.O,{...e,loading:e.loading,pretitle:e.agencyName,title:e.title,asManagement:!0,className:"SalesPage"+(0,s.cn)(e.className),tabs:(0,d.agencyEditTabs)(t,!0,!0),currentTab:"Sales",toolbarButtons:void 0,goUpTitle:"this agency",onGoUp:i.JZ.agencyEdit(t),children:[(0,l.jsx)(o.V,{value:e.currentTab,tabs:[{name:"Summary",title:"Summary",icon:n.P.FaChartPie,onClick:i.JZ.sales(t)},{name:"RoyaltyHistory",title:"Royalty History",icon:n.P.FaListUl,onClick:i.JZ.salesRoyaltyHistory(t)},{name:"OverTime",title:"Over time",icon:n.P.FaChartLine,onClick:i.JZ.salesOverTime(t)},{name:"TopLists",title:"Tops & Bottoms",icon:n.P.FaListUl,onClick:i.JZ.salesTopLists(t)},{name:"Customers",title:"Customers",icon:n.P.FaUsers,onClick:i.JZ.salesCustomers(t)},{name:"Alignment",title:"Alignment",icon:n.P.FaChartLine,onClick:i.JZ.salesAlignemnt(t)}],className:"SalesTabs"}),e.toolbarButtons&&(0,l.jsx)(u.M,{centered:!0,className:"ForHeader SalesToolbar",children:e.toolbarButtons}),e.children]})]})}},90579:()=>{},90617:(e,t,a)=>{"use strict";a.d(t,{K:()=>l});var l,s=a(58076);(l||(l={})).call=async e=>await s.u.fetch("zazzle/royalty/over-time",e)}},e=>{e.O(0,[6212,2697,1303,9050,2428,5564,6598,630,4597,4346,4868,8503,4366,3944,3236,5115,636,6593,8792],()=>e(e.s=48759)),_N_E=e.O()}]);
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.