@veloceapps/sdk 3.1.4 → 3.1.6

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.
Files changed (31) hide show
  1. package/bundles/veloce-sdk-cms.umd.js +75 -73
  2. package/bundles/veloce-sdk-cms.umd.js.map +1 -1
  3. package/bundles/veloce-sdk.umd.js +8 -1
  4. package/bundles/veloce-sdk.umd.js.map +1 -1
  5. package/cms/index.d.ts +1 -0
  6. package/cms/modules/federated/default-options.d.ts +4 -0
  7. package/cms/modules/federated/export.d.ts +1 -0
  8. package/cms/{components → modules}/federated/federated.component.d.ts +12 -22
  9. package/cms/{components → modules}/federated/federated.module.d.ts +3 -1
  10. package/cms/modules/federated/federated.types.d.ts +30 -0
  11. package/cms/modules/federated/federated.utils.d.ts +1 -0
  12. package/cms/utils/index.d.ts +0 -1
  13. package/esm2015/cms/index.js +2 -1
  14. package/esm2015/cms/modules/federated/default-options.js +5 -0
  15. package/esm2015/cms/modules/federated/export.js +2 -0
  16. package/esm2015/cms/modules/federated/federated.component.js +82 -0
  17. package/esm2015/cms/modules/federated/federated.module.js +19 -0
  18. package/esm2015/cms/modules/federated/federated.types.js +2 -0
  19. package/esm2015/cms/modules/federated/federated.utils.js +37 -0
  20. package/esm2015/cms/services/launcher.service.js +2 -2
  21. package/esm2015/cms/utils/index.js +1 -2
  22. package/esm2015/src/services/flow.service.js +9 -2
  23. package/fesm2015/veloce-sdk-cms.js +69 -66
  24. package/fesm2015/veloce-sdk-cms.js.map +1 -1
  25. package/fesm2015/veloce-sdk.js +8 -1
  26. package/fesm2015/veloce-sdk.js.map +1 -1
  27. package/package.json +1 -1
  28. package/cms/utils/federated.util.d.ts +0 -6
  29. package/esm2015/cms/components/federated/federated.component.js +0 -81
  30. package/esm2015/cms/components/federated/federated.module.js +0 -16
  31. package/esm2015/cms/utils/federated.util.js +0 -37
@@ -1,6 +1,6 @@
1
1
  import { __decorate, __param, __awaiter, __rest } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
- import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Injector, Injectable, Directive, ViewContainerRef, SkipSelf, ViewChild, Input, EventEmitter, TemplateRef, Output, NgModule, ViewEncapsulation } from '@angular/core';
3
+ import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Injector, Injectable, Directive, ViewContainerRef, SkipSelf, ViewChild, Input, NgModule, ViewEncapsulation } from '@angular/core';
4
4
  import * as rxjs from 'rxjs';
5
5
  import { BehaviorSubject, Subject, takeUntil, map, filter, from, tap, of, switchMap, forkJoin, catchError } from 'rxjs';
6
6
  import * as lodash from 'lodash';
@@ -13,12 +13,12 @@ import * as angularForms from '@angular/forms';
13
13
  import { FormsModule, ReactiveFormsModule } from '@angular/forms';
14
14
  import * as i2 from '@veloce/sdk/core';
15
15
  import { ConfigurationService, LineItemWorker, generateLineItem, getAttributeValue, FlowConfigurationService, lineItemUtils, SdkCoreModule } from '@veloce/sdk/core';
16
+ import * as i1 from '@veloce/components';
17
+ import { LoaderModule } from '@veloce/components';
16
18
  import { transform } from '@babel/standalone';
17
19
  import { SalesforceApiService, QuoteApiService, DocumentTemplatesApiService, DocumentAttachmentApiService, RampApiService, CatalogApiService, ApiModule } from '@veloce/api';
18
20
  import * as rxjsOperators from 'rxjs/operators';
19
21
  import * as i3 from 'primeng/api';
