@veloceapps/sdk 2.0.13 → 2.0.15

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.
@@ -10,9 +10,13 @@ import * as _ from 'lodash';
10
10
  import { merge, isDate } from 'lodash';
11
11
  import * as rxjsOperators from 'rxjs/operators';
12
12
  import { tap, map, take, filter, shareReplay, takeUntil } from 'rxjs/operators';
13
+ import * as i8 from '@veloce/components';
14
+ import { ConfirmationComponent, LoaderModule } from '@veloce/components';
13
15
  import * as i1 from '@veloce/api';
14
16
  import { ApiModule } from '@veloce/api';
15
- import * as i3 from 'primeng/api';
17
+ import * as i3 from 'primeng/dynamicdialog';
18
+ import { DialogService } from 'primeng/dynamicdialog';
19
+ import * as i3$1 from 'primeng/api';
16
20
  import { MessageService } from 'primeng/api';
17
21
  import { __awaiter, __decorate } from 'tslib';
18
22
  import { ScrollingModule as ScrollingModule$1 } from '@angular/cdk-experimental/scrolling';
@@ -21,8 +25,6 @@ import * as i5 from '@angular/common';
21
25
  import { CurrencyPipe, DOCUMENT, CommonModule, DatePipe } from '@angular/common';
22
26
  import '@angular/compiler';
23
27
  import { VeloceElementsModule } from '@veloce/elements';
24
- import * as i8 from '@veloce/components';
25
- import { LoaderModule } from '@veloce/components';
26
28
  import * as i5$1 from 'ngx-bootstrap/popover';
27
29
  import { PopoverModule } from 'ngx-bootstrap/popover';
28
30
  import { TemplatePortal } from '@angular/cdk/portal';
@@ -780,28 +782,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
780
782
  }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
781
783
 
782
784
  class ConfigurationService {
783
- constructor(configurationApiService, contextService) {
785
+ constructor(configurationApiService, contextService, dialogService) {
784
786
  this.configurationApiService = configurationApiService;
785
787
  this.contextService = contextService;
788
+ this.dialogService = dialogService;
786
789
  }
787
790
  configure(runtimeContext, states, resolve) {
791
+ var _a;
788
792
  const lineItem = (states && states.configurableRamp) || this.getDefaultLineItem(runtimeContext);
789
793
  const configurationMode = resolve ? ConfigurationMode.RESOLVE : ConfigurationMode.SEARCH;
790
794
  const configurationRequest = this.createRequest(lineItem, runtimeContext, configurationMode);
791
795
  configurationRequest.lineItems = states.currentState || [];
792
796
  configurationRequest.asset = states.asset;
793
797
  const runtimeModel = runtimeContext.runtimeModel;
794
- if (runtimeContext.uiDefinition && runtimeContext.uiDefinition.pricingEnabled) {
795
- return this.configurationApiService.configureAndPriceLineItem(configurationRequest, runtimeModel).pipe(map(({ lineItem, context }) => {
796
- if (context) {
797
- this.contextService.update({ properties: context.properties });
798
- }
799
- return lineItem;
800
- }));
801
- }
802
- else {
803
- return this.configurationApiService.configureLineItem(configurationRequest, runtimeModel);
804
- }
798
+ const pricingEnabled = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.pricingEnabled;
799
+ return this.configurationApiService
800
+ .configureLineItem({
801
+ configurationRequest,
802
+ runtimeModel,
803
+ pricingEnabled,
804
+ })
805
+ .pipe(map(({ lineItem, context, deletedLineItems }) => {
806
+ if (context) {
807
+ this.contextService.update({ properties: context.properties });
808
+ }
809
+ if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
810
+ this.showInactiveProductsConfirmation();
811
+ }
812
+ return lineItem;
813
+ }));
805
814
  }
806
815
  createRequest(lineItem, runtimeContext, configurationMode) {
807
816
  var _a, _b, _c;
@@ -833,12 +842,37 @@ class ConfigurationService {
833
842
  : {}));
834
843
  return lineItem;
835
844
  }
