Liferay.Loader.define("commerce-frontend-js@4.0.52/components/account_selector/views/AccountsListView",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","liferay!frontend-js-react-web$react","../../../ServiceProvider/index","../Sticker","../util/constants","./EmptyListView","./ListView"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a("@frontend-taglib-clay$clayui/button"),r=f(a("@frontend-taglib-clay$clayui/drop-down")),l=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),c=f(a("../../../ServiceProvider/index")),i=f(a("../Sticker")),u=a("../util/constants"),o=f(a("./EmptyListView")),d=f(a("./ListView"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function f(e){return e&&e.__esModule?e:{default:e}}function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}const{baseURL:e}=c.default.AdminAccountAPI("v1");var p=function({accountEntryAllowedTypes:t,changeAccount:a,currentAccount:c,disabled:s,setCurrentView:f}){const p=(0,l.useRef)(),y=new URL(e,themeDisplay.getPortalURL()),g=t.map((e=>"'".concat(e,"'"))).join(", ");return g&&y.searchParams.append("filter","type in ("+g+")"),l.default.createElement(r.default.ItemList,{className:"accounts-list-container"},l.default.createElement(r.default.Section,{className:"item-list-head"},l.default.createElement("span",{className:"text-truncate-inline"},l.default.createElement("span",{className:"text-truncate"},Liferay.Language.get("select-account"))),c&&l.default.createElement(n.ClayButtonWithIcon,{displayType:"unstyled",onClick:()=>f(u.VIEWS.ORDERS_LIST),symbol:"angle-right-small"})),l.default.createElement(r.default.Divider,null),l.default.createElement(r.default.Section,null,l.default.createElement(d.default,{apiUrl:y.toString(),contentWrapperRef:p,customView:({items:e,loading:t})=>e&&e.length?l.default.createElement(r.default.ItemList,{className:"accounts-list"},e.map((e=>l.default.createElement(r.default.Item,{key:e.id,onClick:()=>a(e)},l.default.createElement(i.default,m({className:"current-account-thumbnail mr-2"},e)),l.default.createElement("span",{className:"ml-2 text-truncate-inline"},l.default.createElement("span",{className:"text-truncate"},e.name)))))):l.default.createElement(o.default,{caption:Liferay.Language.get("no-accounts-were-found"),loading:t}),disabled:s,placeholder:Liferay.Language.get("search")})),l.default.createElement(r.default.Divider,null),l.default.createElement("li",null,l.default.createElement("div",{ref:p})))};t.default=p}}));
//# sourceMappingURL=AccountsListView.js.map