20
- import * as i5 from '@veloce/components';
21
- import { LoaderModule } from '@veloce/components';
22
22
  import { DialogService } from 'primeng/dynamicdialog';
23
23
 
24
24
  var FlowAction;
@@ -690,6 +690,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
690
690
  }]
691
691
  }], ctorParameters: function () { return [{ type: ElementContextService }]; } });
692
692
 
693
+ // eslint-disable-next-line @angular-eslint/directive-selector
694
+ class CustomTemplateDirective {
695
+ constructor(templateRef, templatesService) {
696
+ this.templateRef = templateRef;
697
+ this.templatesService = templatesService;
698
+ }
699
+ ngAfterViewInit() {
700
+ if (!this.customTemplate) {
701
+ return;
702
+ }
703
+ this.templatesService.register(this.customTemplate, this.templateRef);
704
+ }
705
+ }
706
+ CustomTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CustomTemplateDirective, deps: [{ token: i0.TemplateRef }, { token: TemplatesService }], target: i0.ɵɵFactoryTarget.Directive });
707
+ CustomTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0 });
708
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CustomTemplateDirective, decorators: [{
709
+ type: Directive,
710
+ args: [{ selector: '[customTemplate]' }]
711
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
712
+ type: Input
713
+ }] } });
714
+
715
+ const defaultOptions = {
716
+ suppressLoading: false,
717
+ loadingLabel: 'LOADING',
718
+ };
719
+
693
720
  const moduleMap = {};
694
721
  function loadRemoteEntry(remoteEntry) {
695
722
  return new Promise((resolve, reject) => {
@@ -719,59 +746,64 @@ function lookupExposedModule(remoteName, exposedModule) {
719
746
  return Module;
720
747
  });
721
748
  }
722
- function loadRemoteModule(options) {
749
+ function loadRemoteModule(remoteEntry, remoteName, exposedModule) {
723
750
  return __awaiter(this, void 0, void 0, function* () {
724
- yield loadRemoteEntry(options.remoteEntry);
725
- return yield lookupExposedModule(options.remoteName, options.exposedModule);
751
+ yield loadRemoteEntry(remoteEntry);
752
+ return yield lookupExposedModule(remoteName, exposedModule);
726
753
  });
727
754
  }
728
755
 
729
- var IntegrationEvent;
730
- (function (IntegrationEvent) {
731
- IntegrationEvent["Init"] = "Init";
732
- })(IntegrationEvent || (IntegrationEvent = {}));
733
756
  class FederatedComponent {
734
757
  constructor(injector, compiler, appRef, renderer) {
735
758
  this.injector = injector;
736
759
  this.compiler = compiler;
737
760
  this.appRef = appRef;
738
761
  this.renderer = renderer;
739
- this.integrationEvent = new EventEmitter();
740
- this.moduleReady = false;
762
+ this.isLoading$ = new BehaviorSubject(false);
763
+ // configs
764
+ this.suppressLoading = defaultOptions.suppressLoading;
765
+ this.loadingLabel = defaultOptions.loadingLabel;
766
+ }
767
+ ngOnChanges(changes) {
768
+ var _a, _b, _c, _d;
769
+ if (changes.data && this.instance) {
770
+ this.instance.data = this.data;
771
+ }
772
+ if (changes.options) {
773
+ this.suppressLoading = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.suppressLoading) !== null && _b !== void 0 ? _b : defaultOptions.suppressLoading;
774
+ this.loadingLabel = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.loadingLabel) !== null && _d !== void 0 ? _d : defaultOptions.loadingLabel;
775
+ }
776
+ }
777
+ ngOnInit() {
778
+ this.isLoading$.next(true);
741
779
  }
742
780
  ngAfterViewInit() {
743
- if (!this.remoteEntry || !this.remoteName || !this.exposedModule) {
781
+ var _a, _b, _c, _d, _e, _f;
782
+ const remoteEntry = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.remoteEntry) !== null && _b !== void 0 ? _b : this.remoteEntry;
783
+ const remoteName = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.remoteName) !== null && _d !== void 0 ? _d : this.remoteName;
784
+ const exposedModule = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.exposedModule) !== null && _f !== void 0 ? _f : this.exposedModule;
785
+ if (!remoteEntry || !remoteName || !exposedModule) {
744
786
  return;
745
787
  }
