@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.
@@ -29821,6 +29821,23 @@ class ApiEditStepComponent {
29821
29821
  }
29822
29822
  setStep(step) {
29823
29823
  if (step >= this.minStep && step <= this.maxStep) {
29824
+ // Validate current step before allowing forward navigation
29825
+ if (step > this.currentStep) {
29826
+ // Validate URL before allowing navigation away from step 1
29827
+ if (this.currentStep === 1) {
29828
+ if (!this.validateUrl()) {
29829
+ this.cdr.markForCheck();
29830
+ return;
29831
+ }
29832
+ }
29833
+ // Validate variable name before allowing navigation away from step 2
29834
+ if (this.currentStep === 2 && !this.variableName?.trim()) {
29835
+ this.variableNameError = 'Variable Name is required.';
29836
+ this.cdr.markForCheck();
29837
+ return;
29838
+ }
29839
+ this.variableNameError = '';
29840
+ }
29824
29841
  this.currentStep = step;
29825
29842
  }
29826
29843
  }
@@ -30801,22 +30818,29 @@ class ApiEditStepComponent {
30801
30818
  this.urlError = '';
30802
30819
  return true;
30803
30820
  }
30804
- // Check if URL matches http or https pattern
30805
- const urlPattern = /^https?:\/\/.+/i;
30806
- if (!urlPattern.test(urlValue)) {
30807
- this.urlError = 'URL must start with http:// or https://';
30808
- return false;
30809
- }
30810
- // Additional validation: try to create URL object to ensure it's valid
30811
- try {
30812
- new URL(urlValue);
30813
- this.urlError = '';
30814
- return true;
30815
- }
30816
- catch {
30817
- this.urlError = 'Please enter a valid URL';
30818
- return false;
30821
+ // When an environment is selected, skip the http/https validation
30822
+ // because the URL may be a relative path or parameter that gets resolved against the environment base URL.
30823
+ const hasEnvironment = this.currentEnvironmentValue != null
30824
+ && this.currentEnvironmentValue !== ''
30825
+ && this.currentEnvironmentValue !== 'none';
30826
+ if (!hasEnvironment) {
30827
+ // Check if URL matches http or https pattern
30828
+ const urlPattern = /^https?:\/\/.+/i;
30829
+ if (!urlPattern.test(urlValue)) {
30830
+ this.urlError = 'URL must start with http:// or https://';
30831
+ return false;
30832
+ }
30833
+ // Additional validation: try to create URL object to ensure it's valid
30834
+ try {
30835
+ new URL(urlValue);
30836
+ }
30837
+ catch {
30838
+ this.urlError = 'Please enter a valid URL';
30839
+ return false;
30840
+ }
30819
30841
  }
30842
+ this.urlError = '';
30843
+ return true;
30820
30844
  }
30821
30845
  /**
30822
30846
  * Check if URL is valid (for button disabled state)
@@ -30832,6 +30856,13 @@ class ApiEditStepComponent {
30832
30856
  if (isParameterPlaceholder) {
30833
30857
  return true;
30834
30858
  }
30859
+ // When an environment is selected, skip the http/https validation
30860
+ const hasEnvironment = this.currentEnvironmentValue != null
30861
+ && this.currentEnvironmentValue !== ''
30862
+ && this.currentEnvironmentValue !== 'none';
30863
+ if (hasEnvironment) {
30864
+ return true;
30865
+ }
30835
30866
  // Must match http/https pattern
30836
30867
  const urlPattern = /^https?:\/\/.+/i;
30837
30868
  if (!urlPattern.test(urlValue)) {