@everymatrix/general-registration 1.10.4 → 1.10.5

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.
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-9a07d1e9.js');
5
+ const index = require('./index-ad0df8ea.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE$1 = 'en';
8
8
  const SUPPORTED_LANGUAGES$1 = ['ro', 'en'];
9
9
  const TRANSLATIONS$1 = {
10
10
  en: {
11
11
  dateError: 'The selected date should be between {min} and {max}',
12
- numberLengthError: 'The number should be between ${min} and ${max}',
12
+ numberLengthError: 'The number should be between {min} and {max}',
13
13
  lengthError: `The length should be between {minLength} and {maxLength}`,
14
14
  requiredError: 'This input is required.',
15
15
  nextButton: 'Next',
@@ -62,6 +62,12 @@ const CheckboxInput = class {
62
62
  valueHandler(inputValueEvent) {
63
63
  this.sendInputValue.emit(inputValueEvent);
64
64
  }
65
+ componentDidLoad() {
66
+ if (this.defaultValue) {
67
+ this.value = this.defaultValue;
68
+ this.valueHandler({ name: this.name, value: this.value });
69
+ }
70
+ }
65
71
  handleClick() {
66
72
  this.value = this.inputReference.checked.toString();
67
73
  this.errorMessage = this.setErrorMessage();
@@ -23056,6 +23062,10 @@ const DateInput = class {
23056
23062
  }
23057
23063
  componentDidLoad() {
23058
23064
  this.inputReference = this.element.shadowRoot.querySelector('input');
23065
+ if (this.defaultValue) {
23066
+ this.value = this.defaultValue;
23067
+ this.valueHandler({ name: this.name, value: this.value });
23068
+ }
23059
23069
  }
23060
23070
  handleInput(event) {
23061
23071
  this.value = event.target.value;
@@ -23115,6 +23125,12 @@ const EmailInput = class {
23115
23125
  connectedCallback() {
23116
23126
  this.validationPattern = this.setPattern();
23117
23127
  }
23128
+ componentDidLoad() {
23129
+ if (this.defaultValue) {
23130
+ this.value = this.defaultValue;
23131
+ this.valueHandler({ name: this.name, value: this.value });
23132
+ }
23133
+ }
23118
23134
  handleInput(event) {
23119
23135
  this.value = event.target.value;
23120
23136
  this.errorMessage = this.setErrorMessage();
@@ -23126,14 +23142,15 @@ const EmailInput = class {
23126
23142
  return this.inputReference.validity.valid;
23127
23143
  }
23128
23144
  setPattern() {
23129
- var _a;
23145
+ var _a, _b;
23130
23146
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
23131
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
23147
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
23132
23148
  }
23133
23149
  }
23134
23150
  setErrorMessage() {
23151
+ var _a;
23135
23152
  if (this.inputReference.validity.patternMismatch) {
23136
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
23153
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
23137
23154
  }
23138
23155
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
23139
23156
  return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -23195,7 +23212,7 @@ const SUPPORTED_LANGUAGES = ['ro', 'en'];
23195
23212
  const TRANSLATIONS = {
23196
23213
  en: {
23197
23214
  dateError: 'The selected date should be between {min} and {max}',
23198
- numberLengthError: 'The number should be between ${min} and ${max}',
23215
+ numberLengthError: 'The number should be between {min} and {max}',
23199
23216
  lengthError: `The length should be between {minLength} and {maxLength}`,
23200
23217
  requiredError: 'This input is required.',
23201
23218
  nextButton: 'Next',
@@ -23459,10 +23476,11 @@ const GeneralRegistration = class {
23459
23476
  this.isFormValid = !this.getInvalidStatus(this.listOfInputs);
23460
23477
  }
23461
23478
  getInputsValueHandler(event) {
23462
- this.listOfInputValues.find(input => input.name == event.detail.name).value = event.detail.value;
23463
- /*Note to self: -- what about the inputs that received a default value.
23464
- They will send an undefined because there was no input
23465
- Handle it somehow!!!!!, one idea can be that value equals defaultValue but dependes on how the api wants stuff*/
23479
+ this.listOfInputValues.find(input => {
23480
+ if (input.name == event.detail.name) {
23481
+ input.value = event.detail.value;
23482
+ }
23483
+ });
23466
23484
  this.stepsStateMachine({ event: 'set', type: 'values' });
23467
23485
  }
23468
23486
  componentWillLoad() {
@@ -23499,10 +23517,7 @@ const GeneralRegistration = class {
23499
23517
  }
23500
23518
  if (state.type == 'values') {
23501
23519
  this.registrationStepsState[this.registrationStep].registerUserData = this.listOfInputValues.reduce((acc, curr) => {
23502
- // @TODO remove this once GMCore is smart enough to understand the concept of UNIQUE KEYS
23503
- if (curr.value != null) {
23504
- acc[curr.name] = curr.value;
23505
- }
23520
+ acc[curr.name] = curr.value;
23506
23521
  return acc;
23507
23522
  }, {});
23508
23523
  }
@@ -23534,9 +23549,6 @@ const GeneralRegistration = class {
23534
23549
  getRegisterConfig(registrationID) {
23535
23550
  const url = new URL(`${this.endpoint}/v1/player/legislation/registration/config`);
23536
23551
  const headers = new Headers();
23537
- // headers.append('X-Tenant-ID', this.tenantId);
23538
- // headers.append('X-Client-ID', this.clientId);
23539
- // headers.append('X-Api-Key', this.apiKey);
23540
23552
  headers.append('Content-Type', 'application/json');
23541
23553
  headers.append('Accept', 'application/json');
23542
23554
  if (registrationID) {
@@ -23566,8 +23578,12 @@ const GeneralRegistration = class {
23566
23578
  const registerStep = {
23567
23579
  registrationId: this.registrationID,
23568
23580
  registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
23569
- // @TODO remove this once GMCore is smart enough to understand the concept of UNIQUE KEYS
23570
- if (curr.value != null) {
23581
+ // Special case for "Mobile" as it needs to be split in two values -- API expects it this way.
23582
+ if (curr.name == "Mobile") {
23583
+ acc['MobilePrefix'] = curr.value.split('|')[0];
23584
+ acc[curr.name] = curr.value.split('|')[1];
23585
+ }
23586
+ else {
23571
23587
  acc[curr.name] = curr.value;
23572
23588
  }
23573
23589
  return acc;
@@ -23575,9 +23591,6 @@ const GeneralRegistration = class {
23575
23591
  step: this.registrationStep,
23576
23592
  };
23577
23593
  const headers = new Headers();
23578
- // headers.append('X-Tenant-ID', this.tenantId);
23579
- // headers.append('X-Client-ID', this.clientId);
23580
- // headers.append('X-Api-Key', this.apiKey);
23581
23594
  headers.append('Content-Type', 'application/json');
23582
23595
  headers.append('Accept', 'application/json');
23583
23596
  const options = {
@@ -23617,19 +23630,8 @@ const GeneralRegistration = class {
23617
23630
  this.isLoading = true;
23618
23631
  const url = new URL(`${this.endpoint}/v1/player/legislation/register`);
23619
23632
  const headers = new Headers();
23620
- // headers.append('X-Tenant-ID', this.tenantId);
23621
- // headers.append('X-Client-ID', this.clientId);
23622
- // headers.append('X-Api-Key', this.apiKey);
23623
23633
  headers.append('Content-Type', 'application/json');
23624
23634
  headers.append('Accept', 'application/json');
23625
- // const registerStep = {
23626
- // registrationId: this.registrationID,
23627
- // registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
23628
- // acc[curr.name] = curr.value;
23629
- // return acc;
23630
- // }, {}),
23631
- // step: this.registrationStep,
23632
- // };
23633
23635
  const options = {
23634
23636
  method: 'PUT',
23635
23637
  body: JSON.stringify({ registrationId: this.registrationID }),
@@ -23656,9 +23658,10 @@ const GeneralRegistration = class {
23656
23658
  }
23657
23659
  formatConfig(config) {
23658
23660
  // Populate the list of inputs and set as invalid in the beginning
23659
- this.listOfInputs = config.content.fields.map((field) => {
23661
+ let newListOfInputs = config.content.fields.map((field) => {
23660
23662
  return Object.assign(Object.assign({}, field), { isValid: false });
23661
23663
  });
23664
+ this.listOfInputs = JSON.parse(JSON.stringify(newListOfInputs));
23662
23665
  // Populate the list of inputs values and set as null in the beginning
23663
23666
  this.listOfInputValues = config.content.fields.map(field => {
23664
23667
  return { name: field.name, value: null };
@@ -23725,6 +23728,12 @@ const NumberInput = class {
23725
23728
  valueHandler(inputValueEvent) {
23726
23729
  this.sendInputValue.emit(inputValueEvent);
23727
23730
  }
23731
+ componentDidLoad() {
23732
+ if (this.defaultValue) {
23733
+ this.value = this.defaultValue;
23734
+ this.valueHandler({ name: this.name, value: this.value });
23735
+ }
23736
+ }
23728
23737
  handleInput(event) {
23729
23738
  this.value = event.target.value;
23730
23739
  this.errorMessage = this.setErrorMessage();
@@ -23788,6 +23797,12 @@ const PasswordInput = class {
23788
23797
  connectedCallback() {
23789
23798
  this.validationPattern = this.setPattern();
23790
23799
  }
23800
+ componentDidLoad() {
23801
+ if (this.defaultValue) {
23802
+ this.value = this.defaultValue;
23803
+ this.valueHandler({ name: this.name, value: this.value });
23804
+ }
23805
+ }
23791
23806
  handleInput(event) {
23792
23807
  this.value = event.target.value;
23793
23808
  this.errorMessage = this.setErrorMessage();
@@ -23799,14 +23814,15 @@ const PasswordInput = class {
23799
23814
  return this.inputReference.validity.valid;
23800
23815
  }
23801
23816
  setPattern() {
23802
- var _a;
23817
+ var _a, _b;
23803
23818
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
23804
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
23819
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
23805
23820
  }
23806
23821
  }
23807
23822
  setErrorMessage() {
23823
+ var _a;
23808
23824
  if (this.inputReference.validity.patternMismatch) {
23809
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
23825
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
23810
23826
  }
23811
23827
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
23812
23828
  return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -28349,6 +28365,10 @@ const SelectInput = class {
28349
28365
  }
28350
28366
  componentDidLoad() {
28351
28367
  this.inputReference = this.element.shadowRoot.querySelector('input');
28368
+ if (this.defaultValue) {
28369
+ this.value = this.defaultValue;
28370
+ this.valueHandler({ name: this.name, value: this.value });
28371
+ }
28352
28372
  }
28353
28373
  getOptions() {
28354
28374
  // TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
@@ -28425,12 +28445,18 @@ const TelInput = class {
28425
28445
  if (this.action.split(" ")[0] == 'GET') {
28426
28446
  return this.getPhoneCodes().then((options) => {
28427
28447
  this.phoneCodesOptions = options.phoneCodes.map(code => {
28428
- return { label: code.Prefix, value: code.CountryID };
28448
+ return { label: code.Prefix, value: code.Prefix };
28429
28449
  });
28430
28450
  });
28431
28451
  }
28432
28452
  }
28433
28453
  }
28454
+ componentDidLoad() {
28455
+ if (this.defaultValue) {
28456
+ this.prefixValue = this.defaultValue;
28457
+ this.valueHandler({ name: this.name, value: `${this.prefixValue}|` });
28458
+ }
28459
+ }
28434
28460
  getPhoneCodes() {
28435
28461
  // TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
28436
28462
  const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/phonecodes");
@@ -28446,7 +28472,8 @@ const TelInput = class {
28446
28472
  });
28447
28473
  }
28448
28474
  handleInput(event) {
28449
- this.value = event.target.value;
28475
+ // Kinda hack? Open to suggestions.
28476
+ this.value = `${this.prefixValue}|${event.target.value}`;
28450
28477
  this.errorMessage = this.setErrorMessage();
28451
28478
  this.isValid = this.setValidity();
28452
28479
  this.validityStateHandler({ valid: this.isValid, name: this.name });
@@ -28456,14 +28483,15 @@ const TelInput = class {
28456
28483
  return this.inputReference.validity.valid;
28457
28484
  }
28458
28485
  setPattern() {
28459
- var _a;
28486
+ var _a, _b;
28460
28487
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
28461
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
28488
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
28462
28489
  }
28463
28490
  }
28464
28491
  setErrorMessage() {
28492
+ var _a;
28465
28493
  if (this.inputReference.validity.patternMismatch) {
28466
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
28494
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
28467
28495
  }
28468
28496
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
28469
28497
  return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -28474,7 +28502,7 @@ const TelInput = class {
28474
28502
  }
28475
28503
  render() {
28476
28504
  const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__input--invalid';
28477
- return index.h("div", { class: 'tel__wrapper' }, index.h("div", { class: 'tel__wrapper--flex' }, index.h("vaadin-combo-box", { items: this.phoneCodesOptions, value: this.defaultValue, readOnly: this.autofilled }), index.h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input ${invalidClass}`, 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));
28505
+ return index.h("div", { class: 'tel__wrapper' }, index.h("div", { class: 'tel__wrapper--flex' }, index.h("vaadin-combo-box", { items: this.phoneCodesOptions, value: this.defaultValue, 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 ${invalidClass}`, 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));
28478
28506
  }
28479
28507
  static get watchers() { return {
28480
28508
  "isValid": ["validityChanged"],
@@ -28516,10 +28544,14 @@ const TextInput = class {
28516
28544
  this.sendInputValue.emit(inputValueEvent);
28517
28545
  }
28518
28546
  connectedCallback() {
28519
- // @TODO do something with customRules !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28520
- this.customRules = this.setCustomRules();
28521
28547
  this.validationPattern = this.setPattern();
28522
28548
  }
28549
+ componentDidLoad() {
28550
+ if (this.defaultValue) {
28551
+ this.value = this.defaultValue;
28552
+ this.valueHandler({ name: this.name, value: this.value });
28553
+ }
28554
+ }
28523
28555
  handleInput(event) {
28524
28556
  this.value = event.target.value;
28525
28557
  this.isValid = this.setValidity();
@@ -28538,14 +28570,15 @@ const TextInput = class {
28538
28570
  }
28539
28571
  }
28540
28572
  setPattern() {
28541
- var _a;
28573
+ var _a, _b;
28542
28574
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
28543
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
28575
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
28544
28576
  }
28545
28577
  }
28546
28578
  setErrorMessage() {
28579
+ var _a;
28547
28580
  if (this.inputReference.validity.patternMismatch) {
28548
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
28581
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
28549
28582
  }
28550
28583
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
28551
28584
  return translate$2('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-9a07d1e9.js');
3
+ const index = require('./index-ad0df8ea.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -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":[1],"tenantId":[1,"tenant-id"],"clientId":[1,"client-id"],"apiKey":[1,"api-key"],"language":[1],"errorMessage":[32],"emitValue":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[1],"name":[1],"displayName":[1,"display-name"],"action":[1],"validation":[16],"options":[8],"language":[1],"autofilled":[4],"defaultValue":[8,"default-value"],"emitValue":[4,"emit-value"]}],[1,"checkbox-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"date-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"email-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"number-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[2,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"password-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"radio-input",{"name":[1],"displayName":[1,"display-name"],"optionsGroup":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"select-input",{"name":[1],"displayName":[1,"display-name"],"action":[1],"defaultValue":[1,"default-value"],"autofilled":[4],"options":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"tel-input",{"name":[1],"displayName":[1,"display-name"],"showLabels":[4,"show-labels"],"action":[1],"validation":[16],"defaultValue":[8,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"text-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"rules":[1],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}]]]], options);
18
+ return index.bootstrapLazy([["checkbox-input_11.cjs",[[1,"general-registration",{"endpoint":[1],"tenantId":[1,"tenant-id"],"clientId":[1,"client-id"],"apiKey":[1,"api-key"],"language":[1],"errorMessage":[32],"emitValue":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[1],"name":[1],"displayName":[1,"display-name"],"action":[1],"validation":[16],"options":[8],"language":[1],"autofilled":[4],"defaultValue":[8,"default-value"],"emitValue":[4,"emit-value"]}],[1,"checkbox-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"date-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"email-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"number-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"password-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"radio-input",{"name":[1],"displayName":[1,"display-name"],"optionsGroup":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"select-input",{"name":[1],"displayName":[1,"display-name"],"action":[1],"defaultValue":[1,"default-value"],"autofilled":[4],"options":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"tel-input",{"name":[1],"displayName":[1,"display-name"],"showLabels":[4,"show-labels"],"action":[1],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"text-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"rules":[1],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}]]]], options);
19
19
  });
@@ -787,10 +787,6 @@ const parsePropertyValue = (propValue, propType) => {
787
787
  // but we'll cheat here and say that the string "false" is the boolean false
788
788
  return propValue === 'false' ? false : propValue === '' || !!propValue;
789
789
  }
790
- if (propType & 2 /* Number */) {
791
- // force it to be a number
792
- return parseFloat(propValue);
793
- }
794
790
  if (propType & 1 /* String */) {
795
791
  // could have been passed as a number or boolean
796
792
  // but we still want it as a string
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-9a07d1e9.js');
5
+ const index = require('./index-ad0df8ea.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -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":[1],"tenantId":[1,"tenant-id"],"clientId":[1,"client-id"],"apiKey":[1,"api-key"],"language":[1],"errorMessage":[32],"emitValue":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[1],"name":[1],"displayName":[1,"display-name"],"action":[1],"validation":[16],"options":[8],"language":[1],"autofilled":[4],"defaultValue":[8,"default-value"],"emitValue":[4,"emit-value"]}],[1,"checkbox-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"date-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"email-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"number-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[2,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"password-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"radio-input",{"name":[1],"displayName":[1,"display-name"],"optionsGroup":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"select-input",{"name":[1],"displayName":[1,"display-name"],"action":[1],"defaultValue":[1,"default-value"],"autofilled":[4],"options":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"tel-input",{"name":[1],"displayName":[1,"display-name"],"showLabels":[4,"show-labels"],"action":[1],"validation":[16],"defaultValue":[8,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"text-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"rules":[1],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}]]]], options);
17
+ return index.bootstrapLazy([["checkbox-input_11.cjs",[[1,"general-registration",{"endpoint":[1],"tenantId":[1,"tenant-id"],"clientId":[1,"client-id"],"apiKey":[1,"api-key"],"language":[1],"errorMessage":[32],"emitValue":[32],"isFormValid":[32],"listOfInputs":[32],"isLoading":[32],"registrationStep":[32]},[[0,"sendValidityState","checkInputsValidityHandler"],[0,"sendInputValue","getInputsValueHandler"]]],[1,"general-input",{"type":[1],"name":[1],"displayName":[1,"display-name"],"action":[1],"validation":[16],"options":[8],"language":[1],"autofilled":[4],"defaultValue":[8,"default-value"],"emitValue":[4,"emit-value"]}],[1,"checkbox-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"date-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"email-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"number-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"password-input",{"name":[1],"displayName":[1,"display-name"],"defaultValue":[1,"default-value"],"autofilled":[4],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"radio-input",{"name":[1],"displayName":[1,"display-name"],"optionsGroup":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"select-input",{"name":[1],"displayName":[1,"display-name"],"action":[1],"defaultValue":[1,"default-value"],"autofilled":[4],"options":[16],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"tel-input",{"name":[1],"displayName":[1,"display-name"],"showLabels":[4,"show-labels"],"action":[1],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"text-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"autofilled":[4],"rules":[1],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -238,10 +238,11 @@ export class GeneralRegistration {
238
238
  this.isFormValid = !this.getInvalidStatus(this.listOfInputs);
239
239
  }
240
240
  getInputsValueHandler(event) {
241
- this.listOfInputValues.find(input => input.name == event.detail.name).value = event.detail.value;
242
- /*Note to self: -- what about the inputs that received a default value.
243
- They will send an undefined because there was no input
244
- Handle it somehow!!!!!, one idea can be that value equals defaultValue but dependes on how the api wants stuff*/
241
+ this.listOfInputValues.find(input => {
242
+ if (input.name == event.detail.name) {
243
+ input.value = event.detail.value;
244
+ }
245
+ });
245
246
  this.stepsStateMachine({ event: 'set', type: 'values' });
246
247
  }
247
248
  componentWillLoad() {
@@ -278,10 +279,7 @@ export class GeneralRegistration {
278
279
  }
279
280
  if (state.type == 'values') {
280
281
  this.registrationStepsState[this.registrationStep].registerUserData = this.listOfInputValues.reduce((acc, curr) => {
281
- // @TODO remove this once GMCore is smart enough to understand the concept of UNIQUE KEYS
282
- if (curr.value != null) {
283
- acc[curr.name] = curr.value;
284
- }
282
+ acc[curr.name] = curr.value;
285
283
  return acc;
286
284
  }, {});
287
285
  }
@@ -313,9 +311,6 @@ export class GeneralRegistration {
313
311
  getRegisterConfig(registrationID) {
314
312
  const url = new URL(`${this.endpoint}/v1/player/legislation/registration/config`);
315
313
  const headers = new Headers();
316
- // headers.append('X-Tenant-ID', this.tenantId);
317
- // headers.append('X-Client-ID', this.clientId);
318
- // headers.append('X-Api-Key', this.apiKey);
319
314
  headers.append('Content-Type', 'application/json');
320
315
  headers.append('Accept', 'application/json');
321
316
  if (registrationID) {
@@ -345,8 +340,12 @@ export class GeneralRegistration {
345
340
  const registerStep = {
346
341
  registrationId: this.registrationID,
347
342
  registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
348
- // @TODO remove this once GMCore is smart enough to understand the concept of UNIQUE KEYS
349
- if (curr.value != null) {
343
+ // Special case for "Mobile" as it needs to be split in two values -- API expects it this way.
344
+ if (curr.name == "Mobile") {
345
+ acc['MobilePrefix'] = curr.value.split('|')[0];
346
+ acc[curr.name] = curr.value.split('|')[1];
347
+ }
348
+ else {
350
349
  acc[curr.name] = curr.value;
351
350
  }
352
351
  return acc;
@@ -354,9 +353,6 @@ export class GeneralRegistration {
354
353
  step: this.registrationStep,
355
354
  };
356
355
  const headers = new Headers();
357
- // headers.append('X-Tenant-ID', this.tenantId);
358
- // headers.append('X-Client-ID', this.clientId);
359
- // headers.append('X-Api-Key', this.apiKey);
360
356
  headers.append('Content-Type', 'application/json');
361
357
  headers.append('Accept', 'application/json');
362
358
  const options = {
@@ -396,19 +392,8 @@ export class GeneralRegistration {
396
392
  this.isLoading = true;
397
393
  const url = new URL(`${this.endpoint}/v1/player/legislation/register`);
398
394
  const headers = new Headers();
399
- // headers.append('X-Tenant-ID', this.tenantId);
400
- // headers.append('X-Client-ID', this.clientId);
401
- // headers.append('X-Api-Key', this.apiKey);
402
395
  headers.append('Content-Type', 'application/json');
403
396
  headers.append('Accept', 'application/json');
404
- // const registerStep = {
405
- // registrationId: this.registrationID,
406
- // registerUserDto: this.listOfInputValues.reduce((acc, curr) => {
407
- // acc[curr.name] = curr.value;
408
- // return acc;
409
- // }, {}),
410
- // step: this.registrationStep,
411
- // };
412
397
  const options = {
413
398
  method: 'PUT',
414
399
  body: JSON.stringify({ registrationId: this.registrationID }),
@@ -435,9 +420,10 @@ export class GeneralRegistration {
435
420
  }
436
421
  formatConfig(config) {
437
422
  // Populate the list of inputs and set as invalid in the beginning
438
- this.listOfInputs = config.content.fields.map((field) => {
423
+ let newListOfInputs = config.content.fields.map((field) => {
439
424
  return Object.assign(Object.assign({}, field), { isValid: false });
440
425
  });
426
+ this.listOfInputs = JSON.parse(JSON.stringify(newListOfInputs));
441
427
  // Populate the list of inputs values and set as null in the beginning
442
428
  this.listOfInputValues = config.content.fields.map(field => {
443
429
  return { name: field.name, value: null };
@@ -32,6 +32,12 @@ const CheckboxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
32
32
  valueHandler(inputValueEvent) {
33
33
  this.sendInputValue.emit(inputValueEvent);
34
34
  }
35
+ componentDidLoad() {
36
+ if (this.defaultValue) {
37
+ this.value = this.defaultValue;
38
+ this.valueHandler({ name: this.name, value: this.value });
39
+ }
40
+ }
35
41
  handleClick() {
36
42
  this.value = this.inputReference.checked.toString();
37
43
  this.errorMessage = this.setErrorMessage();
@@ -6508,6 +6508,10 @@ const DateInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1 {
6508
6508
  }
6509
6509
  componentDidLoad() {
6510
6510
  this.inputReference = this.element.shadowRoot.querySelector('input');
6511
+ if (this.defaultValue) {
6512
+ this.value = this.defaultValue;
6513
+ this.valueHandler({ name: this.name, value: this.value });
6514
+ }
6511
6515
  }
6512
6516
  handleInput(event) {
6513
6517
  this.value = event.target.value;
@@ -32,6 +32,12 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
32
32
  connectedCallback() {
33
33
  this.validationPattern = this.setPattern();
34
34
  }
35
+ componentDidLoad() {
36
+ if (this.defaultValue) {
37
+ this.value = this.defaultValue;
38
+ this.valueHandler({ name: this.name, value: this.value });
39
+ }
40
+ }
35
41
  handleInput(event) {
36
42
  this.value = event.target.value;
37
43
  this.errorMessage = this.setErrorMessage();
@@ -43,14 +49,15 @@ const EmailInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
43
49
  return this.inputReference.validity.valid;
44
50
  }
45
51
  setPattern() {
46
- var _a;
52
+ var _a, _b;
47
53
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
48
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
54
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
49
55
  }
50
56
  }
51
57
  setErrorMessage() {
58
+ var _a;
52
59
  if (this.inputReference.validity.patternMismatch) {
53
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
60
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
54
61
  }
55
62
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
56
63
  return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });