Liferay.Loader.define("commerce-frontend-js@4.0.75/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=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),r=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),i=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 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=_interopRequireDefault(a("../../ServiceProvider/index")),u=a("../../utilities/eventsDefinitions"),c=a("../../utilities/index"),s=a("../add_to_cart/constants"),d=_interopRequireDefault(a("./MiniCartContext")),o=a("./util/constants");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const e=l.default.DeliveryCartAPI("v1");var f=function CartItemsListActions(){const{actionURLs:t,cartState:a,labels:l,setIsUpdating:f,updateCartModel:m}=(0,i.useContext)(d.default),{cartItems:p=[],id:y}=a,{orderDetailURL:g}=t,[b,_]=(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"},!!p.length&&i.default.createElement(i.default.Fragment,null,i.default.createElement("span",{className:"items"},p.length),p.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:!p.length,displayType:"link",onClick:()=>{(0,c.liferayNavigate)(g)},small:!0},l[o.VIEW_DETAILS]),i.default.createElement(n.default,{className:"action text-danger",disabled:!p.length,displayType:"link",onClick:()=>_(!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(y,{cartItems:[]}).then((()=>m({order:{id:y}}))).then((()=>{_(!1),f(!1),Liferay.fire(u.CART_PRODUCT_QUANTITY_CHANGED,{quantity:0,skuId:s.ALL})}))},type:"button"},Liferay.Language.get("yes")),i.default.createElement("button",{className:"btn btn-outline-danger btn-sm",onClick:()=>_(!1),type:"button"},Liferay.Language.get("no")))))))};t.default=f}}));
//# sourceMappingURL=CartItemsListActions.js.map