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:"8880988be24c475421d2b54c9dfd945684766746"},h("slot",{key:"0301cb11f3a0e1d10d60df81dc880ffc77693aaa"}),h("sc-dialog",{key:"a96eb1959b206b58dc1ada90b707963e779e62f4",open:!!this.showSuccessModal,style:{"--body-spacing":"var(--sc-spacing-xxx-large)","--width":"400px"},noHeader:!0,onScRequestClose:e=>e.preventDefault()},h("div",{key:"496ecd0823810af00622b5a37748b9c2c9837b5f",class:"confirm__icon"},h("div",{key:"9677f7f47900bf129659b27a00eb90e06368a36f",class:"confirm__icon-container"},h("sc-icon",{key:"167e6fbc7a880b4092aadf657c3a780ac8136cda",name:"check"}))),h("sc-dashboard-module",{key:"ff63fb9cc9c26176ff347c9809cab0c186ecbdf1",heading:wp.i18n.__("Test checkout successful!","surecart"),style:{"--sc-dashboard-module-spacing":"var(--sc-spacing-x-large)",textAlign:"center"}},h("span",{key:"02716802dc259ae7505ab69a817e3a6da55129c9",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:"fe6f7c7134aa4a30fb9eeb04451b418018e05c13",type:"info",open:!0,style:{"text-align":"left"}},h("span",{key:"c3ccaecdf4d8a9407ef333691d631c83a713b23a",slot:"title"},null===(s=this.manualPaymentMethod)||void 0===s?void 0:s.name),h("div",{key:"4881bc45861b75cd49989239a6ea074e8418f5a6",innerHTML:null===(c=this.manualPaymentMethod)||void 0===c?void 0:c.instructions})),h("sc-button",{key:"b27f7d8f4844d5c6fc05efc5915232fd2c3cf079",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:"c1ba21e3fec1994dd1d27c0207138e58428c0113",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};