@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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common'), require('@veloce/core'), require('@angular/cdk/drag-drop'), require('@angular/forms'), require('lodash'), require('@veloce/sdk/runtime'), require('rxjs/operators'), require('@veloce/api'), require('primeng/api'), require('@babel/standalone'), require('@veloce/components')) :
3
- typeof define === 'function' && define.amd ? define('@veloce/sdk/cms', ['exports', '@angular/core', 'rxjs', '@angular/common', '@veloce/core', '@angular/cdk/drag-drop', '@angular/forms', 'lodash', '@veloce/sdk/runtime', 'rxjs/operators', '@veloce/api', 'primeng/api', '@babel/standalone', '@veloce/components'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloce = global.veloce || {}, global.veloce.sdk = global.veloce.sdk || {}, global.veloce.sdk.cms = {}), global.ng.core, global.rxjs, global.ng.common, global["@veloce/core"], global.ng.cdk.dragDrop, global.ng.forms, global.lodash, global.veloce.sdk.runtime, global.rxjs.operators, global["@veloce/api"], global["primeng/api"], global["@babel/standalone"], global["@veloce/components"]));
5
- })(this, (function (exports, i0, rxjs, i7, core, dragDrop, angularForms, lodash, i2, rxjsOperators, i1, i2$1, standalone, i5) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common'), require('@veloce/core'), require('@angular/cdk/drag-drop'), require('@angular/forms'), require('lodash'), require('@veloce/sdk/runtime'), require('rxjs/operators'), require('@veloce/components'), require('@veloce/api'), require('primeng/api'), require('primeng/dynamicdialog'), require('@babel/standalone')) :
3
+ typeof define === 'function' && define.amd ? define('@veloce/sdk/cms', ['exports', '@angular/core', 'rxjs', '@angular/common', '@veloce/core', '@angular/cdk/drag-drop', '@angular/forms', 'lodash', '@veloce/sdk/runtime', 'rxjs/operators', '@veloce/components', '@veloce/api', 'primeng/api', 'primeng/dynamicdialog', '@babel/standalone'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloce = global.veloce || {}, global.veloce.sdk = global.veloce.sdk || {}, global.veloce.sdk.cms = {}), global.ng.core, global.rxjs, global.ng.common, global["@veloce/core"], global.ng.cdk.dragDrop, global.ng.forms, global.lodash, global.veloce.sdk.runtime, global.rxjs.operators, global["@veloce/components"], global["@veloce/api"], global["primeng/api"], global.i5$1, global["@babel/standalone"]));
5
+ })(this, (function (exports, i0, rxjs, i7, core, dragDrop, angularForms, lodash, i2, rxjsOperators, i5, i1, i2$1, i5$1, standalone) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -29,9 +29,10 @@
29
29
  var lodash__namespace = /*#__PURE__*/_interopNamespace(lodash);
30
30
  var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2);
31
31
  var rxjsOperators__namespace = /*#__PURE__*/_interopNamespace(rxjsOperators);
32
+ var i5__namespace$1 = /*#__PURE__*/_interopNamespace(i5);
32
33
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
33
34
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2$1);
34
- var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
35
+ var i5__namespace = /*#__PURE__*/_interopNamespace(i5$1);
35
36
 
