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:"da83e00c7cd3bf2ee128f8a93a4529c055492c25",heading:this.heading||__("Enter An Amount","surecart"),class:"subscription-switch"},h("sc-card",{key:"5bebb597b231cfb2902b414cc85e6d5ac10d37bf"},h("sc-form",{key:"7fcc7104b0df71156d9b2e154098e4619cf0d39d",onScSubmit:e=>this.handleSubmit(e)},h("sc-price-input",{key:"0a9ac97efa255d8ab6f3ad05343814681a63a4d5",label:"Amount",name:"ad_hoc_amount",currencyCode:this.currencyCode,autofocus:!0,required:!0},h("span",{key:"f6508d8acb67b8a76d3c472194eb51cb3a816618",slot:"suffix",style:{opacity:"0.75"}},intervalString(this.price))),h("sc-button",{key:"1aca8cefb2c5bb70455fba2d7c196760be563c6e",type:"primary",full:!0,submit:!0,loading:this.busy},__("Next","surecart")," ",h("sc-icon",{key:"f1f747f9b880d98cc95692d7cc6a659d6e3422c9",name:"arrow-right",slot:"suffix"})))),this.busy&&h("sc-block-ui",{key:"469340f496da0a5bb3cdfad2678cc4a0885b0a0a",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:{}}}}