intelica-library-project 20.0.20 → 20.0.21

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.
@@ -2163,16 +2163,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImpo
2163
2163
  class Shared {
2164
2164
  http = inject(HttpClient);
2165
2165
  configService = inject(ConfigService);
2166
+ alertService = inject(AlertService);
2167
+ termPipe = inject(TermPipe);
2168
+ globalTermService = inject(GlobalTermService);
2166
2169
  path = `${this.configService.environment?.sharedPath}`;
2170
+ sessionTimer;
2171
+ scheduleSessionExpiry(expiresInMinutes) {
2172
+ this.clearSessionTimer();
2173
+ this.sessionTimer = setTimeout(() => this.handleSessionExpired(), Math.max((expiresInMinutes - 1) * 60_000, 30_000));
2174
+ }
2175
+ clearSessionTimer() {
2176
+ clearTimeout(this.sessionTimer);
2177
+ }
2178
+ async handleSessionExpired() {
2179
+ const { isConfirmed } = await this.alertService.confirm(this.termPipe.transform("QUICKSIGHT_SESSION_EXPIRED_TITLE", this.globalTermService.languageCode), this.termPipe.transform("QUICKSIGHT_SESSION_EXPIRED_MESSAGE", this.globalTermService.languageCode), this.termPipe.transform("QUICKSIGHT_SESSION_EXPIRED_CONFIRM", this.globalTermService.languageCode), this.termPipe.transform("CANCEL", this.globalTermService.languageCode));
2180
+ if (isConfirmed)
2181
+ window.location.reload();
2182
+ }
2167
2183
  getEmbedUrl(command) {
2168
2184
  return this.http.post(`${this.path}/quicksight-embed-url`, command);
2169
2185
  }
2170
2186
  getEmbedVisualUrl(command) {
2171
2187
  return this.http.post(`${this.path}/quicksight-embed-visual-url`, command);
2172
2188
  }
2173
- getEmbedVisualUrlsAnonymous(command) {
2174
- return this.http.post(`${this.path}/quicksight-embed-visual-anonymous`, command);
2175
- }
2176
2189
  async createEmbedContext(embedUrl, container, options) {
2177
2190
  const embeddingContext = await createEmbeddingContext();
2178
2191
  await embeddingContext.embedDashboard({
@@ -2180,27 +2193,27 @@ class Shared {
2180
2193
  container,
2181
2194
  ...(options?.height && { height: options.height }),
2182
2195
  ...(options?.width && { width: options.width }),
2183
- onChange: (changeEvent) => console.log("[QS onChange]", changeEvent?.eventName, JSON.stringify(changeEvent?.data)),
2184
2196
  }, {
2185
2197
  ...(options?.onMessage && { onMessage: this.toSdkMessageListener(options.onMessage) }),
2186
2198
  });
2187
2199
  }
2188
2200
  async embedDashboard(command, container, options) {
2189
2201
  container.replaceChildren();
2190
- const embedUrl = await firstValueFrom(this.getEmbedUrl(command));
2191
- await this.createEmbedContext(embedUrl, container, options);
2202
+ const dashResponse = await firstValueFrom(this.getEmbedUrl(command));
2203
+ this.scheduleSessionExpiry(dashResponse.expiresInMinutes);
2204
+ await this.createEmbedContext(dashResponse.embedUrl, container, options);
2192
2205
  }
2193
2206
  async embedDashboardInteractive(command, container, options) {
2194
2207
  container.replaceChildren();
2195
- const embedUrl = await firstValueFrom(this.getEmbedUrl({ ...command, parameters: undefined }));
2208
+ const dashResponse = await firstValueFrom(this.getEmbedUrl({ ...command, parameters: undefined }));
2209
+ this.scheduleSessionExpiry(dashResponse.expiresInMinutes);
2196
2210
  const embeddingContext = await createEmbeddingContext();
2197
2211
  const sdkParameters = command.parameters ? Object.entries(command.parameters).map(([Name, Values]) => ({ Name, Values })) : undefined;
2198
2212
  return await embeddingContext.embedDashboard({
2199
- url: embedUrl,
2213
+ url: dashResponse.embedUrl,
2200
2214
  container,
2201
2215
  ...(options?.height && { height: options.height }),
2202
2216
  ...(options?.width && { width: options.width }),
2203
- onChange: (changeEvent) => console.log("[QS onChange]", changeEvent?.eventName, JSON.stringify(changeEvent?.data)),
2204
2217
  }, {
2205
2218
  ...(sdkParameters ? { parameters: sdkParameters } : {}),
2206
2219
  ...(options?.onMessage && { onMessage: this.toSdkMessageListener(options.onMessage) }),
@@ -2287,30 +2300,18 @@ const QuicksightEventName = {
2287
2300
  };
2288
2301
  const QUICKSIGHT_AUTH_ERROR_CODES = ["Forbidden", "Unauthorized", "EmbeddingNotAuthorized", "TokenExpired"];
2289
2302
 
2290
- function isQuicksightSessionExpiredEvent(event) {
2291
- if (event.eventName !== QuicksightEventName.ERROR_OCCURRED)
2292
- return false;
2293
- const code = event.data?.errorCode ?? event.data?.code ?? "";
2294
- return typeof code === "string" && QUICKSIGHT_AUTH_ERROR_CODES.some(c => code.includes(c));
2295
- }
2296
2303
  function dispatchQuicksightEvent(event, outputs) {
2297
2304
  outputs.sdkEvent.emit(event);
2298
2305
  if (event.eventName === QuicksightEventName.CONTENT_LOADED)
2299
2306
  outputs.contentLoaded?.emit(event);
2300
2307
  if (event.eventName === QuicksightEventName.ERROR_OCCURRED) {
2301
2308
  outputs.errorOccurred?.emit(event);
2302
- if (isQuicksightSessionExpiredEvent(event))
2303
- outputs.sessionExpired?.emit(event);
2304
2309
  }
2305
2310
  }
2306
2311
 
2307
2312
  class DashboardQsComponent {
2308
2313
  sharedService = inject(Shared);
2309
- alertService = inject(AlertService);
2310
- termPipe = inject(TermPipe);
2311
- GlobalTermService = inject(GlobalTermService);
2312
2314
  route = inject(ActivatedRoute);
2313
- sessionExpiredShown = false;
2314
2315
  containers;
2315
2316
  dashboardIdInput = input(undefined, ...(ngDevMode ? [{ debugName: "dashboardIdInput", alias: 'dashboardId' }] : [{ alias: 'dashboardId' }]));
2316
2317
  parametersInput = input(undefined, ...(ngDevMode ? [{ debugName: "parametersInput", alias: 'parameters' }] : [{ alias: 'parameters' }]));
@@ -2353,8 +2354,6 @@ class DashboardQsComponent {
2353
2354
  dispatchQuicksightEvent(event, this);
2354
2355
  if (event.eventName === QuicksightEventName.CONTENT_LOADED || event.eventName === QuicksightEventName.ERROR_OCCURRED)
2355
2356
  this.isLoading.set(false);
2356
- if (isQuicksightSessionExpiredEvent(event))
2357
- this.handleSessionExpired();
2358
2357
  },
2359
2358
  });
2360
2359
  }
@@ -2363,15 +2362,8 @@ class DashboardQsComponent {
2363
2362
  this.isLoading.set(false);
2364
2363
  }
2365
2364
  }
2366
- async handleSessionExpired() {
2367
- if (this.sessionExpiredShown)
2368
- return;
2369
- this.sessionExpiredShown = true;
2370
- const { isConfirmed } = await this.alertService.confirm(this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_TITLE', this.GlobalTermService.languageCode), this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_MESSAGE', this.GlobalTermService.languageCode), this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_CONFIRM', this.GlobalTermService.languageCode), this.termPipe.transform('CANCEL', this.GlobalTermService.languageCode));
2371
- if (isConfirmed)
2372
- window.location.reload();
2373
- else
2374
- this.sessionExpiredShown = false;
2365
+ ngOnDestroy() {
2366
+ this.sharedService.clearSessionTimer();
2375
2367
  }
2376
2368
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: DashboardQsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2377
2369
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.23", type: DashboardQsComponent, isStandalone: true, selector: "intelica-dashboard-qs", inputs: { dashboardIdInput: { classPropertyName: "dashboardIdInput", publicName: "dashboardId", isSignal: true, isRequired: false, transformFunction: null }, parametersInput: { classPropertyName: "parametersInput", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, heightInput: { classPropertyName: "heightInput", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isLoadingChange: "isLoadingChange", sdkEvent: "sdkEvent", contentLoaded: "contentLoaded", errorOccurred: "errorOccurred", sessionExpired: "sessionExpired" }, viewQueries: [{ propertyName: "containers", predicate: ["visualContainer"], descendants: true }], ngImport: i0, template: "@if (isLoading()) {\n<div class=\"u-display-flex u-flex-column u-gap-sm\">\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" style=\"aspect-ratio: 1061.57 / 93.02\" />\n </p-panel>\n </div>\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\n @for (_ of [].constructor(4); track $index) {\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" style=\"aspect-ratio: 244.87 / 123.12\" />\n </p-panel>\n }\n </div>\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" style=\"aspect-ratio: 1061.57 / 303.7\" />\n </p-panel>\n </div>\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\n @for (_ of [].constructor(2); track $index) {\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" style=\"aspect-ratio: 517.1 / 123.12\" />\n </p-panel>\n }\n </div>\n</div>\n}\n<div #visualContainer [style.height]=\"height()\" [hidden]=\"isLoading()\"></div>", dependencies: [{ kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Panel, selector: "p-panel", inputs: ["id", "toggleable", "header", "collapsed", "styleClass", "iconPos", "showHeader", "toggler", "transitionOptions", "toggleButtonProps"], outputs: ["collapsedChange", "onBeforeToggle", "onAfterToggle"] }] });
@@ -2386,11 +2378,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImpo
2386
2378
 
2387
2379
  class DashboardQsInteractiveComponent {
2388
2380
  sharedService = inject(Shared);
2389
- alertService = inject(AlertService);
2390
- termPipe = inject(TermPipe);
2391
- GlobalTermService = inject(GlobalTermService);
2392
2381
  route = inject(ActivatedRoute);
2393
- sessionExpiredShown = false;
2394
2382
  containers;
2395
2383
  dashboardIdInput = input(undefined, ...(ngDevMode ? [{ debugName: "dashboardIdInput", alias: 'dashboardId' }] : [{ alias: 'dashboardId' }]));
2396
2384
  parametersInput = input(undefined, ...(ngDevMode ? [{ debugName: "parametersInput", alias: 'parameters' }] : [{ alias: 'parameters' }]));
@@ -2440,12 +2428,9 @@ class DashboardQsInteractiveComponent {
2440
2428
  this.dashboardRef = await this.sharedService.embedDashboardInteractive({ dashboardId, parameters: this.parameters() }, container, {
2441
2429
  height: this.height() ?? `${window.innerHeight - 50}px`,
2442
2430
  onMessage: event => {
2443
- console.log('[QS event]', event.eventName, JSON.stringify(event.data));
2444
2431
  dispatchQuicksightEvent(event, this);
2445
2432
  if (event.eventName === QuicksightEventName.CONTENT_LOADED || event.eventName === QuicksightEventName.ERROR_OCCURRED || event.eventName === QuicksightEventName.PARAMETERS_CHANGED)
2446
2433
  this.isLoading.set(false);
2447
- if (isQuicksightSessionExpiredEvent(event))
2448
- this.handleSessionExpired();
2449
2434
  },
2450
2435
  });
2451
2436
  }
@@ -2454,15 +2439,8 @@ class DashboardQsInteractiveComponent {
2454
2439
  this.isLoading.set(false);
2455
2440
  }
2456
2441
  }
2457
- async handleSessionExpired() {
2458
- if (this.sessionExpiredShown)
2459
- return;
2460
- this.sessionExpiredShown = true;
2461
- const { isConfirmed } = await this.alertService.confirm(this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_TITLE', this.GlobalTermService.languageCode), this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_MESSAGE', this.GlobalTermService.languageCode), this.termPipe.transform('QUICKSIGHT_SESSION_EXPIRED_CONFIRM', this.GlobalTermService.languageCode), this.termPipe.transform('CANCEL', this.GlobalTermService.languageCode));
2462
- if (isConfirmed)
2463
- window.location.reload();
2464
- else
2465
- this.sessionExpiredShown = false;
2442
+ ngOnDestroy() {
2443
+ this.sharedService.clearSessionTimer();
2466
2444
  }
2467
2445
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: DashboardQsInteractiveComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2468
2446
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.23", type: DashboardQsInteractiveComponent, isStandalone: true, selector: "intelica-dashboard-qs-interactive", inputs: { dashboardIdInput: { classPropertyName: "dashboardIdInput", publicName: "dashboardId", isSignal: true, isRequired: false, transformFunction: null }, parametersInput: { classPropertyName: "parametersInput", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, heightInput: { classPropertyName: "heightInput", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isLoadingChange: "isLoadingChange", sdkEvent: "sdkEvent", contentLoaded: "contentLoaded", errorOccurred: "errorOccurred", sessionExpired: "sessionExpired" }, viewQueries: [{ propertyName: "containers", predicate: ["visualContainer"], descendants: true }], ngImport: i0, template: "@if (isLoading()) {\n<div class=\"u-display-flex u-flex-column u-gap-sm\">\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" style=\"aspect-ratio: 1061.57 / 93.02\" />\n </p-panel>\n </div>\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\n @for (_ of [].constructor(4); track $index) {\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" style=\"aspect-ratio: 244.87 / 123.12\" />\n </p-panel>\n }\n </div>\n <div class=\"u-display-flex u-flex-column u-gap-sm\">\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" style=\"aspect-ratio: 1061.57 / 303.7\" />\n </p-panel>\n </div>\n <div class=\"u-display-flex u-flex-row u-gap-sm\">\n @for (_ of [].constructor(2); track $index) {\n <p-panel class=\"prPanel u-flex-grow-1 u-flex-basis-0 u-shadow-none\" showHeader=\"false\">\n <p-skeleton class=\"prSkeleton\" [width]=\"'100%'\" [height]=\"'100%'\" style=\"aspect-ratio: 517.1 / 123.12\" />\n </p-panel>\n }\n </div>\n</div>\n}\n<div #visualContainer [style.height]=\"height()\" [hidden]=\"isLoading()\"></div>", dependencies: [{ kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Panel, selector: "p-panel", inputs: ["id", "toggleable", "header", "collapsed", "styleClass", "iconPos", "showHeader", "toggler", "transitionOptions", "toggleButtonProps"], outputs: ["collapsedChange", "onBeforeToggle", "onAfterToggle"] }] });
@@ -3394,5 +3372,5 @@ class PageInformation {
3394
3372
  * Generated bundle index. Do not edit.
3395
3373
  */
3396
3374
 
3397
- export { AddFavoritesComponent, AddFavoritesService, BreadCrumbComponent, ColumnComponent, ColumnGroupComponent, DashboardQsComponent, DashboardQsInteractiveComponent, EchartComponent, EchartService, ElementHTTPService, ElementService, FormatAmountPipe, FormatCellPipe, OrderConstants, PageInformation, QUICKSIGHT_AUTH_ERROR_CODES, QuicksightEventName, RequestCacheService, RowResumenComponent, SearchComponent, SearchInputEnum, Shared, SharedService, SkeletonTableComponent, SortingComponent, TableComponent, TableFetchComponent, TitleComponent, TruncatePipe, darkenColor, dispatchQuicksightEvent, isQuicksightSessionExpiredEvent };
3375
+ export { AddFavoritesComponent, AddFavoritesService, BreadCrumbComponent, ColumnComponent, ColumnGroupComponent, DashboardQsComponent, DashboardQsInteractiveComponent, EchartComponent, EchartService, ElementHTTPService, ElementService, FormatAmountPipe, FormatCellPipe, OrderConstants, PageInformation, QUICKSIGHT_AUTH_ERROR_CODES, QuicksightEventName, RequestCacheService, RowResumenComponent, SearchComponent, SearchInputEnum, Shared, SharedService, SkeletonTableComponent, SortingComponent, TableComponent, TableFetchComponent, TitleComponent, TruncatePipe, darkenColor, dispatchQuicksightEvent };
3398
3376
  //# sourceMappingURL=intelica-library-project.mjs.map