import{r as i,h as s}from"./p-b891c2f1.js";import{g as t,a as r}from"./p-6fd3642a.js";import{_ as o}from"./p-684c85b4.js";import"./p-aafd8ea4.js";import{U as a}from"./p-aad60fb9.js";import{a as n}from"./p-1c2e2695.js";import"./p-112455b1.js";const e=class{constructor(s){i(this,s),this.loading=!1}componentWillLoad(){a.create(this,this.state()),this.getSession()}getSessionId(){var i;return(null===(i=this.order)||void 0===i?void 0:i.id)?this.order.id:t(window.location.href,"order")}async getSession(){var i;if(this.getSessionId()&&!(null===(i=this.order)||void 0===i?void 0:i.id))try{this.loading=!0,this.order=await await r({path:n(`surecart/v1/checkouts/${this.getSessionId()}`,{expand:["line_items","line_item.price","price.product","customer","customer.shipping_address","payment_intent","discount","discount.promotion","billing_address","shipping_address"],refresh_status:!0})})}catch(i){this.error=(null==i?void 0:i.message)?i.message:o("Something went wrong","surecart")}finally{this.loading=!1}}state(){var i;return{processor:"stripe",loading:this.loading,orderId:this.getSessionId(),order:this.order,customer:null===(i=this.order)||void 0===i?void 0:i.customer}}renderOnHold(){var i,t,r;return"requires_approval"!==(null===(i=this.order)||void 0===i?void 0:i.status)?null:"paypal"===(null===(r=null===(t=null==this?void 0:this.order)||void 0===t?void 0:t.payment_intent)||void 0===r?void 0:r.processor_type)?s("sc-alert",{type:"warning",open:!0},o("Paypal is taking a closer look at this payment. It’s required for some payments and normally takes up to 3 business days.","surecart")):"asdf"}render(){var i,t;return s(a.Provider,{state:this.state()},s("div",{class:{"order-confirmation":!0}},s("div",{class:{"order-confirmation__content":!0,hidden:!(null===(i=this.order)||void 0===i?void 0:i.id)&&!this.loading}},this.renderOnHold(),s("slot",null)),!(null===(t=this.order)||void 0===t?void 0:t.id)&&!this.loading&&s("sc-heading",null,o("Order not found.","surecart"),s("span",{slot:"description"},o("This order could not be found. Please try again.","surecart")))))}};e.style=":host{display:block;max-width:800px;margin:auto}.order-confirmation__content{display:grid;gap:var(--sc-form-row-spacing-large)}.order-confirmation__content.hidden{display:none}::part(line-items){display:grid;gap:0.5em}";export{e as sc_order_confirmation}