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:"4a35e1114f863dfc79fa4694e2941a594535af36",heading:this.heading||__("Enter An Amount","surecart"),class:"subscription-switch"},h("sc-card",{key:"77414bee1502459d44fd69e40bf4524118717396"},h("sc-form",{key:"9519d021e34e84d91d02c26351d5f6a55a69be0d",onScSubmit:e=>this.handleSubmit(e)},h("sc-price-input",{key:"9bec5ccec951d14d53e886e2c138b0ba72ab455e",label:"Amount",name:"ad_hoc_amount",currencyCode:this.currencyCode,autofocus:!0,required:!0},h("span",{key:"58ab6d75deaa8c9d38564938f6403b48f1479580",slot:"suffix",style:{opacity:"0.75"}},intervalString(this.price))),h("sc-button",{key:"cbc32465ecb3991997344b9e36c05a0f0a0f1e3e",type:"primary",full:!0,submit:!0,loading:this.busy},__("Next","surecart")," ",h("sc-icon",{key:"5506388e1ebab66cea771c15a1efdb061a1629bf",name:"arrow-right",slot:"suffix"})))),this.busy&&h("sc-block-ui",{key:"34b2fbbd163b67f8bdbea04ab9a210486ecbc386",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:{}}}}