CRM.$(function(d){f("civicrm_stripe loaded, dom-ready function firing.");if(window.civicrmStripeHandleReload){f("calling existing civicrmStripeHandleReload.");window.civicrmStripeHandleReload();return}varo;varb;varc;vara;varn=false;window.onbeforeunload=null;window.civicrmStripeHandleReload=function(){f("civicrmStripeHandleReload");vary=document.getElementById("card-element");if((typeofy!=="undefined")&&(y)){if(!y.children.length){f("checkAndLoad from document.ready");l()}}};window.civicrmStripeHandleReload();functiont(z){f("paymentIntent confirmation success");vary=document.createElement("input");y.setAttribute("type","hidden");y.setAttribute("name","paymentIntentID");y.setAttribute("value",z.id);c.appendChild(y);c.submit()}functiong(y){f("error: "+y.error.message);varz=document.getElementById("card-errors");z.style.display="block";z.textContent=y.error.message;document.querySelector("#billing-payment-block").scrollIntoView();window.scrollBy(0,-50);a.removeAttribute("disabled")}functionw(){f("handle card payment");o.createPaymentMethod("card",b).then(function(y){if(y.error){g(y)}else{varz=CRM.url("civicrm/stripe/confirm-payment");d.post(z,{payment_method_id:y.paymentMethod.id,amount:p(),currency:CRM.vars.stripe.currency,id:CRM.vars.stripe.id}).then(function(A){u(A)})}})}functionu(y){f("handleServerResponse");if(y.error){g(y)}else{if(y.requires_action){q(y)}else{t(y.paymentIntent)}}}functionq(y){o.handleCardAction(y.payment_intent_client_secret).then(function(z){if(z.error){g(z)}else{t(z.paymentIntent)}})}d(document).ajaxComplete(function(A,B,z){if((z.url.match("civicrm(/|%2F)payment(/|%2F)form")!==null)||(z.url.match("civicrm(/|%2F)contact(/|%2F)view(/|%2F)participant")!==null)){if(typeofCRM.vars.stripe==="undefined"){return}vary=j();if(y!==null){if(y!==parseInt(CRM.vars.stripe.id)){f("payment processor changed to id: "+y);if(y===0){returnk()}CRM.api3("PaymentProcessor","getvalue",{"return":"user_name",id:y,payment_processor_type_id:CRM.vars.stripe.paymentProcessorTypeID}).done(function(C){varD=C.result;if(D){f("Setting new stripe key to: "+D);CRM.vars.stripe.publishableKey=D}else{returnk()}f("checkAndLoad from ajaxComplete");l()})}}}});functionk(){f("New payment processor is not Stripe, clearing CRM.vars.stripe");if((typeofb!=="undefined")&&(b)){f("destroying card element");b.destroy();b=undefined}delete (CRM.vars.stripe)}functionl(){if(typeofCRM.vars.stripe==="undefined"){f("CRM.vars.stripe not defined! Not a Stripe processor?");return}if(typeofStripe==="undefined"){if(n){return}n=true;f("Stripe.js is not loaded!");d.getScript("https://js.stripe.com/v3",function(){f("Script loaded and executed.");n=false;e()})}else{e()}}functione(){f("loadStripeBillingBlock");if(typeofo==="undefined"){o=Stripe(CRM.vars.stripe.publishableKey)}varE=o.elements();varB={base:{fontSize:"20px"}};b=E.create("card",{style:B});b.mount("#card-element");f("created new card element",b);document.getElementsByClassName("billing_postal_code-"+CRM.vars.stripe.billingAddressID+"-section")[0].setAttribute("hidden",true);b.addEventListener("change",function(F){s(F)});c=h();if(typeofc.length==="undefined"||c.length===0){f("No billing form!");return}a=x();c.dataset.submitdontprocess=false;vary=c.querySelectorAll('[type="submit"][formnovalidate="1"], [type="submit"][formnovalidate="formnovalidate"], [type="submit"].cancel, [type="submit"].webform-previous'),A;for(A=0;A<y.length;++A){y[A].addEventListener("click",D())}functionD(){f("adding submitdontprocess");c.dataset.submitdontprocess=true}a.addEventListener("click",z);functionz(F){if(c.dataset.submitted){return}c.dataset.submitted=true;if(typeofCRM.vars.stripe==="undefined"){returnc.submit()}f("clearing submitdontprocess");c.dataset.submitdontprocess=false;returnC(F)}a.removeAttribute("onclick");m();if(v()){d("[type=submit]").click(function(){r(this.value)});c.addEventListener("keydown",function(F){if(F.keyCode===13){r(this.value);C(event)}});d("#billingcheckbox:input").hide();d('label[for="billingcheckbox"]').hide()}functionC(H){H.preventDefault();f("submit handler");if(d(c).valid()===false){f("Form not valid");returnfalse}if(typeofCRM.vars.stripe==="undefined"){f("Submitting - not a stripe processor");returntrue}if(c.dataset.submitted===true){f("form already submitted");returnfalse}varJ=CRM.vars.stripe.id;varG=null;if(v()){J=CRM.vars.stripe.id;if(!d('input[name="submitted[civicrm_1_contribution_1_contribution_payment_processor_id]"]').length){G=J}else{G=c.querySelector('input[name="submitted[civicrm_1_contribution_1_contribution_payment_processor_id]"]:checked').val()}}else{if((c.querySelector(".crm-section.payment_processor-section")!==null)||(c.querySelector(".crm-section.credit_card_info-section")!==null)){J=CRM.vars.stripe.id;if(c.querySelector('input[name="payment_processor_id"]:checked')!==null){G=c.querySelector('input[name="payment_processor_id"]:checked').value}}}if((G===0)||(J===null)||((G===null)&&(J===null))){f("Not a Stripe transaction, or pay-later");returntrue}else{f("Stripe is the selected payprocessor")}if(typeofCRM.vars.stripe.publishableKey==="undefined"){f("submit missing stripe-pub-key element or value");returntrue}if(c.dataset.submitdontprocess===true){f("non-payment submit detected - not submitting payment");returntrue}if(v()){if(d("#billing-payment-block").is(":hidden")){f("no payment processor on webform");returntrue}varI=d('[name="submitted[civicrm_1_contribution_1_contribution_payment_processor_id]"]');if(I.length){if(I.filter(":checked").val()==="0"||I.filter(":checked").val()===0){f("no payment processor selected");returntrue}}}varF=p();if(F=="0"){f("Total amount is 0");returntrue}if(c.dataset.submitted===true){alert("Form already submitted. Please wait.");returnfalse}else{c.dataset.submitted=true}a.setAttribute("disabled",true);w();returntrue}}functionv(){if(c!==null){returnc.classList.contains("webform-client-form")||c.classList.contains("webform-submission-form")}returnfalse}functionh(){vary=d("div#card-element").closest("form").prop("id");if((typeofy==="undefined")||(!y.length)){y=d("input[name=hidden_processor]").closest("form").prop("id")}returndocument.getElementById(y)}functionx(){vary=null;if(v()){y=c.querySelector('[type="submit"].webform-submit');if(!y){y=c.querySelector('[type="submit"].webform-button--submit')}}else{y=c.querySelector('[type="submit"].validate')}returny}functionp(){vary=null;if(typeofcalculateTotalFee=="function"){y=calculateTotalFee()}else{if(v()){d(".line-item:visible","#wf-crm-billing-items").each(function(){y+=parseFloat(d(this).data("amount"))})}else{if(document.getElementById("total_amount")){returndocument.getElementById("total_amount").value}}}returny}functions(y){if(!y.complete){return}document.getElementById("billing_postal_code-"+CRM.vars.stripe.billingAddressID).value=y.value.postalCode}functionm(){cividiscountElements=c.querySelectorAll("input#discountcode");vary=function(z){if(z.keyCode===13){z.preventDefault();f("adding submitdontprocess");c.dataset.submitdontprocess=true}};for(i=0;i<cividiscountElements.length;++i){cividiscountElements[i].addEventListener("keydown",y)}}functionf(y){if((typeof(CRM.vars.stripe)==="undefined")||(Boolean(CRM.vars.stripe.jsDebug)===true)){console.log(newDate().toISOString()+" civicrm_stripe.js: "+y)}}functionr(z){vary=null;if(document.getElementById("action")!==null){y=document.getElementById("action")}else{y=document.createElement("input")}y.setAttribute("type","hidden");y.setAttribute("name","op");y.setAttribute("id","action");y.setAttribute("value",z);c.appendChild(y)}functionj(){if((typeofc==="undefined")||(!c)){c=h();if(!c){returnnull}}vary=c.querySelector('input[name="payment_processor_id"]:checked');if(y!==null){returnparseInt(y.value)}returnnull}});
\ No newline at end of file
CRM.$(function(d){f("civicrm_stripe loaded, dom-ready function firing.");if(window.civicrmStripeHandleReload){f("calling existing civicrmStripeHandleReload.");window.civicrmStripeHandleReload();return}varp;varb;varc;vara;varo=false;window.onbeforeunload=null;window.civicrmStripeHandleReload=function(){f("civicrmStripeHandleReload");varz=document.getElementById("card-element");if((typeofz!=="undefined")&&(z)){if(!z.children.length){f("checkAndLoad from document.ready");m()}}};window.civicrmStripeHandleReload();functionu(A){f("paymentIntent confirmation success");varz=document.createElement("input");z.setAttribute("type","hidden");z.setAttribute("name","paymentIntentID");z.setAttribute("value",A.id);c.appendChild(z);c.submit()}functionh(z){f("error: "+z.error.message);varA=document.getElementById("card-errors");A.style.display="block";A.textContent=z.error.message;document.querySelector("#billing-payment-block").scrollIntoView();window.scrollBy(0,-50);c.dataset.submitted=false;a.removeAttribute("disabled")}functionx(){f("handle card payment");p.createPaymentMethod("card",b).then(function(z){if(z.error){h(z)}else{varA=CRM.url("civicrm/stripe/confirm-payment");d.post(A,{payment_method_id:z.paymentMethod.id,amount:q(),currency:CRM.vars.stripe.currency,id:CRM.vars.stripe.id,recur:g()}).then(function(B){v(B)})}})}functionv(z){f("handleServerResponse");if(z.error){h(z)}else{if(z.requires_action){r(z)}else{u(z.paymentIntent)}}}functionr(z){p.handleCardAction(z.payment_intent_client_secret).then(function(A){if(A.error){h(A)}else{u(A.paymentIntent)}})}d(document).ajaxComplete(function(B,C,A){if((A.url.match("civicrm(/|%2F)payment(/|%2F)form")!==null)||(A.url.match("civicrm(/|%2F)contact(/|%2F)view(/|%2F)participant")!==null)){if(typeofCRM.vars.stripe==="undefined"){return}varz=k();if(z!==null){if(z!==parseInt(CRM.vars.stripe.id)){f("payment processor changed to id: "+z);if(z===0){returnl()}CRM.api3("PaymentProcessor","getvalue",{"return":"user_name",id:z,payment_processor_type_id:CRM.vars.stripe.paymentProcessorTypeID}).done(function(D){varE=D.result;if(E){f("Setting new stripe key to: "+E);CRM.vars.stripe.publishableKey=E}else{returnl()}f("checkAndLoad from ajaxComplete");m()})}}}});functionl(){f("New payment processor is not Stripe, clearing CRM.vars.stripe");if((typeofb!=="undefined")&&(b)){f("destroying card element");b.destroy();b=undefined}delete (CRM.vars.stripe)}functionm(){if(typeofCRM.vars.stripe==="undefined"){f("CRM.vars.stripe not defined! Not a Stripe processor?");return}if(typeofStripe==="undefined"){if(o){return}o=true;f("Stripe.js is not loaded!");d.getScript("https://js.stripe.com/v3",function(){f("Script loaded and executed.");o=false;e()})}else{e()}}functione(){f("loadStripeBillingBlock");if(typeofp==="undefined"){p=Stripe(CRM.vars.stripe.publishableKey)}varF=p.elements();varC={base:{fontSize:"20px"}};b=F.create("card",{style:C});b.mount("#card-element");f("created new card element",b);document.getElementsByClassName("billing_postal_code-"+CRM.vars.stripe.billingAddressID+"-section")[0].setAttribute("hidden",true);b.addEventListener("change",function(G){t(G)});c=j();if(typeofc.length==="undefined"||c.length===0){f("No billing form!");return}a=y();c.dataset.submitdontprocess=false;varz=c.querySelectorAll('[type="submit"][formnovalidate="1"], [type="submit"][formnovalidate="formnovalidate"], [type="submit"].cancel, [type="submit"].webform-previous'),B;for(B=0;B<z.length;++B){z[B].addEventListener("click",E())}functionE(){f("adding submitdontprocess");c.dataset.submitdontprocess=true}a.addEventListener("click",A);functionA(G){if(c.dataset.submitted===true){return}c.dataset.submitted=true;if(typeofCRM.vars.stripe==="undefined"){returnc.submit()}f("clearing submitdontprocess");c.dataset.submitdontprocess=false;returnD(G)}a.removeAttribute("onclick");n();if(w()){d("[type=submit]").click(function(){s(this.value)});c.addEventListener("keydown",function(G){if(G.keyCode===13){s(this.value);D(event)}});d("#billingcheckbox:input").hide();d('label[for="billingcheckbox"]').hide()}functionD(I){I.preventDefault();f("submit handler");if(d(c).valid()===false){f("Form not valid");returnfalse}if(typeofCRM.vars.stripe==="undefined"){f("Submitting - not a stripe processor");returntrue}if(c.dataset.submitted===true){f("form already submitted");returnfalse}varK=CRM.vars.stripe.id;varH=null;if(w()){K=CRM.vars.stripe.id;if(!d('input[name="submitted[civicrm_1_contribution_1_contribution_payment_processor_id]"]').length){H=K}else{H=c.querySelector('input[name="submitted[civicrm_1_contribution_1_contribution_payment_processor_id]"]:checked').val()}}else{if((c.querySelector(".crm-section.payment_processor-section")!==null)||(c.querySelector(".crm-section.credit_card_info-section")!==null)){K=CRM.vars.stripe.id;if(c.querySelector('input[name="payment_processor_id"]:checked')!==null){H=c.querySelector('input[name="payment_processor_id"]:checked').value}}}if((H===0)||(K===null)||((H===null)&&(K===null))){f("Not a Stripe transaction, or pay-later");returntrue}else{f("Stripe is the selected payprocessor")}if(typeofCRM.vars.stripe.publishableKey==="undefined"){f("submit missing stripe-pub-key element or value");returntrue}if(c.dataset.submitdontprocess===true){f("non-payment submit detected - not submitting payment");returntrue}if(w()){if(d("#billing-payment-block").is(":hidden")){f("no payment processor on webform");returntrue}varJ=d('[name="submitted[civicrm_1_contribution_1_contribution_payment_processor_id]"]');if(J.length){if(J.filter(":checked").val()==="0"||J.filter(":checked").val()===0){f("no payment processor selected");returntrue}}}varG=q();if(G=="0"){f("Total amount is 0");returntrue}if(c.dataset.submitted===true){alert("Form already submitted. Please wait.");returnfalse}else{c.dataset.submitted=true}a.setAttribute("disabled",true);x();returntrue}}functionw(){if(c!==null){returnc.classList.contains("webform-client-form")||c.classList.contains("webform-submission-form")}returnfalse}functionj(){varz=d("div#card-element").closest("form").prop("id");if((typeofz==="undefined")||(!z.length)){z=d("input[name=hidden_processor]").closest("form").prop("id")}returndocument.getElementById(z)}functiony(){varz=null;if(w()){z=c.querySelector('[type="submit"].webform-submit');if(!z){z=c.querySelector('[type="submit"].webform-button--submit')}}else{z=c.querySelector('[type="submit"].validate')}returnz}functionq(){varz=null;if(typeofcalculateTotalFee=="function"){z=calculateTotalFee()}else{if(w()){d(".line-item:visible","#wf-crm-billing-items").each(function(){z+=parseFloat(d(this).data("amount"))})}else{if(document.getElementById("total_amount")){returndocument.getElementById("total_amount").value}}}returnz}functiong(){if(document.getElementById("is_recur")!==null){returnBoolean(document.getElementById("is_recur").value)}returnfalse}functiont(z){if(!z.complete){return}document.getElementById("billing_postal_code-"+CRM.vars.stripe.billingAddressID).value=z.value.postalCode}functionn(){cividiscountElements=c.querySelectorAll("input#discountcode");varz=function(A){if(A.keyCode===13){A.preventDefault();f("adding submitdontprocess");c.dataset.submitdontprocess=true}};for(i=0;i<cividiscountElements.length;++i){cividiscountElements[i].addEventListener("keydown",z)}}functionf(z){if((typeof(CRM.vars.stripe)==="undefined")||(Boolean(CRM.vars.stripe.jsDebug)===true)){console.log(newDate().toISOString()+" civicrm_stripe.js: "+z)}}functions(A){varz=null;if(document.getElementById("action")!==null){z=document.getElementById("action")}else{z=document.createElement("input")}z.setAttribute("type","hidden");z.setAttribute("name","op");z.setAttribute("id","action");z.setAttribute("value",A);c.appendChild(z)}functionk(){if((typeofc==="undefined")||(!c)){c=j();if(!c){returnnull}}varz=c.querySelector('input[name="payment_processor_id"]:checked');if(z!==null){returnparseInt(z.value)}returnnull}});