@everymatrix/general-registration 1.10.16 → 1.10.17

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.
@@ -7,18 +7,15 @@ const index = require('./index-a69a5278.js');
7
7
  const DEFAULT_LANGUAGE$1 = 'en';
8
8
  const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
9
9
  const TRANSLATIONS$1 = {
10
- en: {
11
- dateError: 'The selected date should be between {min} and {max}',
12
- numberLengthError: 'The number should be between {min} and {max}',
13
- lengthError: `The length should be between {minLength} and {maxLength}`,
14
- requiredError: 'This input is required.',
15
- nextButton: 'Next',
16
- backButton: 'Back',
17
- doneButton: 'Done'
10
+ "en": {
11
+ "dateError": 'The selected date should be between {min} and {max}',
12
+ "numberLengthError": 'The number should be between {min} and {max}',
13
+ "lengthError": `The length should be between {minLength} and {maxLength}`,
14
+ "requiredError": 'This input is required.',
18
15
  },
19
- ro: {
20
- lengthError: `Cuvântul introdus este prea scurt. {minLength} and {maxLength}`,
21
- requiredError: 'Acest câmp este obligatoriu.'
16
+ "ro": {
17
+ "lengthError": `Cuvântul introdus este prea scurt. {minLength} and {maxLength}`,
18
+ "requiredError": 'Acest câmp este obligatoriu.'
22
19
  }
23
20
  };
24
21
  const translate$2 = (key, customLang, values) => {
@@ -80,8 +77,6 @@ const CheckboxInput = class {
80
77
  this.limitStylingAppends = true;
81
78
  }
82
79
  // end custom styling area
83
- }
84
- componentDidLoad() {
85
80
  if (this.defaultValue) {
86
81
  this.value = this.defaultValue;
87
82
  this.valueHandler({ name: this.name, value: this.value });
@@ -102,8 +97,11 @@ const CheckboxInput = class {
102
97
  return translate$2('requiredError', this.language);
103
98
  }
104
99
  }
100
+ renderLabel() {
101
+ return (index.h("label", { class: 'checkbox__label', htmlFor: `${this.name}__input` }, index.h("div", { innerHTML: `${this.displayName} ${this.validation.mandatory ? '*' : ''}` })));
102
+ }
105
103
  render() {
106
- return index.h("div", { class: 'checkbox__wrapper', ref: el => this.stylingContainer = el }, index.h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, checked: this.defaultValue == "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), index.h("label", { class: 'checkbox__label', htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), index.h("small", { class: 'checkbox__error-message' }, this.errorMessage));
104
+ return index.h("div", { class: 'checkbox__wrapper', ref: el => this.stylingContainer = el }, index.h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, checked: this.defaultValue == "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), this.renderLabel(), index.h("small", { class: 'checkbox__error-message' }, this.errorMessage));
107
105
  }
108
106
  static get watchers() { return {
109
107
  "isValid": ["validityChanged"],
@@ -23097,14 +23095,14 @@ const DateInput = class {
23097
23095
  this.limitStylingAppends = true;
23098
23096
  }
23099
23097
  // end custom styling area
23100
- }
23101
- componentDidLoad() {
23102
- this.inputReference = this.element.shadowRoot.querySelector('input');
23103
23098
  if (this.defaultValue) {
23104
23099
  this.value = this.defaultValue;
23105
23100
  this.valueHandler({ name: this.name, value: this.value });
23106
23101
  }
23107
23102
  }
23103
+ componentDidLoad() {
23104
+ this.inputReference = this.element.shadowRoot.querySelector('input');
23105
+ }
23108
23106
  handleInput(event) {
23109
23107
  this.value = event.target.value;
23110
23108
  this.errorMessage = this.setErrorMessage();
@@ -23189,8 +23187,6 @@ const EmailInput = class {
23189
23187
  this.limitStylingAppends = true;
23190
23188
  }
23191
23189
  // end custom styling area
23192
- }
23193
- componentDidLoad() {
23194
23190
  if (this.defaultValue) {
23195
23191
  this.value = this.defaultValue;
23196
23192
  this.valueHandler({ name: this.name, value: this.value });
@@ -23283,18 +23279,16 @@ GeneralInput.style = generalInputCss;
23283
23279
  const DEFAULT_LANGUAGE = 'en';
23284
23280
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
23285
23281
  const TRANSLATIONS = {
23286
- en: {
23287
- dateError: 'The selected date should be between {min} and {max}',
23288
- numberLengthError: 'The number should be between {min} and {max}',
23289
- lengthError: `The length should be between {minLength} and {maxLength}`,
23290
- requiredError: 'This input is required.',
23291
- nextButton: 'Next',
23292
- backButton: 'Back',
23293
- doneButton: 'Done'
23294
- },
23295
- ro: {
23296
- lengthError: `Cuvântul introdus este prea scurt. {minLength} and {maxLength}`,
23297
- requiredError: 'Acest câmp este obligatoriu.'
23282
+ "en": {
23283
+ "nextButton": 'Next',
23284
+ "backButton": 'Back',
23285
+ "doneButton": 'Done',
23286
+ "GmErr_BadRequest_Duplicate_User": 'A user with this information already exists.',
23287
+ "GmErr_BadRequest_ModelValidationFailed": 'Something went wrong... Please try again.',
23288
+ "GmErr_BadInternalConfigs": 'Something went wrong... Please try again.',
23289
+ "GmErr_Unauthorized": 'Something went wrong... Please try again.',
23290
+ "GmErr_NotFound": 'Something went wrong... Please try again.',
23291
+ "GmErr_UnexpectedException": 'Something went wrong... Please try again.',
23298
23292
  }
23299
23293
  };
23300
23294
  const translate = (key, customLang, values) => {
@@ -23309,7 +23303,7 @@ const translate = (key, customLang, values) => {
23309
23303
  return translation;
23310
23304
  };
23311
23305
 
23312
- const generalRegistrationCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\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__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: row-reverse;\n justify-content: space-around;\n align-items: center;\n}\n.registration__button {\n text-transform: uppercase;\n width: 250px;\n height: 40px;\n border-radius: 3px;\n}\n.registration__button:hover {\n opacity: 0.8;\n}\n.registration__button:active {\n opacity: 1;\n}\n.registration__button--next {\n color: #FFFFFF;\n background-color: #B0B0B0;\n border: none;\n}\n.registration__button--back {\n color: #B0B0B0;\n background-color: #FFFFFF;\n border: 2px solid #B0B0B0;\n}\n.registration__button--disabled {\n opacity: 0.5;\n}\n.registration__button--disabled:hover {\n opacity: 0.5;\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: column;\n gap: 15px;\n }\n}";
23306
+ const generalRegistrationCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\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 text-transform: uppercase;\n width: 250px;\n height: 40px;\n border-radius: 3px;\n}\n.registration__button:hover {\n opacity: 0.8;\n}\n.registration__button:active {\n opacity: 1;\n}\n.registration__button--next {\n color: #FFFFFF;\n background-color: #B0B0B0;\n border: none;\n}\n.registration__button--back {\n color: #B0B0B0;\n background-color: #FFFFFF;\n border: 2px solid #B0B0B0;\n}\n.registration__button--disabled {\n opacity: 0.5;\n}\n.registration__button--disabled:hover {\n opacity: 0.5;\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}";
23313
23307
 
23314
23308
  const GeneralRegistration = class {
23315
23309
  constructor(hostRef) {
@@ -23363,6 +23357,7 @@ const GeneralRegistration = class {
23363
23357
  window.postMessage({ type: 'registrationStepUpdated', step: this.registrationStep }, window.location.href);
23364
23358
  }
23365
23359
  setFormValidity() {
23360
+ this.errorMessage = '';
23366
23361
  this.isFormValid = !this.getInvalidStatus(this.listOfInputs);
23367
23362
  }
23368
23363
  checkInputsValidityHandler(event) {
@@ -23435,7 +23430,6 @@ const GeneralRegistration = class {
23435
23430
  }
23436
23431
  if (state.type == 'values') {
23437
23432
  const savedValues = savedUserData[this.registrationStep].registerUserData;
23438
- console.log(savedValues);
23439
23433
  this.listOfInputValues = Object.keys(savedValues).map(name => {
23440
23434
  return { name, value: savedValues[name].value, isDuplicate: savedValues[name].isDuplicate };
23441
23435
  });
@@ -23506,8 +23500,20 @@ const GeneralRegistration = class {
23506
23500
  };
23507
23501
  fetch(url.href, options)
23508
23502
  .then((res) => {
23509
- if (res.status >= 300) {
23510
- throw new Error('err');
23503
+ if (!res.ok) {
23504
+ return res.json().then(error => {
23505
+ this.errorCode = error.thirdPartyResponse.errorCode;
23506
+ // Show the idomsoft error if it is the case
23507
+ if (this.errorCode == 'GmErr_BadRequest_IdomsoftVerification_ShouldRetry') {
23508
+ this.errorMessage = error.thirdPartyResponse.message;
23509
+ }
23510
+ else if (this.errorCode == 'GmErr_BadRequest') {
23511
+ this.errorMessage = error.thirdPartyResponse.message;
23512
+ }
23513
+ else {
23514
+ this.errorMessage = translate(`${this.errorCode}`, this.language) || this.errorCode;
23515
+ }
23516
+ });
23511
23517
  }
23512
23518
  return res.json();
23513
23519
  })
@@ -23533,6 +23539,8 @@ const GeneralRegistration = class {
23533
23539
  this.stepsStateMachine({ event: 'set', type: 'inputs' });
23534
23540
  });
23535
23541
  }
23542
+ // Set it in local storage.
23543
+ this.stepsStateMachine({ event: 'set', type: 'inputs' });
23536
23544
  }
23537
23545
  })
23538
23546
  .catch((err) => {
@@ -23644,7 +23652,7 @@ const GeneralRegistration = class {
23644
23652
  if (this.isLoading) {
23645
23653
  return index.h("p", null, "Please wait, loading ...");
23646
23654
  }
23647
- return (index.h("div", { class: `registration registration__${this.registrationStep}`, ref: el => this.stylingContainer = el }, index.h("form", { action: '.', id: 'RegistrationForm', class: 'registration__form' }, this.renderInputs()), this.renderButtons()));
23655
+ return (index.h("div", { class: `registration registration__${this.registrationStep}`, ref: el => this.stylingContainer = el }, index.h("form", { action: '.', id: 'RegistrationForm', class: 'registration__form' }, this.renderInputs()), index.h("p", { class: 'registration__error-message' }, this.errorMessage), this.renderButtons()));
23648
23656
  }
23649
23657
  static get watchers() { return {
23650
23658
  "registrationStep": ["sendStep"],
@@ -23665,6 +23673,7 @@ const NumberInput = class {
23665
23673
  */
23666
23674
  this.clientStyling = '';
23667
23675
  this.limitStylingAppends = false;
23676
+ this.validationPattern = '';
23668
23677
  this.setClientStyling = () => {
23669
23678
  let sheet = document.createElement('style');
23670
23679
  sheet.innerHTML = this.clientStyling;
@@ -23688,6 +23697,9 @@ const NumberInput = class {
23688
23697
  valueHandler(inputValueEvent) {
23689
23698
  this.sendInputValue.emit(inputValueEvent);
23690
23699
  }
23700
+ connectedCallback() {
23701
+ this.validationPattern = this.setPattern();
23702
+ }
23691
23703
  componentDidRender() {
23692
23704
  // start custom styling area
23693
23705
  if (!this.limitStylingAppends && this.stylingContainer) {
@@ -23696,8 +23708,6 @@ const NumberInput = class {
23696
23708
  this.limitStylingAppends = true;
23697
23709
  }
23698
23710
  // end custom styling area
23699
- }
23700
- componentDidLoad() {
23701
23711
  if (this.defaultValue) {
23702
23712
  this.value = this.defaultValue;
23703
23713
  this.valueHandler({ name: this.name, value: this.value });
@@ -23713,7 +23723,17 @@ const NumberInput = class {
23713
23723
  setValidity() {
23714
23724
  return this.inputReference.validity.valid;
23715
23725
  }
23726
+ setPattern() {
23727
+ var _a, _b;
23728
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
23729
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
23730
+ }
23731
+ }
23716
23732
  setErrorMessage() {
23733
+ var _a;
23734
+ if (this.inputReference.validity.patternMismatch) {
23735
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
23736
+ }
23717
23737
  if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
23718
23738
  return translate$2('numberLengthError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
23719
23739
  }
@@ -23723,7 +23743,7 @@ const NumberInput = class {
23723
23743
  }
23724
23744
  render() {
23725
23745
  const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'number__input--invalid';
23726
- return index.h("div", { class: 'number__wrapper', ref: el => this.stylingContainer = el }, index.h("input", { ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, readOnly: this.autofilled, id: `${this.name}__input`, class: `number__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onBlur: (e) => this.handleInput(e) }), index.h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'number__error-message' }, this.errorMessage));
23746
+ return index.h("div", { class: 'number__wrapper', ref: el => this.stylingContainer = el }, index.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.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onBlur: (e) => this.handleInput(e) }), index.h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'number__error-message' }, this.errorMessage));
23727
23747
  }
23728
23748
  static get watchers() { return {
23729
23749
  "isValid": ["validityChanged"],
@@ -24586,14 +24606,14 @@ const PasswordInput = class {
24586
24606
  this.limitStylingAppends = true;
24587
24607
  }
24588
24608
  // end custom styling area
24589
- }
24590
- componentDidLoad() {
24591
- this.inputReference = this.element.shadowRoot.querySelector('input');
24592
24609
  if (this.defaultValue) {
24593
24610
  this.value = this.defaultValue;
24594
24611
  this.valueHandler({ name: this.name, value: this.value });
24595
24612
  }
24596
24613
  }
24614
+ componentDidLoad() {
24615
+ this.inputReference = this.element.shadowRoot.querySelector('input');
24616
+ }
24597
24617
  handleInput(event) {
24598
24618
  this.value = event.target.value;
24599
24619
  this.errorMessage = this.setErrorMessage();
@@ -29114,14 +29134,14 @@ const SelectInput = class {
29114
29134
  this.limitStylingAppends = true;
29115
29135
  }
29116
29136
  // end custom styling area
29117
- }
29118
- componentDidLoad() {
29119
- this.inputReference = this.element.shadowRoot.querySelector('input');
29120
29137
  if (this.defaultValue) {
29121
29138
  this.value = this.defaultValue;
29122
29139
  this.valueHandler({ name: this.name, value: this.value });
29123
29140
  }
29124
29141
  }
29142
+ componentDidLoad() {
29143
+ this.inputReference = this.element.shadowRoot.querySelector('input');
29144
+ }
29125
29145
  getOptions() {
29126
29146
  // TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
29127
29147
  const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/countries");
@@ -29225,8 +29245,6 @@ const TelInput = class {
29225
29245
  this.limitStylingAppends = true;
29226
29246
  }
29227
29247
  // end custom styling area
29228
- }
29229
- componentDidLoad() {
29230
29248
  if (this.defaultValue) {
29231
29249
  this.value = `${this.prefixValue}|${this.phoneValue}`;
29232
29250
  this.valueHandler({ name: this.name, value: this.value });
@@ -29277,7 +29295,7 @@ const TelInput = class {
29277
29295
  }
29278
29296
  render() {
29279
29297
  const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__wrapper--flex--invalid';
29280
- return index.h("div", { class: 'tel__wrapper', ref: el => this.stylingContainer = el }, index.h("div", { class: `tel__wrapper--flex ${invalidClass}` }, index.h("vaadin-combo-box", { class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.autofilled, onBlur: (e) => this.prefixValue = e.target.value }), index.h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: this.phoneValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onBlur: (e) => this.handleInput(e) })), index.h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'tel__error-message' }, this.errorMessage));
29298
+ return index.h("div", { class: 'tel__wrapper', ref: el => this.stylingContainer = el }, index.h("div", { class: `tel__wrapper--flex ${invalidClass}` }, index.h("vaadin-combo-box", { class: 'tel__prefix', items: this.phoneCodesOptions, value: this.prefixValue, readOnly: this.autofilled, onChange: (e) => this.prefixValue = e.target.value }), index.h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input`, value: this.phoneValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onBlur: (e) => this.handleInput(e) })), index.h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), index.h("small", { class: 'tel__error-message' }, this.errorMessage));
29281
29299
  }
29282
29300
  static get watchers() { return {
29283
29301
  "isValid": ["validityChanged"],
@@ -29346,8 +29364,6 @@ const TextInput = class {
29346
29364
  this.limitStylingAppends = true;
29347
29365
  }
29348
29366
  // end custom styling area
29349
- }
29350
- componentDidLoad() {
29351
29367
  if (this.defaultValue) {
29352
29368
  this.value = this.defaultValue;
29353
29369
  this.valueHandler({ name: this.name, value: this.value });
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["checkbox-input_11.cjs",[[1,"general-registration",{"endpoint":[513],"language":[513],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationsUrl":[513,"translations-url"],"errorMessage":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[513],"name":[513],"displayName":[513,"display-name"],"action":[513],"validation":[16],"options":[520],"language":[513],"autofilled":[516],"defaultValue":[520,"default-value"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[520,"client-styling"]}],[1,"checkbox-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"date-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"email-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]],[1,"number-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"password-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]],[1,"radio-input",{"name":[513],"displayName":[513,"display-name"],"optionsGroup":[16],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"select-input",{"name":[513],"displayName":[513,"display-name"],"action":[513],"defaultValue":[513,"default-value"],"autofilled":[516],"options":[16],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"tel-input",{"name":[513],"displayName":[513,"display-name"],"showLabels":[516,"show-labels"],"action":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]}],[1,"text-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"rules":[513],"language":[513],"checkValidity":[516,"check-validity"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]]]]], options);
18
+ return index.bootstrapLazy([["checkbox-input_11.cjs",[[1,"general-registration",{"endpoint":[513],"language":[513],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationsUrl":[513,"translations-url"],"errorMessage":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[513],"name":[513],"displayName":[513,"display-name"],"action":[513],"validation":[16],"options":[520],"language":[513],"autofilled":[516],"defaultValue":[520,"default-value"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[520,"client-styling"]}],[1,"checkbox-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"date-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"email-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]],[1,"number-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"password-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]],[1,"radio-input",{"name":[513],"displayName":[513,"display-name"],"optionsGroup":[16],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"select-input",{"name":[513],"displayName":[513,"display-name"],"action":[513],"defaultValue":[513,"default-value"],"autofilled":[516],"options":[16],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"tel-input",{"name":[513],"displayName":[513,"display-name"],"showLabels":[516,"show-labels"],"action":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]}],[1,"text-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"checkValidity":[516,"check-validity"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]]]]], options);
19
19
  });
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["checkbox-input_11.cjs",[[1,"general-registration",{"endpoint":[513],"language":[513],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationsUrl":[513,"translations-url"],"errorMessage":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[513],"name":[513],"displayName":[513,"display-name"],"action":[513],"validation":[16],"options":[520],"language":[513],"autofilled":[516],"defaultValue":[520,"default-value"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[520,"client-styling"]}],[1,"checkbox-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"date-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"email-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]],[1,"number-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"password-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]],[1,"radio-input",{"name":[513],"displayName":[513,"display-name"],"optionsGroup":[16],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"select-input",{"name":[513],"displayName":[513,"display-name"],"action":[513],"defaultValue":[513,"default-value"],"autofilled":[516],"options":[16],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"tel-input",{"name":[513],"displayName":[513,"display-name"],"showLabels":[516,"show-labels"],"action":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]}],[1,"text-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"rules":[513],"language":[513],"checkValidity":[516,"check-validity"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]]]]], options);
17
+ return index.bootstrapLazy([["checkbox-input_11.cjs",[[1,"general-registration",{"endpoint":[513],"language":[513],"clientStyling":[1537,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationsUrl":[513,"translations-url"],"errorMessage":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[513],"name":[513],"displayName":[513,"display-name"],"action":[513],"validation":[16],"options":[520],"language":[513],"autofilled":[516],"defaultValue":[520,"default-value"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[520,"client-styling"]}],[1,"checkbox-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"date-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"email-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]],[1,"number-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"password-input",{"name":[513],"displayName":[513,"display-name"],"defaultValue":[513,"default-value"],"autofilled":[516],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]],[1,"radio-input",{"name":[513],"displayName":[513,"display-name"],"optionsGroup":[16],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"select-input",{"name":[513],"displayName":[513,"display-name"],"action":[513],"defaultValue":[513,"default-value"],"autofilled":[516],"options":[16],"validation":[16],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"errorMessage":[32],"isValid":[32],"limitStylingAppends":[32]}],[1,"tel-input",{"name":[513],"displayName":[513,"display-name"],"showLabels":[516,"show-labels"],"action":[513],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"emitValue":[516,"emit-value"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]}],[1,"text-input",{"name":[513],"displayName":[513,"display-name"],"validation":[16],"defaultValue":[513,"default-value"],"autofilled":[516],"language":[513],"checkValidity":[516,"check-validity"],"emitValue":[516,"emit-value"],"isDuplicateInput":[516,"is-duplicate-input"],"clientStyling":[513,"client-styling"],"isValid":[32],"errorMessage":[32],"limitStylingAppends":[32]},[[16,"sendInputValue","valueChangedHandler"]]]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -17,6 +17,9 @@
17
17
  height: 100%;
18
18
  container-type: inline-size;
19
19
  }
20
+ .registration__error-message {
21
+ color: #cc0000b3;
22
+ }
20
23
  .registration__form {
21
24
  display: grid;
22
25
  grid-template-columns: repeat(1, 1fr);
@@ -29,7 +32,7 @@
29
32
  }
30
33
  .registration__buttons-wrapper {
31
34
  display: flex;
32
- flex-direction: row-reverse;
35
+ flex-direction: column;
33
36
  justify-content: space-around;
34
37
  align-items: center;
35
38
  }
@@ -71,7 +74,7 @@
71
74
  }
72
75
 
73
76
  .registration__buttons-wrapper {
74
- flex-direction: column;
77
+ flex-direction: row-reverse;
75
78
  gap: 15px;
76
79
  }
77
80
  }
@@ -1,5 +1,5 @@
1
1
  import { Component, h, Listen, Prop, State, Watch, Event } from '@stencil/core';
2
- import { translate } from '../../../../general-input/src/utils/locale.utils';
2
+ import { translate } from '../../utils/locale.utils';
3
3
  import '@everymatrix/general-input';
4
4
  export class GeneralRegistration {
5
5
  constructor() {
@@ -50,6 +50,7 @@ export class GeneralRegistration {
50
50
  window.postMessage({ type: 'registrationStepUpdated', step: this.registrationStep }, window.location.href);
51
51
  }
52
52
  setFormValidity() {
53
+ this.errorMessage = '';
53
54
  this.isFormValid = !this.getInvalidStatus(this.listOfInputs);
54
55
  }
55
56
  checkInputsValidityHandler(event) {
@@ -122,7 +123,6 @@ export class GeneralRegistration {
122
123
  }
123
124
  if (state.type == 'values') {
124
125
  const savedValues = savedUserData[this.registrationStep].registerUserData;
125
- console.log(savedValues);
126
126
  this.listOfInputValues = Object.keys(savedValues).map(name => {
127
127
  return { name, value: savedValues[name].value, isDuplicate: savedValues[name].isDuplicate };
128
128
  });
@@ -193,8 +193,20 @@ export class GeneralRegistration {
193
193
  };
194
194
  fetch(url.href, options)
195
195
  .then((res) => {
196
- if (res.status >= 300) {
197
- throw new Error('err');
196
+ if (!res.ok) {
197
+ return res.json().then(error => {
198
+ this.errorCode = error.thirdPartyResponse.errorCode;
199
+ // Show the idomsoft error if it is the case
200
+ if (this.errorCode == 'GmErr_BadRequest_IdomsoftVerification_ShouldRetry') {
201
+ this.errorMessage = error.thirdPartyResponse.message;
202
+ }
203
+ else if (this.errorCode == 'GmErr_BadRequest') {
204
+ this.errorMessage = error.thirdPartyResponse.message;
205
+ }
206
+ else {
207
+ this.errorMessage = translate(`${this.errorCode}`, this.language) || this.errorCode;
208
+ }
209
+ });
198
210
  }
199
211
  return res.json();
200
212
  })
@@ -220,6 +232,8 @@ export class GeneralRegistration {
220
232
  this.stepsStateMachine({ event: 'set', type: 'inputs' });
221
233
  });
222
234
  }
235
+ // Set it in local storage.
236
+ this.stepsStateMachine({ event: 'set', type: 'inputs' });
223
237
  }
224
238
  })
225
239
  .catch((err) => {
@@ -335,6 +349,7 @@ export class GeneralRegistration {
335
349
  }
336
350
  return (h("div", { class: `registration registration__${this.registrationStep}`, ref: el => this.stylingContainer = el },
337
351
  h("form", { action: '.', id: 'RegistrationForm', class: 'registration__form' }, this.renderInputs()),
352
+ h("p", { class: 'registration__error-message' }, this.errorMessage),
338
353
  this.renderButtons()));
339
354
  }
340
355
  static get is() { return "general-registration"; }
@@ -1,20 +1,33 @@
1
1
  const DEFAULT_LANGUAGE = 'en';
2
2
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
3
3
  const TRANSLATIONS = {
4
- en: {
5
- dateError: 'The selected date should be between {min} and {max}',
6
- numberLengthError: 'The number should be between {min} and {max}',
7
- lengthError: `The length should be between {minLength} and {maxLength}`,
8
- requiredError: 'This input is required.',
9
- nextButton: 'Next',
10
- backButton: 'Back',
11
- doneButton: 'Done'
12
- },
13
- ro: {
14
- lengthError: `Cuvântul introdus este prea scurt. {minLength} and {maxLength}`,
15
- requiredError: 'Acest câmp este obligatoriu.'
4
+ "en": {
5
+ "nextButton": 'Next',
6
+ "backButton": 'Back',
7
+ "doneButton": 'Done',
8
+ "GmErr_BadRequest_Duplicate_User": 'A user with this information already exists.',
9
+ "GmErr_BadRequest_ModelValidationFailed": 'Something went wrong... Please try again.',
10
+ "GmErr_BadInternalConfigs": 'Something went wrong... Please try again.',
11
+ "GmErr_Unauthorized": 'Something went wrong... Please try again.',
12
+ "GmErr_NotFound": 'Something went wrong... Please try again.',
13
+ "GmErr_UnexpectedException": 'Something went wrong... Please try again.',
16
14
  }
17
15
  };
16
+ export const getTranslations = (url) => {
17
+ // fetch url, get the data, replace the TRANSLATIONS content
18
+ return new Promise((resolve) => {
19
+ fetch(url)
20
+ .then((res) => res.json())
21
+ .then((data) => {
22
+ Object.keys(data).forEach((item) => {
23
+ for (let key in data[item]) {
24
+ TRANSLATIONS[item][key] = data[item][key];
25
+ }
26
+ });
27
+ resolve(true);
28
+ });
29
+ });
30
+ };
18
31
  export const translate = (key, customLang, values) => {
19
32
  const lang = customLang;
20
33
  let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
@@ -50,8 +50,6 @@ const CheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
50
50
  this.limitStylingAppends = true;
51
51
  }
52
52
  // end custom styling area
53
- }
54
- componentDidLoad() {
55
53
  if (this.defaultValue) {
56
54
  this.value = this.defaultValue;
57
55
  this.valueHandler({ name: this.name, value: this.value });
@@ -72,8 +70,11 @@ const CheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
72
70
  return translate('requiredError', this.language);
73
71
  }
74
72
  }
73
+ renderLabel() {
74
+ return (h("label", { class: 'checkbox__label', htmlFor: `${this.name}__input` }, h("div", { innerHTML: `${this.displayName} ${this.validation.mandatory ? '*' : ''}` })));
75
+ }
75
76
  render() {
76
- return h("div", { class: 'checkbox__wrapper', ref: el => this.stylingContainer = el }, h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, checked: this.defaultValue == "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }), h("label", { class: 'checkbox__label', htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), h("small", { class: 'checkbox__error-message' }, this.errorMessage));
77
+ return h("div", { class: 'checkbox__wrapper', ref: el => this.stylingContainer = el }, h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = 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: 'checkbox__error-message' }, this.errorMessage));
77
78
  }
78
79
  static get watchers() { return {
79
80
  "isValid": ["validityChanged"],
@@ -5097,14 +5097,14 @@ const DateInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
5097
5097
  this.limitStylingAppends = true;
5098
5098
  }
5099
5099
  // end custom styling area
5100
- }
5101
- componentDidLoad() {
5102
- this.inputReference = this.element.shadowRoot.querySelector('input');
5103
5100
  if (this.defaultValue) {
5104
5101
  this.value = this.defaultValue;
5105
5102
  this.valueHandler({ name: this.name, value: this.value });
5106
5103
  }
5107
5104
  }
5105
+ componentDidLoad() {
5106
+ this.inputReference = this.element.shadowRoot.querySelector('input');
5107
+ }
5108
5108
  handleInput(event) {
5109
5109
  this.value = event.target.value;
5110
5110
  this.errorMessage = this.setErrorMessage();
@@ -57,8 +57,6 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
57
57
  this.limitStylingAppends = true;
58
58
  }
59
59
  // end custom styling area
60
- }
61
- componentDidLoad() {
62
60
  if (this.defaultValue) {
63
61
  this.value = this.defaultValue;
64
62
  this.valueHandler({ name: this.name, value: this.value });
@@ -13,18 +13,16 @@ import { d as defineCustomElement$2 } from './text-input2.js';
13
13
  const DEFAULT_LANGUAGE = 'en';
14
14
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
15
15
  const TRANSLATIONS = {
16
- en: {
17
- dateError: 'The selected date should be between {min} and {max}',
18
- numberLengthError: 'The number should be between {min} and {max}',
19
- lengthError: `The length should be between {minLength} and {maxLength}`,
20
- requiredError: 'This input is required.',
21
- nextButton: 'Next',
22
- backButton: 'Back',
23
- doneButton: 'Done'
24
- },
25
- ro: {
26
- lengthError: `Cuvântul introdus este prea scurt. {minLength} and {maxLength}`,
27
- requiredError: 'Acest câmp este obligatoriu.'
16
+ "en": {
17
+ "nextButton": 'Next',
18
+ "backButton": 'Back',
19
+ "doneButton": 'Done',
20
+ "GmErr_BadRequest_Duplicate_User": 'A user with this information already exists.',
21
+ "GmErr_BadRequest_ModelValidationFailed": 'Something went wrong... Please try again.',
22
+ "GmErr_BadInternalConfigs": 'Something went wrong... Please try again.',
23
+ "GmErr_Unauthorized": 'Something went wrong... Please try again.',
24
+ "GmErr_NotFound": 'Something went wrong... Please try again.',
25
+ "GmErr_UnexpectedException": 'Something went wrong... Please try again.',
28
26
  }
29
27
  };
30
28
  const translate = (key, customLang, values) => {
@@ -39,7 +37,7 @@ const translate = (key, customLang, values) => {
39
37
  return translation;
40
38
  };
41
39
 
42
- const generalRegistrationCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\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__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: row-reverse;\n justify-content: space-around;\n align-items: center;\n}\n.registration__button {\n text-transform: uppercase;\n width: 250px;\n height: 40px;\n border-radius: 3px;\n}\n.registration__button:hover {\n opacity: 0.8;\n}\n.registration__button:active {\n opacity: 1;\n}\n.registration__button--next {\n color: #FFFFFF;\n background-color: #B0B0B0;\n border: none;\n}\n.registration__button--back {\n color: #B0B0B0;\n background-color: #FFFFFF;\n border: 2px solid #B0B0B0;\n}\n.registration__button--disabled {\n opacity: 0.5;\n}\n.registration__button--disabled:hover {\n opacity: 0.5;\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: column;\n gap: 15px;\n }\n}";
40
+ const generalRegistrationCss = "*,\n*::before,\n*::after {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\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 text-transform: uppercase;\n width: 250px;\n height: 40px;\n border-radius: 3px;\n}\n.registration__button:hover {\n opacity: 0.8;\n}\n.registration__button:active {\n opacity: 1;\n}\n.registration__button--next {\n color: #FFFFFF;\n background-color: #B0B0B0;\n border: none;\n}\n.registration__button--back {\n color: #B0B0B0;\n background-color: #FFFFFF;\n border: 2px solid #B0B0B0;\n}\n.registration__button--disabled {\n opacity: 0.5;\n}\n.registration__button--disabled:hover {\n opacity: 0.5;\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}";
43
41
 
44
42
  const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
45
43
  constructor() {
@@ -95,6 +93,7 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
95
93
  window.postMessage({ type: 'registrationStepUpdated', step: this.registrationStep }, window.location.href);
96
94
  }
97
95
  setFormValidity() {
96
+ this.errorMessage = '';
98
97
  this.isFormValid = !this.getInvalidStatus(this.listOfInputs);
99
98
  }
100
99
  checkInputsValidityHandler(event) {
@@ -167,7 +166,6 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
167
166
  }
168
167
  if (state.type == 'values') {
169
168
  const savedValues = savedUserData[this.registrationStep].registerUserData;
170
- console.log(savedValues);
171
169
  this.listOfInputValues = Object.keys(savedValues).map(name => {
172
170
  return { name, value: savedValues[name].value, isDuplicate: savedValues[name].isDuplicate };
173
171
  });
@@ -238,8 +236,20 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
238
236
  };
239
237
  fetch(url.href, options)
240
238
  .then((res) => {
241
- if (res.status >= 300) {
242
- throw new Error('err');
239
+ if (!res.ok) {
240
+ return res.json().then(error => {
241
+ this.errorCode = error.thirdPartyResponse.errorCode;
242
+ // Show the idomsoft error if it is the case
243
+ if (this.errorCode == 'GmErr_BadRequest_IdomsoftVerification_ShouldRetry') {
244
+ this.errorMessage = error.thirdPartyResponse.message;
245
+ }
246
+ else if (this.errorCode == 'GmErr_BadRequest') {
247
+ this.errorMessage = error.thirdPartyResponse.message;
248
+ }
249
+ else {
250
+ this.errorMessage = translate(`${this.errorCode}`, this.language) || this.errorCode;
251
+ }
252
+ });
243
253
  }
244
254
  return res.json();
245
255
  })
@@ -265,6 +275,8 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
265
275
  this.stepsStateMachine({ event: 'set', type: 'inputs' });
266
276
  });
267
277
  }
278
+ // Set it in local storage.
279
+ this.stepsStateMachine({ event: 'set', type: 'inputs' });
268
280
  }
269
281
  })
270
282
  .catch((err) => {
@@ -376,7 +388,7 @@ const GeneralRegistration$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
376
388
  if (this.isLoading) {
377
389
  return h("p", null, "Please wait, loading ...");
378
390
  }
379
- return (h("div", { class: `registration registration__${this.registrationStep}`, ref: el => this.stylingContainer = el }, h("form", { action: '.', id: 'RegistrationForm', class: 'registration__form' }, this.renderInputs()), this.renderButtons()));
391
+ return (h("div", { class: `registration registration__${this.registrationStep}`, ref: el => this.stylingContainer = el }, h("form", { action: '.', id: 'RegistrationForm', class: 'registration__form' }, this.renderInputs()), h("p", { class: 'registration__error-message' }, this.errorMessage), this.renderButtons()));
380
392
  }
381
393
  static get watchers() { return {
382
394
  "registrationStep": ["sendStep"],