import{h}from"@stencil/core";import{__}from"@wordpress/i18n";import{addQueryArgs}from"@wordpress/url";import{intervalString}from"../../../../functions/price";export class ScSubscriptionAdHocConfirm{constructor(){this.heading=void 0,this.price=void 0,this.currencyCode=void 0,this.busy=!1}async handleSubmit(e){const{ad_hoc_amount:t}=await e.target.getFormJson();return this.busy=!0,window.location.assign(addQueryArgs(window.location.href,{action:"confirm",ad_hoc_amount:t}))}render(){return h("sc-dashboard-module",{key:"bb5940347cf9480364b5d0bd80242a334e4ce048",heading:this.heading||__("Enter An Amount","surecart"),class:"subscription-switch"},h("sc-card",{key:"42657c15f23c9c79c6f28c177bd5401fd1bedd3d"},h("sc-form",{key:"2e418bd74140bcfcedabe937fd265d8b4e81d1d6",onScSubmit:e=>this.handleSubmit(e)},h("sc-price-input",{key:"a596b7ba0df54ae44365c7f3a94e5d4ec6c146e7",label:"Amount",name:"ad_hoc_amount",currencyCode:this.currencyCode,autofocus:!0,required:!0},h("span",{key:"0295dedc9b7b170c2f168c487f67f5ca8e039e1f",slot:"suffix",style:{opacity:"0.75"}},intervalString(this.price))),h("sc-button",{key:"dcf0b3f2f6f5ee815213998df57bb9acf11e128f",type:"primary",full:!0,submit:!0,loading:this.busy},__("Next","surecart")," ",h("sc-icon",{key:"b34ea76f75d72695ccbe8bdebb00e14f8585b104",name:"arrow-right",slot:"suffix"})))),this.busy&&h("sc-block-ui",{key:"0210ee58c7683a7246412c6318c12b9b69d0ad4e",style:{zIndex:"9"}}))}static get is(){return"sc-subscription-ad-hoc-confirm"}static get originalStyleUrls(){return{$:["sc-subscription-ad-hoc-confirm.scss"]}}static get styleUrls(){return{$:["sc-subscription-ad-hoc-confirm.css"]}}static get properties(){return{heading:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"heading",reflect:!1},price:{type:"unknown",mutable:!1,complexType:{original:"Price",resolved:"Price",references:{Price:{location:"import",path:"../../../../types",id:"src/types.ts::Price"}}},required:!1,optional:!1,docs:{tags:[],text:""}},currencyCode:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"currency-code",reflect:!1}}}static get states(){return{busy:{}}}}