845
+ showInactiveProductsConfirmation() {
846
+ this.dialogService
847
+ .open(ConfirmationComponent, {
848
+ dismissableMask: false,
849
+ closeOnEscape: false,
850
+ closable: false,
851
+ showHeader: true,
852
+ header: `Inactive Products in Quote`,
853
+ width: '440px',
854
+ data: {
855
+ confirmationConfig: {
856
+ title: ' ',
857
+ description: 'This quote contains inactive products. Do you want to remove them?',
858
+ submitBtn: 'Remove products',
859
+ cancelBtn: 'Back to Quote',
860
+ },
861
+ },
862
+ })
863
+ .onClose.subscribe(result => {
864
+ if (!result) {
865
+ const context = this.contextService.resolve();
866
+ window['VELO_BACK_FN'].apply(null, [(context === null || context === void 0 ? void 0 : context.headerId) || '']);
867
+ }
868
+ });
869
+ }
836
870
  }
837
- ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }], target: i0.ɵɵFactoryTarget.Injectable });
871
+ ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: i3.DialogService }], target: i0.ɵɵFactoryTarget.Injectable });
838
872
  ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService });
839
873
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, decorators: [{
840
874
  type: Injectable
841
- }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }]; } });
875
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: i3.DialogService }]; } });
842
876
 
843
877
  class RuntimeService {
844
878
  constructor(configurationService, contextService, messageService) {
@@ -937,11 +971,11 @@ class RuntimeService {
937
971
  this.runtimeContext.invocationContext = Object.assign(Object.assign({}, this.runtimeContext.invocationContext), { runtimeStep });
938
972
  }
939
973
  }
940
- RuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeService, deps: [{ token: ConfigurationService }, { token: ContextService }, { token: i3.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
974
+ RuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeService, deps: [{ token: ConfigurationService }, { token: ContextService }, { token: i3$1.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
941
975
  RuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeService });
942
976
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeService, decorators: [{
943
977
  type: Injectable
944
- }], ctorParameters: function () { return [{ type: ConfigurationService }, { type: ContextService }, { type: i3.MessageService }]; } });
978
+ }], ctorParameters: function () { return [{ type: ConfigurationService }, { type: ContextService }, { type: i3$1.MessageService }]; } });
945
979
 
946
980
  class QuoteService {
947
981
  constructor(contextService, quoteApiService, priceApiService) {
@@ -1094,11 +1128,11 @@ class RuntimeContextService {
1094
1128
  return uiDefinition;
1095
1129
  }
1096
1130
  }
1097
- RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }, { token: i3.MessageService }, { token: ContextService }], target: i0.ɵɵFactoryTarget.Injectable });
1131
+ RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }, { token: i3$1.MessageService }, { token: ContextService }], target: i0.ɵɵFactoryTarget.Injectable });
1098
1132
  RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService });
1099
1133
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, decorators: [{
1100
1134
  type: Injectable
1101
- }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: i3.MessageService }, { type: ContextService }]; } });
1135
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: i3$1.MessageService }, { type: ContextService }]; } });
1102
1136
 
1103
1137
  class SectionStoreService {
1104
1138
  constructor() {
@@ -2097,7 +2131,7 @@ class VeloTypeComponent {
2097
2131
  }
2098
2132
  }
2099
2133
  }
