import{o as x,c as J,H as B,b as u,b0 as Q,bR as Z,G as ee,T as te,U as F,df as ae,b1 as oe,F as N,a as s,bV as j,w as c,d as h,bf as C,bo as _,bW as z,bY as E,bX as L,ap as U,c2 as O,c3 as G,f as le,V as se,c4 as re,e as ne,aY as n,aW as K,b_ as ie}from"./index-CUCRxCBw.js";import{p as M}from"./payApi-Das4qzXB.js";import{_ as de}from"./ReCaptcha-CVJ3WPVA.js";import{_ as A}from"./_plugin-vue_export-helper-DlAUqK2U.js";const ce={name:"Overlay",props:{show:Boolean}},ue={key:0,class:"overlays"};function me(S,v,V,d,o,p){return x(),J(te,{to:"body"},[V.show?(x(),B("div",ue,[u("div",{class:"modal",onClick:v[0]||(v[0]=Z(y=>S.$emit("close"),["self"]))},[Q(S.$slots,"default",{},void 0,!0)])])):ee("",!0)])}const pe=A(ce,[["render",me],["__scopeId","data-v-333a22a5"]]),fe={class:"d-flex align-center"},ve={id:"card-errors",class:"sr-field-error",role:"alert"},ye={class:"mt-6 d-flex align-center",style:{color:"#106ebe","justify-content":"center"}},ge=F({__name:"AddPaymentCardDialog",props:{title:String},emits:["reflash"],setup(S,{expose:v,emit:V}){let d=n(!1);const o=n(!1);let p=n([]),y=n("");const b=n(""),r=n(""),t=K({color:"",msg:"",isShow:!1});let P=n(!1);ae();let f=n(""),w=n(""),k=n(""),i=n(""),a=n("");const m=V,W=S,I=M();function Y(){I.publicKey().then(l=>{I.createPaymentIntent({orderIds:p.value,couponCode:a.value,contentType:"application/json;charset=UTF-8"}).then(e=>{i.value=e.data.clientSecret,y.value=e.data.stripePaymentIntentId,w.value=Stripe(l.data);let T=w.value.elements({locale:"en"});var g={base:{fontSize:"16px",color:"#32325d",fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif",fontSmoothing:"antialiased","::placeholder":{color:"rgba(0,0,0,0.4)"}}};f.value=T.create("card",{style:g,hidePostalCode:!0}),f.value.mount("#card-element"),f.value.on("focus",function(){var $=document.getElementById("card-element");$.classList.add("focused")}),f.value.on("blur",function(){var $=document.getElementById("card-element");$.classList.remove("focused")})})})}function q(){if(!r.value){t.color="error",t.msg="Please verify reCaptcha",t.isShow=!0;return}o.value=!0,I.recaptchaValid({recaptchaToken:r.value}).then(l=>{w.value.confirmCardPayment(i.value,{payment_method:{card:f.value,type:"card"}}).then(e=>{console.log(e),e.error?(o.value=!1,t.color="error",t.msg=e.error.message,t.isShow=!0):R()})}).catch(l=>{t.color="error",t.msg=l.msg,t.isShow=!0,o.value=!1})}function R(){setTimeout(async()=>{I.createPaymentIntentStatus({stripePaymentIntentId:y.value}).then(l=>{l.data.status===1?R():l.data.status===3?(t.color="error",t.msg=l.data.failReason,t.isShow=!0,o.value=!1,D()):l.data.status===2&&(t.color="success",t.msg="paySuccess",t.isShow=!0,o.value=!1,m("reflash"),D())})},500)}function H(l){return console.log("val....",l),r.value=l,l}function X(l){p.value=l.orderId,a.value=l.couponCode,console.log("orderId1...",l),console.log("orderId...",p.value),d.value=!0,setTimeout(()=>{P.value=!0},1e3),Y()}function D(){o.value=!1,d.value=!1}return v({openDialog:X,closeDialog:D}),(l,e)=>{const T=oe("lockIcon");return x(),B(N,null,[s(j,{modelValue:t.isShow,"onUpdate:modelValue":e[0]||(e[0]=g=>t.isShow=g),color:t.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:c(()=>[h(C(t.msg),1)]),_:1},8,["modelValue","color"]),s(pe,{show:_(d)},{default:c(()=>[s(z,{style:{"max-width":"570px"}},{default:c(()=>[s(E,{style:{"padding-top":"24px"}},{default:c(()=>[u("h3",fe,[h(C(W.title)+" ",1),s(L,{src:_(O),width:32,height:32,class:"close",onClick:e[1]||(e[1]=g=>U(d)?d.value=!1:d=!1)},null,8,["src"])]),s(G,{class:"mt-4"}),e[5]||(e[5]=u("p",{class:"mt-6"},"1.Add a credit card information",-1)),e[6]||(e[6]=u("div",{id:"card-element"},null,-1)),u("div",ve,C(_(k)),1),s(le,{class:"mt-4"},{default:c(()=>[s(se,{lg:"12",cols:"12"},{default:c(()=>[s(re,{label:"Cardholder name",color:"primary",variant:"outlined",modelValue:b.value,"onUpdate:modelValue":e[2]||(e[2]=g=>b.value=g)},null,8,["modelValue"])]),_:1})]),_:1}),s(de,{onGetChildren:H}),s(ne,{class:"mt-6",color:"primary",block:"",loading:o.value,disabled:!r.value,onClick:q},{default:c(()=>[...e[3]||(e[3]=[h("Submit",-1)])]),_:1},8,["loading","disabled"]),u("div",ye,[s(T),e[4]||(e[4]=h("lock Secure card form ",-1))]),e[7]||(e[7]=u("div",{class:"mt-4 text-medium-emphasis text-center pb-4",style:{"font-size":"12px"}}," Credit cards handled securely with SSL encryption ",-1))]),_:1})]),_:1})]),_:1},8,["show"])],64)}}}),Ie=A(ge,[["__scopeId","data-v-91a541e5"]]),he={class:"d-flex align-center"},Se=F({__name:"AddPayPalDialog",props:{title:String},emits:["reflash"],setup(S,{expose:v,emit:V}){let d=n(""),o=n(!1);const p=M(),y="https://dashboard.jetprintapp.com",b=n(""),r=K({color:"",msg:"",isShow:!1});function t(){paypal.Button.render({env:"production",commit:!0,style:{size:"large",color:"blue",shape:"rect"},locale:"en_US",payment:function(){return P()},onAuthorize:function(i,a){console.log(i,a);var m={paymentId:i.paymentID,payerId:i.payerID};return f(m)}},"paypal-button-container2")}async function P(){try{return(await p.createPaypal({contentType:"application/json;charset=UTF-8",couponCode:b.value,cancelUrl:y+"/order/order?id="+d.value,orderIds:d.value,returnUrl:y+"/order/order?id="+d.value})).data.payId}catch(i){throw i}}function f(i){p.executePaypal(i).then(a=>{data.status===1?(r.color="success",r.msg="Pay success",r.isShow=!0):(r.color="error",r.msg=a.failReason,r.isShow=!0)})}function w(i,a){d.value=i,b.value=a,o.value=!0,setTimeout(()=>{t()},100)}function k(){isSubmit.value=!1,o.value=!1}return v({openDialog:w,closeDialog:k}),(i,a)=>(x(),B(N,null,[s(j,{modelValue:r.isShow,"onUpdate:modelValue":a[0]||(a[0]=m=>r.isShow=m),color:r.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:c(()=>[h(C(r.msg),1)]),_:1},8,["modelValue","color"]),s(ie,{modelValue:_(o),"onUpdate:modelValue":a[2]||(a[2]=m=>U(o)?o.value=m:o=m),"max-width":575},{default:c(()=>[s(z,null,{default:c(()=>[s(E,{style:{"padding-top":"24px"}},{default:c(()=>[u("h3",he,[a[3]||(a[3]=h("Pay Paypal ",-1)),s(L,{src:_(O),width:32,height:32,class:"close",onClick:a[1]||(a[1]=m=>U(o)?o.value=!1:o=!1)},null,8,["src"])]),s(G,{class:"mt-4 mb-6"}),a[4]||(a[4]=u("div",{class:"text-center"},[u("div",{id:"paypal-button-container2"})],-1))]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),Ce=A(Se,[["__scopeId","data-v-fcb1e508"]]);export{Ie as A,Ce as a};