import{h,Host}from"@stencil/core";import{state as upsellState}from"../../../../store/upsell/index";import{state as noticesState}from"../../../../store/notices/index";import{isProductOutOfStock,isSelectedVariantMissing}from"../../../../store/product/getters";import{accept}from"../../../../store/upsell/mutations";import{isBusy}from"../../../../store/upsell/getters";export class ScUpsellSubmitButton{getUpsellProductId(){var t;return(null===(t=upsellState.product)||void 0===t?void 0:t.id)||""}async handleAddToOrderClick(t){t.preventDefault(),accept()}render(){return h(Host,{key:"c1306c0a36e0ca4c9cf76f9b8417c82392dd1e69",class:{"is-busy":isBusy(),"is-disabled":upsellState.disabled,"is-sold-out":isProductOutOfStock(this.getUpsellProductId())&&!isSelectedVariantMissing(this.getUpsellProductId())||"out_of_stock"===(null==noticesState?void 0:noticesState.code),"is-unavailable":isSelectedVariantMissing(this.getUpsellProductId())||"expired"===(null==noticesState?void 0:noticesState.code)},onClick:t=>this.handleAddToOrderClick(t)},h("slot",{key:"a311418425c1786ed6e87fc0388bdb59c8d4182f"}))}static get is(){return"sc-upsell-submit-button"}static get originalStyleUrls(){return{$:["sc-upsell-submit-button.scss"]}}static get styleUrls(){return{$:["sc-upsell-submit-button.css"]}}static get elementRef(){return"el"}}