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