import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";import"./watchers4.js";import{s as state}from"./getters5.js";import"./mutations2.js";import{s as state$1}from"./watchers5.js";import{c as clearCheckout}from"./mutations4.js";import{d as defineCustomElement$6}from"./sc-alert2.js";import{d as defineCustomElement$5}from"./sc-button2.js";import{d as defineCustomElement$4}from"./sc-dashboard-module2.js";import{d as defineCustomElement$3}from"./sc-dialog2.js";import{d as defineCustomElement$2}from"./sc-icon2.js";import{d as defineCustomElement$1}from"./sc-spinner2.js";const checkoutTestCompleteCss=".confirm__icon{margin-bottom:var(--sc-spacing-medium);display:flex;justify-content:center}.confirm__icon-container{background:var(--sc-color-primary-500);width:55px;height:55px;border-radius:999999px;display:flex;align-items:center;justify-content:center;font-size:26px;line-height:1;color:white}sc-dialog::part(overlay){backdrop-filter:blur(4px)}",ScCheckoutTestCompleteStyle0=checkoutTestCompleteCss,ScCheckoutTestComplete=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.scOrderPaid=createEvent(this,"scOrderPaid",7),this.scSetState=createEvent(this,"scSetState",7),this.showSuccessModal=!1,this.manualPaymentMethod=void 0,this.checkoutStatus=void 0,this.successUrl=void 0}handleConfirmOrderEvent(){"test_mode_restricted"===this.checkoutStatus&&this.confirmOrder()}async confirmOrder(){var e;this.manualPaymentMethod=null===(e=state.manualPaymentMethods||[])||void 0===e?void 0:e.find((e=>e.id===state$1.id)),this.showSuccessModal=!0,clearCheckout()}handleSuccessModal(){this.showSuccessModal&&setTimeout((()=>{var e;null===(e=this.continueButton)||void 0===e||e.focus()}),50)}render(){var e,t,s,c,o;return h(Host,{key:"3c0c52fb69aacbf3bf4fb797586c7a2432c1f790"},h("slot",{key:"d63060fd4eb7e78e7a658bbd8d17c0cf8707e473"}),h("sc-dialog",{key:"01e59224ca7271e9bd5c7457e374f097e4276a73",open:!!this.showSuccessModal,style:{"--body-spacing":"var(--sc-spacing-xxx-large)","--width":"400px"},noHeader:!0,onScRequestClose:e=>e.preventDefault()},h("div",{key:"039b32ae7d4c69f45ee0269422cac7154e333ec3",class:"confirm__icon"},h("div",{key:"1a9da9a6d06ab049b13e26dfc59a89e79de54a87",class:"confirm__icon-container"},h("sc-icon",{key:"3e4b7bd0355bd487dfb6c8064353adb79f348b14",name:"check"}))),h("sc-dashboard-module",{key:"3be338aee9787680a67a7dc62fb1f7c835702f98",heading:wp.i18n.__("Test checkout successful!","surecart"),style:{"--sc-dashboard-module-spacing":"var(--sc-spacing-x-large)",textAlign:"center"}},h("span",{key:"b0ae504ecc5c5ba5bc9f2bd7808cfa3b1ec7b088",slot:"description"},wp.i18n.__("This is a simulated test checkout, and no orders were processed. To perform a test order, please contact your store administrator. ","surecart")),!!(null===(e=this.manualPaymentMethod)||void 0===e?void 0:e.name)&&!!(null===(t=this.manualPaymentMethod)||void 0===t?void 0:t.instructions)&&h("sc-alert",{key:"a3781ca62e40a451874384561f69d4443efec91e",type:"info",open:!0,style:{"text-align":"left"}},h("span",{key:"ead7333597d5ba39dafc5ec79713a3311ac8f316",slot:"title"},null===(s=this.manualPaymentMethod)||void 0===s?void 0:s.name),h("div",{key:"98fd27422acf9b9f822a96735828b99660e02ebe",innerHTML:null===(c=this.manualPaymentMethod)||void 0===c?void 0:c.instructions})),h("sc-button",{key:"fae99645209c19f410aea3814cb15da84e2f714f",href:null===(o=null===window||void 0===window?void 0:window.scData)||void 0===o?void 0:o.home_url,size:"large",type:"primary",ref:e=>this.continueButton=e},wp.i18n.__("Go to Homepage","surecart"),h("sc-icon",{key:"11c366e99b08f2197a044734c748d98d6a29aa35",name:"arrow-right",slot:"suffix"})))))}get el(){return this}static get watchers(){return{checkoutStatus:["handleConfirmOrderEvent"],showSuccessModal:["handleSuccessModal"]}}static get style(){return ScCheckoutTestCompleteStyle0}},[1,"sc-checkout-test-complete",{checkoutStatus:[1,"checkout-status"],successUrl:[1,"success-url"],showSuccessModal:[32],manualPaymentMethod:[32]},void 0,{checkoutStatus:["handleConfirmOrderEvent"],showSuccessModal:["handleSuccessModal"]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["sc-checkout-test-complete","sc-alert","sc-button","sc-dashboard-module","sc-dialog","sc-icon","sc-spinner"].forEach((e=>{switch(e){case"sc-checkout-test-complete":customElements.get(e)||customElements.define(e,ScCheckoutTestComplete);break;case"sc-alert":customElements.get(e)||defineCustomElement$6();break;case"sc-button":customElements.get(e)||defineCustomElement$5();break;case"sc-dashboard-module":customElements.get(e)||defineCustomElement$4();break;case"sc-dialog":customElements.get(e)||defineCustomElement$3();break;case"sc-icon":customElements.get(e)||defineCustomElement$2();break;case"sc-spinner":customElements.get(e)||defineCustomElement$1()}}))}export{ScCheckoutTestComplete as S,defineCustomElement as d};