@everymatrix/general-registration 1.87.25 → 1.87.26

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.
@@ -14212,6 +14212,7 @@ const GeneralRegistration = class {
14212
14212
  this.validationChange = index.createEvent(this, "validationChange", 7);
14213
14213
  this.isSelectingAddress = false;
14214
14214
  this.lastPostalCode = null;
14215
+ this.isRestoringAfterError = false;
14215
14216
  this.selectedCountry = '';
14216
14217
  this.listOfInputValues = [];
14217
14218
  this.listOfInputValidity = [];
@@ -14338,10 +14339,12 @@ const GeneralRegistration = class {
14338
14339
  if (value === 'GB') {
14339
14340
  this.selectedCountry = 'UK';
14340
14341
  }
14341
- this.resetAllAddressFields();
14342
- window.dispatchEvent(new CustomEvent('countryCodeUpdated', {
14343
- detail: { name, value: this.selectedCountry }
14344
- }));
14342
+ if (!this.isRestoringAfterError) {
14343
+ this.resetAllAddressFields();
14344
+ window.dispatchEvent(new CustomEvent('countryCodeUpdated', {
14345
+ detail: { name, value: this.selectedCountry }
14346
+ }));
14347
+ }
14345
14348
  }
14346
14349
  if (name === 'PostalCode') {
14347
14350
  if (!this.listOfInputs.some(i => i.name === 'CountryCode')) {
@@ -14411,6 +14414,10 @@ const GeneralRegistration = class {
14411
14414
  this.isSelectingAddress = false;
14412
14415
  }
14413
14416
  handleCountryCodeUpdateGlobal(event) {
14417
+ // Prevents clearing the fields when restoring after error
14418
+ if (this.isRestoringAfterError) {
14419
+ return;
14420
+ }
14414
14421
  const { name } = event.detail;
14415
14422
  if (name === 'CountryCode') {
14416
14423
  const savedState = localStorage.getItem('registrationStepsState');
@@ -14565,6 +14572,9 @@ const GeneralRegistration = class {
14565
14572
  }
14566
14573
  nextHandler(e) {
14567
14574
  e.preventDefault();
14575
+ // Set flag before emitting values to prevent countryCodeUpdated from clearing fields
14576
+ // This protects against clearing during both submission and error restoration
14577
+ this.isRestoringAfterError = true;
14568
14578
  // Trigger events in subwidgets.
14569
14579
  this.emitValue = true;
14570
14580
  this.errorMessage = '';
@@ -14865,6 +14875,7 @@ const GeneralRegistration = class {
14865
14875
  console.error(err);
14866
14876
  }).finally(() => {
14867
14877
  this.isLoadingPOST = false;
14878
+ this.isRestoringAfterError = false;
14868
14879
  });
14869
14880
  }
14870
14881
  setRegister() {
@@ -8,6 +8,7 @@ export class GeneralRegistration {
8
8
  constructor() {
9
9
  this.isSelectingAddress = false;
10
10
  this.lastPostalCode = null;
11
+ this.isRestoringAfterError = false;
11
12
  this.selectedCountry = '';
12
13
  this.listOfInputValues = [];
13
14
  this.listOfInputValidity = [];
@@ -134,10 +135,12 @@ export class GeneralRegistration {
134
135
  if (value === 'GB') {
135
136
  this.selectedCountry = 'UK';
136
137
  }
137
- this.resetAllAddressFields();
138
- window.dispatchEvent(new CustomEvent('countryCodeUpdated', {
139
- detail: { name, value: this.selectedCountry }
140
- }));
138
+ if (!this.isRestoringAfterError) {
139
+ this.resetAllAddressFields();
140
+ window.dispatchEvent(new CustomEvent('countryCodeUpdated', {
141
+ detail: { name, value: this.selectedCountry }
142
+ }));
143
+ }
141
144
  }
142
145
  if (name === 'PostalCode') {
143
146
  if (!this.listOfInputs.some(i => i.name === 'CountryCode')) {
@@ -207,6 +210,10 @@ export class GeneralRegistration {
207
210
  this.isSelectingAddress = false;
208
211
  }
209
212
  handleCountryCodeUpdateGlobal(event) {
213
+ // Prevents clearing the fields when restoring after error
214
+ if (this.isRestoringAfterError) {
215
+ return;
216
+ }
210
217
  const { name } = event.detail;
211
218
  if (name === 'CountryCode') {
212
219
  const savedState = localStorage.getItem('registrationStepsState');
@@ -361,6 +368,9 @@ export class GeneralRegistration {
361
368
  }
362
369
  nextHandler(e) {
363
370
  e.preventDefault();
371
+ // Set flag before emitting values to prevent countryCodeUpdated from clearing fields
372
+ // This protects against clearing during both submission and error restoration
373
+ this.isRestoringAfterError = true;
364
374
  // Trigger events in subwidgets.
365
375
  this.emitValue = true;
366
376
  this.errorMessage = '';
@@ -661,6 +671,7 @@ export class GeneralRegistration {
661
671
  console.error(err);
662
672
  }).finally(() => {
663
673
  this.isLoadingPOST = false;
674
+ this.isRestoringAfterError = false;
664
675
  });
665
676
  }
666
677
  setRegister() {
@@ -14208,6 +14208,7 @@ const GeneralRegistration = class {
14208
14208
  this.validationChange = createEvent(this, "validationChange", 7);
14209
14209
  this.isSelectingAddress = false;
14210
14210
  this.lastPostalCode = null;
14211
+ this.isRestoringAfterError = false;
14211
14212
  this.selectedCountry = '';
14212
14213
  this.listOfInputValues = [];
14213
14214
  this.listOfInputValidity = [];
@@ -14334,10 +14335,12 @@ const GeneralRegistration = class {
14334
14335
  if (value === 'GB') {
14335
14336
  this.selectedCountry = 'UK';
14336
14337
  }
14337
- this.resetAllAddressFields();
14338
- window.dispatchEvent(new CustomEvent('countryCodeUpdated', {
14339
- detail: { name, value: this.selectedCountry }
14340
- }));
14338
+ if (!this.isRestoringAfterError) {
14339
+ this.resetAllAddressFields();
14340
+ window.dispatchEvent(new CustomEvent('countryCodeUpdated', {
14341
+ detail: { name, value: this.selectedCountry }
14342
+ }));
14343
+ }
14341
14344
  }
14342
14345
  if (name === 'PostalCode') {
14343
14346
  if (!this.listOfInputs.some(i => i.name === 'CountryCode')) {
@@ -14407,6 +14410,10 @@ const GeneralRegistration = class {
14407
14410
  this.isSelectingAddress = false;
14408
14411
  }
14409
14412
  handleCountryCodeUpdateGlobal(event) {
14413
+ // Prevents clearing the fields when restoring after error
14414
+ if (this.isRestoringAfterError) {
14415
+ return;
14416
+ }
14410
14417
  const { name } = event.detail;
14411
14418
  if (name === 'CountryCode') {
14412
14419
  const savedState = localStorage.getItem('registrationStepsState');
@@ -14561,6 +14568,9 @@ const GeneralRegistration = class {
14561
14568
  }
14562
14569
  nextHandler(e) {
14563
14570
  e.preventDefault();
14571
+ // Set flag before emitting values to prevent countryCodeUpdated from clearing fields
14572
+ // This protects against clearing during both submission and error restoration
14573
+ this.isRestoringAfterError = true;
14564
14574
  // Trigger events in subwidgets.
14565
14575
  this.emitValue = true;
14566
14576
  this.errorMessage = '';
@@ -14861,6 +14871,7 @@ const GeneralRegistration = class {
14861
14871
  console.error(err);
14862
14872
  }).finally(() => {
14863
14873
  this.isLoadingPOST = false;
14874
+ this.isRestoringAfterError = false;
14864
14875
  });
14865
14876
  }
14866
14877
  setRegister() {