Skip to content

Commit 238c51d

Browse files
committed
Dont run auto country select if fastform conditions have been met
1 parent 591c9c9 commit 238c51d

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

packages/scripts/dist/auto-country-select.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ export class AutoCountrySelect {
1616
ENGrid.getUrlParameter("supporter.region") ||
1717
(ENGrid.getUrlParameter("ea.url.id") &&
1818
!ENGrid.getUrlParameter("forwarded"));
19+
// If fast form is active, then personal details have already been filled somehow and we should not override the country selection
20+
// The client is also likely using WelcomeBack.
21+
const fastFormActive = ENGrid.getBodyData("hide-fast-address-details") ||
22+
ENGrid.getBodyData("hide-fast-personal-details");
1923
if (!engridAutofill &&
2024
!submissionFailed &&
2125
hasIntlSupport &&
22-
!locationDataInUrl) {
26+
!locationDataInUrl &&
27+
!fastFormActive) {
2328
fetch(`https://${window.location.hostname}/cdn-cgi/trace`)
2429
.then((res) => res.text())
2530
.then((t) => {

packages/scripts/src/auto-country-select.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@ export class AutoCountrySelect {
3030
(ENGrid.getUrlParameter("ea.url.id") &&
3131
!ENGrid.getUrlParameter("forwarded"));
3232

33+
// If fast form is active, then personal details have already been filled somehow and we should not override the country selection
34+
// The client is also likely using WelcomeBack.
35+
const fastFormActive =
36+
ENGrid.getBodyData("hide-fast-address-details") ||
37+
ENGrid.getBodyData("hide-fast-personal-details");
38+
3339
if (
3440
!engridAutofill &&
3541
!submissionFailed &&
3642
hasIntlSupport &&
37-
!locationDataInUrl
43+
!locationDataInUrl &&
44+
!fastFormActive
3845
) {
3946
fetch(`https://${window.location.hostname}/cdn-cgi/trace`)
4047
.then((res) => res.text())

0 commit comments

Comments
 (0)