1import{u as e,i as a,r as t,R as o,j as r,M as n,N as l,v as i}from"./main.1.45.0.js";const s=()=>{var s;const d=e((e=>e.checkout)),c=a(),[u,h]=t.useState("2000px"),v=e=>{return a=null,t=null,o=function*(){try{if(!d.id||!d.provider||!d.businessId)throw new Error("Missing checkout id or provider.");const a=yield c(n({checkoutId:d.id,externalOrderId:`${e}`,businessId:d.businessId}));n.fulfilled.match(a)?(c(l()),window.location.href=i().toString()):n.rejected.match(a)&&console.log("An error occurred completing the external purchase process.")}catch(a){console.log(a.message)}},new Promise(((e,r)=>{var n=e=>{try{i(o.next(e))}catch(a){r(a)}},l=e=>{try{i(o.throw(e))}catch(a){r(a)}},i=a=>a.done?e(a.value):Promise.resolve(a.value).then(n,l);i((o=o.apply(a,t)).next())}));var a,t,o};function p(e){var a,t,o,r,n;if(e.data&&"string"==typeof e.data){const l=JSON.parse(e.data);"iframe:resize"===(null==l?void 0:l.event)&&h(`${l.payload.height+200}px`),"purchase"===(null==(t=null==(a=null==l?void 0:l.payload)?void 0:a.payload)?void 0:t.event)&&(null==(n=null==(r=null==(o=null==l?void 0:l.payload)?void 0:o.payload)?void 0:r.ecommerce)?void 0:n.transaction_id)&&v(l.payload.payload.ecommerce.transaction_id)}}return o.useEffect((()=>(window.addEventListener("message",p,!1),()=>window.removeEventListener("message",p,!1))),[]),(null==(s=d.metadata)?void 0:s.externalCheckoutUrl)?r.jsx("iframe",{width:"100%",height:u,src:`${d.metadata.externalCheckoutUrl}`,title:"Dutchie checkout page"}):null};export{s as DutchieCheckout,s as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.