intelica-library-components 1.1.149 → 1.1.151

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.
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { Injectable, inject, signal, Pipe, Component, TemplateRef, ContentChild, Input, Directive, EventEmitter, ContentChildren, Output, HostListener, forwardRef, ViewChild, PLATFORM_ID, Inject, DestroyRef, output, input, effect, computed, ViewChildren, Optional, Host, InjectionToken } from '@angular/core';
3
3
  import { getCookie, setCookie } from 'typescript-cookie';
4
4
  import * as i1$4 from '@angular/common/http';
5
- import { HttpClient, HttpHeaders, HttpResponse, HttpParams } from '@angular/common/http';
5
+ import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
6
6
  import { BehaviorSubject, catchError, throwError, Subject, Subscription, tap as tap$1, of, map, fromEvent, startWith, distinctUntilChanged, firstValueFrom, shareReplay } from 'rxjs';
7
7
  import Swal from 'sweetalert2';
8
8
  import { tap, catchError as catchError$1 } from 'rxjs/operators';
@@ -6145,32 +6145,14 @@ class Shared {
6145
6145
  http = inject(HttpClient);
6146
6146
  configService = inject(ConfigService);
6147
6147
  path = `${this.configService.environment?.sharedPath}/Quicksight`;
6148
- getEmbedUrl(dashboardId) {
6149
- return this.http.get(`${this.path}/embed-url/${dashboardId}`);
6150
- }
6151
- getEmbedVisualUrl(request) {
6152
- let params = new HttpParams()
6153
- .set('dashboardId', request.dashboardId)
6154
- .set('sheetId', request.sheetId)
6155
- .set('visualId', request.visualId);
6156
- Object.entries(request.parameters).forEach(([key, values]) => {
6157
- values.forEach(value => {
6158
- params = params.append(`parameters[${key}]`, value);
6159
- });
6160
- });
6161
- return this.http.get(`${this.path}/embed-visual-url`, { params });
6162
- }
6163
- getEmbedVisualUrlsAnonymous(request) {
6164
- let params = new HttpParams()
6165
- .set('dashboardId', request.dashboardId)
6166
- .set('sheetId', request.sheetId)
6167
- .set('visualId', request.visualId);
6168
- Object.entries(request.parameters).forEach(([key, values]) => {
6169
- values.forEach(value => {
6170
- params = params.append(`parameters[${key}]`, value);
6171
- });
6172
- });
6173
- return this.http.get(`${this.path}/embed-visual-anonymous`, { params });
6148
+ getEmbedUrl(command) {
6149
+ return this.http.post(`${this.path}/embed-url`, command);
6150
+ }
6151
+ getEmbedVisualUrl(command) {
6152
+ return this.http.post(`${this.path}/embed-visual-url`, command);
6153
+ }
6154
+ getEmbedVisualUrlsAnonymous(command) {
6155
+ return this.http.post(`${this.path}/embed-visual-anonymous`, command);
6174
6156
  }
6175
6157
  async createEmbedContext(embedUrl, container, options) {
6176
6158
  const embeddingContext = await createEmbeddingContext();
@@ -6181,8 +6163,8 @@ class Shared {
6181
6163
  ...(options?.width && { width: options.width }),
6182
6164
  });
6183
6165
  }
6184
- async embedDashboard(dashboardId, container, options) {
6185
- const { embedUrl } = await firstValueFrom(this.getEmbedUrl(dashboardId));
6166
+ async embedDashboard(command, container, options) {
6167
+ const { embedUrl } = await firstValueFrom(this.getEmbedUrl(command));
6186
6168
  await this.createEmbedContext(embedUrl, container, options);
6187
6169
  }
6188
6170
  async createEmbedVisualContext(embedUrl, container, options) {
@@ -6194,10 +6176,10 @@ class Shared {
6194
6176
  ...(options?.width && { width: options.width }),
6195
6177
  }, { scaleToContainer: true, fitToIframeWidth: false });
6196
6178
  }
6197
- async embedSequentialVisuals(dashboardId, sheetId, parameters, configs, onVisualLoaded) {
6179
+ async embedSequentialVisuals(command, configs, onVisualLoaded) {
6198
6180
  for (const config of configs) {
6199
6181
  config.container?.nativeElement?.replaceChildren();
6200
- const { visual } = await firstValueFrom(this.getEmbedVisualUrl({ dashboardId, sheetId, visualId: config.visualId, parameters }));
6182
+ const { visual } = await firstValueFrom(this.getEmbedVisualUrl({ dashboardId: command.dashboardId, sheetId: command.sheetId, visualId: config.visualId, parameters: command.parameters }));
6201
6183
  if (!visual)
6202
6184
  continue;
6203
6185
  await this.createEmbedVisualContext(visual.embedUrl, config.container.nativeElement);
@@ -6220,6 +6202,7 @@ class DashboardQsComponent {
6220
6202
  containers;
6221
6203
  routeData = toSignal(this.route.data, { initialValue: this.route.snapshot.data });
6222
6204
  dashboardId = computed(() => this.routeData()['dashboardId'], ...(ngDevMode ? [{ debugName: "dashboardId" }] : []));
6205
+ parameters = computed(() => this.routeData()['parameters'], ...(ngDevMode ? [{ debugName: "parameters" }] : []));
6223
6206
  height = computed(() => this.routeData()['height'] ?? '700px', ...(ngDevMode ? [{ debugName: "height" }] : []));
6224
6207
  isLoading = signal(true, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
6225
6208
  viewReady = signal(false, ...(ngDevMode ? [{ debugName: "viewReady" }] : []));
@@ -6240,7 +6223,8 @@ class DashboardQsComponent {
6240
6223
  return;
6241
6224
  this.isLoading.set(true);
6242
6225
  try {
6243
- await this.sharedService.embedDashboard(dashboardId, container);
6226
+ const height = window.innerHeight - 50;
6227
+ await this.sharedService.embedDashboard({ dashboardId: dashboardId, parameters: this.parameters() }, container, { height: `${height}px` });
6244
6228
  }
6245
6229
  catch (error) {
6246
6230
  console.error('Error embedding dashboard:', error);