import{o as C,c as Y,A as U,b as p,aH as ee,y as te,s as ae,bj as oe,I as F,k as t,X as q,bk as se,a as o,w as u,e as _,t as x,ax as N,ae as j,af as M,U as z,N as I,ba as E,ak as T,M as L,V as le,f as re,$ as ne,d as ie,F as O,G as ce,ag as G,ah as K,ay as de}from"./index-DphlBmm9.js";import{p as H}from"./payApi-_pNkJsa1.js";import{R as ue}from"./ReCaptcha-D5A4Vakl.js";import{_ as A}from"./_plugin-vue_export-helper-DlAUqK2U.js";const pe={name:"Overlay",props:{show:Boolean}},me={key:0,class:"overlays"};function fe(l,y,w,c,s,f){return C(),Y(oe,{to:"body"},[w.show?(C(),U("div",me,[p("div",{class:"modal",onClick:y[0]||(y[0]=te(v=>l.$emit("close"),["self"]))},[ee(l.$slots,"default",{},void 0,!0)])])):ae("",!0)])}const he=A(pe,[["render",fe],["__scopeId","data-v-333a22a5"]]),B=l=>(G("data-v-0810b5b4"),l=l(),K(),l),ye={class:"d-flex align-center"},ve=B(()=>p("p",{class:"mt-6"},"1.Add a credit card information",-1)),ge=B(()=>p("div",{id:"card-element"},null,-1)),_e={id:"card-errors",class:"sr-field-error",role:"alert"},Se={class:"mt-6 d-flex align-center",style:{color:"#106ebe","justify-content":"center"}},be=B(()=>p("div",{class:"mt-4 text-medium-emphasis text-center pb-4",style:{"font-size":"12px"}}," Credit cards handled securely with SSL encryption ",-1)),Ie=F({__name:"AddPaymentCardDialog",props:{title:String},emits:["reflash"],setup(l,{expose:y,emit:w}){let c=t(!1);const s=t(!1);t([]),t([]),t([]);let f=t([]),v=t("");const r=t("");t(""),t(""),t(""),t(""),t(""),t("");const S=t(""),a=q({color:"",msg:"",isShow:!1});let P=t(!1);t([e=>!!e||"Country is required"]),t([e=>!!e||"State is required"]),t([e=>!!e||"Address is required",e=>e&&e.length<40||"Max length 40"]),t([e=>!!e||"City is required",e=>e&&e.length<40||"Max length 40"]),t([e=>!!e||"ZIP code is required"]),se();let h=t(""),b=t(""),n=t(""),i=t("");const m=w,X=l,V=H();function Z(){V.publicKey().then(e=>{V.createPaymentIntent({orderIds:f.value,contentType:"application/json;charset=UTF-8"}).then(d=>{i.value=d.data.clientSecret,v.value=d.data.stripePaymentIntentId,b.value=Stripe(e.data);let D=b.value.elements();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)"}}};h.value=D.create("card",{style:g,hidePostalCode:!0}),h.value.mount("#card-element"),h.value.on("focus",function(){var $=document.getElementById("card-element");$.classList.add("focused")}),h.value.on("blur",function(){var $=document.getElementById("card-element");$.classList.remove("focused")})})})}function J(){if(!S.value){a.color="error",a.msg="Please verify reCaptcha",a.isShow=!0;return}s.value=!0,V.recaptchaValid({recaptchaToken:S.value}).then(e=>{b.value.confirmCardPayment(i.value,{payment_method:{card:h.value,type:"card"}}).then(d=>{console.log(d),d.error?(a.color="error",a.msg="Please verify reCaptcha",a.isShow=!0):R()})}).catch(e=>{a.color="error",a.msg=e.msg,a.isShow=!0,s.value=!1})}function R(){setTimeout(async()=>{V.createPaymentIntentStatus({stripePaymentIntentId:v.value}).then(e=>{e.data.status===1?R():e.data.status===3?(a.color="error",a.msg=data.failReason,a.isShow=!0,s.value=!1,k()):e.data.status===2&&(a.color="success",a.msg="paySuccess",a.isShow=!0,s.value=!1,m("reflash"),k())})},500)}function Q(e){return console.log("val....",e),S.value=e,e}function W(e){f.value=e.orderId,console.log("orderId1...",e),console.log("orderId...",f.value),c.value=!0,setTimeout(()=>{P.value=!0},1e3),Z()}function k(){s.value=!1,c.value=!1}return y({openDialog:W,closeDialog:k}),(e,d)=>{const D=ce("lockIcon");return C(),U(O,null,[o(N,{modelValue:a.isShow,"onUpdate:modelValue":d[0]||(d[0]=g=>a.isShow=g),color:a.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:u(()=>[_(x(a.msg),1)]),_:1},8,["modelValue","color"]),o(he,{show:I(c)},{default:u(()=>[o(j,{style:{"max-width":"570px"}},{default:u(()=>[o(M,{style:{"padding-top":"24px"}},{default:u(()=>[p("h3",ye,[_(x(X.title)+" ",1),o(z,{src:I(E),width:32,height:32,class:"close",onClick:d[1]||(d[1]=g=>T(c)?c.value=!1:c=!1)},null,8,["src"])]),o(L,{class:"mt-4"}),ve,ge,p("div",_e,x(I(n)),1),o(le,{class:"mt-4"},{default:u(()=>[o(re,{lg:"12",cols:"12"},{default:u(()=>[o(ne,{label:"Cardholder name",color:"primary",variant:"outlined",modelValue:r.value,"onUpdate:modelValue":d[2]||(d[2]=g=>r.value=g)},null,8,["modelValue"])]),_:1})]),_:1}),o(ue,{onGetChildren:Q}),o(ie,{class:"mt-6",color:"primary",block:"",loading:s.value,onClick:J},{default:u(()=>[_("Submit")]),_:1},8,["loading"]),p("div",Se,[o(D),_("lock Secure card form ")]),be]),_:1})]),_:1})]),_:1},8,["show"])],64)}}}),Te=A(Ie,[["__scopeId","data-v-0810b5b4"]]),we=l=>(G("data-v-46b86596"),l=l(),K(),l),Ve={class:"d-flex align-center"},xe=we(()=>p("div",{class:"text-center"},[p("div",{id:"paypal-button-container2"})],-1)),Ce=F({__name:"AddPayPalDialog",props:{title:String},emits:["reflash"],setup(l,{expose:y,emit:w}){let c=t(""),s=t(!1);const f=H(),v="https://dashboard.jetprintapp.com",r=q({color:"",msg:"",isShow:!1});function S(){paypal.Button.render({env:"production",commit:!0,style:{size:"large",color:"blue",shape:"rect"},locale:"en_US",payment:function(){return a()},onAuthorize:function(n,i){console.log(n,i);var m={paymentId:n.paymentID,payerId:n.payerID};return P(m)}},"paypal-button-container2")}async function a(){try{return(await f.createPaypal({contentType:"application/json;charset=UTF-8",cancelUrl:v+"/order/order?id="+c.value,orderIds:c.value,returnUrl:v+"/order/order?id="+c.value})).data.payId}catch(n){throw n}}function P(n){f.executePaypal(n).then(i=>{data.status===1?(r.color="success",r.msg="Pay success",r.isShow=!0):(r.color="error",r.msg=i.failReason,r.isShow=!0)})}function h(n){c.value=n,s.value=!0,setTimeout(()=>{S()},100)}function b(){isSubmit.value=!1,s.value=!1}return y({openDialog:h,closeDialog:b}),(n,i)=>(C(),U(O,null,[o(N,{modelValue:r.isShow,"onUpdate:modelValue":i[0]||(i[0]=m=>r.isShow=m),color:r.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:u(()=>[_(x(r.msg),1)]),_:1},8,["modelValue","color"]),o(de,{modelValue:I(s),"onUpdate:modelValue":i[2]||(i[2]=m=>T(s)?s.value=m:s=m),"max-width":575},{default:u(()=>[o(j,null,{default:u(()=>[o(M,{style:{"padding-top":"24px"}},{default:u(()=>[p("h3",Ve,[_("Pay Paypal "),o(z,{src:I(E),width:32,height:32,class:"close",onClick:i[1]||(i[1]=m=>T(s)?s.value=!1:s=!1)},null,8,["src"])]),o(L,{class:"mt-4 mb-6"}),xe]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),Ue=A(Ce,[["__scopeId","data-v-46b86596"]]);export{Te as A,Ue as a};