Liferay.Loader.define("commerce-frontend-js@4.0.52/utilities/hooks",["module","exports","require","@frontend-taglib-clay$clayui/loading-indicator","liferay!frontend-js-react-web$react","../components/add_to_cart/constants","./cookies","./eventsDefinitions","./modules"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.useLiferayModule=function(e,t=o.default){const[n,i]=(0,r.useState)(e?t:null);return(0,r.useEffect)((()=>{e&&(0,u.getComponentByModuleUrl)(e).then((e=>{i((()=>e))}))}),[e]),n},t.useCommerceAccount=function(e){const[t,n]=(0,r.useState)(e);return(0,r.useEffect)((()=>{function e(e){t.id!==e.id&&n(e)}return Liferay.on(c.CURRENT_ACCOUNT_UPDATED,e),()=>{Liferay.detach(c.CURRENT_ACCOUNT_UPDATED,e)}}),[t]),t},t.useCommerceCart=function(t,n){const[o,i]=(0,r.useState)(t);return(0,r.useEffect)((()=>{function t({order:t}){o.id!==t.id&&(i(t),n&&t.orderUUID&&e.setValue(n,t.orderUUID))}return Liferay.on(c.CURRENT_ORDER_UPDATED,t),()=>{Liferay.detach(c.CURRENT_ORDER_UPDATED,t)}}),[o,n]),o};var o=d(n("@frontend-taglib-clay$clayui/loading-indicator")),r=n("liferay!frontend-js-react-web$react"),i=n("../components/add_to_cart/constants"),a=d(n("./cookies")),c=n("./eventsDefinitions"),u=n("./modules");function d(e){return e&&e.__esModule?e:{default:e}}const e=new a.default(i.GUEST_COMMERCE_ORDER_COOKIE_IDENTIFIER)}}));
//# sourceMappingURL=hooks.js.map