@veloceapps/sdk 11.0.0-70 → 11.0.0-72

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.
@@ -1,12 +1,12 @@
1
- import * as i2 from '@veloceapps/sdk/core';
1
+ import * as i1 from '@veloceapps/sdk/core';
2
2
  import { IntegrationState, ConfigurationService, ConfigurationStateService, filterSuccessfulExecute, FlowInfoService, FlowConfigurationService, FlowStateService, FlowStateConfigurationService, TransactionItemWorker, ProductImagesService, RuntimeSettingsService, ActionCodePipe, DatePipe, NumberPipe, PricePipe, SalesTransactionService, SdkPipesModule, SdkCoreModule, UI_DEFINITION_VERSION } from '@veloceapps/sdk/core';
3
3
  export { IntegrationState } from '@veloceapps/sdk/core';
4
4
  import { __decorate, __param, __metadata } from 'tslib';
5
5
  import * as i0 from '@angular/core';
6
6
  import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Injector, Injectable, ViewContainerRef, ViewChild, Input, ViewEncapsulation, NgModule, inject, ElementRef, Directive, ApplicationRef, createComponent, EventEmitter, createNgModule } from '@angular/core';
7
7
  import * as rxjs from 'rxjs';
8
- import { BehaviorSubject, Subject, map, distinctUntilChanged, of, tap, switchMap, startWith, takeUntil, combineLatest, catchError, ReplaySubject, noop, filter, take, Observable, from } from 'rxjs';
9
- import * as i3 from '@veloceapps/components';
8
+ import { BehaviorSubject, Subject, map, distinctUntilChanged, of, tap, switchMap, startWith, takeUntil, catchError, combineLatest, ReplaySubject, noop, filter, take, Observable, from } from 'rxjs';
9
+ import * as i2 from '@veloceapps/components';
10
10
  import { ToastType, LetDirectiveModule, LoaderModule, ToastService, HiddenTextTooltipModule, ErrorTooltipModule } from '@veloceapps/components';
11
11
  import lodash, { cloneDeep, isArray, pull, merge, omit, flatten, kebabCase, set } from 'lodash';
12
12
  import { applyPatch } from 'rfc6902';
@@ -681,11 +681,11 @@ class RuntimeService {
681
681
  applyPatch(this.applicationTree, [operation]);
682
682
  }
683
683
  }
684
- RuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeService, deps: [{ token: i0.Injector }, { token: i2.IntegrationState }], target: i0.ɵɵFactoryTarget.Injectable });
684
+ RuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeService, deps: [{ token: i0.Injector }, { token: i1.IntegrationState }], target: i0.ɵɵFactoryTarget.Injectable });
685
685
  RuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeService });
686
686
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeService, decorators: [{
687
687
  type: Injectable
688
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i2.IntegrationState }]; } });
688
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.IntegrationState }]; } });
689
689
 
690
690
  const parsePath = (path) => {
691
691
  const segments = path.split('/');
@@ -920,24 +920,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
920
920
  }] } });
921
921
 
