OwlCyberSecurity - MANAGER
Edit File: paypal-commerce.js
(()=>{"use strict";const e=class{constructor(e){this.form=e,this.jQueryForm=jQuery(e),this.ajaxurl=Give.fn.getGlobalVar("ajaxurl"),this.setupProperties()}setupProperties(){}boot(){this.renderPaymentMethodOption()}renderPaymentMethodOption(){}showError(e){e.hasOwnProperty("details")?s.addErrors(this.jQueryForm,Give.form.fn.getErrorHTML([{message:e.details[0].description}])):s.addErrors(this.jQueryForm,e)}isInTestMode(){return"1"===Give.fn.getGlobalVar("is_test_mode")}displayErrorMessage(e,t=!1){let r=Give.form.fn.getErrorHTML([{message:window.givePayPalCommerce.genericDonorErrorMessage}]);(t||this.isInTestMode())&&(r=e),this.showError(r)}isProcessingEventForForm(e){return e===this.form.getAttribute("id")&&s.isPayPalCommerceSelected(this.jQueryForm)}async createOrderHandler(e,t){Give.form.fn.removeErrors(this.jQueryForm);const r=await fetch(`${this.ajaxurl}?action=give_paypal_commerce_create_order`,{method:"POST",body:s.getFormDataWithoutGiveActionField(this.form)}),i=await r.json();if(!i.success)throw i.data.error;return i.data.id}},t=class extends e{setupProperties(){this.ccFieldsContainer=this.form.querySelector('[id^="give_cc_fields-"]'),this.recurringChoiceHiddenField=this.form.querySelector('input[name="_give_is_donation_recurring"]'),this.smartButton=null,this.updateOrderAmount=!1}static canShow(){return-1!==givePayPalCommerce.payPalSdkQueryParameters.components.indexOf("buttons")}getButtonContainer(){this.ccFieldsContainer=this.form.querySelector('[id^="give_cc_fields-"]');const e=this.ccFieldsContainer.querySelector("#give-paypal-commerce-smart-buttons-wrap");if(e)return e;const t=document.createElement("div"),r=this.ccFieldsContainer.querySelector(".separator-with-text");t.setAttribute("id","give-paypal-commerce-smart-buttons-wrap");const i=this.ccFieldsContainer.querySelector("[id^=give-card-number-wrap-]");return this.ccFieldsContainer.insertBefore(t,r||i)}renderPaymentMethodOption(){this.smartButtonContainer=this.getButtonContainer(),this.smartButton&&this.smartButton.close();const e={onInit:this.onInitHandler.bind(this),onClick:this.onClickHandler.bind(this),createOrder:this.createOrderHandler.bind(this),onApprove:this.orderApproveHandler.bind(this),style:{layout:"vertical",size:"responsive",shape:"rect",label:"paypal",color:"gold",tagline:!1},onError:e=>{this.displayErrorMessage(e)}};return s.isRecurringDonation(this.form)&&(e.createSubscription=this.creatSubscriptionHandler.bind(this),e.onApprove=this.subscriptionApproveHandler.bind(this),delete e.createOrder),s.toggleDonateNowButton(this.form),this.smartButton=paypal.Buttons(e),this.smartButton.render(this.smartButtonContainer)}onInitHandler(e,t){}async onClickHandler(e,t){const r=new FormData(this.form);o.canShow()&&(r.delete("card_name"),r.delete("card_cvc"),r.delete("card_number"),r.delete("card_expiry")),Give.form.fn.removeErrors(this.jQueryForm);const i=await Give.form.fn.isDonorFilledValidData(this.form,r);return"success"===i?(this.observeAmount(),t.resolve()):(this.showError(i),t.reject())}observeAmount(){const e=this,t=e.form.querySelector("#give-amount");if(t){const r={attributes:!0,childList:!0,characterData:!0};new MutationObserver((function(t){e.updateOrderAmount=!0})).observe(t,r)}}async creatSubscriptionHandler(e,t){Give.form.fn.removeErrors(this.jQueryForm);const r=await fetch(`${this.ajaxurl}?action=give_paypal_commerce_create_plan_id`,{method:"POST",body:s.getFormDataWithoutGiveActionField(this.form)}),i=await r.json();if(!i.success)throw i.data.error;const o=new FormData(this.form),n={name:{given_name:o.get("give_first"),surname:o.get("give_last")},email_address:o.get("give_email")};return o.get("billing_country")&&(n.shipping_address={name:{full_name:`${o.get("give_first")} ${o.get("give_last")}`.trim()},address:{address_line_1:o.get("card_address"),address_line_2:o.get("card_address_2"),admin_area_2:o.get("card_city"),admin_area_1:o.get("card_state"),postal_code:o.get("card_zip"),country_code:o.get("billing_country")}}),t.subscription.create({plan_id:i.data.id,subscriber:n})}async subscriptionApproveHandler(e,t){Give.form.fn.showProcessingState(window.givePayPalCommerce.textForOverlayScreen),await s.addFieldToForm(this.form,e.subscriptionID,"payPalSubscriptionId"),this.submitDonationForm()}async orderApproveHandler(e,t){Give.form.fn.showProcessingState(window.givePayPalCommerce.textForOverlayScreen),Give.form.fn.disable(this.jQueryForm,!0),Give.form.fn.removeErrors(this.jQueryForm);const r=await fetch(`${this.ajaxurl}?action=give_paypal_commerce_approve_order&order=${e.orderID}&update_amount=${this.updateOrderAmount}`,{method:"post",body:s.getFormDataWithoutGiveActionField(this.form)}),i=await r.json();let o={};if(!i.success)return Give.form.fn.disable(this.jQueryForm,!1),Give.form.fn.hideProcessingState(),this.displayErrorMessage(i.data.error,!0),o=i.data.error?.details?.[0],o&&"INSTRUMENT_DECLINED"===o.issue?t.restart():void 0;const n=i.data.order;await s.addFieldToForm(this.form,n.id,"payPalOrderId"),this.submitDonationForm()}submitDonationForm(){this.jQueryForm.off("submit"),this.removeCreditCardFields(),this.form.submit()}removeCreditCardFields(){if(o.canShow()){this.jQueryForm.find('input[name="card_name"]').parent().remove(),this.ccFieldsContainer.querySelector(".separator-with-text").remove();const e=new i(this.form);for(const t in e.cardFields)e.cardFields[t].el.parentElement.remove()}}};class r extends e{setupProperties(){this.ccFieldsContainer=this.form.querySelector('[id^="give_cc_fields-"]'),this.cardFields=this.getCardFields(),this.recurringChoiceHiddenField=this.form.querySelector('input[name="_give_is_donation_recurring"]'),this.separator=this.ccFieldsContainer.querySelector(".separator-with-text"),this.separator||!r.canShow(this.form)&&!o.canShow()||(this.separator=this.cardFields.number.el?this.cardFields.number.el.parentElement.insertAdjacentElement("beforebegin",this.separatorHtml()):null)}renderPaymentMethodOption(){this.toggleFields()}getCardFields(){return{number:{el:this.form.querySelector('input[name="card_number"]')},cvv:{el:this.form.querySelector('input[name="card_cvc"]')},expirationDate:{el:this.form.querySelector('input[name="card_expiry"]')}}}toggleFields(){const e=r.canShow(this.form)?"block":"none";for(const t in this.cardFields)this.cardFields[t].el.style.display=e,this.cardFields[t].el.disabled="none"===e}static canShow(e){return o.canShow()&&s.isRecurringDonation(e)}removeFields(){for(const e in this.cardFields)this.cardFields[e].el&&this.cardFields[e].el.parentElement.remove();const e=this.form.querySelector('input[name="card_name"]');e&&e.parentElement.remove(),this.separator&&this.separator.remove()}separatorHtml(){const e=document.createElement("div");return e.setAttribute("class","separator-with-text"),e.innerHTML=`<div class="dashed-line"></div><div class="label">${givePayPalCommerce.separatorLabel}</div><div class="dashed-line"></div>`,e}}const i=r,o=class extends e{constructor(e){super(e.form),this.customCardFields=e,this.setFocusStyle()}setupProperties(){this.cardFields={},this.hostedCardFieldsContainers={},this.hostedFieldContainerStyleProperties=["height"],this.hostedInputFieldStyleProperties=["color","direction","font-size","letter-spacing","line-height"],this.hostedFocusedInputFieldStyleProperties=["color","border-left-color"],this.hostedInputFieldPlaceholderStyleProperties=["color"],this.styles={container:{},input:{},"input:focus":{},"input:placeholder":{}}}static canShow(){return!0===paypal?.HostedFields?.isEligible()&&"1"===window.givePayPalCommerce.supportsCustomPayments&&-1!==givePayPalCommerce.payPalSdkQueryParameters.components.indexOf("hosted-fields")}async renderPaymentMethodOption(){this.setupContainerForHostedCardFields(),this.applyStyleToContainer();const e=`submit.${this.form.getAttribute("id")}`,t=this.createOrderHandler.bind(this),r=await this.getComputedInputFieldForHostedField(),i=this.getPayPalHostedCardFields(),o=await paypal.HostedFields.render({createOrder:t,styles:r,fields:i}).catch((e=>{this.displayErrorMessage(e)})),n=this.onSubmitHandlerForDonationForm.bind(this);this.addEventToHostedFields(o),this.jQueryForm.off(e).on(e,{hostedCardFields:o},n)}setupContainerForHostedCardFields(){const e=this.customCardFields.cardFields;let t="";for(const r in e){const i=document.createElement("div");t=e[r].el.getAttribute("name");const o=`give-${e[r].el.getAttribute("id")}`;let n;(n=this.form.querySelector(`#${o}`))?(n.innerHTML="",this.hostedCardFieldsContainers[this.getFieldTypeByFieldName(t)]=n):(i.setAttribute("id",o),i.setAttribute("class","give-paypal-commerce-cc-field give-input-field-wrapper"),this.hostedCardFieldsContainers[this.getFieldTypeByFieldName(t)]=e[r].el.parentElement.appendChild(i))}this.toggleFields()}getPayPalHostedCardFields(){return{number:{selector:`#${this.hostedCardFieldsContainers.number.getAttribute("id")}`,placeholder:givePayPalCommerce.cardFieldPlaceholders.cardNumber},cvv:{selector:`#${this.hostedCardFieldsContainers.cvv.getAttribute("id")}`,placeholder:givePayPalCommerce.cardFieldPlaceholders.cardCvc},expirationDate:{selector:`#${this.hostedCardFieldsContainers.expirationDate.getAttribute("id")}`,placeholder:givePayPalCommerce.cardFieldPlaceholders.expirationDate}}}async approvePayment(e){const t=await fetch(`${this.ajaxurl}?action=give_paypal_commerce_approve_order&order=`+e,{method:"POST",body:s.getFormDataWithoutGiveActionField(this.form)});return await t.json()}getComputedInputFieldForHostedField(){return{input:{...this.styles.input,...givePayPalCommerce.hostedCardFieldStyles.input},":focus":{color:this.styles["input:focus"].color,...givePayPalCommerce.hostedCardFieldStyles[":focus"]},":placeholder":{color:this.styles["input:placeholder"].color,...givePayPalCommerce.hostedCardFieldStyles[":placeholder"]}}}async onSubmitHandlerForDonationForm(e){if(!s.isPayPalCommerceSelected(this.jQueryForm))return!0;if(s.isRecurringDonation(this.form))return Give.form.fn.showProcessingState(window.givePayPalCommerce.textForOverlayScreen),void this.submitDonationForm();const t=this.hostedFieldOnSubmitErrorHandler.bind(this);e.preventDefault(),Give.form.fn.removeErrors(this.jQueryForm);const{hostedCardFields:r}=e.data,i=this.getExtraCardDetails.bind(this),o=await r.submit({contingencies:["SCA_WHEN_REQUIRED"],...i}).catch(t);return!!o&&(this.canThreeDsAuthorizeCard(o)&&!this.IsCardThreeDsAuthorized(o)?(Give.form.fn.addErrorsAndResetDonationButton(this.jQueryForm,Give.form.fn.getErrorHTML([{message:givePayPalCommerce.threeDsCardAuthenticationFailedNotice}])),!1):(await this.onApproveHandler(o),!1))}async onApproveHandler(e){Give.form.fn.showProcessingState(window.givePayPalCommerce.textForOverlayScreen);const t=await this.approvePayment(e.orderId);if(!t.success)return this.hostedFieldOnSubmitErrorHandler(t.data.error),void Give.form.fn.hideProcessingState();await s.addFieldToForm(this.form,t.data.order.id,"payPalOrderId"),this.submitDonationForm()}getExtraCardDetails(){return{cardholderName:this.form.getElementById("#card_name").value}}addEventToHostedFields(e){const t=this;e.on("focus",(function(e){t.hostedCardFieldsContainers[e.emittedBy].classList.add("has-focus")})),e.on("blur",(function(e){t.hostedCardFieldsContainers[e.emittedBy].classList.remove("has-focus")}))}applyStyleToContainer(){this.computedStyles(),this.setHostedFieldContainerHeight(),window.addEventListener("load",this.setHostedFieldContainerHeight.bind(this))}computedStyles(){const e=this.form.querySelector('input[name="card_name"]'),t=window.getComputedStyle(e,null);Array.from(this.styles.container).length||(this.hostedFieldContainerStyleProperties.forEach((e=>{this.styles.container={[e]:t.getPropertyValue(e),...this.styles.container}})),this.hostedInputFieldStyleProperties.forEach((e=>{this.styles.input={[e]:t.getPropertyValue(e),...this.styles.input}})),this.hostedInputFieldPlaceholderStyleProperties.forEach((e=>{this.styles["input:placeholder"]={[e]:t.getPropertyValue(e),...this.styles["input:placeholder"]}})))}setHostedFieldContainerHeight(){if(this.styles.container.height=`${this.form.querySelector('input[name="card_name"]').offsetHeight}px`,!["auto","0px"].includes(this.styles.container.height))for(const e in this.hostedCardFieldsContainers)this.hostedCardFieldsContainers[e].style.setProperty("height",this.styles.container.height)}setFocusStyle(){this.form.querySelectorAll('input[type="text"]').forEach((e=>{e.addEventListener("focus",(e=>{if(Array.from(this.styles["input:focus"]).length)return;const t=window.getComputedStyle(e.target,null);this.hostedFocusedInputFieldStyleProperties.forEach((e=>{this.styles["input:focus"]={[e]:t.getPropertyValue(e),...this.styles["input:focus"]}}))}),{once:!0})}))}canThreeDsAuthorizeCard(e){return["NO","POSSIBLE"].includes(e.liabilityShift)}IsCardThreeDsAuthorized(e){return e.liabilityShifted&&"POSSIBLE"===e.liabilityShift}hostedFieldOnSubmitErrorHandler(e){const t={},r=[];if(!e)return r.push({message:window.givePayPalCommerce.genericDonorErrorMessage}),Give.form.fn.resetDonationButton(this.jQueryForm),void Give.form.fn.addErrorsAndResetDonationButton(this.jQueryForm,Give.form.fn.getErrorHTML(r));if("string"==typeof e)return r.push({message:e}),Give.form.fn.resetDonationButton(this.jQueryForm),void Give.form.fn.addErrorsAndResetDonationButton(this.jQueryForm,Give.form.fn.getErrorHTML(r));e.details.forEach((e=>{if(e.hasOwnProperty("field")){if(!t.hasOwnProperty(`${e.field}`)){let i="";if(-1!==e.field.indexOf("expiry"))i=givePayPalCommerce.paypalCardInfoErrorPrefixes.expirationDateField;else if(-1!==e.field.indexOf("number"))i=givePayPalCommerce.paypalCardInfoErrorPrefixes.cardNumberField;else{if(-1===e.field.indexOf("security_code"))return e.hasOwnProperty("description")?void r.push({message:e.description}):void r.push({message:`${givePayPalCommerce.genericDonorErrorMessage} ${givePayPalCommerce.errorCodeLabel}: ${e.issue}`});i=givePayPalCommerce.paypalCardInfoErrorPrefixes.cardCvcField}t[`${e.field}`]=i?[`<strong>${i}</strong>`]:[]}t[`${e.field}`].push(`${e.description}.`)}else r.push({message:e.description})}));for(const e in t)r.push({message:t[e].join(" ")});Give.form.fn.addErrorsAndResetDonationButton(this.jQueryForm,Give.form.fn.getErrorHTML(r))}submitDonationForm(){this.jQueryForm.off("submit"),this.jQueryForm.submit()}toggleFields(){const e=s.isRecurringDonation(this.form)?"none":"block",t="none"===e&&!i.canShow(this.form);this.toggleCardNameField(t);for(const r in this.hostedCardFieldsContainers)this.hostedCardFieldsContainers[r].style.display=e,this.hostedCardFieldsContainers[r].parentElement.style.display=t?"none":"block";this.customCardFields.separator&&(this.customCardFields.separator.style.display=t?"none":"flex")}toggleCardNameField(e){const t=this.form.querySelector('input[name="card_name"]');t.parentElement.style.display=e?"none":"block",t.disabled=e}getFieldTypeByFieldName(e){return"card_number"===e?"number":"card_cvc"===e?"cvv":"card_expiry"===e?"expirationDate":void 0}};class n{static getFormDataWithoutGiveActionField(e){const t=new FormData(e);return t.delete("give_action"),t}static addFieldToForm(e,t,r){const i=document.createElement("input");return i.type="hidden",i.name=r,i.value=t,new Promise(((t,r)=>{t(e.appendChild(i))}))}static isPayPalCommerceSelected(e){return"paypal-commerce"===Give.form.fn.getGateway(e)}static addErrors(e,t){e.find("#give-paypal-commerce-smart-buttons-wrap").before(t)}static isRecurringDonation(e){const t=e.querySelector('input[name="_give_is_donation_recurring"]');return t&&"1"===t.value}static trackRecurringHiddenFieldChange(e,t){new window.MutationObserver((function(e){e[0].oldValue!==e[0].target.value&&n.isPayPalCommerceSelected(jQuery(e[0].target).closest(".give-form"))&&t.call()})).observe(e,{attributeFilter:["value"],attributeOldValue:!0})}static trackDonationCurrencyChange(e,t){new window.MutationObserver((function(e){e[0].oldValue!==e[0].target.getAttribute("data-currency_code")&&n.isPayPalCommerceSelected(jQuery(e[0].target))&&t.call()})).observe(e,{attributeFilter:["data-currency_code"],attributeOldValue:!0})}static toggleDonateNowButton(e){let t="";(!o.canShow()||n.isRecurringDonation(e)&&!i.canShow(e))&&(t="none"),e.querySelector('input[name="give-purchase"]').style.display=t}}const s=n;function a(e,t){void 0===t&&(t={});var r=document.createElement("script");return r.src=e,Object.keys(t).forEach((function(e){r.setAttribute(e,t[e]),"data-csp-nonce"===e&&r.setAttribute("nonce",t["data-csp-nonce"])})),r}function d(e,t){if(void 0===t&&(t=Promise),l(e,t),"undefined"==typeof document)return t.resolve(null);var r=function(e){var t,r,i=e.sdkBaseUrl,o=e.environment,n=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(r[i[o]]=e[i[o]])}return r}(e,["sdkBaseUrl","environment"]),s=i||function(e){return"sandbox"===e?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}(o),a=n,d=Object.keys(a).filter((function(e){return void 0!==a[e]&&null!==a[e]&&""!==a[e]})).reduce((function(e,t){var r,i=a[t].toString();return r=function(e,t){return(t?"-":"")+e.toLowerCase()},"data"===(t=t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,r)).substring(0,4)||"crossorigin"===t?e.attributes[t]=i:e.queryParams[t]=i,e}),{queryParams:{},attributes:{}}),c=d.queryParams,l=d.attributes;return c["merchant-id"]&&-1!==c["merchant-id"].indexOf(",")&&(l["data-merchant-id"]=c["merchant-id"],c["merchant-id"]="*"),{url:"".concat(s,"?").concat((t=c,r="",Object.keys(t).forEach((function(e){0!==r.length&&(r+="&"),r+=e+"="+t[e]})),r)),attributes:l}}(e),i=r.url,o=r.attributes,n=o["data-namespace"]||"paypal",s=c(n);return o["data-js-sdk-library"]||(o["data-js-sdk-library"]="paypal-js"),function(e,t){var r=document.querySelector('script[src="'.concat(e,'"]'));if(null===r)return null;var i=a(e,t),o=r.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(i.dataset).length)return null;var n=!0;return Object.keys(o.dataset).forEach((function(e){o.dataset[e]!==i.dataset[e]&&(n=!1)})),n?r:null}(i,o)&&s?t.resolve(s):function(e,t){void 0===t&&(t=Promise),l(e,t);var r=e.url,i=e.attributes;if("string"!=typeof r||0===r.length)throw new Error("Invalid url.");if(void 0!==i&&"object"!=typeof i)throw new Error("Expected attributes to be an object.");return new t((function(e,t){if("undefined"==typeof document)return e();!function(e){var t=e.onSuccess,r=e.onError,i=a(e.url,e.attributes);i.onerror=r,i.onload=t,document.head.insertBefore(i,document.head.firstElementChild)}({url:r,attributes:i,onSuccess:function(){return e()},onError:function(){var e=new Error('The script "'.concat(r,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return t(e)}})}))}({url:i,attributes:o},t).then((function(){var e=c(n);if(e)return e;throw new Error("The window.".concat(n," global variable is not available."))}))}function c(e){return window[e]}function l(e,t){if("object"!=typeof e||null===e)throw new Error("Expected an options object.");var r=e.environment;if(r&&"production"!==r&&"sandbox"!==r)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==t&&"function"!=typeof t)throw new Error("Expected PromisePonyfill to be a function.")}"function"==typeof SuppressedError&&SuppressedError;const u=window.wp.i18n;document.addEventListener("DOMContentLoaded",(()=>{let e=document.querySelectorAll(".give-form-wrap");const r=[];function n(e){!function(e){const t=e.querySelector('input[name="_give_is_donation_recurring"]');t&&s.trackRecurringHiddenFieldChange(t,(()=>{c(e)}))}(e),function(e){s.trackDonationCurrencyChange(e,(()=>{c(e)}))}(e),function(e){document.addEventListener("give_gateway_loaded",(()=>{s.isPayPalCommerceSelected(jQuery(e))&&c(e)}))}(e)}function a(e){const r=new t(e),n=new i(e);if(t.canShow()&&r.boot(),o.canShow()){const e=new o(n);return n.boot(),void e.boot()}n.removeFields()}function c(t){(async function(e){const t={...givePayPalCommerce.payPalSdkQueryParameters},r=s.isRecurringDonation(e);return t.intent=r?"subscription":"capture",t.vault=!!r,t.currency=Give.form.fn.getInfo("currency_code",jQuery(e)),await d(t)})(t).then((()=>{!function(){const t=e=>{s.isPayPalCommerceSelected(jQuery(e))&&a(e)};e.forEach((e=>{const r=e.querySelector(".give-form");e.classList.contains("give-display-button-only")||e.classList.contains("give-display-modal")||r&&t(r)}));const r=document.querySelector(".mfp-content form.give-form");r&&t(r)}()})).then((()=>{let e=givePayPalCommerce.payPalSdkQueryParameters.components.split(",");paypal.hasOwnProperty("HostedFields")&&-1!==e.indexOf("hosted-fields")&&(o.canShow()||(e=e.filter((e=>"hosted-fields"!==e)),givePayPalCommerce.payPalSdkQueryParameters.components=e.join(","),c(t)))})).catch((e=>{const r=jQuery(t);Give.form.fn.addErrors(r,Give.form.fn.getErrorHTML([{message:(0,u.__)("A problem has occurred with the connection between this site and PayPal, preventing donations. Please contact site administrators if reloading the page does not fix the issue. This is usually the result of some JavaScript conflict on the page.","give")}])),Give.form.fn.disable(r,!0),console.error(e)}))}e.forEach((e=>{Give.form.fn.hasDonationForm(e)&&r.push(e)})),r.length&&(e=r,c(e[0].querySelector(".give-form")),e.forEach((e=>{const t=e.querySelector(".give-form");e.classList.contains("give-display-button-only")||e.classList.contains("give-display-modal")||n(t)})),jQuery(".give-form-wrap.give-display-button-only button.give-btn-modal, .give-form-wrap.give-display-modal button.give-btn-modal").on("click",(function(){const e=window.setInterval((()=>{const t=document.querySelector(".mfp-content form.give-form");t&&(s.isPayPalCommerceSelected(jQuery(t))&&a(t),n(t),window.clearInterval(e))}),100)})),jQuery("form.give-form").on("submit",(e=>!s.isPayPalCommerceSelected(jQuery(void 0))||(e.preventDefault(),!1))))}))})();