PageSourceSearch

https://www.dynamiccatholic.com/on/demandware.static/Sites-dci_us-…/js/components/donationWidget.js

js dynamiccatholic.com collected 2026-10-01 10:41:24 UTC 11,247 bytes, 1 lines download raw bytes

1(()=>{"use strict";function e(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],u=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,n)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var n=[];function r(e){e.querySelectorAll(".user-info").forEach(function(e){e.classList.remove("is-invalid")}),e.querySelectorAll(".cc-info").forEach(function(e){e.classList.remove("is-invalid")}),e.errorContainer.textContent="",e.errorContainer.classList.add("hidden");var t=parseFloat(e.donateInput.value);return!(isNaN(t)||t<10)||(e.donateInput.focus(),e.errorContainer.classList.remove("hidden"),e.errorContainer.textContent="Please enter an amount of at least $10.",!1)}function o(e){e.otg&&e.otg.classList&&e.otg.classList.remove("active"),e.rgm&&e.rgm.classList&&e.rgm.classList.remove("active"),e.rga&&e.rga.classList&&e.rga.classList.remove("active"),u(e,".gift-amount")}function a(e){e.querySelectorAll(".amount-button.active").forEach(function(e){e.classList.remove("active")}),e.donateInput.value="",e.donateInput.removeAttribute("value")}function i(e,t){e.donateInput.value=parseInt(t),e.donateInput.setAttribute("value",parseInt(t))}function s(e,t){e.querySelectorAll(t).forEach(function(e){e.classList.remove("hidden")})}function u(e,t){e.querySelectorAll(t).forEach(function(e){e.classList.add("hidden")})}document.querySelectorAll(".donation-widget").forEach(function(e){n.push({root:e,otg:e.querySelector(".One.Time"),rgm:e.querySelector(".Monthly"),rga:e.querySelector(".Annually"),amountButtons:e.querySelectorAll(".amount-button"),donateInput:e.querySelector("#donateAmountInput"),form:e.querySelector("#donation-form"),clampTimeout:null,errorContainer:e.querySelector(".error-container"),orderErrorContainer:e.querySelector(".order-error"),querySelector:function(e){return this.root.querySelector(e)},querySelectorAll:function(e){return this.root.querySelectorAll(e)}})}),$(document).ready(function(){n.forEach(function(e){!function(e){u(e,".section-two"),u(e,".section-three"),u(e,".section-four"),o(e);var t=e.querySelector(".donation-subheader"),n="Select Your One-Time Donation Amount",r="Select Your Monthly Donation Amount",a="Select Your Annual Donation Amount";e.subHeaderOverrideOneTime=t?t.getAttribute("data-subheader-override-onetime"):"",e.subHeaderOverrideMonthly=t?t.getAttribute("data-subheader-override-monthly"):"",e.subHeaderOverrideAnnual=t?t.getAttribute("data-subheader-override-annual"):"",e.querySelectorAll(".otg-amount").length>0?(e.otg.classList.add("active"),s(e,".otg-amount"),t&&(t.textContent=e.subHeaderOverrideOneTime||n),$(".otg-amount .amount-button").first().addClass("active"),i(e,parseInt($(".otg-amount .amount-button").first().data("amount")))):e.querySelectorAll(".rgm-amount").length>0?(e.rgm.classList.add("active"),s(e,".rgm-amount"),t&&(t.textContent=e.subHeaderOverrideMonthly||r),$(".rgm-amount .amount-button").first().addClass("active"),i(e,parseInt($(".rgm-amount .amount-button").first().data("amount")))):e.querySelectorAll(".rga-amount").length>0&&(e.rga.classList.add("active"),s(e,".rga-amount"),t&&(t.textContent=e.subHeaderOverrideAnnual||a),$(".rga-amount .amount-button").first().addClass("active"),i(e,parseInt($(".rga-amount .amount-button").first().data("amount"))))}(e),function(e){var t=e.querySelector(".donation-subheader"),n="Select Your One-Time Donation Amount",r="Select Your Monthly Donation Amount",u="Select Your Annual Donation Amount";e.otg&&e.otg.addEventListener("click",function(){o(e),a(e),e.otg.classList.add("active"),s(e,".otg-amount"),i(e,e.querySelector(".otg-amount .amount-button").dataset.amount),t&&(t.textContent=e.subHeaderOverrideOneTime||n)});e.rgm&&e.rgm.addEventListener("click",function(){o(e),a(e),e.rgm.classList.add("active"),s(e,".rgm-amount"),i(e,e.querySelector(".rgm-amount .amount-button").dataset.amount),t&&(t.textContent=e.subHeaderOverrideMonthly||r)});e.rga&&e.rga.addEventListener("click",function(){o(e),a(e),e.rga.classList.add("active"),s(e,".rga-amount"),i(e,e.querySelector(".rga-amount .amount-button").dataset.amount),t&&(t.textContent=e.subHeaderOverrideAnnual||u)})}(e),function(e){e.amountButtons.forEach(function(t){t.addEventListener("click",function(n){a(e),$(this).addClass("active"),i(e,t.getAttribute("data-amount"))})}),e.donateInput.addEventListener("input",function(){clearTimeout(e.clampTimeout),e.clampTimeout=setTimeout(function(){var t=parseInt(e.donateInput.value,10);!isNaN(t)&&t<10&&(e.donateInput.value=10)},500)})}(e),function(e){var t=e.querySelector(".firstButton"),n=e.querySelector(".secondButton"),o=e.querySelector(".thirdButton"),a=e.querySelectorAll(".backButton"),i=document.getElementById("donation-message");t.addEventListener("click",function(){r(e)&&(u(e,".section-one"),s(e,".section-two"),u(e,".section-three"))}),n.addEventListener("click",function(){r(e)&&(u(e,".section-one"),u(e,".section-two"),s(e,".section-three"))}),a[0].addEventListener("click",function(){s(e,".section-one"),u(e,".section-two"),u(e,".section-three")}),a[1].addEventListener("click",function(){u(e,".section-one"),s(e,".section-two"),u(e,".section-three")}),o.addEventListener("click",function(){var t=function(e){if(e.orderErrorContainer.textContent="",e.orderErrorContainer.classList.add("hidden"),e.errorContainer.textContent="",e.errorContainer.classList.add("hidden"),e.querySelectorAll(".user-info").forEach(function(e){e.classList.remove("is-invalid")}),e.querySelectorAll(".cc-info").forEach(function(e){e.classList.remove("is-invalid")}),!e.form.checkValidity()){var t=e.form.querySelector(":invalid");return e.errorContainer.classList.remove("hidden"),e.errorContainer.textContent="Please fill in all required fields",e.form.querySelectorAll(".form-section").forEach(function(e){e.contains(t)?e.classList.remove("hidden"):e.classList.add("hidden")}),t.focus(),!1}var n=e.form.elements.expiry.value;if(!/^(0[1-9]|1[0-2])\/\d{2}$/.test(n))return e.form.elements.expiry.focus(),e.errorContainer.classList.remove("hidden"),e.errorContainer.textContent="Expiry must be in MM/YY format.",!1;var r=e.form.elements.cvc.value;if(!/^\d{3,4}$/.test(r))return e.form.elements.cvc.focus(),e.errorContainer.classList.remove("hidden"),e.errorContainer.textContent="CVC must be 3 or 4 digits.",!1;return!0}(e),n=new FormData(e.form),r=function(e,t){var n=t.get("adress"),r=t.get("zip"),o=t.get("country"),a=t.get("state"),i=t.get("city"),s=t.get("email"),u=t.get("phone"),l=t.get("firstName"),c=t.get("lastName"),d=t.get("cardNumber"),m=t.get("expiry"),f=t.get("cvc"),v=t.get("oneTimeGiftSKU"),g=t.get("monthlyGift
1SKU"),h=t.get("annualGiftSKU"),y={amount:e.donateInput.value,type:e.querySelector(".type-button.active").dataset.type,address1:n,zip:r,country:o,state:a,city:i,email:s,phone:u,firstName:l,lastName:c,cardNum:d,expires:m,cvv:f,oneTimeGiftSKU:v,monthlyGiftSKU:g,annualGiftSKU:h};return y}(e,n),a=new URLSearchParams(r).toString(),d=$(".donation-place-order-url").val();t&&(!function(e){(function(){if(document.getElementById("pd-spinner-style"))return;var e="\n    .pd-spinner{display:inline-block;width:18px;height:18px;border:2px solid rgba(0,0,0,0.12);border-top-color:#000;border-radius:50%;animation:pd-spin 0.6s linear infinite;vertical-align:middle;margin-right:8px;}\n    .pd-spinner-text{vertical-align:middle;}\n    @keyframes pd-spin{to{transform:rotate(360deg)}}\n  ",t=document.createElement("style");t.id="pd-spinner-style",t.appendChild(document.createTextNode(e)),document.head.appendChild(t)})(),e.dataset.originalHtml||(e.dataset.originalHtml=e.innerHTML);e.disabled=!0,e.classList.add("disabled"),e.setAttribute("aria-busy","true"),e.innerHTML=l}(o),fetch(d,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a}).then(function(e){return e.json()}).then(function(t){t.success?(s(e,".section-four"),u(e,".section-three")):i.textContent="Error: "+(t.error||"Could not add to cart"),i.classList.remove("hidden"),c(o)}).catch(function(t){console.error("Donation order error:",t),console.error(t.stack),e.orderErrorContainer.textContent="We ran into an error making your order. Please check the information above and try again",e.orderErrorContainer.classList.remove("hidden"),c(o)}))});var m=e.querySelector("#country");m.addEventListener("change",function(){d(e)}),d(e)}(e),function(e){var t=e.querySelector('input[name="expiry"], #expiry');if(!t)return;t.addEventListener("input",function(e){if(null!=e.data){var n=(t.value||"").replace(/\D/g,"");if(0!==n.length)if(n.length>4&&(n=n.slice(0,4)),1!==n.length){var r=n.slice(0,2),o=n.slice(2);"00"===r?r="01":parseInt(r,10)>12&&(r="12");var a=r+"/";o.length>0&&(a+=o),t.value=a}else{var i=n[0];"0"===i?t.value="0":"1"!==i?t.value="0"+i+"/":"/"===e.data&&(t.value="01/")}else t.value=""}})}(e)})});var l='<span class="pd-spinner" aria-hidden="true"></span><span class="pd-spinner-text">Processing...</span>';function c(e){var t=e.dataset.originalHtml;void 0!==t&&(e.innerHTML=t,delete e.dataset.originalHtml),e.disabled=!1,e.classList.remove("disabled"),e.removeAttribute("aria-busy")}function d(t){var n=t.querySelector("#state"),r=t.querySelector("#country");n.innerHTML="";var o=r.value,a=m[o];if(a)for(var i=0,s=Object.entries(a);i<s.length;i++){var u=e(s[i],2),l=u[0],c=u[1],d=document.createElement("option");d.value=l,d.textContent=c,""===l&&(d.disabled=!0,d.selected=!0),n.appendChild(d)}}var m={US:{"":"Select a State",AL:"Alabama",AK:"Alaska",AZ:"Arizona",AR:"Arkansas",CA:"California",CO:"Colorado",CT:"Connecticut",DE:"Delaware",DC:"District Of Columbia",FL:"Florida",GA:"Georgia",HI:"Hawaii",ID:"Idaho",IL:"Illinois",IN:"Indiana",IA:"Iowa",KS:"Kansas",KY:"Kentucky",LA:"Louisiana",ME:"Maine",MD:"Maryland",MA:"Massachusetts",MI:"Michigan",MN:"Minnesota",MS:"Mississippi",MO:"Missouri",MT:"Montana",NE:"Nebraska",NV:"Nevada",NH:"New Hampshire",NJ:"New Jersey",NM:"New Mexico",NY:"New York",NC:"North Carolina",ND:"North Dakota",OH:"Ohio",OK:"Oklahoma",OR:"Oregon",PA:"Pennsylvania",RI:"Rhode Island",SC:"South Carolina",SD:"South Dakota",TN:"Tennessee",TX:"Texas",UT:"Utah",VT:"Vermont",VA:"Virginia",WA:"Washington",WV:"West Virginia",WI:"Wisconsin",WY:"Wyoming"},CA:{"":"Select a Province/Territory",AB:"Alberta",BC:"British Columbia",MB:"Manitoba",NB:"New Brunswick",NL:"Newfoundland and Labrador",NS:"Nova Scotia",NT:"Northwest Territories",NU:"Nunavut",ON:"Ontario",PE:"Prince Edward Island",QC:"Quebec",SK:"Saskatchewan",YT:"Yukon"}}})();

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.