@everymatrix/general-registration 1.85.19 → 1.85.21

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.
@@ -13957,6 +13957,16 @@ const dispatchCustomEvent = (type, data = {}) => {
13957
13957
  document.dispatchEvent(event);
13958
13958
  };
13959
13959
 
13960
+ const checkEmptyValue = (val) => {
13961
+ if (val === null || val === undefined) return true;
13962
+
13963
+ if (typeof val === 'string') return val.trim() === '';
13964
+ if (Array.isArray(val)) return val.length === 0;
13965
+ if (typeof val === 'object') return Object.keys(val).length === 0;
13966
+
13967
+ return false;
13968
+ };
13969
+
13960
13970
  var PlayerConsentsBpocBWYo = {};
13961
13971
 
13962
13972
  var GeneralAnimationLoadingCvjpSnS0 = {};
@@ -14769,8 +14779,7 @@ const GeneralRegistration = class {
14769
14779
  else {
14770
14780
  this.isConsentReady = false;
14771
14781
  }
14772
- this.forms[this.registrationStep] = this.listOfInputs;
14773
- this.forms = Object.assign({}, this.forms);
14782
+ this.forms = Object.assign(Object.assign({}, this.forms), { [this.registrationStep]: this.listOfInputs.map(input => (Object.assign({}, input))) });
14774
14783
  // The translations for fields happens here.
14775
14784
  if (this.translationUrl) {
14776
14785
  getTranslations(this.translationUrl).then(() => {
@@ -14853,13 +14862,14 @@ const GeneralRegistration = class {
14853
14862
  const invalidInputs = listOfInputs.filter(input => {
14854
14863
  var _a;
14855
14864
  const inputConfig = this.listOfInputs.find(i => i.name === input.name);
14865
+ const inputValue = (_a = this.listOfInputValues.find(v => v.name === input.name)) === null || _a === void 0 ? void 0 : _a.value;
14856
14866
  if (inputConfig && !inputConfig.validate.mandatory) {
14857
- const inputValue = (_a = this.listOfInputValues.find(v => v.name === input.name)) === null || _a === void 0 ? void 0 : _a.value;
14858
- if (!inputValue || inputValue.trim() === '') {
14867
+ // Use the helper function to check if value is empty
14868
+ if (checkEmptyValue(inputValue)) {
14859
14869
  return false;
14860
14870
  }
14861
14871
  }
14862
- return input.isValid == false;
14872
+ return input.isValid === false;
14863
14873
  });
14864
14874
  return invalidInputs.length > 0;
14865
14875
  }
@@ -1,6 +1,7 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { getTranslations, translate, TRANSLATIONS, DEFAULT_LANGUAGE } from "../../utils/locale.utils";
3
3
  import { dispatchCustomEvent } from "../../../../../../../../libs/custom-events/src/index";
4
+ import { checkEmptyValue } from "../../../../../../../../libs/common/src/utils/index";
4
5
  import "../../../../../general-input/dist/types/index";
5
6
  import "../../../../../../svelte/player-consents/es2015/player-consents";
6
7
  export class GeneralRegistration {
@@ -795,8 +796,7 @@ export class GeneralRegistration {
795
796
  else {
796
797
  this.isConsentReady = false;
797
798
  }
798
- this.forms[this.registrationStep] = this.listOfInputs;
799
- this.forms = Object.assign({}, this.forms);
799
+ this.forms = Object.assign(Object.assign({}, this.forms), { [this.registrationStep]: this.listOfInputs.map(input => (Object.assign({}, input))) });
800
800
  // The translations for fields happens here.
801
801
  if (this.translationUrl) {
802
802
  getTranslations(this.translationUrl).then(() => {
@@ -879,13 +879,14 @@ export class GeneralRegistration {
879
879
  const invalidInputs = listOfInputs.filter(input => {
880
880
  var _a;
881
881
  const inputConfig = this.listOfInputs.find(i => i.name === input.name);
882
+ const inputValue = (_a = this.listOfInputValues.find(v => v.name === input.name)) === null || _a === void 0 ? void 0 : _a.value;
882
883
  if (inputConfig && !inputConfig.validate.mandatory) {
883
- const inputValue = (_a = this.listOfInputValues.find(v => v.name === input.name)) === null || _a === void 0 ? void 0 : _a.value;
884
- if (!inputValue || inputValue.trim() === '') {
884
+ // Use the helper function to check if value is empty
885
+ if (checkEmptyValue(inputValue)) {
885
886
  return false;
886
887
  }
887
888
  }
888
- return input.isValid == false;
889
+ return input.isValid === false;
889
890
  });
890
891
  return invalidInputs.length > 0;
891
892
  }
@@ -13953,6 +13953,16 @@ const dispatchCustomEvent = (type, data = {}) => {
13953
13953
  document.dispatchEvent(event);
13954
13954
  };
13955
13955
 
13956
+ const checkEmptyValue = (val) => {
13957
+ if (val === null || val === undefined) return true;
13958
+
13959
+ if (typeof val === 'string') return val.trim() === '';
13960
+ if (Array.isArray(val)) return val.length === 0;
13961
+ if (typeof val === 'object') return Object.keys(val).length === 0;
13962
+
13963
+ return false;
13964
+ };
13965
+
13956
13966
  var PlayerConsentsBpocBWYo = {};
13957
13967
 
13958
13968
  var GeneralAnimationLoadingCvjpSnS0 = {};
@@ -14765,8 +14775,7 @@ const GeneralRegistration = class {
14765
14775
  else {
14766
14776
  this.isConsentReady = false;
14767
14777
  }
14768
- this.forms[this.registrationStep] = this.listOfInputs;
14769
- this.forms = Object.assign({}, this.forms);
14778
+ this.forms = Object.assign(Object.assign({}, this.forms), { [this.registrationStep]: this.listOfInputs.map(input => (Object.assign({}, input))) });
14770
14779
  // The translations for fields happens here.
14771
14780
  if (this.translationUrl) {
14772
14781
  getTranslations(this.translationUrl).then(() => {
@@ -14849,13 +14858,14 @@ const GeneralRegistration = class {
14849
14858
  const invalidInputs = listOfInputs.filter(input => {
14850
14859
  var _a;
14851
14860
  const inputConfig = this.listOfInputs.find(i => i.name === input.name);
14861
+ const inputValue = (_a = this.listOfInputValues.find(v => v.name === input.name)) === null || _a === void 0 ? void 0 : _a.value;
14852
14862
  if (inputConfig && !inputConfig.validate.mandatory) {
14853
- const inputValue = (_a = this.listOfInputValues.find(v => v.name === input.name)) === null || _a === void 0 ? void 0 : _a.value;
14854
- if (!inputValue || inputValue.trim() === '') {
14863
+ // Use the helper function to check if value is empty
14864
+ if (checkEmptyValue(inputValue)) {
14855
14865
  return false;
14856
14866
  }
14857
14867
  }
14858
- return input.isValid == false;
14868
+ return input.isValid === false;
14859
14869
  });
14860
14870
  return invalidInputs.length > 0;
14861
14871
  }