@everymatrix/general-registration 1.10.24 → 1.10.25

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.
@@ -991,10 +991,6 @@ const CheckboxGroupInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
991
991
  * Default value for the input.
992
992
  */
993
993
  this.defaultValue = '';
994
- /**
995
- * Options of the input.
996
- */
997
- this.options = [];
998
994
  /**
999
995
  * Client custom styling via inline style
1000
996
  */
@@ -1097,7 +1093,7 @@ const CheckboxGroupInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
1097
1093
  "defaultValue": [513, "default-value"],
1098
1094
  "autofilled": [516],
1099
1095
  "tooltip": [513],
1100
- "options": [520],
1096
+ "options": [16],
1101
1097
  "validation": [16],
1102
1098
  "language": [513],
1103
1099
  "emitValue": [516, "emit-value"],
@@ -10202,7 +10202,7 @@ const DateInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10202
10202
  return null;
10203
10203
  }
10204
10204
  render() {
10205
- let invalidClass;
10205
+ let invalidClass = '';
10206
10206
  if (this.touched) {
10207
10207
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
10208
10208
  }
@@ -100,9 +100,11 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
100
100
  }
101
101
  }
102
102
  setErrorMessage() {
103
- var _a;
103
+ var _a, _b, _c, _d;
104
104
  if (this.inputReference.validity.patternMismatch) {
105
- return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
105
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
106
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
107
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
106
108
  }
107
109
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
108
110
  return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -111,7 +113,9 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
111
113
  return translate('requiredError', this.language);
112
114
  }
113
115
  if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
114
- return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
116
+ const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
117
+ const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
118
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
115
119
  }
116
120
  }
117
121
  renderTooltip() {
@@ -121,7 +125,7 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
121
125
  return null;
122
126
  }