922
922
  class PreviewComponent {
923
- constructor(runtimeService, configurationState, toastService, integrationState) {
923
+ constructor(runtimeService, toastService, integrationState) {
924
924
  this.runtimeService = runtimeService;
925
- this.configurationState = configurationState;
926
925
  this.toastService = toastService;
927
926
  this.integrationState = integrationState;
928
927
  this.state$ = new BehaviorSubject({ loading: true, failure: false });
928
+ this.elements$ = new BehaviorSubject([]);
929
929
  this.destroy$ = new Subject();
930
- this.elements$ = combineLatest([this.state$, this.runtimeService.updated$.pipe(startWith(undefined))]).pipe(switchMap(([{ loading, failure }]) => {
931
- if (loading || failure) {
932
- return of([]);
933
- }
934
- const elements = this.runtimeService.applicationTree;
935
- // If UI definition contains pages, return page by SelectedPageName
936
- if (this.uiDefinition?.pages) {
937
- return this.getPages$(elements);
938
- }
939
- return of(elements);
940
- }));
941
930
  }
942
931
  ngOnInit() {
943
932
  if (this.config?.clearStateOnInit) {
@@ -948,9 +937,6 @@ class PreviewComponent {
948
937
  ngOnDestroy() {
949
938
  this.destroy$.next();
950
939
  this.destroy$.complete();
951
- if (!this.config?.persistConfigurationState) {
952
- this.configurationState.cleanup();
953
- }
954
940
  this.runtimeService.clear();
955
941
  }
956
942
  trackBy(_, el) {
@@ -959,18 +945,23 @@ class PreviewComponent {
959
945
  startPreview() {
960
946
  const customInit$ = this.config?.init$?.() ?? of(undefined);
961
947
  customInit$
962
- .pipe(switchMap(() => this.runtimeService.initialize$(this.uiDefinition, this.config)), tap(() => {
948
+ .pipe(switchMap(() => this.runtimeService.initialize$(this.uiDefinition, this.config)), switchMap(() => this.getElements$(this.runtimeService.applicationTree)), tap(elements => {
949
+ this.elements$.next(elements);
963
950
  this.state$.next({ loading: false, failure: false });
964
- }), catchError(error => {
951
+ }), switchMap(() => this.runtimeService.updated$), switchMap(() => this.getElements$(this.runtimeService.applicationTree)), tap(elements => this.elements$.next(elements)), catchError(error => {
965
952
  console.error(error);
966
953
  // we should show toast if initialization failed
967
954
  this.toastService.add({ severity: ToastType.error, summary: error, sticky: true });
955
+ this.elements$.next([]);
968
956
  this.state$.next({ loading: false, failure: true });
969
957
  return of();
970
958
  }), takeUntil(this.destroy$))
971
959
  .subscribe();
972
960
  }
973
- getPages$(elements) {
961
+ getElements$(elements) {
962
+ if (!this.uiDefinition?.pages) {
963
+ return of(elements);
964
+ }
974
965
  return combineLatest([this.runtimeService.selectedPageName$, this.runtimeService.selectedOverlayNames$]).pipe(map(([pageName, overlayNames]) => {
975
966
  const page = elements.find(el => el.name === pageName);
976
967
  const overlayName = overlayNames.at(-1);
@@ -979,12 +970,12 @@ class PreviewComponent {
979
970
  }));
980
971
  }
981
972
  }
982
- PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PreviewComponent, deps: [{ token: RuntimeService }, { token: i2.ConfigurationStateService }, { token: i3.ToastService }, { token: i2.IntegrationState }], target: i0.ɵɵFactoryTarget.Component });
983
- PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: PreviewComponent, selector: "vl-cms-preview", inputs: { uiDefinition: "uiDefinition", config: "config" }, providers: [IOProviderService, TemplatesService], ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer\n *ngFor=\"let el of elements$ | async; trackBy: trackBy\"\n [meta]=\"el\"\n ></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "component", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
973
+ PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PreviewComponent, deps: [{ token: RuntimeService }, { token: i2.ToastService }, { token: i1.IntegrationState }], target: i0.ɵɵFactoryTarget.Component });
974
+ PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: PreviewComponent, selector: "vl-cms-preview", inputs: { uiDefinition: "uiDefinition", config: "config" }, providers: [IOProviderService, TemplatesService], ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer\n *ngFor=\"let el of elements$ | async; trackBy: trackBy\"\n [meta]=\"el\"\n ></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "component", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
984
975
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PreviewComponent, decorators: [{
985
976
  type: Component,
986
977
  args: [{ selector: 'vl-cms-preview', changeDetection: ChangeDetectionStrategy.OnPush, providers: [IOProviderService, TemplatesService], encapsulation: ViewEncapsulation.ShadowDom, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer\n *ngFor=\"let el of elements$ | async; trackBy: trackBy\"\n [meta]=\"el\"\n ></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"] }]
987
- }], ctorParameters: function () { return [{ type: RuntimeService }, { type: i2.ConfigurationStateService }, { type: i3.ToastService }, { type: i2.IntegrationState }]; }, propDecorators: { uiDefinition: [{
978
+ }], ctorParameters: function () { return [{ type: RuntimeService }, { type: i2.ToastService }, { type: i1.IntegrationState }]; }, propDecorators: { uiDefinition: [{
988
979
  type: Input
989
980
  }], config: [{
990
981
  type: Input
@@ -2321,7 +2312,7 @@ class FederatedComponent {
2321
2312
  }
2322
2313
  }
2323
2314
  FederatedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FederatedComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
2324
- FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "host", first: true, predicate: FederatedHostDirective, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template vlFederatedHost></ng-template>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "directive", type: FederatedHostDirective, selector: "[vlFederatedHost]" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2315
+ FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "host", first: true, predicate: FederatedHostDirective, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template vlFederatedHost></ng-template>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "directive", type: FederatedHostDirective, selector: "[vlFederatedHost]" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2325
2316
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FederatedComponent, decorators: [{
2326
2317
  type: Component,
2327
2318
  args: [{ selector: 'veloce-host-federated', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vlFederatedHost></ng-template>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"] }]
@@ -2520,12 +2511,12 @@ class MigrationsService {
2520
2511
  }
2521
2512
  }
2522
2513
  }
2523
- MigrationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MigrationsService, deps: [{ token: i3.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
2514
+ MigrationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MigrationsService, deps: [{ token: i2.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
2524
2515
  MigrationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MigrationsService, providedIn: 'root' });
2525
2516
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MigrationsService, decorators: [{
2526
2517
  type: Injectable,
2527
2518
  args: [{ providedIn: 'root' }]
2528
- }], ctorParameters: function () { return [{ type: i3.ToastService }]; } });
2519
+ }], ctorParameters: function () { return [{ type: i2.ToastService }]; } });
2529
2520
 
2530
2521
  class MigrationsModule {
2531
2522
  }