746
- loadRemoteModule({
747
- remoteEntry: this.remoteEntry,
748
- remoteName: this.remoteName,
749
- exposedModule: this.exposedModule,
750
- }).then(federated => {
751
- this.compiler.compileModuleAsync(federated[this.exposedModule]).then(moduleFactory => {
752
- var _a;
788
+ loadRemoteModule(remoteEntry, remoteName, exposedModule).then(federated => {
789
+ this.compiler.compileModuleAsync(federated[exposedModule]).then(moduleFactory => {
790
+ var _a, _b, _c;
753
791
  const rootModuleRef = moduleFactory.create(this.injector);
754
- const rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[this.exposedModule].rootComponent);
792
+ const rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[exposedModule].rootComponent);
755
793
  const node = document.createElement('div');
756
794
  const { instance, hostView } = rootComponentFactory.create(this.injector, [], node);
757
795
  this.instance = instance;
758
796
  this.instance.data = this.data;
759
- this.instance.eventData = this.eventData;
760
- this.instance.integrationEvent = this.integrationEvent;
761
797
  this.renderer.appendChild((_a = this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
762
798
  this.appRef.attachView(hostView);
799
+ (_c = (_b = this.options) === null || _b === void 0 ? void 0 : _b.onReady) === null || _c === void 0 ? void 0 : _c.call(_b);
800
+ this.isLoading$.next(false);
763
801
  });
764
802
  });
765
803
  }
766
- ngOnChanges(changes) {
767
- if (!this.instance) {
768
- return;
769
- }
770
- this.instance.ngOnChanges(changes);
771
- }
772
804
  }
773
805
  FederatedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedComponent, deps: [{ token: i0.Injector }, { token: i0.Compiler }, { token: i0.ApplicationRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
774
- FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", eventData: "eventData" }, outputs: { integrationEvent: "integrationEvent" }, viewQueries: [{ propertyName: "federatedComponent", first: true, predicate: ["federatedComponent"], descendants: true, read: ViewContainerRef }, { propertyName: "foo", first: true, predicate: ["foo"], descendants: true, read: TemplateRef }, { propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #moduleHost></div>\n", styles: [":host{display:block}div{height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
806
+ FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #moduleHost></div>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], components: [{ type: i1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i7.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
775
807
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedComponent, decorators: [{
776
808
  type: Component,
777
809
  args: [{
@@ -781,13 +813,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
781
813
  styleUrls: ['./federated.component.scss'],
782
814
  changeDetection: ChangeDetectionStrategy.OnPush,
783
815
  }]
784
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }, { type: i0.ApplicationRef }, { type: i0.Renderer2 }]; }, propDecorators: { federatedComponent: [{
785
- type: ViewChild,
786
- args: ['federatedComponent', { read: ViewContainerRef }]
787
- }], foo: [{
788
- type: ViewChild,
789
- args: ['foo', { read: TemplateRef }]
790
- }], moduleHostRef: [{
816
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }, { type: i0.ApplicationRef }, { type: i0.Renderer2 }]; }, propDecorators: { moduleHostRef: [{
791
817
  type: ViewChild,
792
818
  args: ['moduleHost', { static: false }]
793
819
  }], remoteEntry: [{
@@ -798,47 +824,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
798
824
  type: Input
799
825
  }], data: [{
800
826
  type: Input
801
- }], eventData: [{
827
+ }], options: [{
802
828
  type: Input
803
- }], integrationEvent: [{
804
- type: Output
805
829
  }] } });
806
830
 
807
831
  class FederatedModule {
808
832
  }
809
833
  FederatedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
810
- FederatedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, declarations: [FederatedComponent], exports: [FederatedComponent] });
811
- FederatedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule });
834
+ FederatedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, declarations: [FederatedComponent], imports: [CommonModule, LoaderModule], exports: [FederatedComponent] });
835
+ FederatedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, imports: [[CommonModule, LoaderModule]] });
812
836
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, decorators: [{
813
837
  type: NgModule,
814
838
  args: [{
815
839
  declarations: [FederatedComponent],
840
+ imports: [CommonModule, LoaderModule],
816
841
  exports: [FederatedComponent],
817
842
  }]
818
843
  }] });
