@aemforms/af-core 0.22.148 → 0.22.150

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.
@@ -3585,12 +3585,26 @@ class FunctionRuntimeImpl {
3585
3585
  interpreter.globals.form.logger.error('Argument is missing in getQueryParameter. A parameter is expected');
3586
3586
  return '';
3587
3587
  }
3588
- if (interpreter.globals.form?.properties?.queryParams?.[param]) {
3589
- return interpreter.globals.form.properties.queryParams[param.toLowerCase()];
3588
+ const queryParams = interpreter.globals.form?.properties?.queryParams;
3589
+ if (queryParams) {
3590
+ if (queryParams[param] !== undefined) {
3591
+ return queryParams[param];
3592
+ }
3593
+ const lowerParam = param.toLowerCase();
3594
+ for (const [key, value] of Object.entries(queryParams)) {
3595
+ if (key.toLowerCase() === lowerParam) {
3596
+ return value;
3597
+ }
3598
+ }
3590
3599
  }
3591
3600
  try {
3592
3601
  const urlParams = new URLSearchParams(window?.location?.search || '');
3593
- return urlParams.get(param);
3602
+ const urlValue = urlParams.get(param) ||
3603
+ Array.from(urlParams.entries())
3604
+ .find(([key]) => key.toLowerCase() === param.toLowerCase())?.[1];
3605
+ if (urlValue !== null && urlValue !== undefined) {
3606
+ return urlValue;
3607
+ }
3594
3608
  }
3595
3609
  catch (e) {
3596
3610
  interpreter.globals.form.logger.warn('Error reading URL parameters:', e);
@@ -4741,11 +4755,22 @@ class Field extends Scriptable {
4741
4755
  this._setProperty('validationMessage', e);
4742
4756
  }
4743
4757
  set constraintMessage(constraint) {
4744
- const updatedConstraintMessages = {
4745
- ...this._jsonModel.constraintMessages,
4746
- [constraint.type]: constraint.message
4747
- };
4748
- this._setProperty('constraintMessages', updatedConstraintMessages);
4758
+ if (Array.isArray(constraint)) {
4759
+ const updatedConstraintMessages = {
4760
+ ...this._jsonModel.constraintMessages
4761
+ };
4762
+ constraint.forEach(({ type, message }) => {
4763
+ updatedConstraintMessages[type] = message;
4764
+ });
4765
+ this._setProperty('constraintMessages', updatedConstraintMessages);
4766
+ }
4767
+ else {
4768
+ const updatedConstraintMessages = {
4769
+ ...this._jsonModel.constraintMessages,
4770
+ [constraint.type]: constraint.message
4771
+ };
4772
+ this._setProperty('constraintMessages', updatedConstraintMessages);
4773
+ }
4749
4774
  }
4750
4775
  _getConstraintObject() {
4751
4776
  return Constraints;
@@ -69,7 +69,10 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
69
69
  set constraintMessage(constraint: {
70
70
  type: keyof ConstraintsMessages;
71
71
  message: string;
72
- });
72
+ } | Array<{
73
+ type: keyof ConstraintsMessages;
74
+ message: string;
75
+ }>);
73
76
  _getConstraintObject(): {
74
77
  enum: (constraint: any, inputVal: any) => {
75
78
  valid: boolean;
package/lib/Field.d.ts CHANGED
@@ -69,7 +69,10 @@ declare class Field extends Scriptable<FieldJson> implements FieldModel {
69
69
  set constraintMessage(constraint: {
70
70
  type: keyof ConstraintsMessages;
71
71
  message: string;
72
- });
72
+ } | Array<{
73
+ type: keyof ConstraintsMessages;
74
+ message: string;
75
+ }>);
73
76
  _getConstraintObject(): {
74
77
  enum: (constraint: any, inputVal: any) => {
75
78
  valid: boolean;
package/lib/Field.js CHANGED
@@ -482,8 +482,17 @@ class Field extends Scriptable_1.default {
482
482
  this._setProperty('validationMessage', e);
483
483
  }
484
484
  set constraintMessage(constraint) {
485
- const updatedConstraintMessages = Object.assign(Object.assign({}, this._jsonModel.constraintMessages), { [constraint.type]: constraint.message });
486
- this._setProperty('constraintMessages', updatedConstraintMessages);
485
+ if (Array.isArray(constraint)) {
486
+ const updatedConstraintMessages = Object.assign({}, this._jsonModel.constraintMessages);
487
+ constraint.forEach(({ type, message }) => {
488
+ updatedConstraintMessages[type] = message;
489
+ });
490
+ this._setProperty('constraintMessages', updatedConstraintMessages);
491
+ }
492
+ else {
493
+ const updatedConstraintMessages = Object.assign(Object.assign({}, this._jsonModel.constraintMessages), { [constraint.type]: constraint.message });
494
+ this._setProperty('constraintMessages', updatedConstraintMessages);
495
+ }
487
496
  }
488
497
  _getConstraintObject() {
489
498
  return ValidationUtils_1.Constraints;
@@ -755,12 +755,26 @@ class FunctionRuntimeImpl {
755
755
  interpreter.globals.form.logger.error('Argument is missing in getQueryParameter. A parameter is expected');
756
756
  return '';
757
757
  }
758
- if ((_c = (_b = (_a = interpreter.globals.form) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.queryParams) === null || _c === void 0 ? void 0 : _c[param]) {
759
- return interpreter.globals.form.properties.queryParams[param.toLowerCase()];
758
+ const queryParams = (_b = (_a = interpreter.globals.form) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.queryParams;
759
+ if (queryParams) {
760
+ if (queryParams[param] !== undefined) {
761
+ return queryParams[param];
762
+ }
763
+ const lowerParam = param.toLowerCase();
764
+ for (const [key, value] of Object.entries(queryParams)) {
765
+ if (key.toLowerCase() === lowerParam) {
766
+ return value;
767
+ }
768
+ }
760
769
  }
761
770
  try {
762
- const urlParams = new URLSearchParams(((_d = window === null || window === void 0 ? void 0 : window.location) === null || _d === void 0 ? void 0 : _d.search) || '');
763
- return urlParams.get(param);
771
+ const urlParams = new URLSearchParams(((_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.search) || '');
772
+ const urlValue = urlParams.get(param) ||
773
+ ((_d = Array.from(urlParams.entries())
774
+ .find(([key]) => key.toLowerCase() === param.toLowerCase())) === null || _d === void 0 ? void 0 : _d[1]);
775
+ if (urlValue !== null && urlValue !== undefined) {
776
+ return urlValue;
777
+ }
764
778
  }
765
779
  catch (e) {
766
780
  interpreter.globals.form.logger.warn('Error reading URL parameters:', e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.148",
3
+ "version": "0.22.150",
4
4
  "description": "Core Module for Forms Runtime",
5
5
  "author": "Adobe Systems",
6
6
  "license": "Adobe Proprietary",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@adobe/json-formula": "0.1.50",
40
- "@aemforms/af-formatters": "^0.22.148"
40
+ "@aemforms/af-formatters": "^0.22.150"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",