import{r as i,h as e}from"./p-9add63ef.js";import"./p-8dccb656.js";import{U as t}from"./p-e9ae48d3.js";import{g as o}from"./p-d3366af3.js";import{a as r}from"./p-401e165e.js";import{a as s}from"./p-259c3935.js";const n=":host{display:block;max-width:800px;margin:auto}::slotted(*:not(:last-child)),sc-form form>*:not(:last-child){margin-bottom:var(--sc-form-row-spacing-large)}.order-confirmation__content{color:var(--sc-order-confirmation-color, var(--sc-color-gray-500))}.order-confirmation__content.hidden{display:none}::part(line-items){display:grid;gap:0.5em}";const a=n;const d=class{constructor(e){i(this,e);this.order=undefined;this.loading=false;this.error=undefined}componentWillLoad(){t.create(this,this.state());this.getSession()}getSessionId(){var i;if((i=this.order)===null||i===void 0?void 0:i.id)return this.order.id;return o(window.location.href,"sc_order")}async getSession(){var i;if(!this.getSessionId())return;if((i=this.order)===null||i===void 0?void 0:i.id)return;try{this.loading=true;this.order=await await s({path:r(`surecart/v1/checkouts/${this.getSessionId()}`,{expand:["checkout_fees","shipping_fees","line_items","line_item.price","line_item.fees","price.product","customer","customer.shipping_address","payment_intent","discount","manual_payment_method","discount.promotion","billing_address","shipping_address"],refresh_status:true,currency_conversion:false})})}catch(i){if(i===null||i===void 0?void 0:i.message){this.error=i.message}else{this.error=wp.i18n.__("Something went wrong","surecart")}}finally{this.loading=false}}state(){var i,e;const t=(i=this.order)===null||i===void 0?void 0:i.manual_payment_method;return{processor:"stripe",loading:this.loading,orderId:this.getSessionId(),order:this.order,customer:(e=this.order)===null||e===void 0?void 0:e.customer,manualPaymentTitle:t===null||t===void 0?void 0:t.name,manualPaymentInstructions:t===null||t===void 0?void 0:t.instructions}}renderOnHold(){var i,t,o;if(((i=this.order)===null||i===void 0?void 0:i.status)!=="processing")return null;if(((o=(t=this===null||this===void 0?void 0:this.order)===null||t===void 0?void 0:t.payment_intent)===null||o===void 0?void 0:o.processor_type)==="paypal"){return e("sc-alert",{type:"warning",open:true},wp.i18n.__("Paypal is taking a closer look at this payment. It’s required for some payments and normally takes up to 3 business days.","surecart"))}}renderManualInstructions(){var i;const t=(i=this.order)===null||i===void 0?void 0:i.manual_payment_method;if(!(t===null||t===void 0?void 0:t.instructions))return;return e("sc-alert",{type:"info",open:true},e("span",{slot:"title"},t===null||t===void 0?void 0:t.name),e("div",{innerHTML:t===null||t===void 0?void 0:t.instructions}))}render(){var i,o;return e(t.Provider,{key:"30a75bbb9e89cf05ba338e7296138f76e76a18dd",state:this.state()},e("div",{key:"427d288659261313d78e3eb32394cd3ed8a1302e",class:{"order-confirmation":true}},e("div",{key:"f8535b9f36a5f30c3db8e0e17c80e47c1e3c3161",class:{"order-confirmation__content":true,hidden:!((i=this.order)===null||i===void 0?void 0:i.id)&&!this.loading}},e("sc-order-confirm-components-validator",{key:"44c3e632868452b5747635f92f2bdc4a76f6d181",checkout:this.order},e("slot",{key:"898ea9000314f833d17a3291a96622625f7d1cc9"}))),!((o=this.order)===null||o===void 0?void 0:o.id)&&!this.loading&&e("sc-heading",{key:"2b64b397480de2cdcd9b5380e83f2c2eb2f0cc89"},wp.i18n.__("Order not found.","surecart"),e("span",{key:"eef77f6dbf8180af810e37311da6bc0067497852",slot:"description"},wp.i18n.__("This order could not be found. Please try again.","surecart")))))}};d.style=a;export{d as sc_order_confirmation};
//# sourceMappingURL=p-52d194bc.entry.js.map