819
844
 
820
- // eslint-disable-next-line @angular-eslint/directive-selector
821
- class CustomTemplateDirective {
822
- constructor(templateRef, templatesService) {
823
- this.templateRef = templateRef;
824
- this.templatesService = templatesService;
825
- }
826
- ngAfterViewInit() {
827
- if (!this.customTemplate) {
828
- return;
829
- }
830
- this.templatesService.register(this.customTemplate, this.templateRef);
831
- }
832
- }
833
- CustomTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CustomTemplateDirective, deps: [{ token: i0.TemplateRef }, { token: TemplatesService }], target: i0.ɵɵFactoryTarget.Directive });
834
- CustomTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0 });
835
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CustomTemplateDirective, decorators: [{
836
- type: Directive,
837
- args: [{ selector: '[customTemplate]' }]
838
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
839
- type: Input
840
- }] } });
841
-
842
845
  class ConfigurationPlugin {
843
846
  constructor(host) {
844
847
  var _a, _b;
@@ -1206,7 +1209,7 @@ class PreviewComponent {
1206
1209
  }
1207
1210
  }
1208
1211
  PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewComponent, deps: [{ token: LauncherService }, { token: i2.ConfigurationService }, { token: i3.MessageService }, { token: i2.ConfigurationRuntimeService }, { token: IntegrationState }], target: i0.ɵɵFactoryTarget.Component });
1209
- PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition", clearState: "clearState" }, 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 *ngFor=\"let el of elements\" [meta]=\"el\"></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"], components: [{ type: i5.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i7.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
1212
+ PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition", clearState: "clearState" }, 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 *ngFor=\"let el of elements\" [meta]=\"el\"></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"], components: [{ type: i1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i7.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
1210
1213
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewComponent, decorators: [{
1211
1214
  type: Component,
1212
1215
  args: [{
@@ -1291,5 +1294,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1291
1294
  * Generated bundle index. Do not edit.
1292
1295
  */
1293
1296
 
1294
- export { ApplyProductConfigurationAction, ConfigureProductAction, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, ElementsResolver, FlowAction, IntegrationState, LauncherModule, LauncherService, NavigateBackAction, PreviewComponent, PreviewModule, SHARED_ELEMENT_METADATA, TemplatesService, UI_DEFINITION_METADATA, UiBuildError, VENDOR_MAP, doesElementSupportIO, elementToMetadata, extendElementMetadata, extractElementMetadata, findElementByModule, getAbsolutePath, getElementConfig, isValidScript, loadRemoteModule, metadataToElement, normalizeElementMetadata, parseBoundPath, parsePath, stringifyElementMetadata };
1297
+ export { ApplyProductConfigurationAction, ConfigureProductAction, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, ElementsResolver, FlowAction, IntegrationState, LauncherModule, LauncherService, NavigateBackAction, PreviewComponent, PreviewModule, SHARED_ELEMENT_METADATA, TemplatesService, UI_DEFINITION_METADATA, UiBuildError, VENDOR_MAP, doesElementSupportIO, elementToMetadata, extendElementMetadata, extractElementMetadata, findElementByModule, getAbsolutePath, getElementConfig, isValidScript, metadataToElement, normalizeElementMetadata, parseBoundPath, parsePath, stringifyElementMetadata };
1295
1298
  //# sourceMappingURL=veloce-sdk-cms.js.map