@4site/engrid-scripts 0.24.3 → 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;
@@ -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.3";
1
+ export declare const AppVersion = "0.24.4";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const AppVersion = "0.24.3";
1
+ export const AppVersion = "0.24.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4site/engrid-scripts",
3
- "version": "0.24.3",
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": "6f807e8e6ad0b1fcf0b6d3f72de44cc93cdd2fe1",
28
+ "gitHead": "591c9c9c6ae91db22b43352e23f948310a22d120",
29
29
  "devDependencies": {
30
30
  "nodemon": "^2.0.20"
31
31
  }