Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
- Tip: when debugging, `?debug=true` sets body `data-engrid-debug`, unlocking debug panels and conditional UI.

## When in Doubt
- Search in `packages/scripts/src` before creating new utilities; most EN behaviours already exist (currency, remember-me, plaid, vgs).
- Search in `packages/scripts/src` before creating new utilities; most EN behaviours already exist (currency, remember-me, stripe financial connections, vgs).
- Do not hand-edit files under any `dist/` directory—run the relevant build instead.
- Follow repo Prettier config (`.prettierrc.js`); formatting is enforced even though there are no automated tests.
- Document new options by updating the interfaces in `packages/scripts/src/interfaces` and exposing them through `OptionsDefaults`.
- Document new options by updating the interfaces in `packages/scripts/src/interfaces` and exposing them through `OptionsDefaults`.
6 changes: 2 additions & 4 deletions packages/scripts/dist/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DonationAmount, DonationFrequency, EnForm, ProcessingFees, Country, } from "./events";
import { AmountLabel, Loader, ProgressBar, UpsellLightbox, ENGrid, OptionsDefaults, setRecurrFreq, PageBackground, MediaAttribution, ApplePay, A11y, CapitalizeFields, Ecard, ClickToExpand, Advocacy, DataAttributes, LiveVariables, iFrame, InputPlaceholders, InputHasValueAndFocus, ShowHideRadioCheckboxes, AutoCountrySelect, SkipToMainContentLink, SrcDefer, NeverBounce, AutoYear, Autocomplete, RememberMe, TranslateFields, ShowIfAmount, EngridLogger, OtherAmount, MinMaxAmount, Ticker, DataReplace, DataHide, AddNameToMessage, ExpandRegionName, AppVersion, UrlToForm, RequiredIfVisible, TidyContact, DataLayer, LiveCurrency, Autosubmit, EventTickets, SwapAmounts, DebugPanel, DebugHiddenFields, FreshAddress, BrandingHtml, CountryDisable, PremiumGift, DigitalWallets, MobileCTA, LiveFrequency, UniversalOptIn, Plaid, GiveBySelect, UrlParamsToBodyAttrs, ExitIntentLightbox, SupporterHub, FastFormFill, SetAttr, ShowIfPresent, ENValidators, CustomCurrency, VGS, PostalCodeValidator, CountryRedirect, WelcomeBack, EcardToTarget, UsOnlyForm, ThankYouPageConditionalContent, EmbeddedEcard, CheckboxLabel, UpsellCheckbox, PostDonationEmbed, FrequencyUpsell, CustomPremium, PreferredPaymentMethod, } from ".";
import { AmountLabel, Loader, ProgressBar, UpsellLightbox, ENGrid, OptionsDefaults, setRecurrFreq, PageBackground, MediaAttribution, ApplePay, A11y, CapitalizeFields, Ecard, ClickToExpand, Advocacy, DataAttributes, LiveVariables, iFrame, InputPlaceholders, InputHasValueAndFocus, ShowHideRadioCheckboxes, AutoCountrySelect, SkipToMainContentLink, SrcDefer, NeverBounce, AutoYear, Autocomplete, RememberMe, TranslateFields, ShowIfAmount, EngridLogger, OtherAmount, MinMaxAmount, Ticker, DataReplace, DataHide, AddNameToMessage, ExpandRegionName, AppVersion, UrlToForm, RequiredIfVisible, TidyContact, DataLayer, LiveCurrency, Autosubmit, EventTickets, SwapAmounts, DebugPanel, DebugHiddenFields, FreshAddress, BrandingHtml, CountryDisable, PremiumGift, DigitalWallets, MobileCTA, LiveFrequency, UniversalOptIn, StripeFinancialConnections, GiveBySelect, UrlParamsToBodyAttrs, ExitIntentLightbox, SupporterHub, FastFormFill, SetAttr, ShowIfPresent, ENValidators, CustomCurrency, VGS, PostalCodeValidator, CountryRedirect, WelcomeBack, EcardToTarget, UsOnlyForm, ThankYouPageConditionalContent, EmbeddedEcard, CheckboxLabel, UpsellCheckbox, PostDonationEmbed, FrequencyUpsell, CustomPremium, PreferredPaymentMethod, } from ".";
export class App extends ENGrid {
constructor(options) {
super();
Expand Down Expand Up @@ -262,9 +262,7 @@ export class App extends ENGrid {
new LiveFrequency();
// Universal Opt In
new UniversalOptIn();
// Plaid
if (this.options.Plaid)
new Plaid();
new StripeFinancialConnections();
//Exit Intent Lightbox
new ExitIntentLightbox();
new UrlParamsToBodyAttrs();
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export * from "./digital-wallets";
export * from "./mobile-cta";
export * from "./live-frequency";
export * from "./universal-opt-in";
export * from "./plaid";
export * from "./stripe-financial-connections";
export * from "./give-by-select";
export * from "./url-params-to-body-attrs";
export * from "./exit-intent-lightbox";
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export * from "./digital-wallets";
export * from "./mobile-cta";
export * from "./live-frequency";
export * from "./universal-opt-in";
export * from "./plaid";
export * from "./stripe-financial-connections";
export * from "./give-by-select";
export * from "./url-params-to-body-attrs";
export * from "./exit-intent-lightbox";
Expand Down
1 change: 0 additions & 1 deletion packages/scripts/dist/interfaces/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export interface Options {
}[];
PageLayouts?: string[];
CountryDisable?: string[];
Plaid?: boolean;
Placeholders?: false | {
[key: string]: string;
};
Expand Down
1 change: 0 additions & 1 deletion packages/scripts/dist/interfaces/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const OptionsDefaults = {
TidyContact: false,
RegionLongFormat: "",
CountryDisable: [],
Plaid: false,
Placeholders: false,
ENValidators: false,
MobileCTA: false,
Expand Down
14 changes: 14 additions & 0 deletions packages/scripts/dist/stripe-financial-connections.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* This component improves EN's implementation of Stripe Financial Connections.
* Enhancements:
* - When the modal is closed, it re-enables the submit button.
*/
export declare class StripeFinancialConnections {
private stripeModalOpen;
private logger;
constructor();
isStripeModalNode(node: Node): boolean;
isStripeModalNodeWIthIframe(node: Node): boolean;
onStripeModalOpen(): void;
onStripeModalClose(): void;
}
48 changes: 48 additions & 0 deletions packages/scripts/dist/stripe-financial-connections.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* This component improves EN's implementation of Stripe Financial Connections.
* Enhancements:
* - When the modal is closed, it re-enables the submit button.
*/
import { ENGrid, EngridLogger } from ".";
export class StripeFinancialConnections {
constructor() {
this.stripeModalOpen = false;
this.logger = new EngridLogger("Stripe Financial Connections", "black", "pink", "🏛️");
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
if (!this.stripeModalOpen && this.isStripeModalNodeWIthIframe(node)) {
this.logger.log("Stripe Financial Connections modal opened.");
this.onStripeModalOpen();
}
});
mutation.removedNodes.forEach((node) => {
if (this.stripeModalOpen && this.isStripeModalNode(node)) {
this.logger.log("Stripe Financial Connections modal closed.");
this.onStripeModalClose();
}
});
});
});
observer.observe(document.body, {
childList: true,
subtree: true,
});
}
isStripeModalNode(node) {
return (node instanceof HTMLElement &&
node.hasAttribute("data-react-aria-top-layer"));
}
isStripeModalNodeWIthIframe(node) {
return !!(this.isStripeModalNode(node) &&
node instanceof HTMLElement &&
node.querySelector('iframe[src*="js.stripe.com"]'));
}
onStripeModalOpen() {
this.stripeModalOpen = true;
}
onStripeModalClose() {
this.stripeModalOpen = false;
ENGrid.enableSubmit();
}
}
2 changes: 1 addition & 1 deletion packages/scripts/dist/supporter-hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class SupporterHub {
}
});
});
// Start observing the Link ID #plaid-link-button
// Start observing the Link ID
observer.observe(form, {
childList: true,
subtree: true,
Expand Down
5 changes: 2 additions & 3 deletions packages/scripts/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import {
MobileCTA,
LiveFrequency,
UniversalOptIn,
Plaid,
StripeFinancialConnections,
GiveBySelect,
UrlParamsToBodyAttrs,
ExitIntentLightbox,
Expand Down Expand Up @@ -433,8 +433,7 @@ export class App extends ENGrid {
// Universal Opt In
new UniversalOptIn();

// Plaid
if (this.options.Plaid) new Plaid();
new StripeFinancialConnections();

//Exit Intent Lightbox
new ExitIntentLightbox();
Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export * from "./digital-wallets";
export * from "./mobile-cta";
export * from "./live-frequency";
export * from "./universal-opt-in";
export * from "./plaid";
export * from "./stripe-financial-connections";
export * from "./give-by-select";
export * from "./url-params-to-body-attrs";
export * from "./exit-intent-lightbox";
Expand Down
10 changes: 5 additions & 5 deletions packages/scripts/src/interfaces/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export interface Options {
MobileCTA?: false | { pageType: string; label: string }[];
PageLayouts?: string[];
CountryDisable?: string[];
Plaid?: boolean;
Placeholders?: false | { [key: string]: string };
ENValidators?: boolean;
// CustomCurrency is either false or an object with the following properties:
Expand All @@ -112,9 +111,11 @@ export interface Options {
};
ariaLabel?: string;
placeholder?: string;
validCardBrands?: {
type: string;
}[] | null;
validCardBrands?:
| {
type: string;
}[]
| null;
};
"transaction.ccvv"?: {
showCardIcon?: boolean | object;
Expand Down Expand Up @@ -219,7 +220,6 @@ export const OptionsDefaults: Options = {
TidyContact: false,
RegionLongFormat: "",
CountryDisable: [],
Plaid: false,
Placeholders: false,
ENValidators: false,
MobileCTA: false,
Expand Down
57 changes: 0 additions & 57 deletions packages/scripts/src/plaid.ts

This file was deleted.

66 changes: 66 additions & 0 deletions packages/scripts/src/stripe-financial-connections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* This component improves EN's implementation of Stripe Financial Connections.
* Enhancements:
* - When the modal is closed, it re-enables the submit button.
*/

import { ENGrid, EngridLogger } from ".";

export class StripeFinancialConnections {
private stripeModalOpen: boolean = false;
private logger: EngridLogger = new EngridLogger(
"Stripe Financial Connections",
"black",
"pink",
"🏛️"
);

constructor() {
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
if (!this.stripeModalOpen && this.isStripeModalNodeWIthIframe(node)) {
this.logger.log("Stripe Financial Connections modal opened.");
this.onStripeModalOpen();
}
});

mutation.removedNodes.forEach((node) => {
if (this.stripeModalOpen && this.isStripeModalNode(node)) {
this.logger.log("Stripe Financial Connections modal closed.");
this.onStripeModalClose();
}
});
});
});

observer.observe(document.body, {
childList: true,
subtree: true,
});
}

isStripeModalNode(node: Node): boolean {
return (
node instanceof HTMLElement &&
node.hasAttribute("data-react-aria-top-layer")
);
}

isStripeModalNodeWIthIframe(node: Node): boolean {
return !!(
this.isStripeModalNode(node) &&
node instanceof HTMLElement &&
node.querySelector('iframe[src*="js.stripe.com"]')
);
}

onStripeModalOpen() {
this.stripeModalOpen = true;
}

onStripeModalClose() {
this.stripeModalOpen = false;
ENGrid.enableSubmit();
}
}
2 changes: 1 addition & 1 deletion packages/scripts/src/supporter-hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class SupporterHub {
}
});
});
// Start observing the Link ID #plaid-link-button
// Start observing the Link ID
observer.observe(form, {
childList: true,
subtree: true,
Expand Down
12 changes: 2 additions & 10 deletions packages/styles/dist/main.css

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

2 changes: 1 addition & 1 deletion packages/styles/dist/main.css.map

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions packages/styles/src/_engrid-components-layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@
.i8-hide .en__field:nth-of-type(8),
.i9-hide .en__field:nth-of-type(9),
.i10-hide .en__field:nth-of-type(10),
.i11-hide .en__field:nth-of-type(11),
.en__field--plaid {
.i11-hide .en__field:nth-of-type(11) {
background-color: #ff00001a !important;
}

Expand Down Expand Up @@ -200,8 +199,7 @@ body:not(#en__pagebuilder):not([data-engrid-debug]) {
.i8-hide .en__field:not(.en__field--validationFailed):nth-of-type(8),
.i9-hide .en__field:not(.en__field--validationFailed):nth-of-type(9),
.i10-hide .en__field:not(.en__field--validationFailed):nth-of-type(10),
.i11-hide .en__field:not(.en__field--validationFailed):nth-of-type(11),
.en__field--plaid{
.i11-hide .en__field:not(.en__field--validationFailed):nth-of-type(11) {
display: none;
}

Expand Down
Loading
Loading