2100
- VeloTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloTypeComponent, deps: [{ token: FormScopeService }, { token: CollapsibleStateService }, { token: SectionScopeService }, { token: i3.MessageService }], target: i0.ɵɵFactoryTarget.Component });
2134
+ VeloTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloTypeComponent, deps: [{ token: FormScopeService }, { token: CollapsibleStateService }, { token: SectionScopeService }, { token: i3$1.MessageService }], target: i0.ɵɵFactoryTarget.Component });
2101
2135
  VeloTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: VeloTypeComponent, selector: "velo-type", ngImport: i0, template: "<div class=\"container-box div-block collapsed container-box-bordered\" [formGroup]=\"form\">\n <div class=\"box-title\">\n <div class=\"header clearfix\">\n <div>\n <div class=\"header-label div-inline\">\n {{ displayName }}\n <span *ngIf=\"prices.length > 0\">\n <span>${{ prices[0].netPrice }}</span>\n <span *ngIf=\"prices.length > 1\">\n <span>, </span>\n <span>${{ prices[1].netPrice }}</span>\n </span>\n </span>\n </div>\n\n <div class=\"header-qty-container input-form-input\">\n <input\n [id]=\"qtyControlName\"\n [formControlName]=\"qtyControlName\"\n (blur)=\"form.controls[qtyControlName].valid && handleQuantityUpdate()\"\n type=\"text\"\n class=\"form-control\"\n size=\"3\"\n />\n <div class=\"validation-message\">\n <div *ngFor=\"let key of form.controls[qtyControlName].errors | values\">\n <span>\n {{ form.controls[qtyControlName]?.errors?.[key].message }}\n </span>\n </div>\n <span *ngIf=\"form.controls[qtyControlName].valid\"> &nbsp; </span>\n </div>\n <span *ngIf=\"prices.length > 0\">\n <div>{{ prices[0].explanation }}</div>\n <span *ngIf=\"prices.length > 1 && prices[1].explanation\">\n <div>{{ prices[1].explanation }}</div>\n </span>\n </span>\n </div>\n </div>\n </div>\n\n <div class=\"box-actions\">\n <ng-container *ngIf=\"section.controlType !== 'MESSAGE'\">\n <ng-template #msgTemplate>\n <div class=\"runtime-info-message\">\n <ul class=\"message-text\">\n <li *ngFor=\"let message of section.model?.messages\">{{ message }}</li>\n </ul>\n </div>\n </ng-template>\n\n <div\n class=\"box-action-button\"\n *ngIf=\"(section.model?.messages?.length ?? 0) > 0\"\n [popover]=\"msgTemplate\"\n placement=\"left\"\n container=\"body\"\n [isOpen]=\"true\"\n >\n <a href=\"javascript:void(0);\">\n <i class=\"fa fa-info check-icon\"></i>\n </a>\n </div>\n </ng-container>\n\n <div\n class=\"box-action-button\"\n (click)=\"toggleCollapse()\"\n [hidden]=\"!section.children || section.children.length < 1\"\n >\n <a><i class=\"fa fa-chevron-down check-icon\"></i></a>\n </div>\n\n <div class=\"box-action-button\" (click)=\"handleRemove()\">\n <a><i class=\"fa fa-trash-o check-icon\"></i></a>\n </div>\n </div>\n </div>\n\n <ng-content></ng-content>\n</div>\n", directives: [{ type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5$1.PopoverDirective, selector: "[popover]", inputs: ["outsideClick", "containerClass", "isOpen", "adaptivePosition", "popover", "popoverContext", "popoverTitle", "placement", "triggers", "container", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }], pipes: { "values": i7.ValuesPipe } });
2102
2136
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloTypeComponent, decorators: [{
2103
2137
  type: Component,
@@ -2106,7 +2140,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
2106
2140
  selector: 'velo-type',
2107
2141
  templateUrl: 'velo-type.component.html',
2108
2142
  }]
2109
- }], ctorParameters: function () { return [{ type: FormScopeService }, { type: CollapsibleStateService }, { type: SectionScopeService }, { type: i3.MessageService }]; } });
2143
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: CollapsibleStateService }, { type: SectionScopeService }, { type: i3$1.MessageService }]; } });
2110
2144
 
2111
2145
  class SfQueryDirective {
2112
2146
  constructor(apiService) {
@@ -3762,7 +3796,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
3762
3796
  styleUrls: ['./runtime-legacy-styles.scss', 'runtime.component.scss'],
3763
3797
  providers: [FormScopeService, CollapsibleStateService, OrderByPipe, SearchFilterPipe],
3764
3798
  }]
3765
- }], ctorParameters: function () { return [{ type: SectionsService }, { type: FormScopeService }, { type: CollapsibleStateService }, { type: RuntimeFormService }, { type: RuntimeService }, { type: i3.MessageService, decorators: [{
3799
+ }], ctorParameters: function () { return [{ type: SectionsService }, { type: FormScopeService }, { type: CollapsibleStateService }, { type: RuntimeFormService }, { type: RuntimeService }, { type: i3$1.MessageService, decorators: [{
3766
3800
  type: Inject,
3767
3801
  args: [MessageService]
3768
3802
  }] }, { type: ContextService }, { type: i7.OrderByPipe }, { type: i7.SearchFilterPipe }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { solutionUpdated: [{
@@ -3904,6 +3938,7 @@ RuntimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version:
3904
3938
  DatePipe,
3905
3939
  SectionsService,
3906
3940
  SectionStoreService,
3941
+ DialogService,
3907
3942
  ], imports: [[
3908
3943
  CommonModule,
3909
3944
  FormsModule,
@@ -3932,6 +3967,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
3932
3967
  DatePipe,
3933
3968
  SectionsService,
3934
3969
  SectionStoreService,
3970
+ DialogService,
3935
3971
  ],
3936
3972
  imports: [
3937
3973
  CommonModule,