36
37
  /*! *****************************************************************************
37
38
  Copyright (c) Microsoft Corporation.
@@ -803,7 +804,7 @@
803
804
  var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
804
805
  // need to reset regex last index to prevent null result for next execution
805
806
  METADATA_DECORATOR_REGEX.lastIndex = 0;
806
- return eval("(" + metadataString + ")");
807
+ return new Function("return " + metadataString)();
807
808
  };
808
809
  var extendElementMetadata = function (script, extend) {
809
810
  var _a;
@@ -813,7 +814,7 @@
813
814
  if (!metadataString) {
814
815
  return script;
815
816
  }
816
- var updated = Object.assign(Object.assign({}, eval("(" + metadataString + ")")), extend);
817
+ var updated = Object.assign(Object.assign({}, new Function("return " + metadataString)()), extend);
817
818
  return script.replace(metadataString, stringifyElementMetadata(updated));
818
819
  };
819
820
  var getElementConfig = function (type) {
@@ -1145,11 +1146,12 @@
1145
1146
  }], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }, { type: i2__namespace$1.ContextService }, { type: RuntimeContextService }]; } });
1146
1147
 
1147
1148
  var ConfigurationService = /** @class */ (function () {
1148
- function ConfigurationService(runtimeService, contextService, configurationApiService, messageService) {
1149
+ function ConfigurationService(runtimeService, contextService, configurationApiService, messageService, dialogService) {
1149
1150
  this.runtimeService = runtimeService;
1150
1151
  this.contextService = contextService;
1151
1152
  this.configurationApiService = configurationApiService;
1152
1153
  this.messageService = messageService;
1154
+ this.dialogService = dialogService;
1153
1155
  this.mode = core.ConfigurationMode.SEARCH;
1154
1156
  this.states = {};
1155
1157
  this.lineItem = new rxjs.BehaviorSubject(undefined);
@@ -1224,21 +1226,21 @@
1224
1226
  var configurationRequest = this.createRequest(lineItem);
1225
1227
  configurationRequest.lineItems = this.states.currentState || [];
1226
1228
  configurationRequest.asset = this.states.asset;
1227
- var request$;
1228
- if (uiDefinitionProperties.pricingEnabled) {
1229
- request$ = this.configurationApiService.configureAndPriceLineItem(configurationRequest, runtimeModel).pipe(rxjsOperators.map(function (_e) {
1230
- var lineItem = _e.lineItem, context = _e.context, charges = _e.charges;
1231
- if (context) {
1232
- _this.contextService.update({ properties: context.properties });
1233
- }
1234
- _this.charges.next(charges !== null && charges !== void 0 ? charges : {});
1235
- return lineItem;
1236
- }));
1237
- }
1238
- else {
1239
- request$ = this.configurationApiService.configureLineItem(configurationRequest, runtimeModel);
1240
- }
1241
- return request$.pipe(rxjsOperators.tap(function (lineItem) { return lineItem && _this.lineItem.next(lineItem); }), rxjsOperators.catchError(function (error) { return rxjs.throwError(function () { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); }); }));
1229
+ var pricingEnabled = uiDefinitionProperties.pricingEnabled;
1230
+ return this.configurationApiService
1231
+ .configureLineItem({ configurationRequest: configurationRequest, runtimeModel: runtimeModel, pricingEnabled: pricingEnabled })
1232
+ .pipe(rxjsOperators.map(function (_e) {
1233
+ var lineItem = _e.lineItem, context = _e.context, charges = _e.charges, deletedLineItems = _e.deletedLineItems;
1234
+ if (context) {
1235
+ _this.contextService.update({ properties: context.properties });
1236
+ }
1237
+ _this.charges.next(charges !== null && charges !== void 0 ? charges : {});
1238
+ if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
1239
+ _this.showInactiveProductsConfirmation();
1240
+ }
1241
+ return lineItem;
1242
+ }))
1243
+ .pipe(rxjsOperators.tap(function (lineItem) { return lineItem && _this.lineItem.next(lineItem); }), rxjsOperators.catchError(function (error) { return rxjs.throwError(function () { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); }); }));
1242
1244
  };
1243
1245
  ConfigurationService.prototype.createRequest = function (lineItem) {
1244
1246
  return {
@@ -1249,13 +1251,39 @@
1249
1251
  context: this.contextService.resolve(),
1250
1252
  };
1251
1253
  };
