max-agent-ui 0.0.27 → 0.0.28

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.
@@ -619,7 +619,7 @@ class MaxAssistantSupportService {
619
619
  if (!this.http) {
620
620
  return throwError(() => new Error('HttpClient is not available. Add provideHttpClient() to the host app.'));
621
621
  }
622
- return this.http.get(this.tagsEndpoint, { headers: this.getHeaders(this.mergeConfig({})) }).pipe(map(tags => tags.map(tag => ({
622
+ return this.http.get(this.getEndpoint(this.tagsEndpoint, this.mergeConfig({})), { headers: this.getHeaders(this.mergeConfig({})) }).pipe(map(tags => tags.map(tag => ({
623
623
  ...tag,
624
624
  icon: 'pi pi-tag',
625
625
  severity: 'info'
@@ -629,14 +629,14 @@ class MaxAssistantSupportService {
629
629
  if (!this.http) {
630
630
  return throwError(() => new Error('HttpClient is not available. Add provideHttpClient() to the host app.'));
631
631
  }
632
- return this.http.get(this.severitiesEndpoint, { headers: this.getHeaders(this.mergeConfig({})) });
632
+ return this.http.get(this.getEndpoint(this.severitiesEndpoint, this.mergeConfig({})), { headers: this.getHeaders(this.mergeConfig({})) });
633
633
  }
634
634
  submitTicket(ticket, config = {}) {
635
635
  if (!this.http) {
636
636
  return throwError(() => new Error('HttpClient is not available. Add provideHttpClient() to the host app.'));
637
637
  }
638
638
  const mergedConfig = this.mergeConfig(config);
639
- const response$ = this.http.post(this.ticketsEndpoint, {
639
+ const response$ = this.http.post(this.getEndpoint(this.ticketsEndpoint, mergedConfig), {
640
640
  subject: ticket.subject,
641
641
  body: ticket.query,
642
642
  severity: ticket.severity,
@@ -673,6 +673,10 @@ class MaxAssistantSupportService {
673
673
  }
674
674
  return headers;
675
675
  }
676
+ getEndpoint(path, config) {
677
+ const baseUrl = config.apiBaseUrl?.trim();
678
+ return baseUrl ? `${baseUrl.replace(/\/$/, '')}${path}` : path;
679
+ }
676
680
  getUser(config) {
677
681
  return typeof config.user === 'function' ? config.user() : config.user ?? {};
678
682
  }