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:"9e91f9ca15371b03b61d9835df0a4f58db447c85",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:"c45a227f186c3548fc810a91a7181860ae6c82ab"}))}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"}}