1import{_ as U}from"./JSYoA_QN.js";import{_ as C,d as j,r as l,s as L,aw as Y,c as k,o as V,a as t,i as y,p as H,k as f,v,h as E,A as O,j as K,U as $,e as R}from"./SuPpnckH.js";import{_ as q}from"./D9KiulC6.js";import{A as B}from"./ChKFBoyU.js";import{u as G}from"./D2Ikzhvp.js";import"./QVoDY9p2.js";import"./W9H1toHc.js";import"./D_eYetee.js";import"./C7A_Nvk3.js";import"./BVnAYhmB.js";import"./hYJoJCZL.js";import"./BU1Wq2eS.js";const J={class:"arrow-link"},Q={class:"form-holder"},W={class:"form-group"},X={class:"form-group"},Z={class:"form-group"},D={class:"form-group"},ee={class:"form-group"},te={class:"form-group"},oe={class:"text-left flex justify-center w-max mx-auto",style:{"padding-top":"1rem"}},re=["disabled"],ne={__name:"StripeForm",setup(A){const{addPaymentMethod:h,isAddingPaymentMethod:x}=G(),I=$();let _=null,d=null,a=null,g=null,b=null;const w=j(()=>I.public.stripePublicKey),p=l(""),S=l(""),i=l(""),c=l(""),u=l(""),m=l("");function z(){return new Promise((o,e)=>{if(window.Stripe){o(window.Stripe);return}const n=document.createElement("script");n.src="https://js.stripe.com/v3/",n.onload=()=>o(window.Stripe),n.onerror=e,document.head.appendChild(n)})}function M(){if(!w.value){console.error("Stripe public key is not configured");return}_=window.Stripe(w.value),d=_.elements(),a=d.create("cardNumber",{style:{base:{color:"#25282a",fontSize:"14px",fontFamily:"Inter, sans-serif",padding:"13px 0px 13px 0px","::placeholder":{fontSize:"13px",color:"#9B9B9B",textTransform:"uppercase"}}},placeholder:"Card number *"}),g=d.create("cardExpiry",{style:{base:{color:"#25282a",fontSize:"14px",fontFamily:"Inter, sans-serif",padding:"13px 0px 13px 0px","::placeholder":{fontSize:"13px",color:"#9B9B9B",textTransform:"uppercase"}}},placeholder:"MM/YYYY"}),b=d.create("cardCvc",{style:{base:{color:"#25282a",fontSize:"14px",fontFamily:"Nunito Sans, sans-serif",padding:"13px 0px 13px 0px","::placeholder":{fontSize:"13px",color:"#9B9B9B",textTransform:"uppercase"}}},placeholder:"CVV *"})}function T(){const o=document.getElementById("card-number"),e=document.getElementById("card-expiry"),n=document.getElementById("card-cvc");if(!o||!e||!n){console.error("Stripe mount elements not found in DOM");return}a.mount(o),a.focus(),a.on("change",function(r){const s=document.getElementById("card-errors");s&&(s.textContent=r.error?r.error.message:"")}),g.mount(e),g.on("change",function(r){const s=document.getElementById("card-errors");s&&(s.textContent=r.error?r.error.message:"")}),b.mount(n),b.on("change",function(r){const s=document.getElementById("card-errors");s&&(s.textContent=r.error?r.error.message:"")})}L(async()=>{try{await z(),M(),await Y(),T()}catch(o){console.error("Failed to initialize Stripe:",o)}});function F(o){c.value=o.locality,u.value=o.administrative_area_level_1,m.value=o.postal_code}function N(o){if(o.formatted_address)i.value=o.formatted_address;else{const e=[];o.street_number&&e.push(o.street_number),o.route&&e.push(o.route),o.locality&&e.push(o.locality),i.value=e.join(" ")}}async function P(){const o=document.getElementById("card-errors");if(p.value)o.textContent="";else{o.textContent="Card name can't be blank";return}const{token:e,error:n}=await _.createToken(a,{name:p.value,address_line1:S.value,address_line2:i.value,address_city:c.value,address_state:u.value,address_zip:m.value});if(n){o.textContent=n;return}else o.textContent="",h({paymentType:"creditcard",invoiceInfo:null,stripeToken:e.id})}return(o,e)=>{const n=U;return V(),k("div",null,[e[12]||(e[12]=t("h2",{class:"page-titles"},"Add credit card",-1)),t("div",J,[y(n,{to:"/billing?tab=payment"},{default:H(()=>[...e[6]||(e[6]=[t("span",null," Back to payments",-1)])]),_:1})]),t("form",{id:"payment-form",onSubmit:K(P,["prevent"])},[t("section",Q,[e[7]||(e[7]=t("div",{class:"form-group"},[t("div",{id:"card-number",class:"form-control"})],-1)),t("div",W,[f(t("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>p.value=r),type:"text",placeholder:"Name on card *",class:"form-control"},null,512),[[v,p.value]])]),e[8]||(e[8]=t("div",{class:"form-group inline-inputs"},[t("label",null,"Expiration*"),t("div",{id:"card-expiry"}),t("div",{id:"card-cvc"})],-1)),t("div",X,[y(B,{modelValue:S.value,"onUpdate:modelValue":e[1]||(e[1]=r=>S.value=r),"input-id":"stripe_address_one","input-name":"address_one",placeholder:"Address Line 1 *","input-class":"form-control",onAddressFilled:F},null,8,["modelValue"])]),t("div",Z,[y(B,{modelValue:i.value,"onUpdate:modelValue":e[2]||(e[2]=r=>i.value=r),"input-id":"stripe_address_two","input-name":"address_two",placeholder:"Address Line 2","input-class":"form-control",onAddressFilled:N},null,8,["modelValue"])]),t("div",D,[f(t("input",{"onUpdate:modelValue":e[3]||(e[3]=r=>c.value=r),type:"text",placeholder:"City *",class:"form-control"},null,512),[[v,c.value]])]),t("div",ee,[f(t("input",{"onUpdate:modelValue":e[4]||(e[4]=r=>u.value=r),type:"text",placeholder:"State *",class:"form-control"},null,512),[[v,u.value]])]),t("div",te,[f(t("input",{"onUpdate:modelValue":e[5]||(e[5]=r=>m.value=r),type:"text",placeholder:"Postal Code *",class:"form-control"},null,512),[[v,m.value]])])]),e[10]||(e[10]=t("p",{id:"card-errors",role:"alert",class:"card-errors"},null,-1)),t("div",oe,[t("button",{class:O(["button-gemnote button-gemnote--small",{"button-gemnote--disabled":E(x)}]),disabled:E(x)},[...e[9]||(e[9]=[t("span",null,"Save",-1)])],10,re)]),e[11]||(e[11]=t("div",{class:"flex items-center justify-center margin-top-2 gap-1 item"},[t("img",{src:q,alt:"check",class:"w-4"}),t("span",null,"SSL Secure Encryption")],-1))],32)])}}},se=C(ne,[["__scopeId","data-v-c110a5dc"]]),le={class:"content-wrapper","data-testid":"add-payment-method-page"},ae={__name:"add-payment-method",setup(A){return R({title:"Add Payment Method"}),(h,x)=>(V(),k("div",le,[y(se,{"data-testid":"stripe-form"})]))}},be=C(ae,[["__scopeId","data-v-eee02098"]]);export{be 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.