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:"76b630e477294c5f0e8b58dfbc5caae4fa89b7e0",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:"39f35fafd31d421e3586391aea2b0725fb40f6f2"}))}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"}}