intelica-library-ui 0.1.226 → 0.1.227

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 { inject, Injectable, signal, Pipe, Component, HostListener, Directive, EventEmitter, Output, Input, forwardRef, TemplateRef, ContentChild, ContentChildren, ViewChild, PLATFORM_ID, Inject, ChangeDetectorRef, Optional, Host } from '@angular/core';
3
3
  import { getCookie, Cookies, setCookie } from 'typescript-cookie';
4
4
  import { HttpClient, HttpHeaders, HttpResponse, HttpParams } from '@angular/common/http';
5
- import { BehaviorSubject, catchError, throwError, from, switchMap, Subject, Subscription, of, tap as tap$1, map } from 'rxjs';
5
+ import { BehaviorSubject, catchError, throwError, from, switchMap, Subject, Subscription, of, tap as tap$1, map, firstValueFrom } from 'rxjs';
6
6
  import Swal from 'sweetalert2';
7
7
  import { tap } from 'rxjs/operators';
8
8
  import * as i1 from '@angular/common';
@@ -8171,27 +8171,23 @@ class Shared {
8171
8171
  getEmbedUrl(dashboardId) {
8172
8172
  return this.http.get(`${this.path}/embed-url/${dashboardId}`);
8173
8173
  }
8174
- getEmbedVisualUrls(request) {
8174
+ getEmbedVisualUrl(request) {
8175
8175
  let params = new HttpParams()
8176
8176
  .set('dashboardId', request.dashboardId)
8177
- .set('sheetId', request.sheetId);
8178
- request.visualIds.forEach(id => {
8179
- params = params.append('visualIds', id);
8180
- });
8177
+ .set('sheetId', request.sheetId)
8178
+ .set('visualId', request.visualId);
8181
8179
  Object.entries(request.parameters).forEach(([key, values]) => {
8182
8180
  values.forEach(value => {
8183
8181
  params = params.append(`parameters[${key}]`, value);
8184
8182
  });
8185
8183
  });
8186
- return this.http.get(`${this.path}/embed-visual-urls`, { params });
8184
+ return this.http.get(`${this.path}/embed-visual-url`, { params });
8187
8185
  }
8188
8186
  getEmbedVisualUrlsAnonymous(request) {
8189
8187
  let params = new HttpParams()
8190
8188
  .set('dashboardId', request.dashboardId)
8191
- .set('sheetId', request.sheetId);
8192
- request.visualIds.forEach(id => {
8193
- params = params.append('visualIds', id);
8194
- });
8189
+ .set('sheetId', request.sheetId)
8190
+ .set('visualId', request.visualId);
8195
8191
  Object.entries(request.parameters).forEach(([key, values]) => {
8196
8192
  values.forEach(value => {
8197
8193
  params = params.append(`parameters[${key}]`, value);
@@ -8208,6 +8204,29 @@ class Shared {
8208
8204
  ...(options?.width && { width: options.width }),
8209
8205
  });
8210
8206
  }
8207
+ async embedDashboard(dashboardId, container, options) {
8208
+ const { embedUrl } = await firstValueFrom(this.getEmbedUrl(dashboardId));
8209
+ await this.createEmbedContext(embedUrl, container, options);
8210
+ }
8211
+ async createEmbedVisualContext(embedUrl, container, options) {
8212
+ const embeddingContext = await createEmbeddingContext();
8213
+ await embeddingContext.embedVisual({
8214
+ url: embedUrl,
8215
+ container,
8216
+ ...(options?.height && { height: options.height }),
8217
+ ...(options?.width && { width: options.width }),
8218
+ }, { scaleToContainer: true, fitToIframeWidth: false });
8219
+ }
8220
+ async embedSequentialVisuals(dashboardId, sheetId, parameters, configs, onVisualLoaded) {
8221
+ for (const config of configs) {
8222
+ config.container?.nativeElement?.replaceChildren();
8223
+ const { visual } = await firstValueFrom(this.getEmbedVisualUrl({ dashboardId, sheetId, visualId: config.visualId, parameters }));
8224
+ if (!visual)
8225
+ continue;
8226
+ await this.createEmbedVisualContext(visual.embedUrl, config.container.nativeElement);
8227
+ onVisualLoaded?.(config.visualId);
8228
+ }
8229
+ }
8211
8230
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: Shared, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
8212
8231
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: Shared, providedIn: 'root' });
8213
8232
  }