@4site/engrid-scripts 0.19.11 → 0.19.12

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/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AppVersion = "0.19.11";
1
+ export declare const AppVersion = "0.19.12";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const AppVersion = "0.19.11";
1
+ export const AppVersion = "0.19.12";
@@ -1,7 +1,9 @@
1
1
  export declare class WelcomeBack {
2
2
  private supporterDetails;
3
3
  private options;
4
+ private rememberMeEvents;
4
5
  constructor();
6
+ private run;
5
7
  private shouldRun;
6
8
  private addWelcomeBack;
7
9
  private resetWelcomeBack;
@@ -7,30 +7,44 @@
7
7
  *
8
8
  * All the text content and positioning is configurable through the "WelcomeBack" option.
9
9
  */
10
- import { ENGrid } from ".";
10
+ import { ENGrid, RememberMeEvents } from ".";
11
11
  import * as cookie from "./cookie";
12
12
  export class WelcomeBack {
13
13
  constructor() {
14
14
  var _a;
15
15
  this.supporterDetails = {};
16
16
  this.options = (_a = ENGrid.getOption("WelcomeBack")) !== null && _a !== void 0 ? _a : false;
17
- if (this.shouldRun()) {
18
- this.supporterDetails = {
19
- firstName: ENGrid.getFieldValue("supporter.firstName"),
20
- lastName: ENGrid.getFieldValue("supporter.lastName"),
21
- emailAddress: ENGrid.getFieldValue("supporter.emailAddress"),
22
- address1: ENGrid.getFieldValue("supporter.address1"),
23
- address2: ENGrid.getFieldValue("supporter.address2"),
24
- city: ENGrid.getFieldValue("supporter.city"),
25
- region: ENGrid.getFieldValue("supporter.region"),
26
- postcode: ENGrid.getFieldValue("supporter.postcode"),
27
- country: ENGrid.getFieldValue("supporter.country"),
28
- };
29
- this.addWelcomeBack();
30
- this.addPersonalDetailsSummary();
31
- this.addEventListeners();
17
+ this.rememberMeEvents = RememberMeEvents.getInstance();
18
+ if (!this.shouldRun())
19
+ return;
20
+ if (ENGrid.getOption("RememberMe")) {
21
+ this.rememberMeEvents.onLoad.subscribe(() => {
22
+ this.run();
23
+ });
24
+ this.rememberMeEvents.onClear.subscribe(() => {
25
+ this.resetWelcomeBack();
26
+ });
27
+ }
28
+ else {
29
+ this.run();
32
30
  }
33
31
  }
32
+ run() {
33
+ this.supporterDetails = {
34
+ firstName: ENGrid.getFieldValue("supporter.firstName"),
35
+ lastName: ENGrid.getFieldValue("supporter.lastName"),
36
+ emailAddress: ENGrid.getFieldValue("supporter.emailAddress"),
37
+ address1: ENGrid.getFieldValue("supporter.address1"),
38
+ address2: ENGrid.getFieldValue("supporter.address2"),
39
+ city: ENGrid.getFieldValue("supporter.city"),
40
+ region: ENGrid.getFieldValue("supporter.region"),
41
+ postcode: ENGrid.getFieldValue("supporter.postcode"),
42
+ country: ENGrid.getFieldValue("supporter.country"),
43
+ };
44
+ this.addWelcomeBack();
45
+ this.addPersonalDetailsSummary();
46
+ this.addEventListeners();
47
+ }
34
48
  shouldRun() {
35
49
  return (!!document.querySelector(".fast-personal-details") &&
36
50
  this.options !== false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4site/engrid-scripts",
3
- "version": "0.19.11",
3
+ "version": "0.19.12",
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": "253c4fc83741ff28c179c03c9b6833a15ce6e14d",
28
+ "gitHead": "3797669bb45cad103c45ce0e0fe984e89f53bf43",
29
29
  "devDependencies": {
30
30
  "nodemon": "^2.0.20"
31
31
  }