@4site/engrid-scripts 0.19.5 → 0.19.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DonationAmount, DonationFrequency, EnForm, ProcessingFees, Country, } from "./events";
2
- 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, } from ".";
2
+ 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, } from ".";
3
3
  export class App extends ENGrid {
4
4
  constructor(options) {
5
5
  super();
@@ -272,6 +272,7 @@ export class App extends ENGrid {
272
272
  new UsOnlyForm();
273
273
  new ThankYouPageConditionalContent();
274
274
  new EmbeddedEcard();
275
+ new CheckboxLabel();
275
276
  //Debug panel
276
277
  let showDebugPanel = this.options.Debug;
277
278
  try {
@@ -0,0 +1,7 @@
1
+ export declare class CheckboxLabel {
2
+ private logger;
3
+ private checkBoxesLabels;
4
+ constructor();
5
+ shoudRun(): boolean;
6
+ run(): void;
7
+ }
@@ -0,0 +1,30 @@
1
+ // Component to allow the user to set custom labels for the checkboxes,
2
+ // you can customize the checkbox label on a per-page basis, which is not possible with Engaging Networks
3
+ // The .checkbox-label element should be placed right before the checkbox form block
4
+ import { EngridLogger } from ".";
5
+ export class CheckboxLabel {
6
+ constructor() {
7
+ this.logger = new EngridLogger("CheckboxLabel", "#00CC95", "#2C3E50", "✅");
8
+ this.checkBoxesLabels = document.querySelectorAll(".checkbox-label");
9
+ if (!this.shoudRun())
10
+ return;
11
+ this.logger.log(`Found ${this.checkBoxesLabels.length} custom labels`);
12
+ this.run();
13
+ }
14
+ shoudRun() {
15
+ return this.checkBoxesLabels.length > 0;
16
+ }
17
+ run() {
18
+ this.checkBoxesLabels.forEach((checkboxLabel) => {
19
+ var _a;
20
+ const labelText = (_a = checkboxLabel.textContent) === null || _a === void 0 ? void 0 : _a.trim();
21
+ const checkboxContainer = checkboxLabel.nextElementSibling;
22
+ const checkboxLabelElement = checkboxContainer.querySelector("label");
23
+ if (!checkboxLabelElement || !labelText)
24
+ return;
25
+ checkboxLabelElement.textContent = labelText;
26
+ checkboxLabel.remove();
27
+ this.logger.log(`Set checkbox label to "${labelText}"`);
28
+ });
29
+ }
30
+ }
package/dist/index.d.ts CHANGED
@@ -78,5 +78,6 @@ export * from "./ecard-to-target";
78
78
  export * from "./embedded-ecard";
79
79
  export * from "./us-only-form";
80
80
  export * from "./thank-you-page-conditional-content";
81
+ export * from "./checkbox-label";
81
82
  export * from "./events";
82
83
  export * from "./version";
package/dist/index.js CHANGED
@@ -78,6 +78,7 @@ export * from "./ecard-to-target";
78
78
  export * from "./embedded-ecard";
79
79
  export * from "./us-only-form";
80
80
  export * from "./thank-you-page-conditional-content";
81
+ export * from "./checkbox-label";
81
82
  // Events
82
83
  export * from "./events";
83
84
  // Version
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AppVersion = "0.19.5";
1
+ export declare const AppVersion = "0.19.6";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const AppVersion = "0.19.5";
1
+ export const AppVersion = "0.19.6";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4site/engrid-scripts",
3
- "version": "0.19.5",
3
+ "version": "0.19.6",
4
4
  "description": "Scripts for the ENGRID Project",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "strongly-typed-events": "^2.0.9"
26
26
  },
27
27
  "homepage": "https://github.com/4site-interactive-studios/engrid#readme",
28
- "gitHead": "b0e2cba40e66bb5f6fc2867c5baf344d7ce58201",
28
+ "gitHead": "6a545c3e4cf2fa7deb810b34b5c082c6864b5f95",
29
29
  "devDependencies": {
30
30
  "nodemon": "^2.0.20"
31
31
  }