@4site/engrid-scripts 0.22.0 → 0.22.1

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.22.0";
1
+ export declare const AppVersion = "0.22.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const AppVersion = "0.22.0";
1
+ export const AppVersion = "0.22.1";
@@ -12,4 +12,5 @@ export declare class WelcomeBack {
12
12
  private addPersonalDetailsSummary;
13
13
  private addEventListeners;
14
14
  enOnValidate(): void;
15
+ doubleCheckValidation(): void;
15
16
  }
@@ -129,10 +129,16 @@ export class WelcomeBack {
129
129
  });
130
130
  });
131
131
  this._form.onValidate.subscribe(this.enOnValidate.bind(this));
132
+ this._form.onValidate.subscribe(() => {
133
+ window.setTimeout(this.doubleCheckValidation.bind(this), 150);
134
+ });
132
135
  }
133
136
  enOnValidate() {
134
- if (!this._form.validate)
137
+ if (!this._form.validate) {
138
+ // Disable the fast personal details if the form is invalidated by other components running before
139
+ ENGrid.setBodyData("hide-fast-personal-details", false);
135
140
  return;
141
+ }
136
142
  const regionFieldValue = ENGrid.getFieldValue("supporter.region");
137
143
  const regionFieldLabel = document.querySelector(".en__field--region label");
138
144
  if (regionFieldLabel && regionFieldValue === "") {
@@ -141,4 +147,17 @@ export class WelcomeBack {
141
147
  this._form.validate = false;
142
148
  }
143
149
  }
150
+ doubleCheckValidation() {
151
+ // Disable the fast personal details if the form is invalidated by other components running AFTER
152
+ // the fast personal details component
153
+ const validationError = document.querySelector(".fast-personal-details .en__field--validationFailed");
154
+ if (validationError) {
155
+ ENGrid.setBodyData("hide-fast-personal-details", false);
156
+ validationError.scrollIntoView({
157
+ behavior: "smooth",
158
+ block: "center",
159
+ });
160
+ }
161
+ return;
162
+ }
144
163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4site/engrid-scripts",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
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": "e5d7823be14fd1c1116bd43d80be85da4c1e69fd",
28
+ "gitHead": "831fa83063d0b6b961ae9ebae68e5f31c15be7b9",
29
29
  "devDependencies": {
30
30
  "nodemon": "^2.0.20"
31
31
  }