@4site/engrid-scripts 0.27.4 → 0.27.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/engrid.d.ts CHANGED
@@ -26,7 +26,7 @@ export declare abstract class ENGrid {
26
26
  */
27
27
  static getPageIdFromUrl(url: string): number;
28
28
  static getClientID(): any;
29
- static getDataCenter(): "us" | "ca";
29
+ static getDataCenter(): "us2" | "us" | "ca";
30
30
  static getPageType(): "DONATION" | "ECARD" | "SURVEY" | "EMAILTOTARGET" | "ADVOCACY" | "SUBSCRIBEFORM" | "EVENT" | "SUPPORTERHUB" | "UNSUBSCRIBE" | "TWEETPAGE" | "UNKNOWN";
31
31
  static setBodyData(dataName: string, value: string | boolean): void;
32
32
  static getBodyData(dataName: string): string | null;
package/dist/engrid.js CHANGED
@@ -205,7 +205,15 @@ export class ENGrid {
205
205
  }
206
206
  //returns 'us or 'ca' based on the client ID
207
207
  static getDataCenter() {
208
- return ENGrid.getClientID() >= 10000 ? "us" : "ca";
208
+ if (ENGrid.getClientID() > 20000) {
209
+ return "us2";
210
+ }
211
+ else if (ENGrid.getClientID() > 10000) {
212
+ return "us";
213
+ }
214
+ else {
215
+ return "ca";
216
+ }
209
217
  }
210
218
  // Return the current page type
211
219
  static getPageType() {
@@ -52,6 +52,7 @@ export interface Options {
52
52
  fieldClearSelectorTarget?: string;
53
53
  fieldClearSelectorTargetLocation?: string;
54
54
  fieldClearLabel?: string;
55
+ rememberMeLabel?: string;
55
56
  checked?: boolean;
56
57
  encryptData?: boolean;
57
58
  hide?: boolean;
@@ -22,6 +22,7 @@ export declare class RememberMe {
22
22
  private fieldClearSelectorTarget;
23
23
  private fieldClearSelectorTargetLocation;
24
24
  private fieldClearLabel;
25
+ private rememberMeLabel;
25
26
  constructor(options: {
26
27
  remoteUrl?: string;
27
28
  cookieName?: string;
@@ -37,6 +38,7 @@ export declare class RememberMe {
37
38
  fieldClearSelectorTarget?: string;
38
39
  fieldClearSelectorTargetLocation?: string;
39
40
  fieldClearLabel?: string;
41
+ rememberMeLabel?: string;
40
42
  checked?: boolean;
41
43
  encryptData?: boolean;
42
44
  hide?: boolean;
@@ -65,6 +65,9 @@ export class RememberMe {
65
65
  this.fieldClearLabel = options.fieldClearLabel
66
66
  ? options.fieldClearLabel
67
67
  : "(clear autofill)";
68
+ this.rememberMeLabel = options.rememberMeLabel
69
+ ? options.rememberMeLabel
70
+ : "Remember Me";
68
71
  this.fieldData = {};
69
72
  if (this.useRemote()) {
70
73
  this.createIframe(() => {
@@ -228,11 +231,11 @@ export class RememberMe {
228
231
  insertRememberMeOptin() {
229
232
  let rememberMeOptInField = document.getElementById("remember-me-opt-in");
230
233
  if (!rememberMeOptInField) {
231
- const rememberMeLabel = "Remember Me";
234
+ const rememberMeLabel = this.rememberMeLabel;
232
235
  const rememberMeInfo = `
233
- Check “Remember me” to complete forms on this device faster.
236
+ Check “${rememberMeLabel}” to complete forms on this device faster.
234
237
  While your financial information won’t be stored, you should only check this box from a personal device.
235
- Click “Clear autofill” to remove the information from your device at any time.
238
+ Click “${this.fieldClearLabel}” to remove the information from your device at any time.
236
239
  `;
237
240
  const rememberMeOptInFieldChecked = this.rememberMeOptIn ? "checked" : "";
238
241
  const rememberMeOptInField = document.createElement("div");
@@ -47,8 +47,17 @@ export class SwapAmounts {
47
47
  this.hasRecurringNSG = !!(window.EngagingNetworks.suggestedGift &&
48
48
  window.EngagingNetworks.suggestedGift.recurring &&
49
49
  window.EngagingNetworks.suggestedGift.recurring.length > 0);
50
+ if (this.hasOneTimeNSG) {
51
+ ENGrid.setBodyData("en-nsg-onetime", true);
52
+ }
53
+ if (this.hasRecurringNSG) {
54
+ ENGrid.setBodyData("en-nsg-recurring", true);
55
+ }
50
56
  if (this.hasOneTimeNSG || this.hasRecurringNSG) {
51
- this.logger.log("Detected NSG amounts", { suggestedGift: window.EngagingNetworks.suggestedGift });
57
+ ENGrid.setBodyData("en-nsg", true);
58
+ this.logger.log("Detected NSG amounts", {
59
+ suggestedGift: window.EngagingNetworks.suggestedGift,
60
+ });
52
61
  }
53
62
  if (!this.shouldRun())
54
63
  return;
@@ -110,7 +119,9 @@ export class SwapAmounts {
110
119
  if (!config)
111
120
  return;
112
121
  if (this.shouldUseNSG(freq, config)) {
113
- this.logger.log(`NSG present for ${freq}, using NSG amounts`, { suggestedGift: window.EngagingNetworks.suggestedGift });
122
+ this.logger.log(`NSG present for ${freq}, using NSG amounts`, {
123
+ suggestedGift: window.EngagingNetworks.suggestedGift,
124
+ });
114
125
  window.EngagingNetworks.require._defined.enjs.swapList("donationAmt", this.toEnAmountListNSG(window.EngagingNetworks.suggestedGift, freq), { ignoreCurrentValue: true });
115
126
  this._amount.load();
116
127
  this.swapped = true;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AppVersion = "0.27.4";
1
+ export declare const AppVersion = "0.27.6";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const AppVersion = "0.27.4";
1
+ export const AppVersion = "0.27.6";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4site/engrid-scripts",
3
- "version": "0.27.4",
3
+ "version": "0.27.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": "e01ad2b4ea0b53edda39388f6597976e33e5f129",
28
+ "gitHead": "84b8bf12eb84acac7332a55098a2786815912f84",
29
29
  "devDependencies": {
30
30
  "nodemon": "^2.0.20"
31
31
  }