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:"312c13a59cb9d6debf1965dcfc3cae8be4143ae9",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:"993f199a226383fcde5f2bd67077c0b302d6c759"}))}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"}}