@cqa-lib/cqa-ui 1.1.475 → 1.1.476

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.
@@ -29843,7 +29843,25 @@ class ApiEditStepComponent {
29843
29843
  return (this.currentStep - 1) * -33.333;
29844
29844
  }
29845
29845
  setStep(step) {
29846
+ var _a;
29846
29847
  if (step >= this.minStep && step <= this.maxStep) {
29848
+ // Validate current step before allowing forward navigation
29849
+ if (step > this.currentStep) {
29850
+ // Validate URL before allowing navigation away from step 1
29851
+ if (this.currentStep === 1) {
29852
+ if (!this.validateUrl()) {
29853
+ this.cdr.markForCheck();
29854
+ return;
29855
+ }
29856
+ }
29857
+ // Validate variable name before allowing navigation away from step 2
29858
+ if (this.currentStep === 2 && !((_a = this.variableName) === null || _a === void 0 ? void 0 : _a.trim())) {
29859
+ this.variableNameError = 'Variable Name is required.';
29860
+ this.cdr.markForCheck();
29861
+ return;
29862
+ }
29863
+ this.variableNameError = '';
29864
+ }
29847
29865
  this.currentStep = step;
29848
29866
  }
29849
29867
  }
@@ -30843,22 +30861,29 @@ class ApiEditStepComponent {
30843
30861
  this.urlError = '';
30844
30862
  return true;
30845
30863
  }
30846
- // Check if URL matches http or https pattern
30847
- const urlPattern = /^https?:\/\/.+/i;
30848
- if (!urlPattern.test(urlValue)) {
30849
- this.urlError = 'URL must start with http:// or https://';
30850
- return false;
30851
- }
30852
- // Additional validation: try to create URL object to ensure it's valid
30853
- try {
30854
- new URL(urlValue);
30855
- this.urlError = '';
30856
- return true;
30857
- }
30858
- catch (_c) {
30859
- this.urlError = 'Please enter a valid URL';
30860
- return false;
30864
+ // When an environment is selected, skip the http/https validation
30865
+ // because the URL may be a relative path or parameter that gets resolved against the environment base URL.
30866
+ const hasEnvironment = this.currentEnvironmentValue != null
30867
+ && this.currentEnvironmentValue !== ''
30868
+ && this.currentEnvironmentValue !== 'none';
30869
+ if (!hasEnvironment) {
30870
+ // Check if URL matches http or https pattern
30871
+ const urlPattern = /^https?:\/\/.+/i;
30872
+ if (!urlPattern.test(urlValue)) {
30873
+ this.urlError = 'URL must start with http:// or https://';
30874
+ return false;
30875
+ }
30876
+ // Additional validation: try to create URL object to ensure it's valid
30877
+ try {
30878
+ new URL(urlValue);
30879
+ }
30880
+ catch (_c) {
30881
+ this.urlError = 'Please enter a valid URL';
30882
+ return false;
30883
+ }
30861
30884
  }
30885
+ this.urlError = '';
30886
+ return true;
30862
30887
  }
30863
30888
  /**
30864
30889
  * Check if URL is valid (for button disabled state)
@@ -30875,6 +30900,13 @@ class ApiEditStepComponent {
30875
30900
  if (isParameterPlaceholder) {
30876
30901
  return true;
30877
30902
  }
30903
+ // When an environment is selected, skip the http/https validation
30904
+ const hasEnvironment = this.currentEnvironmentValue != null
30905
+ && this.currentEnvironmentValue !== ''
30906
+ && this.currentEnvironmentValue !== 'none';
30907
+ if (hasEnvironment) {
30908
+ return true;
30909
+ }
30878
30910
  // Must match http/https pattern
30879
30911
  const urlPattern = /^https?:\/\/.+/i;
30880
30912
  if (!urlPattern.test(urlValue)) {