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:"0cf139dcf3983df26a9147496b8900669e213a3f",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:"430d13b9b60794b31a85ce7bce63426c33496d28"}))}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"}}