1254
+ ConfigurationService.prototype.showInactiveProductsConfirmation = function () {
1255
+ var _this = this;
1256
+ this.dialogService
1257
+ .open(i5.ConfirmationComponent, {
1258
+ dismissableMask: false,
1259
+ closeOnEscape: false,
1260
+ closable: false,
1261
+ showHeader: true,
1262
+ header: "Inactive Products in Quote",
1263
+ width: '440px',
1264
+ data: {
1265
+ confirmationConfig: {
1266
+ title: ' ',
1267
+ description: 'This quote contains inactive products. Do you want to remove them?',
1268
+ submitBtn: 'Remove products',
1269
+ cancelBtn: 'Back to Quote',
1270
+ },
1271
+ },
1272
+ })
1273
+ .onClose.subscribe(function (result) {
1274
+ if (!result) {
1275
+ var context = _this.contextService.resolve();
1276
+ window['VELO_BACK_FN'].apply(null, [(context === null || context === void 0 ? void 0 : context.headerId) || '']);
1277
+ }
1278
+ });
1279
+ };
1252
1280
  return ConfigurationService;
1253
1281
  }());
1254
- ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: ConfigurationRuntimeService }, { token: i2__namespace$1.ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i2__namespace.MessageService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1282
+ ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: ConfigurationRuntimeService }, { token: i2__namespace$1.ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i2__namespace.MessageService }, { token: i5__namespace.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1255
1283
  ConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService });
1256
1284
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, decorators: [{
1257
1285
  type: i0.Injectable
1258
- }], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: i2__namespace$1.ContextService }, { type: i1__namespace.ConfigurationApiService }, { type: i2__namespace.MessageService }]; } });
1286
+ }], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: i2__namespace$1.ContextService }, { type: i1__namespace.ConfigurationApiService }, { type: i2__namespace.MessageService }, { type: i5__namespace.DialogService }]; } });
1259
1287
 
1260
1288
  var ElementRendererComponent = /** @class */ (function () {
1261
1289
  function ElementRendererComponent(parentInjector, dynamicModuleService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
@@ -1989,7 +2017,7 @@
1989
2017
  return PreviewComponent;
1990
2018
  }());
1991
2019
  PreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewComponent, deps: [{ token: LauncherService }, { token: ConfigurationService }, { token: i2__namespace.MessageService }, { token: ConfigurationRuntimeService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1992
- PreviewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition" }, providers: [IOProviderService, TemplatesService], ngImport: i0__namespace, 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__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.ShadowDom });
2020
+ PreviewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition" }, providers: [IOProviderService, TemplatesService], ngImport: i0__namespace, 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__namespace$1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.ShadowDom });
1993
2021
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewComponent, decorators: [{
1994
2022
  type: i0.Component,
1995
2023
  args: [{
@@ -2069,7 +2097,7 @@
2069
2097
  return ConfigurationModule;
2070
2098
  }());
2071
2099
  ConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2072
- ConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationModule });
2100
+ ConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationModule, imports: [i5.ConfirmationDialogModule] });
2073
2101
  ConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationModule, providers: [
2074
2102
  i2.ContextService,
2075
2103
  i1.ContextApiService,
@@ -2078,10 +2106,11 @@
2078
2106
  ConfigurationRuntimeService,
2079
2107
  RuntimeContextService,
2080
2108
  ConfigurationService,
2081
- ] });
2109
+ ], imports: [[i5.ConfirmationDialogModule]] });
2082
2110
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationModule, decorators: [{
2083
2111
  type: i0.NgModule,
2084
2112
  args: [{
2113
+ imports: [i5.ConfirmationDialogModule],
2085
2114
  providers: [
2086
2115
  i2.ContextService,
2087
2116
  i1.ContextApiService,
@@ -2108,6 +2137,7 @@
2108
2137
  i1.QuoteApiService,
2109
2138
  i1.DocumentTemplatesApiService,
2110
2139
  i1.DocumentAttachmentApiService,
2140
+ i5$1.DialogService,
2111
2141
  ], imports: [[i7.CommonModule, core.CoreModule, ConfigurationModule]] });
2112
2142
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, decorators: [{
2113
2143
  type: i0.NgModule,
@@ -2120,6 +2150,7 @@
2120
2150
  i1.QuoteApiService,
2121
2151
  i1.DocumentTemplatesApiService,
2122
2152
  i1.DocumentAttachmentApiService,
2153
+ i5$1.DialogService,
2123
2154
  ],
2124
2155
  }]
2125
2156
  }] });