@veloceapps/sdk 2.0.13 → 2.0.14

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,12 @@ 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 * as i3$1 from 'primeng/api';
16
19
  import { MessageService } from 'primeng/api';
17
20
  import { __awaiter, __decorate } from 'tslib';
18
21
  import { ScrollingModule as ScrollingModule$1 } from '@angular/cdk-experimental/scrolling';
@@ -21,8 +24,6 @@ import * as i5 from '@angular/common';
21
24
  import { CurrencyPipe, DOCUMENT, CommonModule, DatePipe } from '@angular/common';
22
25
  import '@angular/compiler';
23
26
  import { VeloceElementsModule } from '@veloce/elements';
24
- import * as i8 from '@veloce/components';
25
- import { LoaderModule } from '@veloce/components';
26
27
  import * as i5$1 from 'ngx-bootstrap/popover';
27
28
  import { PopoverModule } from 'ngx-bootstrap/popover';
28
29
  import { TemplatePortal } from '@angular/cdk/portal';
@@ -780,28 +781,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
780
781
  }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
781
782
 
782
783
  class ConfigurationService {
783
- constructor(configurationApiService, contextService) {
784
+ constructor(configurationApiService, contextService, dialogService) {
784
785
  this.configurationApiService = configurationApiService;
785
786
  this.contextService = contextService;
787
+ this.dialogService = dialogService;
786
788
  }
787
789
  configure(runtimeContext, states, resolve) {
790
+ var _a;
788
791
  const lineItem = (states && states.configurableRamp) || this.getDefaultLineItem(runtimeContext);
789
792
  const configurationMode = resolve ? ConfigurationMode.RESOLVE : ConfigurationMode.SEARCH;
790
793
  const configurationRequest = this.createRequest(lineItem, runtimeContext, configurationMode);
791
794
  configurationRequest.lineItems = states.currentState || [];
792
795
  configurationRequest.asset = states.asset;
793
796
  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
- }
797
+ const pricingEnabled = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.pricingEnabled;
798
+ return this.configurationApiService
799
+ .configureLineItem({
800
+ configurationRequest,
801
+ runtimeModel,
802
+ pricingEnabled,
803
+ })
804
+ .pipe(map(({ lineItem, context, deletedLineItems }) => {
805
+ if (context) {
806
+ this.contextService.update({ properties: context.properties });
807
+ }
808
+ if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
809
+ this.showInactiveProductsConfirmation();
810
+ }
811
+ return lineItem;
812
+ }));
805
813
  }
806
814
  createRequest(lineItem, runtimeContext, configurationMode) {
807
815
  var _a, _b, _c;
@@ -833,12 +841,37 @@ class ConfigurationService {
833
841
  : {}));
834
842
  return lineItem;
835
843
  }
844
+ showInactiveProductsConfirmation() {
845
+ this.dialogService
846
+ .open(ConfirmationComponent, {
847
+ dismissableMask: false,
848
+ closeOnEscape: false,
849
+ closable: false,
850
+ showHeader: true,
851
+ header: `Inactive Products in Quote`,
852
+ width: '440px',
853
+ data: {
854
+ confirmationConfig: {
855
+ title: ' ',
856
+ description: 'This quote contains inactive products. Do you want to remove them?',
857
+ submitBtn: 'Remove products',
858
+ cancelBtn: 'Back to Quote',
859
+ },
860
+ },
861
+ })
862
+ .onClose.subscribe(result => {
863
+ if (!result) {
864
+ const context = this.contextService.resolve();
865
+ window['VELO_BACK_FN'].apply(null, [(context === null || context === void 0 ? void 0 : context.headerId) || '']);
866
+ }
867
+ });
868
+ }
836
869
  }
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 });
870
+ 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
871
  ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService });
839
872
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, decorators: [{
840
873
  type: Injectable
841
- }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }]; } });
874
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: i3.DialogService }]; } });
842
875
 
843
876
  class RuntimeService {
844
877
  constructor(configurationService, contextService, messageService) {
@@ -937,11 +970,11 @@ class RuntimeService {
937
970
  this.runtimeContext.invocationContext = Object.assign(Object.assign({}, this.runtimeContext.invocationContext), { runtimeStep });
938
971
  }
939
972
  }
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 });
973
+ 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
974
  RuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeService });
942
975
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeService, decorators: [{
943
976
  type: Injectable
944
- }], ctorParameters: function () { return [{ type: ConfigurationService }, { type: ContextService }, { type: i3.MessageService }]; } });
977
+ }], ctorParameters: function () { return [{ type: ConfigurationService }, { type: ContextService }, { type: i3$1.MessageService }]; } });
945
978
 
946
979
  class QuoteService {
947
980
  constructor(contextService, quoteApiService, priceApiService) {
@@ -1094,11 +1127,11 @@ class RuntimeContextService {
1094
1127
  return uiDefinition;
1095
1128
  }
1096
1129
  }
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 });
1130
+ 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
1131
  RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService });
1099
1132
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, decorators: [{
1100
1133
  type: Injectable
1101
- }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: i3.MessageService }, { type: ContextService }]; } });
1134
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: i3$1.MessageService }, { type: ContextService }]; } });
1102
1135
 
1103
1136
  class SectionStoreService {
1104
1137
  constructor() {
@@ -2097,7 +2130,7 @@ class VeloTypeComponent {
2097
2130
  }
2098
2131
  }
2099
2132
  }
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 });
2133
+ 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
2134
  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
2135
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: VeloTypeComponent, decorators: [{
2103
2136
  type: Component,
@@ -2106,7 +2139,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
2106
2139
  selector: 'velo-type',
2107
2140
  templateUrl: 'velo-type.component.html',
2108
2141
  }]
2109
- }], ctorParameters: function () { return [{ type: FormScopeService }, { type: CollapsibleStateService }, { type: SectionScopeService }, { type: i3.MessageService }]; } });
2142
+ }], ctorParameters: function () { return [{ type: FormScopeService }, { type: CollapsibleStateService }, { type: SectionScopeService }, { type: i3$1.MessageService }]; } });
2110
2143
 
2111
2144
  class SfQueryDirective {
2112
2145
  constructor(apiService) {
@@ -3762,7 +3795,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
3762
3795
  styleUrls: ['./runtime-legacy-styles.scss', 'runtime.component.scss'],
3763
3796
  providers: [FormScopeService, CollapsibleStateService, OrderByPipe, SearchFilterPipe],
3764
3797
  }]
3765
- }], ctorParameters: function () { return [{ type: SectionsService }, { type: FormScopeService }, { type: CollapsibleStateService }, { type: RuntimeFormService }, { type: RuntimeService }, { type: i3.MessageService, decorators: [{
3798
+ }], ctorParameters: function () { return [{ type: SectionsService }, { type: FormScopeService }, { type: CollapsibleStateService }, { type: RuntimeFormService }, { type: RuntimeService }, { type: i3$1.MessageService, decorators: [{
3766
3799
  type: Inject,
3767
3800
  args: [MessageService]
3768
3801
  }] }, { type: ContextService }, { type: i7.OrderByPipe }, { type: i7.SearchFilterPipe }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { solutionUpdated: [{