123
127
  render() {
124
- let invalidClass;
128
+ let invalidClass = '';
125
129
  if (this.touched) {
126
130
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
127
131
  }
@@ -12,7 +12,7 @@
12
12
  */
13
13
  class Lumo extends HTMLElement {
14
14
  static get version() {
15
- return '23.3.18';
15
+ return '23.3.19';
16
16
  }
17
17
  }
18
18
 
@@ -9383,7 +9383,7 @@ const registered = new Set();
9383
9383
  const ElementMixin = (superClass) =>
9384
9384
  class VaadinElementMixin extends DirMixin(superClass) {
9385
9385
  static get version() {
9386
- return '23.3.18';
9386
+ return '23.3.19';
9387
9387
  }
9388
9388
 
9389
9389
  /** @protected */
@@ -24,10 +24,6 @@ const ToggleCheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
24
24
  * Default value for the input.
25
25
  */
26
26
  this.defaultValue = '';
27
- /**
28
- * Options of the input.
29
- */
30
- this.options = [];
31
27
  /**
32
28
  * Client custom styling via inline style
33
29
  */
@@ -95,7 +91,7 @@ const ToggleCheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
95
91
  render() {
96
92
  return h("div", { class: `togglecheckbox__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'togglecheckbox__wrapper--flex' }, h("input", { class: 'togglecheckbox__input', type: "checkbox", id: `${this.name}__input`, ref: (el) => this.checkboxReference = el, name: this.name, checked: this.defaultValue === "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), this.renderLabel()), h("small", { class: 'togglecheckbox__error-message' }, this.errorMessage), h("div", { class: 'togglecheckbox__wrapper--relative' }, this.tooltip &&
97
93
  h("img", { class: 'togglecheckbox__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip()), h("div", { class: `togglecheckbox__fields-wrapper ${this.showFields ? '' : 'hidden'}` }, this.options.map(subfield => {
98
- return h("general-input", { type: subfield.inputType, name: subfield.name, displayName: subfield.displayName, validation: subfield.validate, action: subfield.action || null, defaultValue: subfield.defaultValue, autofilled: subfield.autofill, emitValue: this.emitValue, language: this.language, isDuplicateInput: subfield.isDuplicateInput, "client-styling": this.clientStyling, tooltip: subfield.tooltip, placeholder: subfield.placeholder == null ? '' : subfield.placeholder });
94
+ return h("general-input", { type: subfield.inputType, name: subfield.name, displayName: subfield.displayName, validation: subfield.validate, action: subfield.action || null, defaultValue: subfield.defaultValue, autofilled: subfield.autofill, emitValue: this.emitValue, language: this.language, "client-styling": this.clientStyling, tooltip: subfield.tooltip, placeholder: subfield.placeholder == null ? '' : subfield.placeholder });
99
95
  })));
100
96
  }
101
97
  static get watchers() { return {
@@ -107,7 +103,7 @@ const ToggleCheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
107
103
  "name": [513],
108
104
  "displayName": [513, "display-name"],
109
105
  "defaultValue": [513, "default-value"],
110
- "options": [520],
106
+ "options": [16],
111
107
  "autofilled": [516],
112
108
  "tooltip": [513],
113
109
  "validation": [16],
@@ -145,29 +145,9 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
145
145
  componentWillLoad() {
146
146
  return this.getRegisterConfig()
147
147
  .then((config) => {
148
- if (this.translationUrl) {
149
- getTranslations(this.translationUrl).then(() => {
150
- config.content.fields.forEach(field => {
151
- if (TRANSLATIONS[this.language][field.name]) {
152
- Object.keys(TRANSLATIONS[this.language][field.name]).forEach((key) => {
153
- field[key] = TRANSLATIONS[this.language][field.name][key];
154
- });
155
- }
156
- return field;
157
- });
158
- })
159
- .catch((error) => {
160
- console.error('Failed to fetch translations:', error);
161
- }).finally(() => {
162
- this.formatConfig(config);
163
- this.stepsStateMachine({ event: 'set', type: 'inputs' });
164
- });
165
- }
166
- else {
167
- this.formatConfig(config);
168
- this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
169
- this.stepsStateMachine({ event: 'set', type: 'inputs' });
170
- }
148
+ this.formatConfig(config);
149
+ this.isFormValid = !this.getInvalidStatus(this.listOfInputValidity);
150
+ this.stepsStateMachine({ event: 'set', type: 'inputs' });
171
151
  });
172
152
  }
173
153
  componentDidLoad() {
@@ -367,10 +347,7 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
367
347
  })
368
348
  .then((data) => {
369
349
  this.isLoading = false;
370
- if (data.userId) {
371
- alert(`User registered - the user ID is ${data.userId}`);
372
- }
373
- window.postMessage({ type: 'registrationSuccessful' }, window.location.href);
350
+ window.postMessage({ type: 'registrationSuccessful', userId: data === null || data === void 0 ? void 0 : data.userId }, window.location.href);
374
351
  })
375
352
  .catch((err) => {
376
353
  this.isLoading = false;
@@ -446,7 +423,32 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
446
423
  if (this.listOfActions.some(action => action == '/register')) {
447
424
  this.lastStep = this.registrationStep;
448
425
  }
449
- this.forms = [...this.forms, { [this.registrationStep]: this.listOfInputs }];
426
+ // The translations for fields happens here.
427
+ if (this.translationUrl) {
428
+ getTranslations(this.translationUrl).then(() => {
429
+ this.listOfInputs.forEach(field => {
430
+ var _a, _b;
431
+ this.addTranslation(field);
432
+ // Logic for fields types that have subfields
433
+ if (((_a = field.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'togglecheckbox') {
434
+ field.data.subFields.forEach(subField => this.addTranslation(subField));
435
+ }
436
+ if (((_b = field.inputType) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'checkboxgroup') {
437
+ this.addTranslation(field);
438
+ field.data.subFields.forEach(subField => this.addTranslation(subField));
439
+ }
440
+ return field;
441
+ });
442
+ })
443
+ .catch((error) => {
444
+ console.error('Failed to fetch translations:', error);
445
+ }).finally(() => {
446
+ this.forms = [...this.forms, { [this.registrationStep]: this.listOfInputs }];
447
+ });
448
+ }
449
+ else {
450
+ this.forms = [...this.forms, { [this.registrationStep]: this.listOfInputs }];
451
+ }
450
452
  // Add the step to the registrationStepsData
451
453
  this.registrationStepsState.regId = this.registrationID;
452
454
  if (!this.registrationStepsState[this.registrationStep]) {
@@ -458,6 +460,13 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
458
460
  };
459
461
  }
460
462
  }
463
+ addTranslation(field) {
464
+ if (TRANSLATIONS[this.language][field.name]) {
465
+ Object.keys(TRANSLATIONS[this.language][field.name]).forEach((key) => {
466
+ field[key] = TRANSLATIONS[this.language][field.name][key];
467
+ });
468
+ }
469
+ }
461
470
  setInitialValidStatus(field) {
462
471
  var _a, _b;
463
472
  // Input type checkbox, with no validation are valid
@@ -93,9 +93,11 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
93
93
  }
94
94
  }
95
95
  setErrorMessage() {
96
- var _a;
96
+ var _a, _b;
97
97
  if (this.inputReference.validity.patternMismatch) {
98
- return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
98
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
99
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
100
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
99
101
  }
100
102
  if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
101
103
  return translate('numberLengthError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
@@ -111,7 +113,7 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
111
113
  return null;
112
114
  }
113
115
  render() {
114
- let invalidClass;
116
+ let invalidClass = '';
115
117
  if (this.touched) {
116
118
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
117
119
  }
@@ -560,7 +560,8 @@ class PasswordField extends TextField {
560
560
  super();
561
561
  this._setType('password');
562
562
  this.__boundRevealButtonClick = this._onRevealButtonClick.bind(this);
563
- this.__boundRevealButtonTouchend = this._onRevealButtonTouchend.bind(this);
563
+ this.__boundRevealButtonMouseDown = this._onRevealButtonMouseDown.bind(this);
564
+ this.__lastChange = '';
564
565
  }
565
566
 
566
567
  /** @protected */
@@ -577,7 +578,7 @@ class PasswordField extends TextField {
577
578
  btn.disabled = host.disabled;
578
579
 
579
580
  btn.addEventListener('click', host.__boundRevealButtonClick);
580
- btn.addEventListener('touchend', host.__boundRevealButtonTouchend);
581
+ btn.addEventListener('mousedown', host.__boundRevealButtonMouseDown);
581
582
  },
582
583
  );
583
584
  this.addController(this._revealButtonController);
@@ -592,6 +593,19 @@ class PasswordField extends TextField {
592
593
  }
593
594
  }
594
595
 
596
+ /**
597
+ * Override an event listener inherited from `InputControlMixin`
598
+ * to store the value at the moment of the native `change` event.
599
+ * @param {Event} event
600
+ * @protected
601
+ * @override
602
+ */
603
+ _onChange(event) {
604
+ super._onChange(event);
605
+
606
+ this.__lastChange = this.inputElement.value;
607
+ }
608
+
595
609
  /**
596
610
  * Override method inherited from `FocusMixin` to mark field as focused
597
611
  * when focus moves to the reveal button using Shift Tab.
@@ -628,6 +642,12 @@ class PasswordField extends TextField {
628
642
 
629
643
  if (!focused) {
630
644
  this._setPasswordVisible(false);
645
+
646
+ // Detect if `focusout` was prevented and if so, dispatch `change` event manually.
647
+ if (this.__lastChange !== this.inputElement.value) {
648
+ this.__lastChange = this.inputElement.value;
649
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
650
+ }
631
651
  } else {
632
652
  const isButtonFocused = this.getRootNode().activeElement === this._revealNode;
633
653
  // Remove focus-ring from the field when the reveal button gets focused
@@ -663,10 +683,10 @@ class PasswordField extends TextField {
663
683
  }
664
684
 
665
685
  /** @private */
666
- _onRevealButtonTouchend(e) {
667
- // Cancel the following click event
686
+ _onRevealButtonMouseDown(e) {
687
+ // Cancel the following focusout event
668
688
  e.preventDefault();
669
- this._togglePasswordVisibility();
689
+
670
690
  // Focus the input to avoid problem with password still visible
671
691
  // when user clicks the reveal button and then clicks outside.
672
692
  this.inputElement.focus();
@@ -719,7 +739,7 @@ class PasswordField extends TextField {
719
739
 
720
740
  customElements.define(PasswordField.is, PasswordField);
721
741
 
722
- const passwordInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.password{font-family:\"Roboto\";font-style:normal}.password__wrapper{width:100%}.password__wrapper--flex{display:flex;gap:5px}.password__wrapper--relative{position:relative}.password__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#2A3841}.password__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.password__input{width:inherit;border:none;margin-bottom:5px}.password__input[focused]::part(input-field){border-color:#3E3E3E}.password__input[invalid]::part(input-field){border-color:#cc0000b3}.password__input::part(input-field){border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;width:100%;position:relative;border:2px solid #DEE1EE}.password__input>input:placeholder-shown{color:#979797}.password__error-message{color:#cc0000b3}.password__complexity{position:relative;padding:10px;display:flex;flex-direction:column;gap:20px;justify-content:center;margin-top:20px;font-weight:300;background:#FFFFFF;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;height:150px;border:1px solid #B0B0B0}.password__complexity--strength{display:flex;justify-content:space-evenly}.password__complexity--strength meter::-webkit-meter-optimum-value{background:#1F1F1F}.password__complexity--strength meter::-moz-meter-bar{background:#B0B0B0}.password__complexity--text-bold{font-weight:500}.password__complexity--checkbox{margin-right:5px}.password__complexity:after{content:\"\";position:absolute;width:25px;height:25px;border-top:1px solid #B0B0B0;border-right:0 solid #B0B0B0;border-left:1px solid #B0B0B0;border-bottom:0 solid #B0B0B0;bottom:92%;left:50%;margin-left:-25px;transform:rotate(45deg);margin-top:-25px;background-color:#FFFFFF}.password__tooltip-icon{width:16px;height:auto}.password__tooltip{position:absolute;top:0;left:20px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.password__tooltip.visible{opacity:1}";
742
+ const passwordInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.password{font-family:\"Roboto\";font-style:normal}.password__wrapper{width:100%}.password__wrapper--flex{display:flex;gap:5px}.password__wrapper--relative{position:relative}.password__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#2A3841}.password__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.password__input{width:inherit;border:none;margin-bottom:5px}.password__input[focused]::part(input-field){border-color:#3E3E3E}.password__input[invalid]::part(input-field){border-color:#cc0000b3}.password__input::part(input-field){border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;width:100%;position:relative;border:2px solid #DEE1EE}.password__input>input:placeholder-shown{color:#979797}.password__error-message{color:#cc0000b3}.password__complexity{position:relative;padding:10px;display:flex;flex-direction:column;gap:20px;justify-content:center;margin-top:20px;font-weight:300;background:#FFFFFF;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;height:150px;border:1px solid #B0B0B0}.password__complexity--strength{display:flex;justify-content:space-evenly}.password__complexity--strength meter::-webkit-meter-optimum-value{background:#1F1F1F}.password__complexity--strength meter::-moz-meter-bar{background:#B0B0B0}.password__complexity--hidden{display:none}.password__complexity--text-bold{font-weight:500}.password__complexity--checkbox{margin-right:5px}.password__complexity:after{content:\"\";position:absolute;width:25px;height:25px;border-top:1px solid #B0B0B0;border-right:0 solid #B0B0B0;border-left:1px solid #B0B0B0;border-bottom:0 solid #B0B0B0;bottom:92%;left:50%;margin-left:-25px;transform:rotate(45deg);margin-top:-25px;background-color:#FFFFFF}.password__tooltip-icon{width:16px;height:auto}.password__tooltip{position:absolute;top:0;left:20px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.password__tooltip.visible{opacity:1}";
723
743
 
724
744
  const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
725
745
  constructor() {
@@ -863,9 +883,11 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
863
883
  }
864
884
  }
865
885
  setErrorMessage() {
866
- var _a;
886
+ var _a, _b, _c, _d;
867
887
  if (this.inputReference.validity.patternMismatch) {
868
- return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
888
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
889
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
890
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
869
891
  }
870
892
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
871
893
  return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -874,7 +896,9 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
874
896
  return translate('requiredError', this.language);
875
897
  }
876
898
  if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
877
- return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
899
+ const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
900
+ const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
901
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
878
902
  }
879
903
  }
880
904
  renderTooltip() {
@@ -888,14 +912,13 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
888
912
  const passedRules = this.passwordComplexity.filter(complexity => complexity.passed).length;
889
913
  const meterValue = passedRules / totalRules;
890
914
  const allRulesPassed = this.passwordComplexity.every(complexity => complexity.passed);
891
- if (this.showPopup === false)
892
- return;
893
- return (h("div", { class: `password__complexity` }, h("div", { class: 'password__complexity--strength' }, h("p", { class: 'password__complexity--text' }, translate('passwordStrength', this.language), "\u00A0", h("span", { class: 'password__complexity--text-bold' }, translate(`${allRulesPassed ? 'passwordStrengthStrong' : 'passwordStrengthWeak'}`, this.language))), h("meter", { value: meterValue, min: "0", max: "1" })), h("div", null, this.passwordComplexity.map((complexity, index) => {
894
- return (h("div", { key: index }, h("input", { class: 'password__complexity--checkbox', type: "checkbox", checked: complexity.passed, disabled: true }), h("span", null, complexity.rule)));
915
+ // if (this.showPopup === false) return;
916
+ return (h("div", { class: `password__complexity ${!this.showPopup ? 'password__complexity--hidden' : ''}` }, h("div", { class: 'password__complexity--strength' }, h("p", { class: 'password__complexity--text' }, translate('passwordStrength', this.language), "\u00A0", h("span", { class: 'password__complexity--text-bold' }, translate(`${allRulesPassed ? 'passwordStrengthStrong' : 'passwordStrengthWeak'}`, this.language))), h("meter", { value: meterValue, min: "0", max: "1" })), h("div", null, this.passwordComplexity.map((complexity, index) => {
917
+ return (h("div", { key: index }, h("input", { class: 'password__complexity--checkbox', type: "checkbox", checked: complexity.passed, disabled: true }), h("span", null, translate(`${complexity.rule}`, this.language) ? translate(`${complexity.rule}`, this.language) : complexity.rule)));
895
918
  }))));
896
919
  }
897
920
  render() {
898
- let invalidClass;
921
+ let invalidClass = '';
899
922
  if (this.touched) {
900
923
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
901
924
  }
@@ -69,8 +69,10 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
69
69
  componentWillLoad() {
70
70
  if (this.action && !this.options.length) {
71
71
  if (this.action.split(" ")[0] == 'GET') {
72
- return this.getOptions().then((options) => {
73
- this.displayedOptions = options.countries.map(option => {
72
+ const endpoint = this.action.split(" ")[1];
73
+ return this.getOptions(endpoint).then((options) => {
74
+ const firstKey = Object.keys(options)[0];
75
+ this.displayedOptions = options[firstKey].map(option => {
74
76
  return { label: option.Name, value: option.Alpha2Code };
75
77
  });
76
78
  });
@@ -94,9 +96,8 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
94
96
  this.valueHandler({ name: this.name, value: this.value });
95
97
  }
96
98
  }
97
- getOptions() {
98
- // TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
99
- const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/countries");
99
+ getOptions(endpoint) {
100
+ const url = new URL(endpoint);
100
101
  return new Promise((resolve, reject) => {
101
102
  fetch(url.href)
102
103
  .then((res) => res.json())
@@ -123,7 +124,7 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
123
124
  return null;
124
125
  }
125
126
  render() {
126
- let invalidClass;
127
+ let invalidClass = '';
127
128
  if (this.touched) {
128
129
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
129
130
  }
@@ -130,9 +130,11 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
130
130
  }
131
131
  }
132
132
  setErrorMessage() {
133
- var _a;
133
+ var _a, _b;
134
134
  if (this.inputReference.validity.patternMismatch) {
135
- return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
135
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
136
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
137
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
136
138
  }
137
139
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
138
140
  return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -148,7 +150,7 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
148
150
  return null;
149
151
  }
150
152
  render() {
151
- let invalidClass;
153
+ let invalidClass = '';
152
154
  if (this.touched) {
153
155
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
154
156
  }
@@ -127,9 +127,11 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
127
127
  }
128
128
  }
129
129
  setErrorMessage() {
130
- var _a;
130
+ var _a, _b, _c, _d;
131
131
  if (this.inputReference.validity.patternMismatch) {
132
- return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
132
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
133
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
134
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
133
135
  }
134
136
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
135
137
  return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -138,7 +140,9 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
138
140
  return translate('requiredError', this.language);
139
141
  }
140
142
  if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
141
- return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
143
+ const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
144
+ const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
145
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
142
146
  }
143
147
  }
144
148
  renderTooltip() {
@@ -148,7 +152,7 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
148
152
  return null;
149
153
  }
150
154
  render() {
151
- let invalidClass;
155
+ let invalidClass = '';
152
156
  if (this.touched) {
153
157
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
154
158
  }
@@ -8,12 +8,29 @@ const TRANSLATIONS = {
8
8
  "passwordStrength": "Password strength",
9
9
  "passwordStrengthWeak": "is not adequate",
10
10
  "passwordStrengthStrong": "is adequate",
11
+ "SpecialCharactersNotAllowed": 'Should not contain special characters',
12
+ "InvalidEmailFormat": "Invalid email format.",
13
+ "EmailNotMatching": "Emails not matching!",
14
+ "PasswordNotMatching": "Passwords not matching",
15
+ "MustIncludeNumber": "include a number",
16
+ "MustContainCapital": "contain capital letters",
17
+ "MustIncludePunctation": "punctuation",
11
18
  },
12
19
  "hu": {
13
20
  "dateError": 'A választott dátumnak {min} és {max} között kell lennie',
14
21
  "numberLengthError": 'A számnak {min} és {max} között kell lennie',
15
22
  "lengthError": `A hossznak {minLength} és {maxLength} között kell lennie`,
16
23
  "requiredError": 'Ez a beviteli mező kötelező.',
24
+ "passwordStrength": "Jelszó erőssége",
25
+ "passwordStrengthWeak": "nem megfelelő",
26
+ "passwordStrengthStrong": "megfelelő",
27
+ "SpecialCharactersNotAllowed": 'Nem tartalmazhat speciális karaktereket',
28
+ "InvalidEmailFormat": "Érvénytelen e-mail formátum.",
29
+ "EmailNotMatching": "Az e-mailek nem egyeznek!",
30
+ "PasswordNotMatching": "A jelszavak nem egyeznek",
31
+ "MustIncludeNumber": "tartalmaznia kell egy számot",
32
+ "MustContainCapital": "nagybetűket kell tartalmaznia",
33
+ "MustIncludePunctation": "írásjelet"
17
34
  }
18
35
  };
19
36
  const translate = (key, customLang, values) => {