Skip to content

Commit

Permalink
ENgrid Update
Browse files Browse the repository at this point in the history
  • Loading branch information
fernanDOTdo committed Jan 8, 2025
1 parent bfb7f2d commit 346bbe5
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 13 deletions.
4 changes: 2 additions & 2 deletions dist/engrid.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
*
* ENGRID PAGE TEMPLATE ASSETS
*
* Date: Saturday, December 21, 2024 @ 02:58:47 ET
* Date: Tuesday, January 7, 2025 @ 16:38:12 ET
* By: fernando
* ENGrid styles: v0.20.0
* ENGrid scripts: v0.20.3
* ENGrid scripts: v0.20.4
*
* Created by 4Site Studios
* Come work with us or join our team, we would love to hear from you
Expand Down
41 changes: 38 additions & 3 deletions dist/engrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
*
* ENGRID PAGE TEMPLATE ASSETS
*
* Date: Saturday, December 21, 2024 @ 02:58:47 ET
* Date: Tuesday, January 7, 2025 @ 16:38:12 ET
* By: fernando
* ENGrid styles: v0.20.0
* ENGrid scripts: v0.20.3
* ENGrid scripts: v0.20.4
*
* Created by 4Site Studios
* Come work with us or join our team, we would love to hear from you
Expand Down Expand Up @@ -12932,7 +12932,9 @@ class Advocacy {

class DataAttributes {
constructor() {
this.logger = new EngridLogger("Data Attribute Changed", "#FFFFFF", "#4d9068", "🛠️");
this._country = Country.getInstance();
this._frequency = DonationFrequency.getInstance();
this.setDataAttributes();
}
setDataAttributes() {
Expand Down Expand Up @@ -13065,6 +13067,7 @@ class DataAttributes {
}
if (engrid_ENGrid.getPageType() === "DONATION") {
this.addFrequencyDataAttribute();
this.addGiftAmountDataAttribute();
}
}
// Add a data attribute to the body tag with how many visible frequency options there are
Expand All @@ -13078,6 +13081,38 @@ class DataAttributes {
});
engrid_ENGrid.setBodyData("visible-frequency", visibleFrequencyOptions.toString());
}
// Add a data attribute to the body tag with how many visible gift amount options there are
addGiftAmountDataAttribute() {
const updateGiftAmountData = () => {
const giftAmountOptions = document.querySelectorAll(".en__field--donationAmt .en__field__element .en__field__item");
let visibleGiftAmountOptions = 0;
giftAmountOptions.forEach((option) => {
if (engrid_ENGrid.isVisible(option)) {
visibleGiftAmountOptions++;
}
});
engrid_ENGrid.setBodyData("visible-gift-amount", visibleGiftAmountOptions.toString());
this.logger.log("Visible Gift Amount Changed to: " + visibleGiftAmountOptions.toString());
};
// Initial update
updateGiftAmountData();
// Observe changes in the donation amount section
const observer = new MutationObserver(updateGiftAmountData);
const targetNode = document.querySelector(".en__field--donationAmt");
if (targetNode) {
observer.observe(targetNode, {
childList: true,
subtree: true,
attributes: true,
});
}
// Run update updateGiftAmountData when frequency changes
this._frequency.onFrequencyChange.subscribe(() => {
setTimeout(() => {
updateGiftAmountData();
}, 10);
});
}
}

;// CONCATENATED MODULE: ./node_modules/@4site/engrid-scripts/dist/iframe.js
Expand Down Expand Up @@ -22045,7 +22080,7 @@ class OptInLadder {
}

;// CONCATENATED MODULE: ./node_modules/@4site/engrid-scripts/dist/version.js
const AppVersion = "0.20.3";
const AppVersion = "0.20.4";

;// CONCATENATED MODULE: ./node_modules/@4site/engrid-scripts/dist/index.js
// Runs first so it can change the DOM markup before any markup dependent code fires
Expand Down
4 changes: 2 additions & 2 deletions dist/engrid.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/engrid.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 346bbe5

Please sign in to comment.