");vwo_$('head').append(_vwo_sel);return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("HEAD")}}, R_722072_156_1_2_1:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
})(".w-inline-block,.w-button,input.w-button,.splash,.splash .mw-ol-btn.mw-ol-whitemw-ol-btn, .splash .mw-ol-btn.mw-ol-whitemw-ol-btn:visited,.splash .logo-link,.splash .btn,.nav,.mw-ol-btn, .mw-ol-btn:visited,.mw-ol-btn.mw-ol-whitemw-ol-btn, .mw-ol-btn.mw-ol-whitemw-ol-btn:visited,.mw-ol-btn.mw-ol-white,.overlay2,.div-block-42,.splash-h1,.div-block-18,.sidephoto,.link-3, .link-3:visited,.stafflink,.w-background-video,.w-background-video > video,.w-background-video > video::-webkit-media-controls-start-playback-button,.background-video,.mw-ol-btn,.mw-ol-btn.mw-ol-whitemw-ol-btn.nav,.w-hidden-small,.link-block,.btn,.w-hidden-tiny,.btn.whitebtn,.btn.whitebtn.onorange,.div-block-42 p,.div-block-17,.dark,.darkpara,.givingtues,.important-text,.heading-5,.btn, .btn:visited,.link-2,.big,.splash .pushdown__col,.splash .pushdown__content,.splash .pushdown-copy > *:last-child,.splash .grid-area,.splash .grid-card,.splash .grid-card div > p,.splash .grid-card div > p > span,.splash .grid-card .flex-col,.splash .grid-card div > p > b,.splash .grid-card button,.splash div div.centered,.splash div a.other-link,.splash .grid-card p:nth-of-type(3),.splash .heading-5,.splash .nav,.splash .dark,/* .splash .grid-card p:nth-of-type(3),.splash .div-block-17,.splash p.dark")}}, C_722072_156_1_2_1:{ fn:function(log,nonce=''){return (function(x) {})(".w-inline-block,.w-button,input.w-button,.splash,.splash .mw-ol-btn.mw-ol-whitemw-ol-btn, .splash .mw-ol-btn.mw-ol-whitemw-ol-btn:visited,.splash .logo-link,.splash .btn,.nav,.mw-ol-btn, .mw-ol-btn:visited,.mw-ol-btn.mw-ol-whitemw-ol-btn, .mw-ol-btn.mw-ol-whitemw-ol-btn:visited,.mw-ol-btn.mw-ol-white,.overlay2,.div-block-42,.splash-h1,.div-block-18,.sidephoto,.link-3, .link-3:visited,.stafflink,.w-background-video,.w-background-video > video,.w-background-video > video::-webkit-media-controls-start-playback-button,.background-video,.mw-ol-btn,.mw-ol-btn.mw-ol-whitemw-ol-btn.nav,.w-hidden-small,.link-block,.btn,.w-hidden-tiny,.btn.whitebtn,.btn.whitebtn.onorange,.div-block-42 p,.div-block-17,.dark,.darkpara,.givingtues,.important-text,.heading-5,.btn, .btn:visited,.link-2,.big,.splash .pushdown__col,.splash .pushdown__content,.splash .pushdown-copy > *:last-child,.splash .grid-area,.splash .grid-card,.splash .grid-card div > p,.splash .grid-card div > p > span,.splash .grid-card .flex-col,.splash .grid-card div > p > b,.splash .grid-card button,.splash div div.centered,.splash div a.other-link,.splash .grid-card p:nth-of-type(3),.splash .heading-5,.splash .nav,.splash .dark,/* .splash .grid-card p:nth-of-type(3),.splash .div-block-17,.splash p.dark")}}, R_722072_156_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="1744048774370"]');
el.revertContentOp().remove();})("HEAD")}}, R_722072_157_1_2_2:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
var el,ctx=vwo_$(x);
/*vwo_debug log("Revert","content",".pushdown-copy > p:nth-of-type(1)"); vwo_debug*/(el=vwo_$(".pushdown-copy > p:nth-of-type(1)")).revertContentOp(),el=vwo_$(".pushdown-copy > p:nth-of-type(1)");})(".pushdown-copy > p:nth-of-type(1)")}}, C_722072_157_1_2_2:{ fn:function(log,nonce=''){return (function(x) {var el,ctx=vwo_$(x);
/*vwo_debug log("content",".pushdown-copy > p:nth-of-type(1)"); vwo_debug*/el=vwo_$(".pushdown-copy > p:nth-of-type(1)"),vwo_$(".pushdown-copy > p:nth-of-type(1)").each((function(){this.__vwoControlOuterHTML=this.__vwoControlOuterHTML||this.outerHTML,!vwo_$(this).find('[vwo-op-1744062807509-0=""]').length&&vwo_$(this).append('Will you help a kid get to Eagle Lake Camps of The Navigators this summer? '),vwo_$(this).nonEmptyContents().eq(0).replaceWith2(document.createTextNode("You can be the difference in a child making a decision to follow Jesus at camp this summer. "))})),el=vwo_$(".pushdown-copy > p:nth-of-type(1)");})(".pushdown-copy > p:nth-of-type(1)")}}, R_722072_157_1_3_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="1744062807520"]');
el.revertContentOp().remove();})("HEAD")}}, C_722072_79_1_2_0:{ fn:function(){return (function(x) { try{
var _vwo_sel = vwo_$("");
!vwo_$("head").find("#1734023425003").length && vwo_$('head').append(_vwo_sel);
const DEFAULT_DONATION_FREQUENCY="One-Time";function getQueryParam(e){let t=window.location.search.match(e+"=([^&]*)");return t?t[1]:void 0}function initOnElement(e,t,n){const i=e.getElementsByTagName(t);return i.length?n(i):setTimeout(initOnElement,500,e,t,n)}window.DonationForm=window.DonationForm||{recurring_checkbox:null,submit_button:null,other_amt:null,gift_array_elements:[],onetime_gift_array:[],recurring_gift_array:[10,20,30,40],setRecurring:function(e){console.log("setRecurring",e,this.recurring_checkbox),(!this.recurring_checkbox.checked&&e||this.recurring_checkbox.checked&&!e)&&(console.log("checked",this.recurring_checkbox.checked,"(before click)"),this.recurring_checkbox.click(),console.log("checked",this.recurring_checkbox.checked,"(after click)"))},selectGiftArray:function(e){this.gift_array_elements[e].click()},modifyGiftArray:function(e){this.gift_array_elements.forEach((t,n)=>{t.value=e[n],t.textContent="$"+e[n]})},setOneTimeGiftArrayValues:function(){let e=this;this.gift_array_elements.forEach(t=>{e.onetime_gift_array.push(parseInt(t.value))})},setFirstNamePersonalization:function(e){const t=void 0===getQueryParam("first_name")||""===getQueryParam("first_name")?"Friend":getQueryParam("first_name");for(let n=0;n<=e.length-1;n++)e[n].innerHTML.includes("[Name]")&&(e[n].innerHTML=e[n].innerHTML.replace(/\[[^\]]*]/,t)),e[n].innerHTML.includes("Friend")&&(e[n].innerHTML=e[n].innerHTML.replace("Friend",t))},init:function(){document.querySelectorAll(".tab").forEach(e=>{e.addEventListener("click",(function(e){this.classList.add("selected"),this.classList.contains("recurring")?(document.querySelector(".tab.onetime").classList.remove("selected"),DonationForm.setRecurring(!0)):(document.querySelector(".tab.recurring").classList.remove("selected"),DonationForm.setRecurring(!1))}))}),this.setOneTimeGiftArrayValues(),this.setRecurring(!1),this.selectGiftArray(0)}},initOnElement(document,"c-donate-community-staff-information",(function(e){initOnElement(e[0],"div",(function(e){e[0].querySelectorAll("div.slds-col")[0].classList.add("page-image");const t=e[0].querySelectorAll("div.slds-col")[1];t.classList.add("donation-form-content");const n=t.querySelectorAll("div,lightning-formatted-rich-text");for(let e=0;e<=n.length-1;e++)0==e&&n[e].classList.add("page-title"),1==e&&n[e].classList.add("page-action-text"),2==e&&n[e].classList.add("donation-form"),3==e&&n[e].classList.add("bottom-title"),4==e&&n[e].classList.add("page-text");DonationForm.setFirstNamePersonalization(n[4].shadowRoot.querySelectorAll("div p")),n[1].before(n[4]);const i=document.createElement("div");i.classList.add("tabs"),i.innerHTML='
One-Time Gift
Recurring Gift
',n[2].before(i),initOnElement(n[2],"c-donate-community-donate-buttons",(function(e){initOnElement(e[0].shadowRoot.querySelector("div"),"div",(function(e){for(let t=0;t *:last-child,.pushdown .grid-area,.pushdown .grid-card,.pushdown .grid-card div > p,.pushdown .grid-card div > p > span,.pushdown .grid-card .flex-col,.pushdown .grid-card div > p > b,.pushdown .grid-card button,.pushdown div div.centered,.pushdown div a.other-link,.pushdown .pushdown__close,.pushdown .grid-card p:nth-of-type(3),.pushdown .grid-card p > b")}}, R_722072_157_1_2_3:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
})(".na-pushdown-wrapper,.mw-w-button,input.mw-w-button,#page,.pushdownbar,.div-block-16,.pushdownheadline,.pushdown,.div-block-7,.div-block-8,.paragraph-2,.div-block-15,.mw-btn,.mw-btn:visited,.mw-white,.mw-btn.mw-white,.mw-btn.mw-whitemw-btn:link,.na-pushdown-wrapper .close span,.na-pushdown-wrapper .close,.fa-angle-down:before,/*#donate-menu,.close-wrapper,.btn-dismiss,#masthead .close-menu,.pushdown .pushdown__row,.pushdown .pushdown__col,.pushdown .pushdown__content,.pushdown .pushdown-copy > *:last-child,.pushdown .grid-area,.pushdown .grid-card,.pushdown .grid-card div > p,.pushdown .grid-card div > p > span,.pushdown .grid-card .flex-col,.pushdown .grid-card div > p > b,.pushdown .grid-card button,.pushdown div div.centered,.pushdown div a.other-link,.pushdown .pushdown__close,.pushdown .grid-card p:nth-of-type(3),.pushdown .grid-card p > b")}}, C_722072_157_1_3_0:{ fn:function(log,nonce=''){return (function(x) {;var _vwo_sel=vwo_$("");vwo_$('head').append(_vwo_sel);return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("HEAD")}}, C_722072_157_1_2_0:{ fn:function(log,nonce=''){return (function(x) {;var _vwo_sel=vwo_$("");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:'\n \x3c!--
--\x3e\n
\n
\n ร \n
\n
\n
\n
\n
\n \x3c!-- \n If you have a moment...\n --\x3e\n \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
\n
\n
\n
\n
\n \x3c!--
--\x3e\n
',position:"append"});})("body")}}, R_722072_157_1_2_1:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
var el,ctx=vwo_$(x);
/*vwo_debug log("Revert","addElement","body"); vwo_debug*/(el=vwo_$('[vwo-element-id="1744048814304"]')).remove();})("body")}}, R_722072_79_1_2_1:{ fn:function(){return (function(x) { try{
var el,ctx=vwo_$(x);
/*vwo_debug log("Revert","addElement","body"); vwo_debug*/(el=vwo_$('[vwo-element-id="1734023425027"]')).remove();
var ctx=vwo_$(x),el;
/*vwo_debug log("Revert","content",""); vwo_debug*/;
el=vwo_$('[vwo-element-id="1734023425028"]');
el.revertContentOp().remove();
return vwo_$('head')[0] && vwo_$('head')[0].lastChild; } catch(e) {} })("HEAD")}}, C_722072_156_1_2_0:{ fn:function(log,nonce=''){return (function(x) {;var _vwo_sel=vwo_$("");vwo_$('head').append(_vwo_sel);return vwo_$('head')[0] && vwo_$('head')[0].lastChild;})("HEAD")}}, R_722072_79_1_3_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="1734023424989"]')).remove();
var ctx=vwo_$(x),el;
/*vwo_debug log("Revert","content",""); vwo_debug*/;
el=vwo_$('[vwo-element-id="1734023424983"]');
el.revertContentOp().remove();
return vwo_$('head')[0] && vwo_$('head')[0].lastChild; } catch(e) {} })("HEAD")}}, C_722072_79_1_3_1:{ fn:function(){return (function(x) { try{
var _vwo_sel = vwo_$("");
!vwo_$("head").find("#1734023425072").length && vwo_$('head').append(_vwo_sel);
!vwo_$("body").find('[vwo-op-1734023424996=""]').length && vwo_$("body").vwoElement({ "html": "\n \n \n
\n Before you finalize your gift... would you be willing to chip in an additional $10 per month to help provide for unexpected missionary expenses? \n \n
\n \n\t\tYour small additional monthly gift will help care for thousands of missionaries to give them training, support in the field, and financial support when unexpected challenges arise.\n
\n \n If you are willing to also give a monthly gift, weโd love to send you an incredible book, 31 Days toward Trusting God by Jerry Bridges.\n
\n \n Would you be willing to chip in an additional $10 per month alongside your missionary gift?\n
\n \n
\n \n \n YES! \n \n Please add a 5 monthly gift to my cart. \n \n \n No, thanks. \n \n Just process my original gift. \n \n
\n \n
\n ", "position": "append", "customBodyElement": true, "addElementId": 1734023424996 })
'esversion: 8';
const ASK_AMOUNT = 10;
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 setAppealCode (sf_ac) {
let queryString;
let searchParams = window.location.search;
if (searchParams.match('sf_ac')) {
const regex = new RegExp(`(${'sf_ac'}=)([^&]*)`);
queryString = searchParams.replace(regex, `$1${sf_ac}`); // replace existing appeal code value
} else {
queryString = searchParams + '&sf_ac=' + sf_ac; // append appeal code
}
window.history.pushState('', '', '?' + queryString);
}
//
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 () {
if (window.VWOInjected) {
console.warn("Do not preview using the VWO Visual Editor.");
return;
}
if (sessionStorage.getItem("NA_DonationInterrupter_StaffDPv2_status") === "dismissed") {
console.warn("Popup already dismissed.");
return;
}
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
clonedButton.id = clonedButton.textContent.trim().replaceAll(' ', '_') + "_copy";
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 and create a window object
waitForElement(document.querySelector('dialog.donation-interrupter'), init, (dialog) => { // wait for element
const donationPageType = window.Navigators?.donationPageType?.toLowerCase() ?? undefined;
if (donationPageType !== "staff") {
dialog.style.setProperty("display", "none", "important");
//dialog.remove();
return console.warn(`Donation page type must be "Staff" for this test to run.`), null;
}
if (document.querySelectorAll('dialog.donation-interrupter').length > 1) {
return console.warn(`Multiple donation interrupters found on the page.`), null;
}
console.log("dialog found:", dialog);
try {
const DonationInterrupter = {
dialog: dialog || document.querySelector('dialog.donation-interrupter'),
_tokenName: DONATION_INTERRUPTER_GROUP_NAME ? "NA_DonationInterrupter_" + DONATION_INTERRUPTER_GROUP_NAME : "NA_DonationInterrupter",
_memoryMode: sessionStorage,
status: "ready",
getStatus: function () {
return this._memoryMode.getItem(this._tokenName + "_status") || undefined;
},
setStatus: function (t) {
this._memoryMode.setItem(this._tokenName + "_status", t);
this.status = t;
return this.getStatus();
},
conditions: (function(){return true;})(),
newAmount: function (originalAmount) { return originalAmount / 12; }, // reduced ask amount
onShow: function (e) {},
onHide: function (e) {},
show: function (e = undefined) {
this.dialog.showModal();
this.dialog.addEventListener('keydown', e => { e.key === "Escape" && (e.preventDefault(), e.stopImmediatePropagation()) }); // prevent esc button clicked
this.setStatus("shown");
typeof this.onShow === "function" && this.onShow.call(null, e);
},
hide: function (e = undefined) {
this.setStatus("dismissed");
this.dialog.close();
typeof this.onHide === "function" && this.onHide.call(null, e);
},
updateDialogData: function () {
if (this.dialog) {
let originalAmount = window.NA.MiniDonationForm.getAmount(),
suggestedAmount = this.newAmount(originalAmount);
[...this.dialog.querySelectorAll('span[data="amount_original"]')].forEach(span => span.textContent = originalAmount.toString());
[...this.dialog.querySelectorAll('span[data="amount_suggested"]')].forEach(span => span.textContent = suggestedAmount.toString());
}
},
};
window.NA = window.NA || {};
window.NA.DonationInterrupter = DonationInterrupter ? DonationInterrupter : window.NA.DonationInterrupter;
if (window.NA.MiniDonationForm && window.NA.DonationInterrupter)
main(window.NA.MiniDonationForm, window.NA.DonationInterrupter);
} catch (err) {
console.error("Failed to interface with donation interrupter.");
}
}, 100); // wait for element
}, 100); // wait for form buttons
}); // when "lightning-input" defined
}); // when "c-donate-community-donate-buttons" defined
}); // when "c-donate-community-staff-information" defined
} catch (err) {
console.error("Error when waiting for custom elements:", err);
}
}
//
//
//
//
//
//
//
//
function main (FormInterface, DonationInterrupterInterface, debug_mode = 0) {
if (!FormInterface.buttons)
return setTimeout(init, 100);
if (!DonationInterrupterInterface.buttons) {
DonationInterrupterInterface.buttons = { // finish setting up the reference to the CTA buttons in the
"yes": [...DonationInterrupterInterface.dialog.querySelectorAll('button')][0],
"no": [...DonationInterrupterInterface.dialog.querySelectorAll('button')][1],
};
return main(FormInterface, DonationInterrupterInterface, debug_mode); // and try again
}
window.NA.DonationInterrupter.setStatus(window.NA.DonationInterrupter._memoryMode.getItem(window.NA.DonationInterrupter._tokenName + "_status") || "ready"); // set status to the sessionStorage token (saved state) or ready (first time)
window.NA.DonationInterrupter.newAmount = originalAmount => ASK_AMOUNT; // set the function that determines the reduced gift amount: constant $10
/// Add click handle to fake submit button to trigger popup
try {
const existingCopiedButtons = [...(window.NA.MiniDonationForm.buttons["Donate Now"]?.parentElement.parentElement).querySelectorAll('button[id$=copy]')];
if (existingCopiedButtons.length > 2)
return;
//
for (const button of Object.values(FormInterface.buttons)) {
const originalButton = button, // get the original button to clone
fakeButton = FormInterface.cloneSubmitButton(originalButton); // clones the element, attributes, and styles
originalButton.style.display = "none"; // hide original button
fakeButton.style.setProperty("margin-left", '0', "important"); // fix positioning
//debug_mode && fakeButton.style.setProperty("border", "3px dashed red", "important"); // highlight the fake button
setInterval(() => fakeButton.disabled = originalButton.disabled, 50); // update disabled state of button every 50ms
fakeButton.addEventListener('click', (e) => { // when the fake button copy is clicked
let amount = FormInterface.getAmount(), // get the amount
isRecurring = FormInterface.getRecurring(), // check if recurring
popupShown = DonationInterrupterInterface.status === "shown" || DonationInterrupterInterface.status === "dismissed"; // check if the popup has been dismissed
if (debug_mode) { // log expression in debug_mode
console.groupCollapsed("Check conditions");
console.info(amount, "< 250", amount < 250);
//console.info(isRecurring, "=== false", isRecurring === false);
console.info(popupShown, "=== false", popupShown === false);
console.groupEnd("Check conditions");
}
const conditionsMet = [
//amount >= 5, // greater than $5
amount < 250, // less than $250
//isRecurring === false, // not recurring
popupShown === false, // not already seen
].every(condition => condition ? true : false); // reduce the expression evaluations to true or false
debug_mode && console.info("showPopup?", conditionsMet);
// Which button triggered the popup determins which button will be used to submit
if (e.srcElement.textContent === FormInterface.buttons["Add to Basket"].textContent) { // if clicked button text equal to original "Add to Basket" button text
conditionsMet ? DonationInterrupterInterface.show(e) : FormInterface.submit(FormInterface.buttons["Add to Basket"]);
} else {
conditionsMet ? DonationInterrupterInterface.show(e) : FormInterface.submit();
}
if (conditionsMet) {
const existingCopiedButtons = [...(window.NA.MiniDonationForm.buttons["Donate Now"]?.parentElement.parentElement).querySelectorAll('button[id$=copy]')];
existingCopiedButtons.forEach(btn => btn.style.setProperty("display", "none"));
}
});
}
}
catch (err) {
console.error("Failed to clone submit button and add event listener.", err);
}
window.NA.DonationInterrupter.onShow = (e) => { // after the popup has been shown
window.NA.DonationInterrupter.updateDialogData(); // update the values in the dialog
//vwoCustomEvent("DonationInterrupter:Shown", { 'token': window.NA.DonationInterrupter._tokenName }); // trigger VWO event to calculate metric that donation interrupter was shown
vwoSendEvent_DonationInterrupter("Shown", window.NA.DonationInterrupter._tokenName);
/// Add click handlers to dialog buttons
try {
const buttons = window.NA.DonationInterrupter.buttons;
const { yes, no } = buttons; // get the button references from the window object
if (e.srcElement.textContent === FormInterface.buttons["Add to Basket"].textContent) { // if clicked button text equal to original "Add to Basket" button text
yes.addEventListener('click', (e) => { // "Yes" button clicked ("Add to Basket" triggered popup)
e.preventDefault();
debug_mode && console.groupCollapsed('"Yes" clicked');
//vwoCustomEvent("DonationInterrupter:Yes", { 'token': window.NA.DonationInterrupter._tokenName });
vwoSendEvent_DonationInterrupter("Yes", window.NA.DonationInterrupter._tokenName);
const originalAmount = FormInterface.getAmount(),
newAmount = window.NA.DonationInterrupter.newAmount(originalAmount);
debug_mode && console.log(originalAmount, '->', newAmount);
//FormInterface.setRecurring(true); // set to recurring
//FormInterface.setAmount(newAmount); // update amount field
DonationInterrupterInterface.hide(); // close popup
setAppealCode("1009710");
addItemToBasket({
"Id": "a4e1Q000000cwIWQAY",
"Amount__c": ASK_AMOUNT,
"Total_Amount__c": ASK_AMOUNT,
"Benefit_Amount__c": 0,
"Total_Benefit_Amount__c": 0,
"Total_Deductible_Amount__c": ASK_AMOUNT,
"Recurring__c": true,
"Anonymous__c": false,
"Quantity__c": 1,
"Community_Campaign__c": "a4e1Q000000cwIWQAY",
"Community_Campaign__r": { "Name": "Missionary Care" } // #22747091
});
FormInterface.submit(FormInterface.buttons["Add to Basket"]); // submit "Add to Basket"
debug_mode && console.groupEnd('"Yes" clicked');
});
no.addEventListener('click', (e) => { // "No" button clicked ("Add to Basket" triggered popup)
e.preventDefault();
debug_mode && console.groupCollapsed('"No" clicked');
//vwoCustomEvent("DonationInterrupter:No", { 'token': window.NA.DonationInterrupter._tokenName });
vwoSendEvent_DonationInterrupter("No", window.NA.DonationInterrupter._tokenName);
DonationInterrupterInterface.hide(); // close popup
FormInterface.submit(FormInterface.buttons["Add to Basket"]); // submit "Add to Basket"
debug_mode && console.groupEnd('"No" clicked');
});
}
else {
yes.addEventListener('click', (e) => { // "Yes" button clicked ("Donate Now" triggered popup)
e.preventDefault();
debug_mode && console.groupCollapsed('"Yes" clicked');
//vwoCustomEvent("DonationInterrupter:Yes", { 'token': window.NA.DonationInterrupter._tokenName });
vwoSendEvent_DonationInterrupter("Yes", window.NA.DonationInterrupter._tokenName);
const originalAmount = FormInterface.getAmount(),
newAmount = window.NA.DonationInterrupter.newAmount(originalAmount);
debug_mode && console.log(originalAmount, '->', newAmount);
//FormInterface.setRecurring(true); // set to recurring
//FormInterface.setAmount(newAmount); // update amount field
DonationInterrupterInterface.hide(); // close popup
setAppealCode("1009710");
addItemToBasket({
"Id": "a4e1Q000000cwIWQAY",
"Amount__c": ASK_AMOUNT,
"Total_Amount__c": ASK_AMOUNT,
"Benefit_Amount__c": 0,
"Total_Benefit_Amount__c": 0,
"Total_Deductible_Amount__c": ASK_AMOUNT,
"Recurring__c": true,
"Anonymous__c": false,
"Quantity__c": 1,
"Community_Campaign__c": "a4e1Q000000cwIWQAY",
"Community_Campaign__r": { "Name": "Missionary Care" } // #22747091
});
FormInterface.submit(); // submit "Donate Now"
debug_mode && console.groupEnd('"Yes" clicked');
});
no.addEventListener('click', (e) => { // "No" button clicked ("Donate Now" triggered popup)
e.preventDefault();
debug_mode && console.groupCollapsed('"No" clicked');
//vwoCustomEvent("DonationInterrupter:No", { 'token': window.NA.DonationInterrupter._tokenName });
vwoSendEvent_DonationInterrupter("No", window.NA.DonationInterrupter._tokenName);
DonationInterrupterInterface.hide(); // close popup
FormInterface.submit(); // submit "Donate Now"
debug_mode && console.groupEnd('"No" clicked');
});
}
debug_mode && console.log("added handlers to buttons", buttons);
}
catch (err) { // if failed
console.error("Failed to attach event listeners to dialog buttons.", err);
//return setTimeout(()=>window.NA.DonationInterrupter.onShow(e), 500); // try again
}
};
}
//
//
setTimeout(init, 500);
return vwo_$('head')[0] && vwo_$('head')[0].lastChild; } catch(e) {} })("HEAD")}}, R_722072_79_1_3_1:{ fn:function(){return (function(x) { try{
var el,ctx=vwo_$(x);
/*vwo_debug log("Revert","addElement","body"); vwo_debug*/(el=vwo_$('[vwo-element-id="1734023424996"]')).remove();
var ctx=vwo_$(x),el;
/*vwo_debug log("Revert","content",""); vwo_debug*/;
el=vwo_$('[vwo-element-id="1734023425072"]');
el.revertContentOp().remove();
return vwo_$('head')[0] && vwo_$('head')[0].lastChild; } catch(e) {} })("HEAD")}}, ce79_4_1:{ fn:function(executeTrigger, vwo_$) {
(// Example Code: This code will stop polling after 5 sec of dom ready (on calling executeTrigger() method)
function() {
vwo_$(document).ready(function () {
// Waiting for 5 more seconds
setTimeout(function () {
// Call this method to stop the polling
executeTrigger();
}, 5000);
});
}
)()
}}, C_722072_157_1_3_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-1744062806872=""]').length&&el.vwoElement({html:'\n \x3c!--
--\x3e\n
\n
\n ร \n
\n
\n
\n
\n
\n \x3c!-- \n If you have a moment...\n --\x3e\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
\n \n
\n
\n
\n
\n
\n
One-time
\n
$35
\n
provides meals for campers
\n
\n Donate \n \n
\n
\n
\n
\n
One-time
\n
$75
\n
provides half a camp scholarship
\n
\n Donate \n \n
\n
\n
\n
\n
One-time
\n
$150
\n
provides 1 camp scholarship
\n
\n Donate \n \n
\n
\n
\n
\n
\n
\n
\n
\n \x3c!--
--\x3e\n
',position:"append"});})("body")}}, R_722072_157_1_3_1:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
var el,ctx=vwo_$(x);
/*vwo_debug log("Revert","addElement","body"); vwo_debug*/(el=vwo_$('[vwo-element-id="1744062806843"]')).remove();})("body")}}, C_722072_157_1_3_2:{ fn:function(log,nonce=''){return (function(x) {var el,ctx=vwo_$(x);
/*vwo_debug log("content",".pushdown-copy > p:nth-of-type(1)"); vwo_debug*/el=vwo_$(".pushdown-copy > p:nth-of-type(1)"),vwo_$(".pushdown-copy > p:nth-of-type(1)").each((function(){this.__vwoControlOuterHTML=this.__vwoControlOuterHTML||this.outerHTML,!vwo_$(this).find('[vwo-op-1744062807520-0=""]').length&&vwo_$(this).append('Will you help a kid get to Eagle Lake Camps of The Navigators this summer? '),vwo_$(this).nonEmptyContents().eq(0).replaceWith2(document.createTextNode("You can be the difference in a child making a decision to follow Jesus at camp this summer. "))})),el=vwo_$(".pushdown-copy > p:nth-of-type(1)");})(".pushdown-copy > p:nth-of-type(1)")}}, R_722072_157_1_3_2:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
var el,ctx=vwo_$(x);
/*vwo_debug log("Revert","content",".pushdown-copy > p:nth-of-type(1)"); vwo_debug*/(el=vwo_$(".pushdown-copy > p:nth-of-type(1)")).revertContentOp(),el=vwo_$(".pushdown-copy > p:nth-of-type(1)");})(".pushdown-copy > p:nth-of-type(1)")}}, C_722072_157_1_3_3:{ fn:function(log,nonce=''){return (function(x) {})(".na-pushdown-wrapper,.mw-w-button,input.mw-w-button,#page,.pushdownbar,.div-block-16,.pushdownheadline,.pushdown,.div-block-7,.div-block-8,.paragraph-2,.div-block-15,.mw-btn,.mw-btn:visited,.mw-white,.mw-btn.mw-white,.mw-btn.mw-whitemw-btn:link,.na-pushdown-wrapper .close span,.na-pushdown-wrapper .close,.fa-angle-down:before,/*#donate-menu,.close-wrapper,.btn-dismiss,#masthead .close-menu,.pushdown .pushdown__row,.pushdown .pushdown__col,.pushdown .pushdown__content,.pushdown .pushdown-copy > *:last-child,.pushdown .grid-area,.pushdown .grid-card,.pushdown .grid-card div > p,.pushdown .grid-card div > p > span,.pushdown .grid-card .flex-col,.pushdown .grid-card div > p > b,.pushdown .grid-card button,.pushdown div div.centered,.pushdown div a.other-link,.pushdown .pushdown__close,.pushdown .grid-card p:nth-of-type(3),.pushdown .grid-card p > b")}}, R_722072_157_1_3_3:{ fn:function(log,nonce=''){return (function(x) {
if(!vwo_$.fn.vwoRevertHtml){
return;
};
})(".na-pushdown-wrapper,.mw-w-button,input.mw-w-button,#page,.pushdownbar,.div-block-16,.pushdownheadline,.pushdown,.div-block-7,.div-block-8,.paragraph-2,.div-block-15,.mw-btn,.mw-btn:visited,.mw-white,.mw-btn.mw-white,.mw-btn.mw-whitemw-btn:link,.na-pushdown-wrapper .close span,.na-pushdown-wrapper .close,.fa-angle-down:before,/*#donate-menu,.close-wrapper,.btn-dismiss,#masthead .close-menu,.pushdown .pushdown__row,.pushdown .pushdown__col,.pushdown .pushdown__content,.pushdown .pushdown-copy > *:last-child,.pushdown .grid-area,.pushdown .grid-card,.pushdown .grid-card div > p,.pushdown .grid-card div > p > span,.pushdown .grid-card .flex-col,.pushdown .grid-card div > p > b,.pushdown .grid-card button,.pushdown div div.centered,.pushdown div a.other-link,.pushdown .pushdown__close,.pushdown .grid-card p:nth-of-type(3),.pushdown .grid-card p > b")}}, 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": "\n \n \n
\n Before you finalize your gift... would you be willing to chip in an additional $5 per month to help provide for unexpected missionary expenses? \n \n
\n \n\t\tYour small additional monthly gift will help care for thousands of missionaries to give them training, support in the field, and financial support when unexpected challenges arise.\n
\n \n If you are willing to also give a monthly gift, weโd love to send you an incredible book, 31 Days toward Trusting God by Jerry Bridges.\n
\n \n Would you be willing to chip in an additional $5 per month alongside your missionary gift?\n
\n \n
\n \n \n YES! \n \n Please add a 5 monthly gift to my cart. \n \n \n No, thanks. \n \n Just process my original gift. \n \n
\n \n
\n ", "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 and create a window object
waitForElement(document.querySelector('dialog.donation-interrupter'), init, (dialog) => { // wait for element
const donationPageType = window.Navigators?.donationPageType?.toLowerCase() ?? undefined;
if (donationPageType !== "staff") {
dialog.style.setProperty("display", "none", "important");
//dialog.remove();
return console.warn(`Donation page type must be "Staff" for this test to run.`), null;
}
if (document.querySelectorAll('dialog.donation-interrupter').length > 1) {
return console.warn(`Multiple donation interrupters found on the page.`), null;
}
console.log("dialog found:", dialog);
try {
const DonationInterrupter = {
dialog: dialog || document.querySelector('dialog.donation-interrupter'),
_tokenName: DONATION_INTERRUPTER_GROUP_NAME ? "NA_DonationInterrupter_" + DONATION_INTERRUPTER_GROUP_NAME : "NA_DonationInterrupter",
_memoryMode: sessionStorage,
status: "ready",
getStatus: function () {
return this._memoryMode.getItem(this._tokenName + "_status") || undefined;
},
setStatus: function (t) {
this._memoryMode.setItem(this._tokenName + "_status", t);
this.status = t;
return this.getStatus();
},
conditions: (function(){return true;})(),
newAmount: function (originalAmount) { return originalAmount / 12; }, // reduced ask amount
onShow: function (e) {},
onHide: function (e) {},
show: function (e = undefined) {
this.dialog.showModal();
this.dialog.addEventListener('keydown', e => { e.key === "Escape" && (e.preventDefault(), e.stopImmediatePropagation()) }); // prevent esc button clicked
this.setStatus("shown");
typeof this.onShow === "function" && this.onShow.call(null, e);
},
hide: function (e = undefined) {
this.setStatus("dismissed");
this.dialog.close();
typeof this.onHide === "function" && this.onHide.call(null, e);
},
updateDialogData: function () {
if (this.dialog) {
let originalAmount = window.NA.MiniDonationForm.getAmount(),
suggestedAmount = this.newAmount(originalAmount);
[...this.dialog.querySelectorAll('span[data="amount_original"]')].forEach(span => span.textContent = originalAmount.toString());
[...this.dialog.querySelectorAll('span[data="amount_suggested"]')].forEach(span => span.textContent = suggestedAmount.toString());
}
},
};
window.NA = window.NA || {};
window.NA.DonationInterrupter = DonationInterrupter ? DonationInterrupter : window.NA.DonationInterrupter;
if (window.NA.MiniDonationForm && window.NA.DonationInterrupter)
main(window.NA.MiniDonationForm, window.NA.DonationInterrupter);
} catch (err) {
console.error("Failed to interface with donation interrupter.");
}
}, 100); // wait for element
}, 100); // wait for form buttons
}); // when "lightning-input" defined
}); // when "c-donate-community-donate-buttons" defined
}); // when "c-donate-community-staff-information" defined
} catch (err) {
console.error("Error when waiting for custom elements:", err);
}
}
//
//
//
//
//
//
//
//
function main (FormInterface, DonationInterrupterInterface, debug_mode = 0) {
if (!FormInterface.buttons)
return setTimeout(init, 100);
if (!DonationInterrupterInterface.buttons) {
DonationInterrupterInterface.buttons = { // finish setting up the reference to the CTA buttons in the
"yes": [...DonationInterrupterInterface.dialog.querySelectorAll('button')][0],
"no": [...DonationInterrupterInterface.dialog.querySelectorAll('button')][1],
};
return main(FormInterface, DonationInterrupterInterface, debug_mode); // and try again
}
window.NA.DonationInterrupter.setStatus(window.NA.DonationInterrupter._memoryMode.getItem(window.NA.DonationInterrupter._tokenName + "_status") || "ready"); // set status to the sessionStorage token (saved state) or ready (first time)
window.NA.DonationInterrupter.newAmount = originalAmount => 5; // set the function that determines the reduced gift amount: constant $10
/// Add click handle to fake submit button to trigger popup
try {
for (const button of Object.values(FormInterface.buttons)) {
const originalButton = button, // get the original button to clone
fakeButton = FormInterface.cloneSubmitButton(originalButton); // clones the element, attributes, and styles
originalButton.style.display = "none"; // hide original button
fakeButton.style.setProperty("margin-left", '0', "important"); // fix positioning
//debug_mode && fakeButton.style.setProperty("border", "3px dashed red", "important"); // highlight the fake button
setInterval(() => fakeButton.disabled = originalButton.disabled, 50); // update disabled state of button every 50ms
fakeButton.addEventListener('click', (e) => { // when the fake button copy is clicked
let amount = FormInterface.getAmount(), // get the amount
isRecurring = FormInterface.getRecurring(), // check if recurring
popupShown = DonationInterrupterInterface.status === "shown" || DonationInterrupterInterface.status === "dismissed"; // check if the popup has been dismissed
if (debug_mode) { // log expression in debug_mode
console.groupCollapsed("Check conditions");
console.info(amount, "< 250", amount < 250);
console.info(isRecurring, "=== false", isRecurring === false);
console.info(popupShown, "=== false", popupShown === false);
console.groupEnd("Check conditions");
}
const conditionsMet = [
//amount >= 5, // greater than $5
amount < 250, // less than $250
isRecurring === false, // not recurring
popupShown === false, // not already seen
].every(condition => condition ? true : false); // reduce the expression evaluations to true or false
debug_mode && console.info("showPopup?", conditionsMet);
// Which button triggered the popup determins which button will be used to submit
if (e.srcElement.textContent === FormInterface.buttons["Add to Basket"].textContent) { // if clicked button text equal to original "Add to Basket" button text
conditionsMet ? DonationInterrupterInterface.show(e) : FormInterface.submit(FormInterface.buttons["Add to Basket"]);
} else {
conditionsMet ? DonationInterrupterInterface.show(e) : FormInterface.submit();
}
});
}
}
catch (err) {
console.error("Failed to clone submit button and add event listener.", err);
}
window.NA.DonationInterrupter.onShow = (e) => { // after the popup has been shown
window.NA.DonationInterrupter.updateDialogData(); // update the values in the dialog
//vwoCustomEvent("DonationInterrupter:Shown", { 'token': window.NA.DonationInterrupter._tokenName }); // trigger VWO event to calculate metric that donation interrupter was shown
vwoSendEvent_DonationInterrupter("Shown", window.NA.DonationInterrupter._tokenName);
/// Add click handlers to dialog buttons
try {
const buttons = window.NA.DonationInterrupter.buttons;
const { yes, no } = buttons; // get the button references from the window object
if (e.srcElement.textContent === FormInterface.buttons["Add to Basket"].textContent) { // if clicked button text equal to original "Add to Basket" button text
yes.addEventListener('click', (e) => { // "Yes" button clicked ("Add to Basket" triggered popup)
e.preventDefault();
debug_mode && console.groupCollapsed('"Yes" clicked');
//vwoCustomEvent("DonationInterrupter:Yes", { 'token': window.NA.DonationInterrupter._tokenName });
vwoSendEvent_DonationInterrupter("Yes", window.NA.DonationInterrupter._tokenName);
const originalAmount = FormInterface.getAmount(),
newAmount = window.NA.DonationInterrupter.newAmount(originalAmount);
debug_mode && console.log(originalAmount, '->', newAmount);
//FormInterface.setRecurring(true); // set to recurring
//FormInterface.setAmount(newAmount); // update amount field
DonationInterrupterInterface.hide(); // close popup
addItemToBasket({
"Id": "a4e1Q000000cwIWQAY",
"Amount__c": 5,
"Total_Amount__c": 5,
"Benefit_Amount__c": 0,
"Total_Benefit_Amount__c": 0,
"Total_Deductible_Amount__c": 5,
"Recurring__c": true,
"Anonymous__c": false,
"Quantity__c": 1,
"Community_Campaign__c": "a4e1Q000000cwIWQAY",
"Community_Campaign__r": { "Name": "Missionary Care" } // #22747091
});
FormInterface.submit(FormInterface.buttons["Add to Basket"]); // submit "Add to Basket"
debug_mode && console.groupEnd('"Yes" clicked');
});
no.addEventListener('click', (e) => { // "No" button clicked ("Add to Basket" triggered popup)
e.preventDefault();
debug_mode && console.groupCollapsed('"No" clicked');
//vwoCustomEvent("DonationInterrupter:No", { 'token': window.NA.DonationInterrupter._tokenName });
vwoSendEvent_DonationInterrupter("No", window.NA.DonationInterrupter._tokenName);
DonationInterrupterInterface.hide(); // close popup
FormInterface.submit(FormInterface.buttons["Add to Basket"]); // submit "Add to Basket"
debug_mode && console.groupEnd('"No" clicked');
});
}
else {
yes.addEventListener('click', (e) => { // "Yes" button clicked ("Donate Now" triggered popup)
e.preventDefault();
debug_mode && console.groupCollapsed('"Yes" clicked');
//vwoCustomEvent("DonationInterrupter:Yes", { 'token': window.NA.DonationInterrupter._tokenName });
vwoSendEvent_DonationInterrupter("Yes", window.NA.DonationInterrupter._tokenName);
const originalAmount = FormInterface.getAmount(),
newAmount = window.NA.DonationInterrupter.newAmount(originalAmount);
debug_mode && console.log(originalAmount, '->', newAmount);
//FormInterface.setRecurring(true); // set to recurring
//FormInterface.setAmount(newAmount); // update amount field
DonationInterrupterInterface.hide(); // close popup
addItemToBasket({
"Id": "a4e1Q000000cwIWQAY",
"Amount__c": 5,
"Total_Amount__c": 5,
"Benefit_Amount__c": 0,
"Total_Benefit_Amount__c": 0,
"Total_Deductible_Amount__c": 5,
"Recurring__c": true,
"Anonymous__c": false,
"Quantity__c": 1,
"Community_Campaign__c": "a4e1Q000000cwIWQAY",
"Community_Campaign__r": { "Name": "Missionary Care" } // #22747091
});
FormInterface.submit(); // submit "Donate Now"
debug_mode && console.groupEnd('"Yes" clicked');
});
no.addEventListener('click', (e) => { // "No" button clicked ("Donate Now" triggered popup)
e.preventDefault();
debug_mode && console.groupCollapsed('"No" clicked');
//vwoCustomEvent("DonationInterrupter:No", { 'token': window.NA.DonationInterrupter._tokenName });
vwoSendEvent_DonationInterrupter("No", window.NA.DonationInterrupter._tokenName);
DonationInterrupterInterface.hide(); // close popup
FormInterface.submit(); // submit "Donate Now"
debug_mode && console.groupEnd('"No" clicked');
});
}
debug_mode && console.log("added handlers to buttons", buttons);
}
catch (err) { // if failed
console.error("Failed to attach event listeners to dialog buttons.", err);
//return setTimeout(()=>window.NA.DonationInterrupter.onShow(e), 500); // try again
}
};
}
//
//
setTimeout(init, 500);
return vwo_$('head')[0] && vwo_$('head')[0].lastChild; } catch(e) {} })("HEAD")}}, C_722072_79_1_3_0:{ fn:function(){return (function(x) { try{
var _vwo_sel = vwo_$("");
!vwo_$("head").find("#1734023424983").length && vwo_$('head').append(_vwo_sel);
const DEFAULT_DONATION_FREQUENCY="One-Time";function getQueryParam(e){let t=window.location.search.match(e+"=([^&]*)");return t?t[1]:void 0}function initOnElement(e,t,n){const i=e.getElementsByTagName(t);return i.length?n(i):setTimeout(initOnElement,500,e,t,n)}window.DonationForm=window.DonationForm||{recurring_checkbox:null,submit_button:null,other_amt:null,gift_array_elements:[],onetime_gift_array:[],recurring_gift_array:[10,20,30,40],setRecurring:function(e){console.log("setRecurring",e,this.recurring_checkbox),(!this.recurring_checkbox.checked&&e||this.recurring_checkbox.checked&&!e)&&(console.log("checked",this.recurring_checkbox.checked,"(before click)"),this.recurring_checkbox.click(),console.log("checked",this.recurring_checkbox.checked,"(after click)"))},selectGiftArray:function(e){this.gift_array_elements[e].click()},modifyGiftArray:function(e){this.gift_array_elements.forEach((t,n)=>{t.value=e[n],t.textContent="$"+e[n]})},setOneTimeGiftArrayValues:function(){let e=this;this.gift_array_elements.forEach(t=>{e.onetime_gift_array.push(parseInt(t.value))})},setFirstNamePersonalization:function(e){const t=void 0===getQueryParam("first_name")||""===getQueryParam("first_name")?"Friend":getQueryParam("first_name");for(let n=0;n<=e.length-1;n++)e[n].innerHTML.includes("[Name]")&&(e[n].innerHTML=e[n].innerHTML.replace(/\[[^\]]*]/,t)),e[n].innerHTML.includes("Friend")&&(e[n].innerHTML=e[n].innerHTML.replace("Friend",t))},init:function(){document.querySelectorAll(".tab").forEach(e=>{e.addEventListener("click",(function(e){this.classList.add("selected"),this.classList.contains("recurring")?(document.querySelector(".tab.onetime").classList.remove("selected"),DonationForm.setRecurring(!0)):(document.querySelector(".tab.recurring").classList.remove("selected"),DonationForm.setRecurring(!1))}))}),this.setOneTimeGiftArrayValues(),this.setRecurring(!1),this.selectGiftArray(0)}},initOnElement(document,"c-donate-community-staff-information",(function(e){initOnElement(e[0],"div",(function(e){e[0].querySelectorAll("div.slds-col")[0].classList.add("page-image");const t=e[0].querySelectorAll("div.slds-col")[1];t.classList.add("donation-form-content");const n=t.querySelectorAll("div,lightning-formatted-rich-text");for(let e=0;e<=n.length-1;e++)0==e&&n[e].classList.add("page-title"),1==e&&n[e].classList.add("page-action-text"),2==e&&n[e].classList.add("donation-form"),3==e&&n[e].classList.add("bottom-title"),4==e&&n[e].classList.add("page-text");DonationForm.setFirstNamePersonalization(n[4].shadowRoot.querySelectorAll("div p")),n[1].before(n[4]);const i=document.createElement("div");i.classList.add("tabs"),i.innerHTML='One-Time Gift
Recurring Gift
',n[2].before(i),initOnElement(n[2],"c-donate-community-donate-buttons",(function(e){initOnElement(e[0].shadowRoot.querySelector("div"),"div",(function(e){for(let t=0;t=1037725){return window.VWO&&window.VWO.get("visitor.id")}else{return window.VWO._&&window.VWO._.cookies&&window.VWO._.cookies.get("_vwo_uuid")}};var pollInterval=100;var timeout=6e4;return function(){var accountIntegrationSettings={};var _interval=null;function waitForAnalyticsVariables(){try{accountIntegrationSettings=argument.valuesGetter();accountIntegrationSettings.visitorUuid=getVisitorUuid()}catch(error){accountIntegrationSettings=undefined}if(accountIntegrationSettings&&argument.verifyData(accountIntegrationSettings)){argument.valuesSetter(accountIntegrationSettings);return 1}return 0}var currentTime=0;_interval=setInterval((function(){currentTime=currentTime||performance.now();var result=waitForAnalyticsVariables();if(result||performance.now()-currentTime>=timeout){clearInterval(_interval)}}),pollInterval)}};
commonWrapper({valuesGetter:function(){return {"ga4s":0}},valuesSetter:function(data){var singleCall=data["ga4s"]||0;if(singleCall){window.sessionStorage.setItem("vwo-ga4-singlecall",true)}var ga4_device_id="";if(typeof window.VWO._.cookies!=="undefined"){ga4_device_id=window.VWO._.cookies.get("_ga")||""}if(ga4_device_id){window.vwo_ga4_uuid=ga4_device_id.split(".").slice(-2).join(".")}},verifyData:function(data){if(typeof window.VWO._.cookies!=="undefined"){return window.VWO._.cookies.get("_ga")||""}else{return false}}})();
var pushBasedCommonWrapper=function(argument){var firedCamp={};if(!argument){argument={integrationName:"",getExperimentList:function(){},accountSettings:function(){},pushData:function(){}}}return function(){window.VWO=window.VWO||[];const getVisitorUuid=function(){if(window._vwo_acc_id>=1037725){return window.VWO&&window.VWO.get("visitor.id")}else{return window.VWO._&&window.VWO._.cookies&&window.VWO._.cookies.get("_vwo_uuid")}};var sendDebugLogsOld=function(expId,variationId,errorType,user_type,data){try{var errorPayload={f:argument["integrationName"]||"",a:window._vwo_acc_id,url:window.location.href,exp:expId,v:variationId,vwo_uuid:getVisitorUuid(),user_type:user_type};if(errorType=="initIntegrationCallback"){errorPayload["log_type"]="initIntegrationCallback";errorPayload["data"]=JSON.stringify(data||"")}else if(errorType=="timeout"){errorPayload["timeout"]=true}if(window.VWO._.customError){window.VWO._.customError({msg:"integration debug",url:window.location.href,lineno:"",colno:"",source:JSON.stringify(errorPayload)})}}catch(e){window.VWO._.customError&&window.VWO._.customError({msg:"integration debug failed",url:"",lineno:"",colno:"",source:""})}};var sendDebugLogs=function(expId,variationId,errorType,user_type){var eventName="vwo_debugLogs";var eventPayload={};try{eventPayload={intName:argument["integrationName"]||"",varId:variationId,expId:expId,type:errorType,vwo_uuid:getVisitorUuid(),user_type:user_type};if(window.VWO._.event){window.VWO._.event(eventName,eventPayload,{enableLogs:1})}}catch(e){eventPayload={msg:"integration event log failed",url:window.location.href};window.VWO._.event&&window.VWO._.event(eventName,eventPayload)}};const callbackFn=function(data){if(!data)return;var expId=data[1],variationId=data[2],repeated=data[0],singleCall=0,debug=0;var experimentList=argument.getExperimentList();var integrationName=argument["integrationName"]||"vwo";if(typeof argument.accountSettings==="function"){var accountSettings=argument.accountSettings();if(accountSettings){singleCall=accountSettings["singleCall"];debug=accountSettings["debug"]}}if(debug){sendDebugLogs(expId,variationId,"intCallTriggered",repeated)}if(singleCall&&(repeated==="vS"||repeated==="vSS")||firedCamp[expId]){return}window.expList=window.expList||{};var expList=window.expList[integrationName]=window.expList[integrationName]||[];if(expId&&variationId&&["VISUAL_AB","VISUAL","SPLIT_URL"].indexOf(_vwo_exp[expId].type)>-1){if(experimentList.indexOf(+expId)!==-1){firedCamp[expId]=variationId;var visitorUuid=getVisitorUuid();var pollInterval=100;var currentTime=0;var timeout=6e4;var user_type=_vwo_exp[expId].exec?"vwo-retry":"vwo-new";var interval=setInterval((function(){if(expList.indexOf(expId)!==-1){clearInterval(interval);return}currentTime=currentTime||performance.now();var toClearInterval=argument.pushData(expId,variationId,visitorUuid);if(debug&&toClearInterval){sendDebugLogsOld(expId,variationId,"",user_type);sendDebugLogs(expId,variationId,"intDataPushed",user_type)}var isTimeout=performance.now()-currentTime>=timeout;if(isTimeout&&debug){sendDebugLogsOld(expId,variationId,"timeout",user_type);sendDebugLogs(expId,variationId,"intTimeout",user_type)}if(toClearInterval||isTimeout){clearInterval(interval)}if(toClearInterval){window.expList[integrationName].push(expId)}}),pollInterval||100)}}};window.VWO.push(["onVariationApplied",callbackFn]);window.VWO.push(["onVariationShownSent",callbackFn])}};
var surveyDataCommonWrapper=function(argument){if(!argument){argument={getCampaignList:function(){return[]},surveyStatusChange:function(){},answerSubmitted:function(){}}}return function(){window.VWO=window.VWO||[];function getValuesFromAnswers(answers){var values=[];for(var i=0;i=timeout;if(toClearInterval||isTimeout){clearInterval(interval)}}),pollInterval)}}window.VWO.push(["onSurveyShown",function(data){commonSurveyCallback(data,argument.surveyStatusChange,"surveyShown")}]);window.VWO.push(["onSurveyCompleted",function(data){commonSurveyCallback(data,argument.surveyStatusChange,"surveyCompleted")}]);window.VWO.push(["onSurveyAnswerSubmitted",function(data){commonSurveyCallback(data,argument.answerSubmitted,"surveySubmitted")}])}};
(function(){var VWOOmniTemp={};window.VWOOmni=window.VWOOmni||{};for(var key in VWOOmniTemp)Object.prototype.hasOwnProperty.call(VWOOmniTemp,key)&&(window.VWOOmni[key]=VWOOmniTemp[key]);window._vwoIntegrationsLoaded=1;pushBasedCommonWrapper({integrationName:"GA4",getExperimentList:function(){return [70,79,121,156,157,158]},accountSettings:function(){var accountIntegrationSettings={"dataVariable":"dataLayer","manualSetup":true,"setupVia":"gtm"};if(accountIntegrationSettings["debugType"]=="ga4"&&accountIntegrationSettings["debug"]){accountIntegrationSettings["debug"]=1}else{accountIntegrationSettings["debug"]=0}return accountIntegrationSettings},pushData:function(expId,variationId){var accountIntegrationSettings={"dataVariable":"dataLayer","manualSetup":true,"setupVia":"gtm"};var ga4Setup=accountIntegrationSettings["setupVia"]||"gtag";if(typeof window.gtag!=="undefined"&&ga4Setup=="gtag"){window.gtag("event","VWO",{vwo_campaign_name:window._vwo_exp[expId].name+":"+expId,vwo_variation_name:window._vwo_exp[expId].comb_n[variationId]+":"+variationId});window.gtag("event","experience_impression",{exp_variant_string:"VWO-"+expId+"-"+variationId});return true}return false}})();pushBasedCommonWrapper({integrationName:"GA4-GTM",getExperimentList:function(){return [70,79,121,156,157,158]},accountSettings:function(){var accountIntegrationSettings={"dataVariable":"dataLayer","manualSetup":true,"setupVia":"gtm"};if(accountIntegrationSettings["debugType"]=="gtm"&&accountIntegrationSettings["debug"]){accountIntegrationSettings["debug"]=1}else{accountIntegrationSettings["debug"]=0}return accountIntegrationSettings},pushData:function(expId,variationId){var accountIntegrationSettings={"dataVariable":"dataLayer","manualSetup":true,"setupVia":"gtm"};var ga4Setup=accountIntegrationSettings["setupVia"]||"gtm";var dataVariable=accountIntegrationSettings["dataVariable"]||"dataLayer";if(typeof window[dataVariable]!=="undefined"&&ga4Setup=="gtm"){window[dataVariable].push({event:"vwo-data-push-ga4",vwo_exp_variant_string:"VWO-"+expId+"-"+variationId});return true}return false}})();
;})();(function(){window.VWO=window.VWO||[];var pollInterval=100;var _vis_data={};var intervalObj={};var analyticsTimerObj={};var experimentListObj={};window.VWO.push(["onVariationApplied",function(data){if(!data){return}var expId=data[1],variationId=data[2];if(expId&&variationId&&["VISUAL_AB","VISUAL","SPLIT_URL"].indexOf(window._vwo_exp[expId].type)>-1){}}])})();;
;var vD=VWO.data||{};VWO.data={content:{"fns":{"list":{"vn":1,"args":{"1":{}}}}},as:"r5.visualwebsiteoptimizer.com",dacdnUrl:"https://dev.visualwebsiteoptimizer.com",accountJSInfo:{"noSS":false,"pc":{"t":0,"a":0},"pvn":0,"ts":1744987164,"rp":30}};for(var k in vD){VWO.data[k]=vD[k]};;var gcpfb=function(a,loadFunc,status,err,success){function vwoErr() {_vwo_err({message:"Google_Cdn failing for " + a + ". Trying Fallback..",code:"cloudcdnerr",status:status});} if(a.indexOf("/cdn/")!==-1){loadFunc(a.replace("cdn/",""),err,success); vwoErr(); return true;} else if(a.indexOf("/dcdn/")!==-1&&a.indexOf("evad.js") !== -1){loadFunc(a.replace("dcdn/",""),err,success); vwoErr(); return true;}};window.VWO=window.VWO || [];window.VWO._= window.VWO._ || {};window.VWO._.gcpfb=gcpfb;;var d={cookie:document.cookie,URL:document.URL,referrer:document.referrer};var w={VWO:{_:{}},location:{href:window.location.href,search:window.location.search},_vwoCc:window._vwoCc};;window._vwo_cdn="https://dev.visualwebsiteoptimizer.com/cdn/";window._vwo_apm_debug_cdn="https://dev.visualwebsiteoptimizer.com/cdn/";window.VWO._.useCdn=true;window.vwo_eT="br";window._VWO=window._VWO||{};window._VWO.fSeg={};window._VWO.dcdnUrl="/dcdn/settings.js";window.VWO.sTs=1744949893;window._VWO._vis_nc_lib=window._vwo_cdn+"edrv/nc-3f9594955e9158c3d78e98fc4a36811dbr.js";var loadWorker=function(url){_vwo_code.load(url, { dSC: true, onloadCb: function(xhr,a){window._vwo_wt_l=true;if(xhr.status===200 ||xhr.status===304){var code="var window="+JSON.stringify(w)+",document="+JSON.stringify(d)+";window.document=document;"+xhr.responseText;var blob=new Blob([code||"throw new Error('code not found!');"],{type:"application/javascript"}),url=URL.createObjectURL(blob);window.mainThread={webWorker:new Worker(url)};window.vwoChannelFW=new MessageChannel();window.vwoChannelToW=new MessageChannel();window.mainThread.webWorker.postMessage({vwoChannelToW:vwoChannelToW.port1,vwoChannelFW:vwoChannelFW.port2},[vwoChannelToW.port1, vwoChannelFW.port2]);if(!window._vwo_mt_f)return window._vwo_wt_f=true;_vwo_code.addScript({text:window._vwo_mt_f});delete window._vwo_mt_f}else{if(gcpfb(a,loadWorker,xhr.status)){return;}_vwo_code.finish("&e=loading_failure:"+a)}}, onerrorCb: function(a){if(gcpfb(a,loadWorker)){return;}window._vwo_wt_l=true;_vwo_code.finish("&e=loading_failure:"+a);}})};loadWorker("https://dev.visualwebsiteoptimizer.com/cdn/edrv/worker-413c17ee3e4a9a6250095279e25419c6br.js");;var _vis_opt_file;var _vis_opt_lib;if(window.VWO._.allSettings.dataStore.previewExtraSettings!=undefined&&window.VWO._.allSettings.dataStore.previewExtraSettings.isSurveyPreviewMode){var surveyHash=window.VWO._.allSettings.dataStore.plugins.LIBINFO.SURVEY_DEBUG_EVENTS.HASH;var param1="evad.js?va=";var param2="&d=debugger_new";var param3="&sp=1&a=722072&sh="+surveyHash;_vis_opt_file=vwoCode.use_existing_jquery&&typeof vwoCode.use_existing_jquery()!=="undefined"?vwoCode.use_existing_jquery()?param1+"vanj"+param2:param1+"va_gq"+param2:param1+"edrv/va_gq-7c7c840681fb5b7ddc0fce3da241cf55br.js"+param2;_vis_opt_file=_vis_opt_file+param3;_vis_opt_lib="https://dev.visualwebsiteoptimizer.com/dcdn/"+_vis_opt_file}else if(window.VWO._.allSettings.dataStore.mode!=undefined&&window.VWO._.allSettings.dataStore.mode=="PREVIEW"){ var path1 = 'edrv/pd_'; var path2 = window.VWO._.allSettings.dataStore.plugins.LIBINFO.EVAD.HASH + ".js"; ;_vis_opt_file=vwoCode.use_existing_jquery&&typeof vwoCode.use_existing_jquery()!=="undefined"?vwoCode.use_existing_jquery()?path1+"vanj"+path2:path1+"va_gq"+path2:path1+"edrv/va_gq-7c7c840681fb5b7ddc0fce3da241cf55br.js"+path2;_vis_opt_lib="https://dev.visualwebsiteoptimizer.com/cdn/"+_vis_opt_file}else{_vis_opt_file=vwoCode.use_existing_jquery&&typeof vwoCode.use_existing_jquery()!=="undefined"?vwoCode.use_existing_jquery()?"edrv/vanj-298dbd0998f2c686c389cd1da334dba4br.js":"edrv/va_gq-7c7c840681fb5b7ddc0fce3da241cf55br.js":"edrv/va_gq-7c7c840681fb5b7ddc0fce3da241cf55br.js"}window._vwo_library_timer=setTimeout((function(){vwoCode.removeLoaderAndOverlay&&vwoCode.removeLoaderAndOverlay();vwoCode.finish()}),vwoCode.library_tolerance&&typeof vwoCode.library_tolerance()!=="undefined"?vwoCode.library_tolerance():2500),_vis_opt_lib=typeof _vis_opt_lib=="undefined"?window._vwo_cdn+_vis_opt_file:_vis_opt_lib;var loadLib=function(url){_vwo_code.load(url, { dSC: true, onloadCb:function(xhr,a){window._vwo_mt_l=true;if(xhr.status===200 || xhr.status===304){if(!window._vwo_wt_f)return window._vwo_mt_f=xhr.responseText;_vwo_code.addScript({text:xhr.responseText});delete window._vwo_wt_f;}else{if(gcpfb(a,loadLib,xhr.status)){return;}_vwo_code.finish("&e=loading_failure:"+a);}}, onerrorCb: function(a){if(gcpfb(a,loadLib)){return;}window._vwo_mt_l=true;_vwo_code.finish("&e=loading_failure:"+a);}})};loadLib(_vis_opt_lib);VWO.load_co=function(u,opts){return window._vwo_code.load(u,opts);};;;}}catch(e){_vwo_code.finish();_vwo_code.removeLoaderAndOverlay&&_vwo_code.removeLoaderAndOverlay();_vwo_err(e);window.VWO.caE=1}})();
Skip to content
Teresa Roberts, author of Raising Disciples: Guiding Your Kids into a Faith of Their Own , shares her heart for cultivating a spiritual community for your kids and tips for helping them grow spiritually at all ages and stages.
What inspired you to write the book Raising Disciples: Guiding Your Kids into a Faith of Their Own?
Over the last decade, I realized that while there are plenty of great books on Christian parenting, none really map out the stages of discipleship from infancy to adolescence. Thatโs why I wrote this book โ to give parents a clear pathway to help their kids grow spiritually at every age and stage.
Drawing from 30 years of walking alongside parents and 15 years as a professor, this pathway weaves together scripture and childhood development to identify key discipleship markers. My hope is that this book becomes a practical resource for parents and anyone who works with kids, making it easier to nurture spiritual growth each year.
Could you share about who discipled you growing up?
Iโm very fortunate that I was raised by Christian parents. My father is a mathematics professor and my mom is an accountant, so thereโs nothing highly spiritual about them. But my parents were intentional to put us into a Christian community from the time we were infants. I was raised in a church of about 200 people in a small town in Illinois, so I had spiritual aunts and uncles and grandparents that were part of that church community. I believe this is why my two brothers and I are all serving in ministry today.
How would you encourage parents looking for a spiritual family for their kids?
Some of the best ways to create a spiritual family is to have people from your church community over to your home or accept invitations into their homes. Allow your families to get to know each other and be intentional about this time.
There is also another way to approach finding those spiritual family members for your kids: ask. When you find someone you trust, make the invitation: Would you come to my sonโs soccer game; or my daughterโs musical performance; or would you mind reaching out to my daughter or son who is struggling right now? I think there are a lot of godly people who would love the opportunity to invest in and disciple children.
For example during my years on staff as a childrenโs minister, I was single. It was natural for families to invite me over to their homes. Also, I had time to show up for soccer games and dance recitals and loved those opportunities.
I encourage families to not forget about two potential groups that can come alongside your child in their discipleship. Single adults (and also couples without children), can become spiritual aunts and uncles to your children. Second, retired men and women, especially those who may not have family nearby, have so much to offer as spiritual grandparents.
Years ago, my parents became spiritual grandparents to a family in the church. This semester, one of those children is now a student in my classroom, studying for ministry. These are the kinds of relationships God intended.
Could you give the audience a taste of your book?
The primary premise is that every child is being discipled. However, the question is, who or what is discipling your child? To help parents think about that, Iโve identified seven stages of a childโs spiritual development, from infancy to adolescence. For each of the seven stages, I provide a variety of suggestions of how a parent can encourage a childโs spiritual growth along this pathway.
The pathway begins with laying a foundation of trust during infancy โ trust with you and trust with others in your church community. Then children can be surrounded with Godโs love, introduced to Godโs story, and recognize they are a part of Godโs community, the church. As they grow in understanding, they can be led to believe in Godโs truth found in scripture and guided toward obedience of God and following Jesus. Our hope is that by the time they reach the age of 13, a child would understand who God created them to be, who they are in God, and that they belong to the community of faith. If we can build a framework of faith centered on Christ, Scripture, and community before the age of 13, then they will be more likely to live according to that framework their whole lives.
How would you encourage parents today who are seeking to disciple their kids?
Your discipleship of your children should flow naturally out of the overflow of your own continued growth as a disciple of Jesus. But also, choose something to be intentional about with your kids and their spiritual development โ whether that be nighttime prayers or praying on the way to school, or perhaps a specific focus of Bible reading for a period of time. Choose something for this season and dedicate yourself and your family to it.
We started a practice in our home a couple years ago, that in the month of November, before we eat dinner together, we each write down one thing weโre thankful for that day, and we add it to a bowl. Itโs a simple practice that has a lot of meaning for my family.
What is one simple next step parents could take to encourage their kids in their journey with God?
Something helpful is asking your kids open-ended questions โ those that require more than a โyesโ or โnoโ answer. Then find which of those questions your kids really respond to. Here are a couple examples: What did you feel like God encouraged you to do today? What was something that was really good about your day?
Iโve found that when you cultivate these types of conversations with your kids with simple questions, it creates a seed bed for when the harder questions come along.
Teresa Roberts is a Professor of Ministry and Christian Formation, Program Director of Childrenโs Ministry, and a vice president at Ozark Christian College. She is an expert in childrenโs spiritual formation training with more than 25 years of ministry experience. Dr. Roberts holds a Master of Arts in Family and Youth Ministry, a Master of Divinity, and a Doctor of Ministry. She serves in childrenโs ministry at Carterville Christian Church where she attends with her husband and step-daughter. Learn more at discipleshipguides.com.
Want to learn more about how parenting and disciplemaking intersect? Read the first chapter of Teresaโs book, Raising Disciples: Guiding Your Kids Into a Faith of Their Own, today.
The Navigators interview author Bill Mowry on his latest book, The Ways of the Leader, and how to gain wisdom.
Continue Reading
Last month, Navigator staff came together in Texas for the National Staff Gathering where they enjoyed times of laughter, along with โฆ
Continue Reading
ร
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?