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