@4site/engrid-scripts 0.24.2 → 0.24.4

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.
@@ -52,6 +52,7 @@ export interface Options {
52
52
  };
53
53
  TidyContact?: false | {
54
54
  cid?: string;
55
+ page_types?: ("DONATION" | "ECARD" | "SURVEY" | "EMAILTOTARGET" | "ADVOCACY" | "SUBSCRIBEFORM" | "EVENT" | "SUPPORTERHUB" | "UNSUBSCRIBE" | "TWEETPAGE" | "UNKNOWN")[];
55
56
  record_field?: string;
56
57
  date_field?: string;
57
58
  status_field?: string;
@@ -148,6 +149,7 @@ export interface Options {
148
149
  editText: string;
149
150
  anchor: string;
150
151
  placement: "beforebegin" | "afterbegin" | "beforeend" | "afterend";
152
+ showPhoneNumber?: boolean;
151
153
  };
152
154
  };
153
155
  OptInLadder?: false | {
@@ -11,6 +11,7 @@ export declare class TidyContact {
11
11
  private countries_dropdown;
12
12
  private country_ip;
13
13
  constructor();
14
+ private shouldRun;
14
15
  private loadOptions;
15
16
  private createFields;
16
17
  private createPhoneFields;
@@ -268,6 +268,10 @@ export class TidyContact {
268
268
  this.options = ENGrid.getOption("TidyContact");
269
269
  if (this.options === false || !((_a = this.options) === null || _a === void 0 ? void 0 : _a.cid))
270
270
  return;
271
+ if (!this.shouldRun()) {
272
+ this.logger.log("TidyContact is disabled on this page type");
273
+ return;
274
+ }
271
275
  this.loadOptions();
272
276
  if (!this.hasAddressFields() && !this.phoneEnabled()) {
273
277
  this.logger.log("No address fields found");
@@ -298,6 +302,14 @@ export class TidyContact {
298
302
  }
299
303
  }
300
304
  }
305
+ shouldRun() {
306
+ if (this.options &&
307
+ this.options.page_types &&
308
+ this.options.page_types.length > 0) {
309
+ return this.options.page_types.includes(ENGrid.getPageType());
310
+ }
311
+ return true;
312
+ }
301
313
  loadOptions() {
302
314
  var _a, _b, _c, _d;
303
315
  if (this.options) {
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AppVersion = "0.24.2";
1
+ export declare const AppVersion = "0.24.4";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const AppVersion = "0.24.2";
1
+ export const AppVersion = "0.24.4";
@@ -100,7 +100,7 @@ export class WelcomeBack {
100
100
  ${this.supporterDetails["firstName"]} ${this.supporterDetails["lastName"]}
101
101
  <br>
102
102
  ${this.supporterDetails["emailAddress"]}
103
- ${this.supporterDetails["mobilePhone"]
103
+ ${this.supporterDetails["mobilePhone"] && options.showPhoneNumber
104
104
  ? `<br>${this.supporterDetails["mobilePhone"]}`
105
105
  : ""}
106
106
  </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4site/engrid-scripts",
3
- "version": "0.24.2",
3
+ "version": "0.24.4",
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": "194597168e8ecb8a919e4b838cd8aaa71952575f",
28
+ "gitHead": "591c9c9c6ae91db22b43352e23f948310a22d120",
29
29
  "devDependencies": {
30
30
  "nodemon": "^2.0.20"
31
31
  }