@everymatrix/general-registration 1.87.24 → 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.
- package/dist/cjs/checkbox-group-input_15.cjs.entry.js +49 -16
- package/dist/collection/components/general-registration/general-registration.js +15 -4
- package/dist/esm/checkbox-group-input_15.entry.js +49 -16
- package/dist/general-registration/checkbox-group-input_15.entry.js +1 -1
- package/dist/types/components/general-registration/general-registration.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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.
|
|
14342
|
-
|
|
14343
|
-
|
|
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() {
|
|
@@ -16282,17 +16293,15 @@ const TelInput = class {
|
|
|
16282
16293
|
clearTimeout(this.debounceTime);
|
|
16283
16294
|
}
|
|
16284
16295
|
this.debounceTime = setTimeout(() => {
|
|
16285
|
-
this.isValid = this.
|
|
16296
|
+
this.isValid = this.isValidValue();
|
|
16286
16297
|
this.errorMessage = this.setErrorMessage();
|
|
16287
16298
|
this.emitValueHandler(true);
|
|
16288
16299
|
}, 500);
|
|
16289
16300
|
};
|
|
16290
16301
|
this.handleBlur = () => {
|
|
16291
|
-
|
|
16292
|
-
|
|
16293
|
-
|
|
16294
|
-
this.touched = true;
|
|
16295
|
-
}
|
|
16302
|
+
this.touched = true;
|
|
16303
|
+
this.isValid = this.isValidValue();
|
|
16304
|
+
this.errorMessage = this.setErrorMessage();
|
|
16296
16305
|
};
|
|
16297
16306
|
this.setClientStyling = () => {
|
|
16298
16307
|
let sheet = document.createElement('style');
|
|
@@ -16388,7 +16397,7 @@ const TelInput = class {
|
|
|
16388
16397
|
// end custom styling area
|
|
16389
16398
|
}
|
|
16390
16399
|
componentDidLoad() {
|
|
16391
|
-
this.isValid = this.
|
|
16400
|
+
this.isValid = this.isValidValue();
|
|
16392
16401
|
if (this.defaultValue) {
|
|
16393
16402
|
this.value = this.defaultValue;
|
|
16394
16403
|
this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
|
|
@@ -16412,8 +16421,29 @@ const TelInput = class {
|
|
|
16412
16421
|
this.value = { prefix: this.prefixValue, phone: this.phoneValue };
|
|
16413
16422
|
this.emitValueHandler(true);
|
|
16414
16423
|
}
|
|
16415
|
-
|
|
16416
|
-
|
|
16424
|
+
isValidValue() {
|
|
16425
|
+
if (!this.inputReference) {
|
|
16426
|
+
return false;
|
|
16427
|
+
}
|
|
16428
|
+
if (this.validation.mandatory && (!this.phoneValue || this.phoneValue.trim() === '')) {
|
|
16429
|
+
return false;
|
|
16430
|
+
}
|
|
16431
|
+
if (!this.phoneValue || this.phoneValue.trim() === '') {
|
|
16432
|
+
return !this.validation.mandatory;
|
|
16433
|
+
}
|
|
16434
|
+
if (this.validation.minLength && this.phoneValue.length < this.validation.minLength) {
|
|
16435
|
+
return false;
|
|
16436
|
+
}
|
|
16437
|
+
if (this.validation.maxLength && this.phoneValue.length > this.validation.maxLength) {
|
|
16438
|
+
return false;
|
|
16439
|
+
}
|
|
16440
|
+
if (this.validationPattern) {
|
|
16441
|
+
const patternRegex = new RegExp(this.validationPattern);
|
|
16442
|
+
if (!patternRegex.test(this.phoneValue)) {
|
|
16443
|
+
return false;
|
|
16444
|
+
}
|
|
16445
|
+
}
|
|
16446
|
+
return true;
|
|
16417
16447
|
}
|
|
16418
16448
|
setPattern() {
|
|
16419
16449
|
var _a, _b;
|
|
@@ -16428,7 +16458,10 @@ const TelInput = class {
|
|
|
16428
16458
|
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
16429
16459
|
return translate$1(`${errorCode}`, this.language) ? translate$1(`${errorCode}`, this.language) : errorMessage;
|
|
16430
16460
|
}
|
|
16431
|
-
if (this.inputReference.validity.tooShort
|
|
16461
|
+
if (this.inputReference.validity.tooShort
|
|
16462
|
+
|| this.inputReference.validity.tooLong
|
|
16463
|
+
|| (this.validation.minLength && this.phoneValue && this.phoneValue.length < this.validation.minLength)
|
|
16464
|
+
|| (this.validation.maxLength && this.phoneValue && this.phoneValue.length > this.validation.maxLength)) {
|
|
16432
16465
|
return translate$1('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
16433
16466
|
}
|
|
16434
16467
|
if (this.inputReference.validity.valueMissing) {
|
|
@@ -16447,8 +16480,8 @@ const TelInput = class {
|
|
|
16447
16480
|
if (this.touched) {
|
|
16448
16481
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
16449
16482
|
}
|
|
16450
|
-
return index.h("div", { key: '
|
|
16451
|
-
index.h("img", { key: '
|
|
16483
|
+
return index.h("div", { key: 'f534de21d5597a3e90912eb87fff893511d09920', class: `tel__wrapper ${this.autofilled ? 'tel__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, index.h("div", { key: '431fb8cbaea0d2244847823ea4d04d8c73a5341c', class: 'tel__wrapper--flex-label' }, index.h("label", { key: '2eb210b2f0c2e0e632997f59fe7aa667578f72fd', class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("div", { key: '2d912b828f7d9475a1bbb5bac13495779f31198e', class: 'tel__wrapper--relative' }, this.tooltip &&
|
|
16484
|
+
index.h("img", { key: 'ce4433263d27dc9d3fb2caf45069d7a92e9ae3a7', class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), index.h("div", { key: '480cd17eafb4f2ff1e396531429177cb3130eb95', class: `tel__wrapper--flex ${invalidClass}` }, index.h("vaadin-combo-box", { key: '5f2292c8509e5f68786d0f462c689102b1c75dc3', class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.disablePhonePrefix, onChange: (e) => this.handlePrefixInput(e) }), index.h("input", { key: '77232e119eed4960f5e1d809507b8585dd112256', type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: (_a = this.phoneValue) !== null && _a !== void 0 ? _a : '', placeholder: `${this.placeholder}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onInput: this.handleInput, onBlur: this.handleBlur })), index.h("small", { key: '0d925cee41881c8c822073790e26ca7dc4a81049', class: 'tel__error-message' }, this.errorMessage));
|
|
16452
16485
|
}
|
|
16453
16486
|
static get watchers() { return {
|
|
16454
16487
|
"clientStyling": ["handleStylingChange"],
|
|
@@ -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.
|
|
138
|
-
|
|
139
|
-
|
|
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.
|
|
14338
|
-
|
|
14339
|
-
|
|
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() {
|
|
@@ -16278,17 +16289,15 @@ const TelInput = class {
|
|
|
16278
16289
|
clearTimeout(this.debounceTime);
|
|
16279
16290
|
}
|
|
16280
16291
|
this.debounceTime = setTimeout(() => {
|
|
16281
|
-
this.isValid = this.
|
|
16292
|
+
this.isValid = this.isValidValue();
|
|
16282
16293
|
this.errorMessage = this.setErrorMessage();
|
|
16283
16294
|
this.emitValueHandler(true);
|
|
16284
16295
|
}, 500);
|
|
16285
16296
|
};
|
|
16286
16297
|
this.handleBlur = () => {
|
|
16287
|
-
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
this.touched = true;
|
|
16291
|
-
}
|
|
16298
|
+
this.touched = true;
|
|
16299
|
+
this.isValid = this.isValidValue();
|
|
16300
|
+
this.errorMessage = this.setErrorMessage();
|
|
16292
16301
|
};
|
|
16293
16302
|
this.setClientStyling = () => {
|
|
16294
16303
|
let sheet = document.createElement('style');
|
|
@@ -16384,7 +16393,7 @@ const TelInput = class {
|
|
|
16384
16393
|
// end custom styling area
|
|
16385
16394
|
}
|
|
16386
16395
|
componentDidLoad() {
|
|
16387
|
-
this.isValid = this.
|
|
16396
|
+
this.isValid = this.isValidValue();
|
|
16388
16397
|
if (this.defaultValue) {
|
|
16389
16398
|
this.value = this.defaultValue;
|
|
16390
16399
|
this.valueHandler({ name: this.name, value: this.value, type: 'tel' });
|
|
@@ -16408,8 +16417,29 @@ const TelInput = class {
|
|
|
16408
16417
|
this.value = { prefix: this.prefixValue, phone: this.phoneValue };
|
|
16409
16418
|
this.emitValueHandler(true);
|
|
16410
16419
|
}
|
|
16411
|
-
|
|
16412
|
-
|
|
16420
|
+
isValidValue() {
|
|
16421
|
+
if (!this.inputReference) {
|
|
16422
|
+
return false;
|
|
16423
|
+
}
|
|
16424
|
+
if (this.validation.mandatory && (!this.phoneValue || this.phoneValue.trim() === '')) {
|
|
16425
|
+
return false;
|
|
16426
|
+
}
|
|
16427
|
+
if (!this.phoneValue || this.phoneValue.trim() === '') {
|
|
16428
|
+
return !this.validation.mandatory;
|
|
16429
|
+
}
|
|
16430
|
+
if (this.validation.minLength && this.phoneValue.length < this.validation.minLength) {
|
|
16431
|
+
return false;
|
|
16432
|
+
}
|
|
16433
|
+
if (this.validation.maxLength && this.phoneValue.length > this.validation.maxLength) {
|
|
16434
|
+
return false;
|
|
16435
|
+
}
|
|
16436
|
+
if (this.validationPattern) {
|
|
16437
|
+
const patternRegex = new RegExp(this.validationPattern);
|
|
16438
|
+
if (!patternRegex.test(this.phoneValue)) {
|
|
16439
|
+
return false;
|
|
16440
|
+
}
|
|
16441
|
+
}
|
|
16442
|
+
return true;
|
|
16413
16443
|
}
|
|
16414
16444
|
setPattern() {
|
|
16415
16445
|
var _a, _b;
|
|
@@ -16424,7 +16454,10 @@ const TelInput = class {
|
|
|
16424
16454
|
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
16425
16455
|
return translate$1(`${errorCode}`, this.language) ? translate$1(`${errorCode}`, this.language) : errorMessage;
|
|
16426
16456
|
}
|
|
16427
|
-
if (this.inputReference.validity.tooShort
|
|
16457
|
+
if (this.inputReference.validity.tooShort
|
|
16458
|
+
|| this.inputReference.validity.tooLong
|
|
16459
|
+
|| (this.validation.minLength && this.phoneValue && this.phoneValue.length < this.validation.minLength)
|
|
16460
|
+
|| (this.validation.maxLength && this.phoneValue && this.phoneValue.length > this.validation.maxLength)) {
|
|
16428
16461
|
return translate$1('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
16429
16462
|
}
|
|
16430
16463
|
if (this.inputReference.validity.valueMissing) {
|
|
@@ -16443,8 +16476,8 @@ const TelInput = class {
|
|
|
16443
16476
|
if (this.touched) {
|
|
16444
16477
|
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
16445
16478
|
}
|
|
16446
|
-
return h$1("div", { key: '
|
|
16447
|
-
h$1("img", { key: '
|
|
16479
|
+
return h$1("div", { key: 'f534de21d5597a3e90912eb87fff893511d09920', class: `tel__wrapper ${this.autofilled ? 'tel__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h$1("div", { key: '431fb8cbaea0d2244847823ea4d04d8c73a5341c', class: 'tel__wrapper--flex-label' }, h$1("label", { key: '2eb210b2f0c2e0e632997f59fe7aa667578f72fd', class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h$1("div", { key: '2d912b828f7d9475a1bbb5bac13495779f31198e', class: 'tel__wrapper--relative' }, this.tooltip &&
|
|
16480
|
+
h$1("img", { key: 'ce4433263d27dc9d3fb2caf45069d7a92e9ae3a7', class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h$1("div", { key: '480cd17eafb4f2ff1e396531429177cb3130eb95', class: `tel__wrapper--flex ${invalidClass}` }, h$1("vaadin-combo-box", { key: '5f2292c8509e5f68786d0f462c689102b1c75dc3', class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.disablePhonePrefix, onChange: (e) => this.handlePrefixInput(e) }), h$1("input", { key: '77232e119eed4960f5e1d809507b8585dd112256', type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: (_a = this.phoneValue) !== null && _a !== void 0 ? _a : '', placeholder: `${this.placeholder}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onInput: this.handleInput, onBlur: this.handleBlur })), h$1("small", { key: '0d925cee41881c8c822073790e26ca7dc4a81049', class: 'tel__error-message' }, this.errorMessage));
|
|
16448
16481
|
}
|
|
16449
16482
|
static get watchers() { return {
|
|
16450
16483
|
"clientStyling": ["handleStylingChange"],
|