");vwo_$('head').append(_vwo_sel);return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("HEAD")}}, R_722072_157_1_2_0:{ fn:function(log,nonce=''){return (function(x) { if(!vwo_$.fn.vwoRevertHtml){ return; }; var ctx=vwo_$(x),el; /*vwo_debug log("Revert","content",""); vwo_debug*/; el=vwo_$('[vwo-element-id="1744062807510"]'); el.revertContentOp().remove();})("HEAD")}}, C_722072_157_1_2_1:{ fn:function(log,nonce=''){return (function(x) {var el,ctx=vwo_$(x); /*vwo_debug log("addElement","body"); vwo_debug*/!(el=vwo_$("body")).find('[vwo-op-1744062793557=""]').length&&el.vwoElement({html:'
\nYou can be the difference in a child making a decision to follow Jesus at camp this summer. Will you help a kid get to Eagle Lake Camps of The Navigators this summer? Give here ยป\n
\n\n You can be the difference in a child making a decision to follow Jesus at camp this summer. Will you help a kid get to Eagle Lake Camps of The Navigators this summer? Give here ยป\n
\nYour monthly partnership will:
Most importantly, you will play an active role in this ongoing work of bringing campers to meet Jesus and grow in their walks with Him. Would you consider becoming a monthly partner today?โ
`, ctaButtons: { "Yes": ``, "No": ``, }, closeButton: false, theme: "NAV", }, memoryMode: 'session', // "session" or "forever"; indicates how long the last interacted state should be remembered minAmount: 5.00, // gift under this amount will be processed (if above the form minimum) and not shown the donation interrupter maxAmount: 100.00, // gifts equal to and above this amount will be processed and not shown the donation interrupter askConditions: function (originalAmount, originalFrequency, state) { const conditions = [ originalFrequency === "One-Time", // "One-Time" or "Recurring" originalAmount > this.minAmount, originalAmount < this.maxAmount, state && state.status !== "shown" && state.status !== "dismissed" && state.status !== "converted", // do not show if the user has already seen the donation interrupter, dismissed the donation interrupter, or converted from the donation interrupter ]; return conditions.every((condition) => typeof condition === 'function' ? !!condition.call(null) : !!condition); // return true if every condition in the array evaluates to true }, askAmount: function (originalAmount) { let askAmount; if (originalAmount >= 400 && originalAmount < 500) { // $400.00 - $499.99 askAmount = 50; } else if (originalAmount >= 300 && originalAmount < 400) { // $300.00 - $399.99 askAmount = 40; } else if (originalAmount >= 200 && originalAmount < 300) { // $200.00 - $299.99 askAmount = 30; } else if (originalAmount >= 100 && originalAmount < 200) { // $100.00 - $199.99 askAmount = 15; } else { // $ 0.01 - $ 99.99 askAmount = 10; } return parseFloat(askAmount); }, }; // // // // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // // // // Run code with configuration from above (function(){ console.log("init"); window.NA.DonationForm.init(config).then((donationFormApi) => { console.log("initialized:", donationFormApi); if (configDonationInterrupter && configDonationInterrupter.enabled === true) { donationFormApi.DonationInterrupter(configDonationInterrupter); console.log("initialized:", donationFormApi.DonationInterrupter); donationFormApi.interceptSubmit(function (capturedEvent) { try { const donationInterrupterApi = this.DonationInterrupter; if (donationFormApi && donationInterrupterApi) { if (donationInterrupterApi.evaluateConditions()) { console.log(donationFormApi); donationInterrupterApi.show(); return false; // do not submit } else { console.warn("Condtions check failed: Donation Interrupter will not be shown."); return true; // submit } } else { throw new ReferenceError("DonationFormApi or DonationInterrupterApi is not defined."); } } catch (error) { console.error("An error occured when handling submit:", error); window.NA?.DonationForm && window.NA.DonationForm.submit(); // retry submit } finally { return false; } }); } }).catch((error) => { console.error("Error creating donation form API:", error); }); })(); }catch(e) {VWO._.vAEH(e);} return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("head")}}, R_722072_79_1_2_0:{ fn:function(){return (function(x) { try{ var el,ctx=vwo_$(x); /*vwo_debug log("Revert","addElement","body"); vwo_debug*/(el=vwo_$('[vwo-element-id="1734023425042"]')).remove(); var ctx=vwo_$(x),el; /*vwo_debug log("Revert","content",""); vwo_debug*/; el=vwo_$('[vwo-element-id="1734023425003"]'); el.revertContentOp().remove(); return vwo_$('head')[0] && vwo_$('head')[0].lastChild; } catch(e) {} })("HEAD")}}, C_722072_79_1_2_1:{ fn:function(){return (function(x) { try{ var _vwo_sel = vwo_$(""); !vwo_$("head").find("#1734023425028").length && vwo_$('head').append(_vwo_sel); !vwo_$("body").find('[vwo-op-1734023425027=""]').length && vwo_$("body").vwoElement({ "html": "", "position": "append", "customBodyElement": true, "addElementId": 1734023425027 }) 'esversion: 8'; const DONATION_INTERRUPTER_GROUP_NAME = "StaffDP" /* all the popups in this test will share the same group name so that the metrics for them are all counted in the test */; window.HTMLElement.prototype.getSlot = window.HTMLElement.prototype.getSlot || function () { return this.querySelector('slot') || this.shadowRoot.querySelector('slot'); } window.HTMLElement.prototype.getSlotNodes = window.HTMLElement.prototype.getSlotNodes || function (n) { return (parseInt(n) !== 'NaN' && n >= 0) ? Array.from(this.getSlot().assignedNodes({ flatten: true })).at(n) : Array.from(this.getSlot().assignedNodes({ flatten: true })); } window.HTMLElement.prototype.shadowChildren = window.HTMLElement.prototype.shadowChildren || function (n) { return (parseInt(n) !== 'NaN' && n >= 0) ? Array.from(this.shadowRoot.children).at(n) : Array.from(this.shadowRoot.children); } function waitForElement (el, retry, onSuccess = (el) => {}, delay = 30) { if ( !el ) return setTimeout(retry, delay); onSuccess(el); return true; } // function vwoSendEvent (eventName = "customEvent", object = { label: '' }) { window.VWO = window.VWO || []; VWO.event = VWO.event || function () {VWO.push(["event"].concat([].slice.call(arguments)));}; VWO.event(eventName, object); console.log(eventName, object); } const vwoSendEvent_DonationInterrupter = (action, group = undefined) => { if (action === "Shown") vwoSendEvent("custom_DonationInterrupter_Shown", { shown: true, group: group }); else if (action === "Yes") vwoSendEvent("custom_DonationInterrupter_Yes", { yes: true, group: group }); else if (action === "No") vwoSendEvent("custom_DonationInterrupter_No", { donationInterrupterNoClicked: true, group: group }); }; // function getBasketId (tokenName = `LSSIndex:LOCAL{"namespace":"c"}`){ const token = localStorage.getItem(tokenName); if (!token) { return console.error("getBasketId:", "Failed to get token from localStorage:", tokenName); } else { try { const { basket } = JSON.parse(token); // get basket property from the object return basket; } catch (error) { return console.error("getBasketId:", "Failed to parse JSON:", token); } } } // function getBasket (basketId) { let token = localStorage.getItem(basketId); if (!token) { const emptyBasket = { "Id": "localBasket", "Basket_Items__r": [], "Total__c": 0, "Number_of_Items__c": 0, "itemMap": {} }; console.info("getBasket:", "Failed to get token from localStorage:", basketId, "\nAttempting to create a new empty basket and retrying..."); localStorage.setItem(basketId, JSON.stringify(emptyBasket)); token = localStorage.getItem(basketId); } if (!token) { return console.error("getBasket:", "Failed to get token from localStorage:", basketId); } else { try { return JSON.parse(token); // get basket property from the object } catch (error) { return console.error("getBasket:", "Failed to parse JSON:", token); } } } // function addItemToBasket (item) { const basketId = getBasketId(), basket = getBasket(basketId); if ( basket.Basket_Items__r.find(item => item.id === item.Id) ) { // check if the item Id is already in the cart const foundItem = basket.Basket_Items__r.find(item => item.Id); foundItem["Quantity__c"] += 1; // update the quantity of the found item foundItem["Total_Amount__c"] = foundItem["Amount__c"] * foundItem["Quantity__c"]; // update the quantity of the found item foundItem["Total_Deductible_Amount__c"] = foundItem["Amount__c"] * foundItem["Quantity__c"]; // update the quantity of the found item } else { basket.Basket_Items__r.push(item); // add the item to the array } basket.Number_of_Items__c = basket.Basket_Items__r.length; // update item count basket.Total__c = basket.Basket_Items__r.reduce((total, item) => total + item["Amount__c"], 0); // update total amount basket.itemMap = Object.fromEntries(basket.Basket_Items__r.map((item, index) => ([item.Id, index]))); // update itemMap return localStorage.setItem(basketId, JSON.stringify(basket)); } // function entangleElements (element1, element2, method = 'innerHTML', options = { attributes: true, childList: true, subtree: true }) { if (!element1 || !element2) return console.error(`entangleElements: ${!element1 && "element1"}${!element1 && !element2 ? " and " : " "} ${!element2 && "element2"} ${!element1 && !element2 ? "are" : "is"} undefined.`); console.log("Entangling:\n", element1, ' ', element2, "\nElement 2 will mirror Element 1's values."); const handleMutation = (mutationList, observer) => { // Callback function to execute when mutations are observed let lastAttributeValues = {}; for (const mutation of mutationList) { switch (mutation.type) { case "attributes": const { attributeName, oldValue } = mutation; if (attributeName !== "style") { // ignore changes to style attribute const currentValue = element1.getAttribute(attributeName); if (currentValue === null) { element2.removeAttribute(attributeName); // mirror element 1 attributes on element 2 by removing null value attribute } else { element2.setAttribute(attributeName, currentValue); // mirror element 1 attributes on element 2 } } break; default: element2[method] = element1[method]; break; } } }; const observer = new MutationObserver(handleMutation); observer.observe(element1, options); // Start observing the target node for configured mutations return observer; } // // // // function init () { try { customElements.whenDefined("c-donate-community-staff-information").then(() => { customElements.whenDefined("c-donate-community-donate-buttons").then(() => { customElements.whenDefined("lightning-input").then(() => { const wrapperForm = document.querySelector('c-donate-community-staff-information'); const wrapperFormInteractive = wrapperForm.shadowRoot.querySelector('c-donate-community-donate-buttons').shadowChildren(0); console.log(wrapperFormInteractive); /// Interface with the giving form and create a window object const form = { getGiftArrayButtons: function () { let w = wrapperFormInteractive; return Array.from(w.children).slice(0, Array.from(w.children).indexOf(w.querySelector('.slds-form-element'))).map(x => x.querySelector('button')); }, getAmount: function () { const sanitizeAmount = a => a.replace(/[^\d\.]/,''); // remove non-digit characters (except for decimals) let selected = this.getGiftArrayButtons().filter(x => x.classList.contains("donate-selected"))[0]; if (selected) { return parseFloat(selected.value); } else { selected = wrapperFormInteractive.querySelector('lightning-input').shadowChildren(0).shadowChildren(0).querySelector('input'); return parseFloat(sanitizeAmount(selected.value)); } console.warn("Amount is not defined: no option is selected.") return undefined; }, setAmount: function (n) { let match; const otherAmount = wrapperFormInteractive.querySelector('lightning-input').shadowChildren(0).shadowChildren(0).querySelector('input'); for (const button of this.getGiftArrayButtons()) { // iterate over gift array buttons if (parseFloat(button.value) === parseFloat(n) ) { // if matching button found for amount otherAmount.value = ''; // clear other amount button.click(); // click the matching button return this.getAmount() === parseFloat(n); // return true if the getAmount() matches the input value } } otherAmount.value = parseFloat(n); // set the other amount field value to the input value otherAmount.dispatchEvent(new Event('change', { bubbles: true })); // trigger a change event to cause the input to be formatted return this.getAmount() === parseFloat(n); // return true if the getAmount() matches the input value }, getRecurring: function () { const checkbox = [...wrapperFormInteractive.querySelector(".slds-grid").querySelectorAll("lightning-input")][0].shadowChildren(0).shadowChildren(0).querySelector('input[type="checkbox"]'); return checkbox.checked; }, setRecurring: function (toRecurring = true) { const checkbox = [...wrapperFormInteractive.querySelector(".slds-grid").querySelectorAll("lightning-input")][0].shadowChildren(0).shadowChildren(0).querySelector('input[type="checkbox"]'); const isRecurring = this.getRecurring(), isOnetime = !isRecurring, toOnetime = !toRecurring; // semantic booleans if ( (isOnetime && toRecurring) || (isRecurring && toOnetime)) { checkbox.click(); } return this.getRecurring() === toRecurring; }, submit: function (btn = this.buttons["Donate Now"]) { return btn.click(); }, }; form.giftArrayButtons = form.getGiftArrayButtons(); window.NA = window.NA || {}; window.NA.MiniDonationForm = form; waitForElement(wrapperFormInteractive.querySelector('button'), init, (el) => { // wait for form buttons window.NA.MiniDonationForm.buttons = { "Donate Now": Array.from(wrapperFormInteractive.children).slice(Array.from(wrapperFormInteractive.children).indexOf(wrapperFormInteractive.querySelector('.slds-form-element'))).map(x => x.querySelector('button')).filter(y => y)[0], "Add to Basket": Array.from(wrapperFormInteractive.children).slice(Array.from(wrapperFormInteractive.children).indexOf(wrapperFormInteractive.querySelector('.slds-form-element'))).map(x => x.querySelector('button')).filter(y => y)[1], }; window.NA.MiniDonationForm.cloneSubmitButton = function (originalButton = this.buttons["Donate Now"]) { const clonedButton = originalButton.cloneNode(true); // clone the button and its children clonedButton.attributes = originalButton.attributes; // copy attributes if (clonedButton.style) clonedButton.style = originalButton.style; // copy styles originalButton.after(clonedButton); // insert the fake button after the original //entangleElements(originalButton, clonedButton, 'outerHTML'); // quantum entangle the elements via outerHTML -- does not work if the element is fully replaced when state changed return clonedButton; // return the fake button }; /// Interface with the Donation Interrupter