PageSourceSearch

https://portal.archeraffiliates.com/_next/static/chunks/pages/admi…lusive-commission-rates-962ceda5701b3e35.js

js archeraffiliates.com collected 2026-10-04 10:16:21 UTC 24,996 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9137],{46761:function(e,n,t){"use strict";var r=t(82066),i=t(85893);n.Z=(0,r.Z)((0,i.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}),"Delete")},96506:function(e,n,t){"use strict";var r=t(82066),i=t(85893);n.Z=(0,r.Z)((0,i.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search")},36122:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin-international-catalog/exclusive-commission-rates",function(){return t(43131)}])},43131:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return be}});var r=t(85893),i=t(47568),l=t(34051),a=t.n(l),s=t(67294),o=t(64712),c=t(75373),u=(0,s.createContext)({}),d=function(){return(0,s.useContext)(u)};var x=t(26042),h=t(69396),v=t(41997),p=t(11057),f=t(42301),j=t(95179),g=t(57589);function m(e){var n=e.loading,t=(0,g.Av)(),i=(0,j.yT)(),l=i.open,a=i.onOpen,o=i.onClose,c=d(),u=c.search,m=c.asin,Z=c.countryIds,b=c.asinCountryPairs,y=c.brandNames,C=c.clear,S=(0,j.N1)([m,Z,b,y]),A=t?f.AutocompleteFilter:f.DrawerAutocompleteFilter,F=t?f.AutocompleteFilter:f.DrawerAutocompleteFilter,w=(0,s.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,r.jsx)(A,(0,h.Z)((0,x.Z)({},e),{multiple:!0,disableCloseOnSelect:!0,filter:Z,getOptionLabel:function(e){return e.label},renderInput:function(e){return(0,r.jsx)(v.Z,(0,h.Z)((0,x.Z)({},e),{placeholder:"Countries"}))},isOptionEqualToValue:function(e,n){return e.value===n.value},sx:(0,x.Z)({width:"100%"},null===e||void 0===e?void 0:e.sx)}))}),[Z]),_=(0,s.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,r.jsx)(F,(0,h.Z)((0,x.Z)({},e),{multiple:!0,disableCloseOnSelect:!0,filter:y,getOptionLabel:function(e){return e.label},renderInput:function(e){return(0,r.jsx)(v.Z,(0,h.Z)((0,x.Z)({},e),{placeholder:"Brands"}))},isOptionEqualToValue:function(e,n){return e.value===n.value},sx:(0,x.Z)({width:"100%"},null===e||void 0===e?void 0:e.sx)}))}),[y]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(f.ButtonGroup,{justifyContent:"space-between",children:[(0,r.jsx)(f.ButtonGroup,{flex:{xs:1,md:0},children:(0,r.jsx)(f.SearchBar,{value:u.value,sx:{width:{xs:"100%",md:240}},onChange:function(e){return u.setValue(e.target.value)},placeholder:"Search by publisher name"})}),(0,r.jsx)(f.ButtonGroup,{children:(0,r.jsx)(f.ToggleFiltersButton,{onClick:a,applicationsCount:S})})]}),(0,r.jsxs)(f.Drawer,{open:l,onClose:o,anchor:"right",PaperProps:{sx:{maxWidth:480}},children:[(0,r.jsx)(f.DrawerHeader,{onClose:o,title:"Filters ".concat(S>0?"(".concat(S,")"):"")}),(0,r.jsxs)(f.DrawerContent,{children:[(0,r.jsx)(f.DrawerFilter,{label:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.DrawerFilterLabel,{children:"ASIN"}),(0,r.jsx)(f.DrawerFilterClearButton,{filters:[m]})]}),children:(0,r.jsx)(v.Z,{fullWidth:!0,placeholder:"Enter ASIN (partial match)",value:m.value,onChange:function(e){return m.setValue(e.target.value)},disabled:n})}),(0,r.jsx)(f.DrawerFilter,{label:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.DrawerFilterLabel,{children:"Brands"}),(0,r.jsx)(f.DrawerFilterClearButton,{filters:[y]})]}),children:_({boxProps:{flex:1}})}),(0,r.jsx)(f.DrawerFilter,{label:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.DrawerFilterLabel,{children:"Countries"}),(0,r.jsx)(f.DrawerFilterClearButton,{filters:[Z]})]}),children:w({boxProps:{flex:1}})}),(0,r.jsx)(f.DrawerFilter,{label:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.DrawerFilterLabel,{children:"ASIN:Country Pairs"}),(0,r.jsx)(f.DrawerFilterClearButton,{filters:[b]})]}),children:(0,r.jsx)(v.Z,{fullWidth:!0,placeholder:"Format: ASIN:COUNTRY,ASIN:COUNTRY (e.g., B08N5WRWNW:US,B08L5VFJ2L:UK)",value:b.value,onChange:function(e){return b.setValue(e.target.value)},disabled:n,multiline:!0,rows:2,helperText:"Enter ASIN:COUNTRY pairs separated by commas"})})]}),(0,r.jsxs)(f.DrawerActions,{children:[(0,r.jsx)(p.Z,{color:"error",sx:{flex:1},onClick:C,variant:"outlined",children:"Reset"}),(0,r.jsx)(p.Z,{sx:{flex:1},onClick:o,variant:"contained",children:"Done"})]})]})]})}var Z=t(5616),b=t(51233),y=t(15861),C=t(27110),S=t(98456),A=t(90629),F=t(72882),w=t(7906),_=t(53184),D=t(53816),P=t(53252),I=t(295),
1k=(0,t(82066).Z)((0,r.jsx)("path",{d:"M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"}),"Visibility"),O=t(46761),E=t(93946),M=t(95537),N=t(96506),B=t(69368),L=t(50657),z=t(37645),V=t(67720),U=t(6514),R=t(87109),W=t(76295),T=t(87918),q=(0,s.createContext)({}),G=function(){return(0,s.useContext)(q)},H=t(10253),J=t(29815),K=(0,s.createContext)({asinCountryPairs:[],isAllSelectionMode:!1,excludedAsinCountryPairs:[],enterAllSelectionMode:function(){},exitAllSelectionMode:function(){},toggleSelection:function(){},clearSelection:function(){},isSelected:function(){return!1}}),X=function(){return(0,s.useContext)(K)},Y=function(e,n){return"".concat(e,":").concat(n)};function Q(e){var n=e.children,t=(0,s.useState)([]),i=t[0],l=t[1],a=(0,s.useState)(!1),o=a[0],c=a[1],u=(0,s.useState)([]),d=u[0],x=u[1],h=(0,s.useMemo)((function(){return i.map((function(e){var n=(0,H.Z)(e.split(":"),2);return{asin:n[0],country:n[1]}}))}),[i]),v=(0,s.useMemo)((function(){return d.map((function(e){var n=(0,H.Z)(e.split(":"),2);return{asin:n[0],country:n[1]}}))}),[d]),p={asinCountryPairs:h,isAllSelectionMode:o,excludedAsinCountryPairs:v,enterAllSelectionMode:function(){c(!0),x([]),l([])},exitAllSelectionMode:function(){c(!1),l([]),x([])},toggleSelection:function(e,n){var t=Y(e,n);o?x((function(e){return e.includes(t)?e.filter((function(e){return e!==t})):(0,J.Z)(e).concat([t])})):l((function(e){return e.includes(t)?e.filter((function(e){return e!==t})):(0,J.Z)(e).concat([t])}))},clearSelection:function(){l([]),x([]),c(!1)},isSelected:function(e,n){var t=Y(e,n);return o?!d.includes(t):i.includes(t)}};return console.log("Selection Context Value:",p),(0,r.jsx)(K.Provider,{value:p,children:n})}var $=t(95473),ee=t(49128);var ne=t(46901),te=t(31425);function re(e){var n,t,i=e.open,l=e.onClose,a=e.userId,o=e.isAllSelectionMode,u=e.asinCountryPairs,d=e.excludedAsinCountryPairs,x=e.filterValues,h=(0,s.useState)(null),v=h[0],f=h[1],j=(0,c.UD)({onSuccess:function(){l()},onError:function(e){var n,t;console.log("error",e),f((null===e||void 0===e||null===(n=e.response)||void 0===n||null===(t=n.data)||void 0===t?void 0:t.detail)||"Failed to delete rate overrides")}}),g=j.mutate,m=j.isLoading,b=o?d.length:0;return(0,r.jsxs)(L.Z,{open:i,onClose:l,maxWidth:"sm",fullWidth:!0,children:[(0,r.jsx)(z.Z,{children:"Delete Rate Overrides"}),(0,r.jsx)(V.Z,{}),(0,r.jsx)(U.Z,{children:(0,r.jsxs)(Z.Z,{sx:{py:2},children:[v&&(0,r.jsx)(ne.Z,{severity:"error",sx:{mb:2},children:v}),(0,r.jsxs)(y.Z,{variant:"body1",gutterBottom:!0,children:["Are you sure you want to delete"," ",(0,r.jsx)("strong",{children:o?"all matching rate overrides":"".concat(u.length," rate override").concat(1===u.length?"":"s")})," ","for user ",(0,r.jsx)("strong",{children:a}),"?"]}),o&&(0,r.jsxs)(Z.Z,{sx:{mt:2,p:2,bgcolor:"action.hover",borderRadius:1},children:[(0,r.jsx)(y.Z,{variant:"body2",color:"text.secondary",gutterBottom:!0,children:(0,r.jsx)("strong",{children:"Filters applied:"})}),x.brand_names&&x.brand_names.length>0&&(0,r.jsxs)(y.Z,{variant:"body2",color:"text.secondary",children:["\u2022 Brands: ",x.brand_names.join(", ")]}),x.countries&&x.countries.length>0&&(0,r.jsxs)(y.Z,{variant:"body2",color:"text.secondary",children:["\u2022 Countries: ",x.countries.join(", ")]}),void 0!==x.status&&(0,r.jsxs)(y.Z,{variant:"body2",color:"text.secondary",children:["\u2022 Status: ",x.status?"Active":"Inactive"]}),b>0&&(0,r.jsxs)(y.Z,{variant:"body2",color:"text.secondary",children:["\u2022 Excluding: ",b," item",1===b?"":"s"]}),!(null===(n=x.brand_names)||void 0===n?void 0:n.length)&&!(null===(t=x.countries)||void 0===t?void 0:t.length)&&void 0===x.status&&(0,r.jsx)(y.Z,{variant:"body2",color:"text.secondary",children:"\u2022 No filters applied (all overrides for this user)"})]})]})}),(0,r.jsxs)(te.Z,{sx:{px:3,pb:2},children:[(0,r.jsx)(p.Z,{onClick:l,disabled:m,children:"Cancel"}),(0,r.jsx)(p.Z,{onClick:function(){f(null);var e={user_id:a,is_all:o};o?(x.brand_names&&x.brand_names.length>0&&(e.filter_by_brands=x.brand_names),x.countries&&x.countries.length>0&&(e.filter_by_countries=x.countries),void 0!==x.status&&(e.filter_by_status=x.status),d.length>0&&(e.excluded_asin_country_pairs=d)):e.asin_country_pairs=u,g(e)},variant:"contained",color:"error",disabled:m,startIcon:m?(0,r.jsx)(S.Z,{size:16}):null,children:m?"Deleting...":"Delete"})]})]})}function ie(e){var n=e.userId,t=(0,f.useDialog)(),i=X(),l=i.asinCountryPairs,a=i.isAllSelectionMode,s=i.excludedAsinCountryPairs,o=i.clearSelection,c=G().getApiFilters;if(!(a||l&&l.length>0))return null;var u=a?"all":l.length,d=a?s.length:0,x=c();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(A.Z,{elevation:3,sx:{position:"sticky",top:0,zIndex:10,borderRadius:0},children:(0,r.jsx)(Z.Z,{sx:{px:3,py:2},children:(0,r.jsxs)(b.Z,{direction:"row",spacing:2,alignItems:"center",justifyContent:"space-between",children:[(0,r.jsxs)(b.Z,{direction:"row",spacing:2,alignItems:"center",children:[(0,r.jsx)(y.Z,{variant:"subtitle1",fontWeight:600,children:a?(0,r.jsxs)(r.Fragment,{children:["All matching items selected",d>0&&(0,r.jsx)(T.Z,{label:"".concat(d," excluded"),size:"small",sx:{ml:1}})]}):"".concat(u," item").concat(1===u?"":"s"," selected")}),(0,r.jsx)(p.Z,{size:"small",onClick:o,sx:{textTransform:"none"},children:"Clear selection"})]}),(0,r.jsx)(b.Z,{direction:"row",spacing:1,children:(0,r.jsx)(p.Z,{variant:"contained",color:"error",startIcon:(0,r.jsx)(O.Z,{}),onClick:function(){t.onOpen()},size:"small",children:"Delete"})})]})})}),(0,r.jsx)(re,{open:t.open,onClose:function(){t.onClose(),o()},userId:n,isAllSelectionMode:a,asinCountryPairs:l,excludedAsinCountryPairs:s,filterValues:x})]})}function le(e){var n=e.overrides,t=e.isAllSelectionMode,i=e.isSelected,l=e.onEnterAllSelectionMode,a=e.onExitAllSelectionMode,s=n.length>0&&n.every((function(e){return i(e.asin,e.country)})),o=n.some((function(e){return i(e.asin,e.country)}))&&!s,c=t||s,u=!t&&o;return(0,r.jsx)(B.Z,{checked:c,indeterminate:u,onChange:function(e){e.target.checked?l():a()},disabled:0===n.length})}function ae(e){var n,t,i=e.userId,l=e.totalCount,a=e.onDeleteOverride,o=e.onClose,u=(0,s.use
1State)(0),d=u[0],p=u[1],j=(0,s.useState)(25),g=j[0],m=j[1],k=G(),q=X(),H=q.isAllSelectionMode,J=q.enterAllSelectionMode,K=q.exitAllSelectionMode,Y=q.toggleSelection,Q=q.isSelected,$=q.clearSelection,ee=k.asinSearch,ne=k.setAsinSearch,te=k.countriesFilter,re=k.setCountriesFilter,ae=k.brandsFilter,se=k.setBrandsFilter,oe=k.statusFilter,ce=k.setStatusFilter,ue=k.countryOptions,de=k.brandOptions,xe=k.statusOptions,he=k.getApiFilters,ve=k.hasActiveFilters,pe=k.clear,fe=(0,c.Cv)(i,(0,x.Z)({enabled:!!i,skip:d*g,limit:g},he())),je=fe.data,ge=fe.isLoading,me=fe.isFetching;(0,s.useEffect)((function(){return function(){pe(),$(),p(0)}}),[]);var Ze=function(e){return e?new Date(e).toLocaleDateString():"-"},be=(null===je||void 0===je||null===(n=je.data)||void 0===n?void 0:n.overrides)||[],ye=(null===je||void 0===je||null===(t=je.data)||void 0===t?void 0:t.total_count)||0;return(0,r.jsxs)(L.Z,{open:!0,maxWidth:"xl",fullWidth:!0,onClose:o,children:[(0,r.jsx)(z.Z,{children:(0,r.jsxs)(b.Z,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[(0,r.jsxs)(Z.Z,{children:[(0,r.jsxs)(y.Z,{variant:"h6",children:["Exclusive Rates for ",i]}),(0,r.jsxs)(y.Z,{variant:"body2",color:"text.secondary",children:[l," total"]})]}),(0,r.jsx)(E.Z,{onClick:o,size:"small",children:(0,r.jsx)(M.Z,{})})]})}),(0,r.jsx)(V.Z,{}),(0,r.jsx)(ie,{userId:i}),(0,r.jsx)(U.Z,{children:(0,r.jsxs)(b.Z,{spacing:3,children:[(0,r.jsxs)(b.Z,{direction:{xs:"column",sm:"row"},spacing:2,alignItems:{xs:"stretch",sm:"center"},padding:.5,children:[(0,r.jsx)(f.SearchBar,{placeholder:"Search by ASIN...",value:ee,onChange:function(e){return n=e.target.value,ne(n),void p(0);var n},size:"small",sx:{flex:{xs:"1 1 auto",sm:"1 1 200px"},maxWidth:{sm:300}},InputProps:{startAdornment:(0,r.jsx)(R.Z,{position:"start",children:(0,r.jsx)(N.Z,{fontSize:"small"})})}}),(0,r.jsx)(W.Z,{multiple:!0,options:de,value:ae,onChange:function(e,n){return se(n),void p(0)},getOptionLabel:function(e){return e.label},isOptionEqualToValue:function(e,n){return e.value===n.value},sx:{flex:{xs:"1 1 auto",sm:"1 1 200px"},maxWidth:{sm:300}},renderInput:function(e){return(0,r.jsx)(v.Z,(0,h.Z)((0,x.Z)({},e),{placeholder:"Filter by brands"}))}}),(0,r.jsx)(W.Z,{multiple:!0,options:ue,value:te,onChange:function(e,n){return re(n),void p(0)},getOptionLabel:function(e){return e.label},isOptionEqualToValue:function(e,n){return e.value===n.value},sx:{flex:{xs:"1 1 auto",sm:"1 1 200px"},maxWidth:{sm:300}},renderInput:function(e){return(0,r.jsx)(v.Z,(0,h.Z)((0,x.Z)({},e),{placeholder:"Filter by countries"}))}}),(0,r.jsx)(W.Z,{options:xe,value:oe,onChange:function(e,n){return ce(n),void p(0)},getOptionLabel:function(e){return e.label},isOptionEqualToValue:function(e,n){return e.value===n.value},sx:{flex:{xs:"1 1 auto",sm:"1 1 200px"},maxWidth:{sm:200}},renderInput:function(e){return(0,r.jsx)(v.Z,(0,h.Z)((0,x.Z)({},e),{placeholder:"Filter by status"}))}})]}),(0,r.jsxs)(F.Z,{component:A.Z,variant:"outlined",sx:{position:"relative"},children:[me&&!ge&&(0,r.jsx)(Z.Z,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.7)",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,r.jsx)(Z.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",py:8},children:(0,r.jsx)(S.Z,{})})}),(0,r.jsxs)(w.Z,{size:"small",sx:{opacity:me&&!ge?.5:1},children:[(0,r.jsx)(_.Z,{children:(0,r.jsxs)(D.Z,{children:[(0,r.jsx)(P.Z,{padding:"checkbox",children:(0,r.jsx)(le,{overrides:be,isAllSelectionMode:H,isSelected:Q,onEnterAllSelectionMode:J,onExitAllSelectionMode:K})}),(0,r.jsx)(P.Z,{children:"ASIN"}),(0,r.jsx)(P.Z,{children:"Country"}),(0,r.jsx)(P.Z,{children:"Brand"}),(0,r.jsx)(P.Z,{children:"Brand Comm."}),(0,r.jsx)(P.Z,{children:"affiliate Comm."}),(0,r.jsx)(P.Z,{children:"Base Brand"}),(0,r.jsx)(P.Z,{children:"Base affiliate"}),(0,r.jsx)(P.Z,{children:"Start Date"}),(0,r.jsx)(P.Z,{children:"End Date"}),(0,r.jsx)(P.Z,{children:"Status"}),(0,r.jsx)(P.Z,{align:"right",children:"Actions"})]})}),(0,r.jsx)(I.Z,{children:ge?(0,r.jsx)(D.Z,{children:(0,r.jsx)(P.Z,{colSpan:12,align:"center",sx:{py:4},children:(0,r.jsx)(Z.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",py:8},children:(0,r.jsx)(S.Z,{})})})}):0===be.length?(0,r.jsx)(D.Z,{children:(0,r.jsx)(P.Z,{colSpan:12,align:"center",sx:{py:4},children:(0,r.jsx)(y.Z,{color:"text.secondary",children:ve()?"No overrides found matching your filters":"No overrides found"})})}):be.map((function(e,n){var t=e.status,l=Q(e.asin,e.country);return(0,r.jsxs)(D.Z,{sx:{opacity:t?1:.6,bgcolor:l?"action.selected":t?void 0:"action.hover"},children:[(0,r.jsx)(P.Z,{padding:"checkbox",children:(0,r.jsx)(B.Z,{checked:l,onChange:function(){Y(e.asin,e.country)}})}),(0,r.jsx)(P.Z,{children:e.asin}),(0,r.jsx)(P.Z,{children:e.country}),(0,r.jsx)(P.Z,{children:(0,r.jsx)(y.Z,{variant:"body2",noWrap:!0,sx:{maxWidth:150},children:e.brand||"-"})}),(0,r.jsx)(P.Z,{children:e.brand_commission||"-"}),(0,r.jsx)(P.Z,{children:(0,r.jsx)(T.Z,{label:e.affiliate_commission,size:"small",variant:"outlined",color:"secondary"})}),(0,r.jsx)(P.Z,{sx:{color:"text.secondary"},children:e.base_brand_commission||"-"}),(0,r.jsx)(P.Z,{sx:{color:"text.secondary"},children:e.base_affiliate_commission||"-"}),(0,r.jsx)(P.Z,{children:Ze(e.start_date)}),(0,r.jsx)(P.Z,{children:Ze(e.end_date)}),(0,r.jsx)(P.Z,{children:(0,r.jsx)(T.Z,{label:t?"Active":"Inactive",size:"small",color:t?"success":"default",variant:"outlined"})}),(0,r.jsx)(P.Z,{align:"right",children:(0,r.jsx)(E.Z,{size:"small",color:"error",onClick:function(){a(i,"".concat(e.asin,":").concat(e.country))},disabled:!t,"aria-label":"delete override",children:(0,r.jsx)(O.Z,{fontSize:"small"})})})]},"".concat(e.asin,"-").concat(e.country,"-").concat(n))}))})]})]}),ye>0&&(0,r.jsx)(C.Z,{component:"div",count:ye,page:d,onPageChange:function(e,n){p(n)},rowsPerPage:g,onRowsPerPageChange:function(e){m(parseInt(e.target.value,10)),p(0)},rowsPerPageOptions:[10,25,50,100]})]})})]})}
1function se(e){var n=e.open,t=function(){var e,n=(0,s.useState)(""),t=n[0],r=n[1],i=(0,s.useState)([]),l=i[0],a=i[1],o=(0,s.useState)([]),c=o[0],u=o[1],d=(0,s.useState)(null),x=d[0],h=d[1],v=(0,$.oD)().data,p=(null===v||void 0===v||null===(e=v.data)||void 0===e?void 0:e.map((function(e){return{value:e,label:e}})))||[];return{asinSearch:t,setAsinSearch:r,countriesFilter:l,setCountriesFilter:a,brandsFilter:c,setBrandsFilter:u,statusFilter:x,setStatusFilter:h,countryOptions:ee.O,brandOptions:p,statusOptions:[{value:!0,label:"Active"},{value:!1,label:"Inactive"}],clear:function(){r(""),a([]),u([]),h(null)},getApiFilters:function(){return{asin:t||void 0,countries:l.length>0?l.map((function(e){return e.value})):void 0,brand_names:c.length>0?c.map((function(e){return e.value})):void 0,status:null!==x?x.value:void 0}},hasActiveFilters:function(){return""!==t||l.length>0||c.length>0||null!==x}}}();return n?(0,r.jsx)(q.Provider,{value:t,children:(0,r.jsx)(Q,{children:(0,r.jsx)(ae,(0,x.Z)({},e))})}):null}function oe(e){var n=e.userOverride,t=e.onDelete,i=e.onDeleteOverride,l=(0,f.useDialog)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(D.Z,{hover:!0,children:[(0,r.jsx)(P.Z,{children:n.user_id}),(0,r.jsxs)(P.Z,{align:"right",children:[(0,r.jsxs)(p.Z,{size:"small",variant:"outlined",startIcon:(0,r.jsx)(k,{}),onClick:l.onOpen,children:["View All (",n.total_count,")"]}),(0,r.jsx)(E.Z,{color:"error",size:"small",onClick:function(){return t(n.user_id)},"aria-label":"delete all overrides",children:(0,r.jsx)(O.Z,{fontSize:"small"})})]})]}),(0,r.jsx)(se,{open:l.open,onClose:l.onClose,userId:n.user_id,totalCount:n.total_count,onDeleteOverride:i})]})}function ce(e){var n=e.data,t=e.isLoading,i=e.isFetching,l=e.onDelete,a=e.onDeleteOverride;return t?(0,r.jsx)(Z.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",py:8},children:(0,r.jsx)(S.Z,{})}):(null===n||void 0===n?void 0:n.data)&&0!==n.data.length?(0,r.jsxs)(F.Z,{component:A.Z,sx:{position:"relative"},children:[i&&!t&&(0,r.jsx)(Z.Z,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.7)",zIndex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,r.jsx)(S.Z,{size:40})}),(0,r.jsxs)(w.Z,{sx:{opacity:i&&!t?.5:1},children:[(0,r.jsx)(_.Z,{children:(0,r.jsxs)(D.Z,{children:[(0,r.jsx)(P.Z,{children:"Username"}),(0,r.jsx)(P.Z,{align:"right",children:"Actions"})]})}),(0,r.jsx)(I.Z,{children:n.data.map((function(e){return(0,r.jsx)(oe,{userOverride:e,onDelete:l,onDeleteOverride:a},e.user_id)}))})]})]}):(0,r.jsx)(A.Z,{sx:{p:6,textAlign:"center"},children:(0,r.jsx)(y.Z,{variant:"body1",color:"text.secondary",children:"No exclusive commission rates found. Create exclusive rates from the Products tab by selecting products and clicking 'Set Exclusive Commission'."})})}function ue(){var e=function(){var e=(0,s.useState)(0),n=e[0],t=e[1],r=(0,s.useState)(25),l=r[0],u=r[1],x=d(),h=x.search,v=x.asin,p=x.countryIds,f=x.asinCountryPairs,j=x.brandNames,g=(0,c.xk)({skip:n*l,limit:l,search:h.value||void 0,brand_names:j.value.length>0?j.value.map((function(e){return e.value})):void 0,asin:v.value||void 0,countries:p.value.length>0?p.value.map((function(e){return e.value})):void 0,asin_country_pairs:f.value||void 0}),m=g.data,Z=g.isLoading,b=g.isFetching,y=(0,c.DM)(),C=function(){var e=(0,i.Z)(a().mark((function e(n){var t,r,i,l,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm("Delete all exclusive commission rates for user ".concat(n,"?"))){e.next=3;break}return e.abrupt("return");case 3:return e.prev=3,e.next=6,y.mutateAsync({userId:n});case 6:o.Am.success("Exclusive commission rates deleted",{description:"Deleted all exclusive rates for ".concat(n),duration:5e3}),e.next=14;break;case 9:e.prev=9,e.t0=e.catch(3),s=(null===e.t0||void 0===e.t0||null===(t=e.t0.response)||void 0===t||null===(r=t.data)||void 0===r?void 0:r.detail)||(null===e.t0||void 0===e.t0||null===(i=e.t0.response)||void 0===i||null===(l=i.data)||void 0===l?void 0:l.message)||(null===e.t0||void 0===e.t0?void 0:e.t0.message)||"Failed to delete exclusive commission rates",o.Am.error("Deleti
1on failed",{description:s,duration:5e3});case 14:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(n){return e.apply(this,arguments)}}(),S=function(){var e=(0,i.Z)(a().mark((function e(n,t){var r,i,l,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm("Delete exclusive commission rate for ".concat(t,"?"))){e.next=3;break}return e.abrupt("return");case 3:return e.prev=3,e.next=6,y.mutateAsync({userId:n,asinCountryPairs:t});case 6:o.Am.success("Exclusive commission rate deleted",{description:"Deleted rate for ".concat(t),duration:5e3}),e.next=14;break;case 9:e.prev=9,e.t0=e.catch(3),c=(null===e.t0||void 0===e.t0||null===(r=e.t0.response)||void 0===r||null===(i=r.data)||void 0===i?void 0:i.detail)||(null===e.t0||void 0===e.t0||null===(l=e.t0.response)||void 0===l||null===(s=l.data)||void 0===s?void 0:s.message)||(null===e.t0||void 0===e.t0?void 0:e.t0.message)||"Failed to delete exclusive commission rate",o.Am.error("Deletion failed",{description:c,duration:5e3});case 14:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(n,t){return e.apply(this,arguments)}}();return{data:m,isLoading:Z,isFetching:b,pagination:{page:n,rowsPerPage:l,handlePageChange:function(e,n){t(n)},handleRowsPerPageChange:function(e){u(parseInt(e.target.value,10)),t(0)}},handleDelete:C,handleDeleteOverride:S}}(),n=e.data,t=e.isLoading,l=e.isFetching,u=e.pagination,x=e.handleDelete,h=e.handleDeleteOverride;return(0,r.jsx)(Z.Z,{sx:{p:3},children:(0,r.jsxs)(b.Z,{spacing:3,children:[(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(y.Z,{variant:"h5",gutterBottom:!0,children:"Exclusive Commission Rates"}),(0,r.jsx)(y.Z,{variant:"body2",color:"text.secondary",children:"Manage exclusive commission rates for users"})]}),(0,r.jsx)(m,{loading:t,isFetching:l}),(0,r.jsx)(ce,{data:null===n||void 0===n?void 0:n.data,isLoading:t,isFetching:l,onDelete:x,onDeleteOverride:h}),(null===n||void 0===n?void 0:n.data)&&n.data.total_count>0&&(0,r.jsx)(C.Z,{component:"div",count:n.data.total_count,page:u.page,onPageChange:u.handlePageChange,rowsPerPage:u.rowsPerPage,onRowsPerPageChange:u.handleRowsPerPageChange,rowsPerPageOptions:[10,25,50,100]})]})})}var de=t(14924),xe=t(86440),he="q",ve="asin",pe="country_ids",fe="asin_country_pairs",je="brand_names";var ge=t(50263),me=t(85339),Ze=t(20338);var be=(0,Ze.ns)((function(){var e=function(){var e,n=function(){var e;return e={},(0,de.Z)(e,he,a.value),(0,de.Z)(e,ve,s.value),(0,de.Z)(e,pe,o.value.map((function(e){return e.value}))),(0,de.Z)(e,fe,c.value),(0,de.Z)(e,je,d.value),e},t=(0,j.c2)(),r=(0,$.oD)(),i=r.data,l=r.isLoading,a=(0,j.US)({defaultValue:"",key:he}),s=(0,j.US)({defaultValue:"",key:ve}),o=(0,j.US)({defaultValue:[],key:pe,options:[{value:"US",label:"United States"},{value:"CA",label:"Canada"},{value:"MX",label:"Mexico"},{value:"BR",label:"Brazil"},{value:"UK",label:"United Kingdom"},{value:"DE",label:"Germany"},{value:"FR",label:"France"},{value:"ES",label:"Spain"},{value:"IT",label:"Italy"},{value:"NL",label:"Netherlands"},{value:"SE",label:"Sweden"},{value:"PL",label:"Poland"},{value:"AE",label:"United Arab Emirates"},{value:"SA",label:"Saudi Arabia"},{value:"IN",label:"India"},{value:"JP",label:"Japan"},{value:"SG",label:"Singapore"},{value:"CN",label:"China"},{value:"AU",label:"Australia"}]}),c=(0,j.US)({defaultValue:"",key:fe}),u=(null===i||void 0===i||null===(e=i.data)||void 0===e?void 0:e.map((function(e){return{value:e,label:e}})))||[],d=(0,j.US)({defaultValue:[],key:je,options:u,optionsLoading:l});return(0,xe.cM)("RateOverridesFilters",{search:a,asin:s,countryIds:o,asinCountryPairs:c,brandNames:d,getValues:n()}),{search:a,asin:s,countryIds:o,asinCountryPairs:c,brandNames:d,getValues:n,clear:function(){t([he,ve,pe,fe,je])}}}();return(0,r.jsxs)(ge.eD,{children:[(0,r.jsx)(f.Header,{title:"Exclusive Commission Rates",backUrl:me.P.adminInternationalCatalog.path}),(0,r.jsx)(f.MainContainer,{maxWidth:!1,children:(0,r.jsx)(u.Provider,{value:e,children:(0,r.jsx)(ue,{})})})]})}),{userTypes:[Ze.m0]})}},function(e){e.O(0,[2640,5473,3810,9774,2888,179],(function(){return n=36122,e(e.s=n);var n}));var n=e.O();_N_E=n}]);

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.