@everymatrix/general-registration 1.10.25 → 1.10.27

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.
@@ -175,6 +175,7 @@ export class GeneralRegistration {
175
175
  });
176
176
  }
177
177
  setRegisterStep() {
178
+ this.isLoadingPOST = true;
178
179
  const url = new URL(`${this.endpoint}/v1/player/legislation/registration/step`);
179
180
  const registerStep = {
180
181
  registrationId: this.registrationID,
@@ -231,6 +232,7 @@ export class GeneralRegistration {
231
232
  return res.json();
232
233
  })
233
234
  .then((data) => {
235
+ this.isLoadingPOST = false;
234
236
  this.registrationID = data.registrationId;
235
237
  if (this.listOfActions.some(action => action == '/register')) {
236
238
  this.setRegister();
@@ -255,7 +257,10 @@ export class GeneralRegistration {
255
257
  }
256
258
  })
257
259
  .catch((err) => {
260
+ this.isLoadingPOST = false;
258
261
  console.error(err);
262
+ }).finally(() => {
263
+ this.isLoadingPOST = false;
259
264
  });
260
265
  }
261
266
  setRegister() {
@@ -271,8 +276,20 @@ export class GeneralRegistration {
271
276
  };
272
277
  fetch(url.href, options)
273
278
  .then((res) => {
274
- if (res.status >= 300) {
275
- throw new Error('err');
279
+ if (!res.ok) {
280
+ return res.json().then(error => {
281
+ this.errorCode = error.thirdPartyResponse.errorCode;
282
+ // Show the idomsoft error if it is the case
283
+ if (this.errorCode == 'GmErr_BadRequest_IdomsoftVerification_ShouldRetry') {
284
+ this.errorMessage = error.thirdPartyResponse.message;
285
+ }
286
+ else if (this.errorCode == 'GmErr_BadRequest') {
287
+ this.errorMessage = error.thirdPartyResponse.message;
288
+ }
289
+ else {
290
+ this.errorMessage = translate(`${this.errorCode}`, this.language) || this.errorCode;
291
+ }
292
+ });
276
293
  }
277
294
  return res.json();
278
295
  })
@@ -361,7 +378,7 @@ export class GeneralRegistration {
361
378
  this.listOfInputs.forEach(field => {
362
379
  var _a, _b;
363
380
  this.addTranslation(field);
364
- // Logic for fields types that have subfields
381
+ // Logic for field types that have subfields
365
382
  if (((_a = field.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'togglecheckbox') {
366
383
  field.data.subFields.forEach(subField => this.addTranslation(subField));
367
384
  }
@@ -437,7 +454,11 @@ export class GeneralRegistration {
437
454
  ;
438
455
  renderButtons() {
439
456
  return (h("div", { class: 'registration__buttons-wrapper' },
440
- h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.lastStep === this.registrationStep ? translate('doneButton', this.language) : translate('nextButton', this.language)),
457
+ this.isLoadingPOST
458
+ && h("slot", { name: 'spinner' })
459
+ && h("svg", { class: "spinner", viewBox: "0 0 50 50" },
460
+ h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" })),
461
+ !this.isLoadingPOST && h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.lastStep === this.registrationStep ? translate('doneButton', this.language) : translate('nextButton', this.language)),
441
462
  h("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language))));
442
463
  }
443
464
  render() {
@@ -586,6 +607,7 @@ export class GeneralRegistration {
586
607
  "errorMessage": {},
587
608
  "isFormValid": {},
588
609
  "isLoading": {},
610
+ "isLoadingPOST": {},
589
611
  "registrationStep": {},
590
612
  "forms": {},
591
613
  "limitStylingAppends": {}
@@ -10099,6 +10099,56 @@ function cleanEscapedString(input) {
10099
10099
  return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
10100
10100
  }
10101
10101
 
10102
+ /**
10103
+ * @name isAfter
10104
+ * @category Common Helpers
10105
+ * @summary Is the first date after the second one?
10106
+ *
10107
+ * @description
10108
+ * Is the first date after the second one?
10109
+ *
10110
+ * @param {Date|Number} date - the date that should be after the other one to return true
10111
+ * @param {Date|Number} dateToCompare - the date to compare with
10112
+ * @returns {Boolean} the first date is after the second date
10113
+ * @throws {TypeError} 2 arguments required
10114
+ *
10115
+ * @example
10116
+ * // Is 10 July 1989 after 11 February 1987?
10117
+ * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
10118
+ * //=> true
10119
+ */
10120
+ function isAfter(dirtyDate, dirtyDateToCompare) {
10121
+ requiredArgs(2, arguments);
10122
+ var date = toDate(dirtyDate);
10123
+ var dateToCompare = toDate(dirtyDateToCompare);
10124
+ return date.getTime() > dateToCompare.getTime();
10125
+ }
10126
+
10127
+ /**
10128
+ * @name isBefore
10129
+ * @category Common Helpers
10130
+ * @summary Is the first date before the second one?
10131
+ *
10132
+ * @description
10133
+ * Is the first date before the second one?
10134
+ *
10135
+ * @param {Date|Number} date - the date that should be before the other one to return true
10136
+ * @param {Date|Number} dateToCompare - the date to compare with
10137
+ * @returns {Boolean} the first date is before the second date
10138
+ * @throws {TypeError} 2 arguments required
10139
+ *
10140
+ * @example
10141
+ * // Is 10 July 1989 before 11 February 1987?
10142
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
10143
+ * //=> false
10144
+ */
10145
+ function isBefore(dirtyDate, dirtyDateToCompare) {
10146
+ requiredArgs(2, arguments);
10147
+ var date = toDate(dirtyDate);
10148
+ var dateToCompare = toDate(dirtyDateToCompare);
10149
+ return date.getTime() < dateToCompare.getTime();
10150
+ }
10151
+
10102
10152
  const dateInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.date{font-family:\"Roboto\";font-style:normal}.date__wrapper{position:relative;width:100%;padding-top:26px}.date__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#2A3841;position:absolute;top:0;left:0}.date__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.date__input{border:none;width:inherit;position:relative}.date__input[focused]::part(input-field){border-color:#3E3E3E}.date__input[invalid]::part(input-field){border-color:#cc0000b3}.date__input::part(input-field){border-radius:4px;background-color:#FFFFFF;border:2px solid #DEE1EE;color:#2A2E3F;border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px}.date__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.date__tooltip-icon{position:absolute;right:0;bottom:10px}.date__tooltip{position:absolute;bottom:35px;right:10px;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}.date__tooltip.visible{opacity:1}";
10103
10153
 
10104
10154
  const DateInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -10158,6 +10208,11 @@ const DateInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10158
10208
  if (event.composedPath()[0] !== this.tooltipReference)
10159
10209
  this.showTooltip = false;
10160
10210
  }
10211
+ connectedCallback() {
10212
+ var _a, _b;
10213
+ this.minDate = parse(((_a = this.validation.min) === null || _a === void 0 ? void 0 : _a.toString()) || '', 'yyyy-MM-dd', new Date());
10214
+ this.maxDate = parse(((_b = this.validation.max) === null || _b === void 0 ? void 0 : _b.toString()) || '', 'yyyy-MM-dd', new Date());
10215
+ }
10161
10216
  componentDidRender() {
10162
10217
  // start custom styling area
10163
10218
  if (!this.limitStylingAppends && this.stylingContainer) {
@@ -10180,14 +10235,23 @@ const DateInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10180
10235
  handleInput(event) {
10181
10236
  this.value = event.target.value;
10182
10237
  this.touched = true;
10183
- this.errorMessage = this.setErrorMessage();
10238
+ this.valueAsDate = parse(this.value || '', 'yyyy-MM-dd', new Date());
10184
10239
  this.isValid = this.setValidity();
10240
+ this.errorMessage = this.setErrorMessage();
10185
10241
  this.emitValueHandler(true);
10186
10242
  }
10187
10243
  setValidity() {
10188
- return this.inputReference.validity.valid;
10244
+ if (isBefore(this.valueAsDate, this.minDate) || isAfter(this.valueAsDate, this.maxDate)) {
10245
+ return false;
10246
+ }
10247
+ else {
10248
+ return this.inputReference.validity.valid;
10249
+ }
10189
10250
  }
10190
10251
  setErrorMessage() {
10252
+ if (isBefore(this.valueAsDate, this.minDate) || isAfter(this.valueAsDate, this.maxDate)) {
10253
+ return translate$1('dateError2', this.language);
10254
+ }
10191
10255
  if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
10192
10256
  return translate$1('dateError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
10193
10257
  }
@@ -10206,7 +10270,7 @@ const DateInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10206
10270
  if (this.touched) {
10207
10271
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
10208
10272
  }
10209
- return h("div", { class: `date__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), h("vaadin-date-picker", { id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onChange: (e) => this.handleInput(e), onBlur: this.handleBlur }), h("small", { class: 'date__error-message' }, this.errorMessage), this.tooltip &&
10273
+ return h("div", { class: `date__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), h("vaadin-date-picker", { id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onChange: (e) => this.handleInput(e), onBlur: this.handleBlur }), h("small", { class: 'date__error-message' }, this.errorMessage), this.tooltip &&
10210
10274
  h("img", { class: 'date__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
10211
10275
  }
10212
10276
  get element() { return this; }
@@ -130,7 +130,7 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
130
130
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
131
131
  }
132
132
  return h("div", { class: `email__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'email__wrapper--flex' }, h("label", { class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'email__wrapper--relative' }, this.tooltip &&
133
- h("img", { class: 'email__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { id: `${this.name}__input`, type: 'email', class: `email__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { class: 'email__error-message' }, this.errorMessage));
133
+ h("img", { class: 'email__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { id: `${this.name}__input`, type: 'email', class: `email__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { class: 'email__error-message' }, this.errorMessage));
134
134
  }
135
135
  static get watchers() { return {
136
136
  "isValid": ["validityChanged"],
@@ -1,4 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import { d as defineCustomElement$b } from './checkbox-group-input2.js';
3
3
  import { d as defineCustomElement$a } from './checkbox-input2.js';
4
4
  import { d as defineCustomElement$9 } from './date-input2.js';
@@ -37,13 +37,9 @@ const ToggleCheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
37
37
  this.stylingContainer.prepend(sheet);
38
38
  };
39
39
  }
40
- validityChanged() {
41
- }
42
40
  validityStateHandler(inputStateEvent) {
43
41
  this.sendValidityState.emit(inputStateEvent);
44
42
  }
45
- emitValueHandler(newValue) {
46
- }
47
43
  valueHandler(inputValueEvent) {
48
44
  this.sendInputValue.emit(inputValueEvent);
49
45
  }
@@ -53,8 +49,6 @@ const ToggleCheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
53
49
  if (event.composedPath()[0] !== this.tooltipReference)
54
50
  this.showTooltip = false;
55
51
  }
56
- connectedCallback() {
57
- }
58
52
  componentDidRender() {
59
53
  // start custom styling area
60
54
  if (!this.limitStylingAppends && this.stylingContainer) {
@@ -64,8 +58,6 @@ const ToggleCheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
64
58
  }
65
59
  // end custom styling area
66
60
  }
67
- componentDidLoad() {
68
- }
69
61
  handleClick() {
70
62
  this.showFields = this.checkboxReference.checked;
71
63
  this.errorMessage = this.setErrorMessage();
@@ -94,10 +86,6 @@ const ToggleCheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
94
86
  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 });
95
87
  })));
96
88
  }
97
- static get watchers() { return {
98
- "isValid": ["validityChanged"],
99
- "emitValue": ["emitValueHandler"]
100
- }; }
101
89
  static get style() { return toggleCheckboxInputCss; }
102
90
  }, [1, "toggle-checkbox-input", {
103
91
  "name": [513],
@@ -206,7 +194,7 @@ const GeneralInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
206
194
  */
207
195
  this.clientStyling = '';
208
196
  }
209
- render() {
197
+ renderInput() {
210
198
  var _a;
211
199
  switch ((_a = this.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) {
212
200
  case 'text':
@@ -235,6 +223,9 @@ const GeneralInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
235
223
  return h("p", null, "The ", this.type, " input type is not valid");
236
224
  }
237
225
  }
226
+ render() {
227
+ return (h(Host, { class: `general-input--${this.name}` }, this.renderInput()));
228
+ }
238
229
  static get style() { return generalInputCss; }
239
230
  }, [1, "general-input", {
240
231
  "type": [513],
@@ -63,7 +63,7 @@ const translate = (key, customLang, values) => {
63
63
  return translation;
64
64
  };
65
65
 
66
- const generalRegistrationCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n.registration__form.hidden {\n display: none;\n}\n\n.registration {\n font-family: \"Roboto\";\n font-style: normal;\n font-family: sans-serif;\n display: flex;\n flex-direction: column;\n gap: 24px;\n width: 100%;\n height: 100%;\n container-type: inline-size;\n}\n.registration__error-message {\n color: #cc0000b3;\n}\n.registration__form {\n display: grid;\n grid-template-columns: repeat(1, 1fr);\n gap: 40px;\n justify-items: stretch;\n align-content: flex-start;\n overflow: auto;\n width: 100%;\n height: 100%;\n}\n.registration__buttons-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n align-items: center;\n}\n.registration__button {\n border: none;\n border-radius: 20px;\n box-shadow: 0px 2px 1px rgba(11, 16, 19, 0.6);\n color: #0B1013;\n font-size: 18px;\n font-weight: bold;\n text-transform: uppercase;\n width: 150px;\n height: 45px;\n}\n.registration__button--disabled {\n color: #647480;\n background-color: #CFCFCF;\n box-shadow: none;\n}\n.registration__button--first-step {\n display: none;\n}\n\n@container (min-width: 450px) {\n .registration__form {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .registration__buttons-wrapper {\n flex-direction: row-reverse;\n gap: 15px;\n }\n}";
66
+ const generalRegistrationCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n}\n\n.registration__form.hidden {\n display: none;\n}\n\n.registration {\n font-family: \"Roboto\";\n font-style: normal;\n font-family: sans-serif;\n display: flex;\n flex-direction: column;\n gap: 24px;\n width: 100%;\n height: 100%;\n container-type: inline-size;\n}\n.registration__error-message {\n color: #cc0000b3;\n}\n.registration__form {\n display: grid;\n grid-template-columns: repeat(1, 1fr);\n gap: 40px;\n justify-items: stretch;\n align-content: flex-start;\n overflow: auto;\n width: 100%;\n height: 100%;\n}\n.registration__buttons-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n align-items: center;\n position: relative;\n}\n.registration__button {\n border: none;\n border-radius: 20px;\n box-shadow: 0px 2px 1px rgba(11, 16, 19, 0.6);\n color: #0B1013;\n font-size: 18px;\n font-weight: bold;\n text-transform: uppercase;\n width: 150px;\n height: 45px;\n}\n.registration__button--disabled {\n color: #647480;\n background-color: #CFCFCF;\n box-shadow: none;\n}\n.registration__button--first-step {\n display: none;\n}\n\n@container (min-width: 450px) {\n .registration__form {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .registration__buttons-wrapper {\n flex-direction: row-reverse;\n gap: 15px;\n }\n}\n.spinner {\n animation: rotate 2s linear infinite;\n z-index: 2;\n position: absolute;\n top: 50%;\n left: 50%;\n margin: -25px 0 0 -25px;\n width: 50px;\n height: 50px;\n}\n.spinner .path {\n stroke: #E37912;\n stroke-linecap: round;\n animation: dash 1.5s ease-in-out infinite;\n}\n\n@keyframes rotate {\n 100% {\n transform: rotate(360deg);\n }\n}\n@keyframes dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n}";
67
67
 
68
68
  const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
69
69
  constructor() {
@@ -244,6 +244,7 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
244
244
  });
245
245
  }
246
246
  setRegisterStep() {
247
+ this.isLoadingPOST = true;
247
248
  const url = new URL(`${this.endpoint}/v1/player/legislation/registration/step`);
248
249
  const registerStep = {
249
250
  registrationId: this.registrationID,
@@ -300,6 +301,7 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
300
301
  return res.json();
301
302
  })
302
303
  .then((data) => {
304
+ this.isLoadingPOST = false;
303
305
  this.registrationID = data.registrationId;
304
306
  if (this.listOfActions.some(action => action == '/register')) {
305
307
  this.setRegister();
@@ -324,7 +326,10 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
324
326
  }
325
327
  })
326
328
  .catch((err) => {
329
+ this.isLoadingPOST = false;
327
330
  console.error(err);
331
+ }).finally(() => {
332
+ this.isLoadingPOST = false;
328
333
  });
329
334
  }
330
335
  setRegister() {
@@ -340,8 +345,20 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
340
345
  };
341
346
  fetch(url.href, options)
342
347
  .then((res) => {
343
- if (res.status >= 300) {
344
- throw new Error('err');
348
+ if (!res.ok) {
349
+ return res.json().then(error => {
350
+ this.errorCode = error.thirdPartyResponse.errorCode;
351
+ // Show the idomsoft error if it is the case
352
+ if (this.errorCode == 'GmErr_BadRequest_IdomsoftVerification_ShouldRetry') {
353
+ this.errorMessage = error.thirdPartyResponse.message;
354
+ }
355
+ else if (this.errorCode == 'GmErr_BadRequest') {
356
+ this.errorMessage = error.thirdPartyResponse.message;
357
+ }
358
+ else {
359
+ this.errorMessage = translate(`${this.errorCode}`, this.language) || this.errorCode;
360
+ }
361
+ });
345
362
  }
346
363
  return res.json();
347
364
  })
@@ -429,7 +446,7 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
429
446
  this.listOfInputs.forEach(field => {
430
447
  var _a, _b;
431
448
  this.addTranslation(field);
432
- // Logic for fields types that have subfields
449
+ // Logic for field types that have subfields
433
450
  if (((_a = field.inputType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'togglecheckbox') {
434
451
  field.data.subFields.forEach(subField => this.addTranslation(subField));
435
452
  }
@@ -502,7 +519,9 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
502
519
  }
503
520
  ;
504
521
  renderButtons() {
505
- return (h("div", { class: 'registration__buttons-wrapper' }, h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.lastStep === this.registrationStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), h("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language))));
522
+ return (h("div", { class: 'registration__buttons-wrapper' }, this.isLoadingPOST
523
+ && h("slot", { name: 'spinner' })
524
+ && h("svg", { class: "spinner", viewBox: "0 0 50 50" }, h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none", "stroke-width": "5" })), !this.isLoadingPOST && h("button", { class: `registration__button registration__button--next ${this.isFormValid ? '' : 'registration__button--disabled'}`, type: 'submit', form: `RegistrationForm${this.registrationStep}`, onClick: (e) => this.nextHandler(e), disabled: !this.isFormValid }, this.lastStep === this.registrationStep ? translate('doneButton', this.language) : translate('nextButton', this.language)), h("button", { class: `registration__button registration__button--back ${this.registrationStep == 'Step1' ? 'registration__button--first-step' : ''}`, onClick: (e) => this.backHandler(e) }, translate('backButton', this.language))));
506
525
  }
507
526
  render() {
508
527
  if (this.isLoading) {
@@ -527,6 +546,7 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
527
546
  "errorMessage": [32],
528
547
  "isFormValid": [32],
529
548
  "isLoading": [32],
549
+ "isLoadingPOST": [32],
530
550
  "registrationStep": [32],
531
551
  "forms": [32],
532
552
  "limitStylingAppends": [32]
@@ -118,7 +118,7 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
118
118
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
119
119
  }
120
120
  return h("div", { class: `number__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'number__wrapper--flex' }, h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'number__wrapper--relative' }, this.tooltip &&
121
- h("img", { class: 'number__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, readOnly: this.autofilled, id: `${this.name}__input`, class: `number__input ${invalidClass}`, pattern: this.validationPattern, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { class: 'number__error-message' }, this.errorMessage));
121
+ h("img", { class: 'number__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, readOnly: this.autofilled, id: `${this.name}__input`, class: `number__input ${invalidClass}`, pattern: this.validationPattern, placeholder: `${this.placeholder}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { class: 'number__error-message' }, this.errorMessage));
122
122
  }
123
123
  static get watchers() { return {
124
124
  "isValid": ["validityChanged"],
@@ -739,7 +739,7 @@ class PasswordField extends TextField {
739
739
 
740
740
  customElements.define(PasswordField.is, PasswordField);
741
741
 
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}";
742
+ const passwordInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.password{font-family:\"Roboto\";font-style:normal}.password__wrapper{position:relative;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{position:absolute;top:calc(100% + 5px);left:0;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}";
743
743
 
744
744
  const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
745
745
  constructor() {
@@ -828,9 +828,6 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
828
828
  if (event.composedPath()[0] !== this.tooltipReference)
829
829
  this.showTooltip = false;
830
830
  }
831
- connectedCallback() {
832
- // this.validationPattern = this.setPattern();
833
- }
834
831
  componentDidRender() {
835
832
  // start custom styling area
836
833
  if (!this.limitStylingAppends && this.stylingContainer) {
@@ -912,7 +909,6 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
912
909
  const passedRules = this.passwordComplexity.filter(complexity => complexity.passed).length;
913
910
  const meterValue = passedRules / totalRules;
914
911
  const allRulesPassed = this.passwordComplexity.every(complexity => complexity.passed);
915
- // if (this.showPopup === false) return;
916
912
  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
913
  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)));
918
914
  }))));
@@ -923,7 +919,7 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
923
919
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
924
920
  }
925
921
  return h("div", { class: `password__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'password__wrapper--flex' }, h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'password__wrapper--relative' }, this.tooltip &&
926
- h("img", { class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("vaadin-password-field", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue, required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: () => this.showPopup = true }), h("small", { class: 'password__error-message' }, this.errorMessage), this.passwordComplexity && !this.isDuplicateInput && this.renderComplexityPopup());
922
+ h("img", { class: 'password__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("vaadin-password-field", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue, required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.placeholder}`, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: () => this.showPopup = true }), h("small", { class: 'password__error-message' }, this.errorMessage), this.passwordComplexity && !this.isDuplicateInput && this.renderComplexityPopup());
927
923
  }
928
924
  get element() { return this; }
929
925
  static get watchers() { return {
@@ -129,7 +129,7 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
129
129
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
130
130
  }
131
131
  return h("div", { class: `select__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'select__wrapper--flex' }, h("label", { class: 'select__label', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`), h("div", { class: 'select__wrapper--relative' }, this.tooltip &&
132
- h("img", { class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, items: this.displayedOptions, onChange: this.handleChange }), h("small", { class: 'select__error-message' }, this.errorMessage));
132
+ h("img", { class: 'select__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleChange }), h("small", { class: 'select__error-message' }, this.errorMessage));
133
133
  }
134
134
  get element() { return this; }
135
135
  static get watchers() { return {
@@ -155,7 +155,7 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
155
155
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
156
156
  }
157
157
  return h("div", { class: `tel__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'tel__wrapper--flex-label' }, h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'tel__wrapper--relative' }, this.tooltip &&
158
- h("img", { class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("div", { class: `tel__wrapper--flex ${invalidClass}` }, h("vaadin-combo-box", { class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.autofilled, onChange: (e) => this.handlePrefixInput(e) }), h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: this.phoneValue, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onInput: this.handleInput, onBlur: this.handleBlur })), h("small", { class: 'tel__error-message' }, this.errorMessage));
158
+ h("img", { class: 'tel__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("div", { class: `tel__wrapper--flex ${invalidClass}` }, h("vaadin-combo-box", { class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.autofilled, onChange: (e) => this.handlePrefixInput(e) }), h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: this.phoneValue, 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("small", { class: 'tel__error-message' }, this.errorMessage));
159
159
  }
160
160
  static get watchers() { return {
161
161
  "isValid": ["validityChanged"],
@@ -157,7 +157,7 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
157
157
  invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
158
158
  }
159
159
  return h("div", { class: `text__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { class: 'text__wrapper--flex' }, h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { class: 'text__wrapper--relative' }, this.tooltip &&
160
- h("img", { class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { name: this.name, id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { class: 'text__error-message' }, this.errorMessage));
160
+ h("img", { class: 'text__tooltip-icon', src: tooltipIconSvg, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { name: this.name, id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.placeholder}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { class: 'text__error-message' }, this.errorMessage));
161
161
  }
162
162
  static get watchers() { return {
163
163
  "isValid": ["validityChanged"],
@@ -2,6 +2,7 @@ const DEFAULT_LANGUAGE = 'en';
2
2
  const TRANSLATIONS = {
3
3
  "en": {
4
4
  "dateError": 'The selected date should be between {min} and {max}',
5
+ "dateError2": 'The selected date is not within the accepted range',
5
6
  "numberLengthError": 'The number should be between {min} and {max}',
6
7
  "lengthError": `The length should be between {minLength} and {maxLength}`,
7
8
  "requiredError": 'This input is required.',
@@ -15,6 +16,7 @@ const TRANSLATIONS = {
15
16
  "MustIncludeNumber": "include a number",
16
17
  "MustContainCapital": "contain capital letters",
17
18
  "MustIncludePunctation": "punctuation",
19
+ "OnlyNumbers": "Should contains only numbers."
18
20
  },
19
21
  "hu": {
20
22
  "dateError": 'A választott dátumnak {min} és {max} között kell lennie',
@@ -30,7 +32,8 @@ const TRANSLATIONS = {
30
32
  "PasswordNotMatching": "A jelszavak nem egyeznek",
31
33
  "MustIncludeNumber": "tartalmaznia kell egy számot",
32
34
  "MustContainCapital": "nagybetűket kell tartalmaznia",
33
- "MustIncludePunctation": "írásjelet"
35
+ "MustIncludePunctation": "írásjelet",
36
+ "OnlyNumbers": "Csak számokat kell tartalmaznia."
34
37
  }
35
38
  };
36
39
  const translate = (key, customLang, values) => {