Liferay.Loader.define("commerce-frontend-js@4.0.52/components/mini_cart/CartItemsListActions",["module","exports","require","@frontend-taglib-clay$clayui/button","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","../../ServiceProvider/index","../../utilities/eventsDefinitions","../../utilities/index","../add_to_cart/constants","./MiniCartContext","./util/constants"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=m(a("@frontend-taglib-clay$clayui/button")),r=m(a("liferay!frontend-js-react-web$classnames")),i=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=f();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 i=n?Object.getOwnPropertyDescriptor(e,r):null;i&&(i.get||i.set)?Object.defineProperty(a,r,i):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),l=m(a("../../ServiceProvider/index")),s=a("../../utilities/eventsDefinitions"),c=a("../../utilities/index"),u=a("../add_to_cart/constants"),d=m(a("./MiniCartContext")),o=a("./util/constants");function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function m(e){return e&&e.__esModule?e:{default:e}}const e=l.default.DeliveryCartAPI("v1");var y=function(){const{actionURLs:t,cartState:a,labels:l,setIsUpdating:f,updateCartModel:m}=(0,i.useContext)(d.default),{cartItems:y=[],id:p}=a,{orderDetailURL:g}=t,[b,v]=(0,i.useState)(!1);return i.default.createElement("div",{className:"mini-cart-header"},i.default.createElement("div",{className:"mini-cart-header-block"},i.default.createElement("div",{className:"mini-cart-header-resume"},y.length>0&&i.default.createElement(i.default.Fragment,null,i.default.createElement("span",{className:"items"},y.length),y.length>1?" "+Liferay.Language.get("products"):" "+Liferay.Language.get("product"))),i.default.createElement("div",{className:"mini-cart-header-actions"},i.default.createElement("span",{className:(0,r.default)({actions:!0,hide:b})},i.default.createElement(n.default,{className:"action",disabled:!y.length,displayType:"link",onClick:()=>{(0,c.liferayNavigate)(g)},small:!0},l[o.VIEW_DETAILS]),i.default.createElement(n.default,{className:"action text-danger",disabled:!y.length,displayType:"link",onClick:()=>v(!0),small:!0},l[o.REMOVE_ALL_ITEMS])),i.default.createElement("div",{className:(0,r.default)({"confirmation-prompt":!0,hide:!b})},i.default.createElement("span",null,Liferay.Language.get("are-you-sure")),i.default.createElement("span",null,i.default.createElement("button",{className:"btn btn-outline-success btn-sm",onClick:()=>{f(!0),e.updateCartById(p,{cartItems:[]}).then((()=>m({order:{id:p}}))).then((()=>{v(!1),f(!1),Liferay.fire(s.CART_PRODUCT_QUANTITY_CHANGED,{quantity:0,skuId:u.ALL})}))},type:"button"},Liferay.Language.get("yes")),i.default.createElement("button",{className:"btn btn-outline-danger btn-sm",onClick:()=>v(!1),type:"button"},Liferay.Language.get("no")))))))};t.default=y}}));
//# sourceMappingURL=CartItemsListActions.js.map