PageSourceSearch

https://app.courier.com/_next/static/chunks/pages/database/brands-faed6b54315469b9.js

js courier.com collected 2026-09-24 09:02:30 UTC 5,227 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9635],{20598:function(e,r,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/database/brands",function(){return n(64363)}])},14024:function(e,r,n){"use strict";var t=n(52322),a=(n(2784),n(22063)),i=n(56982);r.Z=function(e){var r=e.onLoadMore,n=e.loading,o=void 0!==n&&n;return(0,t.jsxs)("div",{className:"flex items-center justify-center py-lg",children:[(0,t.jsx)("div",{className:"h-[1px] flex-auto bg-structure-divider"}),(0,t.jsx)(a.default,{onClick:r,Icon:o?void 0:i.Jwt,loading:o,legacy:!1,children:"Load more results"}),(0,t.jsx)("div",{className:"h-[1px] flex-auto bg-structure-divider"})]})}},62997:function(e,r,n){"use strict";n.r(r),n.d(r,{default:function(){return S}});var t=n(70865),a=n(96670),i=n(52322),o=n(19557),s=n(58580),l=n.n(s),u=n(66338),d=n.n(u),c=n(34126),f=n(2784),v=n(12376),g=n(16034),h=n(56982),x=n(22063),b=n(93278),m=n(33553),y=n(17276),w=n(5632),p=n(44728),j=n(14024),N=n(98788),Z=n(50930),_=n(22970),B=n(55830),P=n(58943),E=n(59042),L=n(29937),M=n(64685);function U(){var e,r,n,t=(0,B.NL)(),a=(0,M.nt)().selectedEnvironment,i=null!==(n=null===a||void 0===a?void 0:a.environmentId)&&void 0!==n?n:null,o=["brands-list",i],s=(0,f.useState)(!1),l=s[0],u=s[1],d=(0,P.a)({queryKey:o,queryFn:(0,N.Z)((function(){var e,r;return(0,_.__generator)(this,(function(n){switch(n.label){case 0:return[4,(0,L.mu)()];case 1:return e=n.sent(),[4,(0,L.vp)()];case 2:return r=n.sent(),[2,{brands:[e].concat((0,Z.Z)(r.items.filter((function(r){return r.id!==e.id})))).sort((0,E.sortBy)("name")),nextPageUrl:r.nextPageUrl||void 0}]}}))})),enabled:null!=i,refetchOnMount:!0,refetchOnWindowFocus:!1}),c=(0,f.useCallback)((0,N.Z)((function(){var e,r,n;return(0,_.__generator)(this,(function(a){switch(a.label){case 0:if(e=t.getQueryData(o),r=function(e){if(e)try{var r;return null!==(r=new URL(e,window.location.origin).searchParams.get("cursor"))&&void 0!==r?r:void 0}catch(n){return e}}(null===e||void 0===e?void 0:e.nextPageUrl),!r||l)return[2];u(!0),a.label=1;case 1:return a.trys.push([1,,3,4]),[4,(0,L.vp)(r)];case 2:return n=a.sent(),t.setQueryData(o,(function(e){if(!e)return e;var r,t=e.brands,a=(null!==(r=n.items)&&void 0!==r?r:[]).filter((function(e){return!t.some((function(r){return r.id===e.id}))}));return{brands:(0,Z.Z)(t).concat((0,Z.Z)(a)),nextPageUrl:n.nextPageUrl||void 0}})),[3,4];case 3:return u(!1),[7];case 4:return[2]}}
1))})),[l,t,o]),v=d.error&&"object"===typeof d.error&&"message"in d.error?String(d.error.message):d.error?"Failed to load brands":null;return{brands:null===(e=d.data)||void 0===e?void 0:e.brands,nextPageUrl:null===(r=d.data)||void 0===r?void 0:r.nextPageUrl,loading:d.isLoading,error:v,refetch:d.refetch,fetchMore:c,isLoadingMore:l}}var k=n(50177),C=n(65310),S=function(){var e,r="searchQuery-brands",n=(0,f.useMemo)((function(){try{var e=c.parse(String(window.location.search)),r=l()(d().unflatten(e),{deep:!0})||{filters:{},sortBy:{}};return(0,a.Z)((0,t.Z)({},v.B),{filters:(0,t.Z)({},v.B.filters,r.filters||{}),sortBy:r.sortBy||v.B.sortBy||[]})}catch(n){return v.B}}),[]),s=(0,f.useState)((null===n||void 0===n||null===(e=n.filters)||void 0===e?void 0:e.searchStr)||""),u=s[0],N=s[1],Z=(0,f.useMemo)((function(){return(0,a.Z)((0,t.Z)({},n),{filters:(0,a.Z)((0,t.Z)({},n.filters),{searchStr:u})})}),[n,u]),_=U(),B=_.brands,P=_.loading,E=_.error,L=_.refetch,M=_.fetchMore,S=_.nextPageUrl,A=_.isLoadingMore,F=(0,w.useRouter)(),D=(0,y.V$)(),O=(0,C.ye)("cds-new-brand-editor"),I=(0,f.useCallback)((function(e){null===e||void 0===e||e.preventDefault(),null===e||void 0===e||e.stopPropagation(),O?F.push(D.newBrandEditor.create()):F.push(D.database.brands.design("new"))}),[F,D,O]);(0,f.useEffect)((function(){return function(){m.cl(r)}}),[r]);var Q=!P&&!E&&Array.isArray(B)&&0===B.length;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(k.Z,{feature:"Brands"}),(0,i.jsx)(p.U7,{variant:"list",loading:P,error:E,onRetry:function(){return L()},empty:Q,emptyMessage:"No brands found",emptyActionLabel:void 0,onEmptyAction:void 0,loadingMessage:"Loading brands\u2026",children:(0,i.jsx)("div",{className:"flex h-full w-full flex-col",children:(0,i.jsxs)("div",{className:"flex w-full flex-col gap-4 px-6 py-6",children:[(0,i.jsx)(o.default,{variant:"semibold-xl",className:"text-header",children:"Brands"}),(0,i.jsxs)("div",{className:"flex w-full flex-row gap-2",children:[(0,i.jsx)(x.default,{Icon:h.mm_,leftAligned:!0,variant:"confirm",onClick:I,children:"New"}),(0,i.jsx)(b.Z,{value:u,onChange:function(e){return N(e.target.value)},className:"flex-grow",autoFocus:!0},"brand-search")]}),(0,i.jsx)(g.Z,{facets:Z,loading:P,brands:B,onBrandDeleted:function(){return L()},newBrandEditorEnabled:O}),S&&(0,i.jsx)(j.Z,{onLoadMore:M,loading:A})]})})})]})}},94648:function(e,r,n){"use strict";n.r(r);var t=n(52322);r.default=function(e){var r=e.children;return(0,t.jsx)("main",{className:"h-full w-full overflow-auto bg-background-frame",children:r})}},64363:function(e,r,n){"use strict";n.r(r);var t=n(52322),a=n(94648),i=n(62997),o=function(){return(0,t.jsx)(i.default,{})};r.default=o,o.Layout=a.default}},function(e){e.O(0,[1156,663,2548,8565,9851,9774,2888,179],(function(){return r=20598,e(e.s=r);var r}));var r=e.O();_N_E=r}]);

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.