@veloceapps/sdk 3.0.4 → 3.0.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.
- package/bundles/veloce-sdk-cms.umd.js +255 -27
- package/bundles/veloce-sdk-cms.umd.js.map +1 -1
- package/bundles/veloce-sdk-runtime.umd.js +11 -0
- package/bundles/veloce-sdk-runtime.umd.js.map +1 -1
- package/bundles/veloce-sdk.umd.js +219 -129
- package/bundles/veloce-sdk.umd.js.map +1 -1
- package/cms/launcher.module.d.ts +2 -1
- package/cms/modules/configuration/services/configuration-runtime.service.d.ts +2 -2
- package/cms/modules/flow-configuration/flow-configuration.module.d.ts +6 -0
- package/cms/modules/flow-configuration/index.d.ts +4 -0
- package/cms/modules/flow-configuration/services/flow-configuration.service.d.ts +34 -0
- package/cms/modules/flow-configuration/services/flow-update.service.d.ts +13 -0
- package/cms/modules/flow-configuration/types/update.types.d.ts +12 -0
- package/cms/modules/index.d.ts +1 -0
- package/cms/types/ui-definition.types.d.ts +2 -0
- package/cms/utils/line-item.utils.d.ts +1 -0
- package/esm2015/cms/components/preview/preview.component.js +2 -4
- package/esm2015/cms/launcher.module.js +5 -4
- package/esm2015/cms/modules/configuration/helpers.js +2 -2
- package/esm2015/cms/modules/configuration/services/configuration-runtime.service.js +7 -5
- package/esm2015/cms/modules/flow-configuration/flow-configuration.module.js +18 -0
- package/esm2015/cms/modules/flow-configuration/index.js +5 -0
- package/esm2015/cms/modules/flow-configuration/services/flow-configuration.service.js +77 -0
- package/esm2015/cms/modules/flow-configuration/services/flow-update.service.js +97 -0
- package/esm2015/cms/modules/flow-configuration/types/update.types.js +2 -0
- package/esm2015/cms/modules/index.js +2 -1
- package/esm2015/cms/types/ui-definition.types.js +1 -1
- package/esm2015/cms/utils/line-item.utils.js +14 -4
- package/esm2015/runtime/execution/directives/vl-ramp.directive.js +1 -1
- package/esm2015/runtime/services/context.service.js +5 -1
- package/esm2015/runtime/services/quote.service.js +4 -1
- package/esm2015/src/components/header/cart-overlay/cart-overlay.component.js +60 -0
- package/esm2015/src/components/header/cart-overlay/cart-overlay.module.js +21 -0
- package/esm2015/src/components/header/header.component.js +16 -10
- package/esm2015/src/components/header/header.module.js +6 -4
- package/esm2015/src/components/header/header.types.js +1 -1
- package/esm2015/src/flow.component.js +2 -6
- package/esm2015/src/pages/debug/debug.component.js +16 -11
- package/esm2015/src/resolvers/quote.resolver.js +21 -6
- package/fesm2015/veloce-sdk-cms.js +218 -28
- package/fesm2015/veloce-sdk-cms.js.map +1 -1
- package/fesm2015/veloce-sdk-runtime.js +7 -0
- package/fesm2015/veloce-sdk-runtime.js.map +1 -1
- package/fesm2015/veloce-sdk.js +150 -69
- package/fesm2015/veloce-sdk.js.map +1 -1
- package/package.json +1 -1
- package/runtime/execution/directives/vl-ramp.directive.d.ts +1 -1
- package/runtime/services/context.service.d.ts +1 -0
- package/runtime/services/quote.service.d.ts +1 -0
- package/src/components/header/cart-overlay/cart-overlay.component.d.ts +21 -0
- package/src/components/header/cart-overlay/cart-overlay.module.d.ts +11 -0
- package/src/components/header/header.component.d.ts +5 -2
- package/src/components/header/header.module.d.ts +3 -1
- package/src/components/header/header.types.d.ts +1 -0
- package/src/pages/debug/debug.component.d.ts +5 -2
- package/src/resolvers/quote.resolver.d.ts +6 -2
|
@@ -1,8 +1,10 @@
|
|
|
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/components'), require('@veloce/sdk/runtime'), require('rxjs/operators'), 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/components', '@veloce/sdk/runtime', 'rxjs/operators', '@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/components"], global.veloce.sdk.runtime, global.rxjs.operators, global["@veloce/api"], global["primeng/api"], global["primeng/dynamicdialog"], global["@babel/standalone"]));
|
|
5
|
-
})(this, (function (exports, i0, rxjs, i8, core, dragDrop, angularForms, lodash, i6, i2, rxjsOperators, i1,
|
|
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/components'), require('@veloce/sdk/runtime'), require('rxjs/operators'), require('@veloce/api'), require('primeng/api'), require('primeng/dynamicdialog'), require('@babel/standalone'), require('moment')) :
|
|
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/components', '@veloce/sdk/runtime', 'rxjs/operators', '@veloce/api', 'primeng/api', 'primeng/dynamicdialog', '@babel/standalone', 'moment'], 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/components"], global.veloce.sdk.runtime, global.rxjs.operators, global["@veloce/api"], global["primeng/api"], global["primeng/dynamicdialog"], global["@babel/standalone"], global.moment));
|
|
5
|
+
})(this, (function (exports, i0, rxjs, i8, core, dragDrop, angularForms, lodash, i6, i2, rxjsOperators, i1, i3, i5, standalone, moment) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
8
|
|
|
7
9
|
function _interopNamespace(e) {
|
|
8
10
|
if (e && e.__esModule) return e;
|
|
@@ -28,11 +30,12 @@
|
|
|
28
30
|
var angularForms__namespace = /*#__PURE__*/_interopNamespace(angularForms);
|
|
29
31
|
var lodash__namespace = /*#__PURE__*/_interopNamespace(lodash);
|
|
30
32
|
var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
|
|
31
|
-
var i2__namespace
|
|
33
|
+
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
32
34
|
var rxjsOperators__namespace = /*#__PURE__*/_interopNamespace(rxjsOperators);
|
|
33
35
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
34
|
-
var
|
|
36
|
+
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
|
35
37
|
var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
|
|
38
|
+
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
36
39
|
|
|
37
40
|
/*! *****************************************************************************
|
|
38
41
|
Copyright (c) Microsoft Corporation.
|
|
@@ -878,7 +881,18 @@
|
|
|
878
881
|
return blocks;
|
|
879
882
|
};
|
|
880
883
|
var findLineItem = function (id, lineItems) {
|
|
881
|
-
return
|
|
884
|
+
return findLineItemWithComparator(lineItems, function (li) { return li.id === id; });
|
|
885
|
+
};
|
|
886
|
+
var findLineItemWithComparator = function (lineItems, comparator) {
|
|
887
|
+
var currentLevel = lineItems;
|
|
888
|
+
while (currentLevel.length) {
|
|
889
|
+
var found = currentLevel.find(comparator);
|
|
890
|
+
if (found) {
|
|
891
|
+
return found;
|
|
892
|
+
}
|
|
893
|
+
currentLevel = lodash.flatten(currentLevel.map(function (parent) { return parent.lineItems; }));
|
|
894
|
+
}
|
|
895
|
+
return;
|
|
882
896
|
};
|
|
883
897
|
var insertLineItem = function (lineItem, parentId, toInsert) {
|
|
884
898
|
var insertData = lineItem.id === parentId ? [toInsert] : [];
|
|
@@ -1009,7 +1023,7 @@
|
|
|
1009
1023
|
var getDefaultLineItem = function (context, uiDefinitionProperties) {
|
|
1010
1024
|
var _a, _b, _c;
|
|
1011
1025
|
var id = core.UUID.UUID();
|
|
1012
|
-
var lineItem = Object.assign({ id: id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', qty: 1, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b.displayName) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (context.offeringId
|
|
1026
|
+
var lineItem = Object.assign({ id: id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty: 1, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b.displayName) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (context.offeringId
|
|
1013
1027
|
? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
|
|
1014
1028
|
: {}));
|
|
1015
1029
|
return lineItem;
|
|
@@ -1066,11 +1080,11 @@
|
|
|
1066
1080
|
};
|
|
1067
1081
|
return RuntimeContextService;
|
|
1068
1082
|
}());
|
|
1069
|
-
RuntimeContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RuntimeContextService, deps: [{ token: i1__namespace.ConfigurationApiService }, { token:
|
|
1083
|
+
RuntimeContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RuntimeContextService, deps: [{ token: i1__namespace.ConfigurationApiService }, { token: i3__namespace.MessageService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1070
1084
|
RuntimeContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RuntimeContextService });
|
|
1071
1085
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RuntimeContextService, decorators: [{
|
|
1072
1086
|
type: i0.Injectable
|
|
1073
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }, { type:
|
|
1087
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }, { type: i3__namespace.MessageService }]; } });
|
|
1074
1088
|
|
|
1075
1089
|
var ConfigurationRuntimeService = /** @class */ (function () {
|
|
1076
1090
|
function ConfigurationRuntimeService(apiService, contextService, runtimeContextService) {
|
|
@@ -1086,9 +1100,11 @@
|
|
|
1086
1100
|
this._assets = undefined;
|
|
1087
1101
|
this.uiDefinitionProperties = {};
|
|
1088
1102
|
};
|
|
1089
|
-
ConfigurationRuntimeService.prototype.initTestMode = function (modelId,
|
|
1103
|
+
ConfigurationRuntimeService.prototype.initTestMode = function (modelId, uiDefinition) {
|
|
1090
1104
|
var _this = this;
|
|
1091
|
-
|
|
1105
|
+
var _a, _b;
|
|
1106
|
+
this.uiDefinitionProperties = (_a = uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
|
|
1107
|
+
var uiDefinitionExternals = (_b = uiDefinition.externals) !== null && _b !== void 0 ? _b : {};
|
|
1092
1108
|
return rxjs.combineLatest([
|
|
1093
1109
|
this.apiService.getRuntimeDataByModelId(modelId),
|
|
1094
1110
|
this.contextService.create('TestId', core.ConfigurationContextMode.TEST),
|
|
@@ -1101,8 +1117,8 @@
|
|
|
1101
1117
|
runtimeMode: i2.RuntimeMode.TEST,
|
|
1102
1118
|
};
|
|
1103
1119
|
_this.contextService.update({
|
|
1104
|
-
priceListId: uiDefinitionProperties.priceList,
|
|
1105
|
-
properties: Object.assign(Object.assign(Object.assign({}, (_a = _this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), configurationContext.properties), { ModelId: modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: String(uiDefinitionProperties.pricingEnabled), StartDate: new Date().toISOString().substring(0, 10), PriceListId: uiDefinitionProperties.priceList }),
|
|
1120
|
+
priceListId: _this.uiDefinitionProperties.priceList,
|
|
1121
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = _this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), configurationContext.properties), { ModelId: modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: String(_this.uiDefinitionProperties.pricingEnabled), StartDate: new Date().toISOString().substring(0, 10), PriceListId: _this.uiDefinitionProperties.priceList }), uiDefinitionExternals),
|
|
1106
1122
|
});
|
|
1107
1123
|
_this._isInitialized = true;
|
|
1108
1124
|
}));
|
|
@@ -1165,11 +1181,11 @@
|
|
|
1165
1181
|
});
|
|
1166
1182
|
return ConfigurationRuntimeService;
|
|
1167
1183
|
}());
|
|
1168
|
-
ConfigurationRuntimeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationRuntimeService, deps: [{ token: i1__namespace.ConfigurationApiService }, { token: i2__namespace
|
|
1184
|
+
ConfigurationRuntimeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationRuntimeService, deps: [{ token: i1__namespace.ConfigurationApiService }, { token: i2__namespace.ContextService }, { token: RuntimeContextService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1169
1185
|
ConfigurationRuntimeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationRuntimeService });
|
|
1170
1186
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationRuntimeService, decorators: [{
|
|
1171
1187
|
type: i0.Injectable
|
|
1172
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }, { type: i2__namespace
|
|
1188
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }, { type: i2__namespace.ContextService }, { type: RuntimeContextService }]; } });
|
|
1173
1189
|
|
|
1174
1190
|
var ConfigurationService = /** @class */ (function () {
|
|
1175
1191
|
function ConfigurationService(runtimeService, contextService, configurationApiService, messageService, dialogService) {
|
|
@@ -1306,11 +1322,11 @@
|
|
|
1306
1322
|
};
|
|
1307
1323
|
return ConfigurationService;
|
|
1308
1324
|
}());
|
|
1309
|
-
ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: ConfigurationRuntimeService }, { token: i2__namespace
|
|
1325
|
+
ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: ConfigurationRuntimeService }, { token: i2__namespace.ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i3__namespace.MessageService }, { token: i5__namespace.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1310
1326
|
ConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService });
|
|
1311
1327
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, decorators: [{
|
|
1312
1328
|
type: i0.Injectable
|
|
1313
|
-
}], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: i2__namespace
|
|
1329
|
+
}], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: i2__namespace.ContextService }, { type: i1__namespace.ConfigurationApiService }, { type: i3__namespace.MessageService }, { type: i5__namespace.DialogService }]; } });
|
|
1314
1330
|
|
|
1315
1331
|
var ElementRendererComponent = /** @class */ (function () {
|
|
1316
1332
|
function ElementRendererComponent(parentInjector, dynamicModuleService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
|
|
@@ -1762,11 +1778,220 @@
|
|
|
1762
1778
|
DEFAULT: [],
|
|
1763
1779
|
};
|
|
1764
1780
|
|
|
1781
|
+
var FlowUpdateService = /** @class */ (function () {
|
|
1782
|
+
function FlowUpdateService() {
|
|
1783
|
+
}
|
|
1784
|
+
FlowUpdateService.prototype.update = function (rootLineItem, params) {
|
|
1785
|
+
switch (params.attributeType) {
|
|
1786
|
+
case 'QTY':
|
|
1787
|
+
return this.updateQty(rootLineItem, params);
|
|
1788
|
+
case 'START_DATE':
|
|
1789
|
+
return this.updateStartDate(rootLineItem, params);
|
|
1790
|
+
case 'END_DATE':
|
|
1791
|
+
return this.updateEndDate(rootLineItem, params);
|
|
1792
|
+
case 'PRICE_ADJUSTMENT':
|
|
1793
|
+
return this.updatePriceAdjustment(rootLineItem, params);
|
|
1794
|
+
default:
|
|
1795
|
+
return rootLineItem;
|
|
1796
|
+
}
|
|
1797
|
+
};
|
|
1798
|
+
FlowUpdateService.prototype.delete = function (lineItems, id) {
|
|
1799
|
+
var filtered = lineItems.filter(function (lineItem) { return lineItem.id !== id; });
|
|
1800
|
+
return filtered.map(function (lineItem) { return new LineItemWorker(lineItem).remove(id).li; });
|
|
1801
|
+
};
|
|
1802
|
+
FlowUpdateService.prototype.updateQty = function (rootLineItem, params) {
|
|
1803
|
+
// change quantity allowed only for lineItem
|
|
1804
|
+
if (params.dataType !== 'LINEITEM') {
|
|
1805
|
+
return rootLineItem;
|
|
1806
|
+
}
|
|
1807
|
+
var lineItem = findLineItem(params.id, [rootLineItem]);
|
|
1808
|
+
if (!lineItem) {
|
|
1809
|
+
return rootLineItem;
|
|
1810
|
+
}
|
|
1811
|
+
if (lineItem.id !== rootLineItem.id) {
|
|
1812
|
+
throw new Error('Quantity can be changed only for root product');
|
|
1813
|
+
}
|
|
1814
|
+
var updated = new LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, lineItem), { qty: params.newValue }));
|
|
1815
|
+
return updated.li;
|
|
1816
|
+
};
|
|
1817
|
+
FlowUpdateService.prototype.updateStartDate = function (rootLineItem, params) {
|
|
1818
|
+
var lineItem = findLineItem(params.id, [rootLineItem]);
|
|
1819
|
+
if (!lineItem) {
|
|
1820
|
+
return rootLineItem;
|
|
1821
|
+
}
|
|
1822
|
+
var updated = new LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, lineItem), { effectiveDate: moment__default["default"](params.newValue).format('YYYY-MM-DD') }));
|
|
1823
|
+
return updated.li;
|
|
1824
|
+
};
|
|
1825
|
+
FlowUpdateService.prototype.updateEndDate = function (rootLineItem, params) {
|
|
1826
|
+
var lineItem = findLineItem(params.id, [rootLineItem]);
|
|
1827
|
+
if (!lineItem) {
|
|
1828
|
+
return rootLineItem;
|
|
1829
|
+
}
|
|
1830
|
+
var updated = new LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, lineItem), { endDate: moment__default["default"](params.newValue).format('YYYY-MM-DD') }));
|
|
1831
|
+
return updated.li;
|
|
1832
|
+
};
|
|
1833
|
+
FlowUpdateService.prototype.updatePriceAdjustment = function (rootLineItem, params) {
|
|
1834
|
+
var comparator = params.dataType === 'LINEITEM'
|
|
1835
|
+
? function (li) { return li.id === params.id; }
|
|
1836
|
+
: params.dataType === 'CHARGE'
|
|
1837
|
+
? function (li) { return li.chargeItems.some(function (_a) {
|
|
1838
|
+
var id = _a.id;
|
|
1839
|
+
return id === params.id;
|
|
1840
|
+
}); }
|
|
1841
|
+
: params.dataType === 'GROUP_CHARGE'
|
|
1842
|
+
? function (li) { return li.chargeGroupItems.some(function (_a) {
|
|
1843
|
+
var id = _a.id;
|
|
1844
|
+
return id === params.id;
|
|
1845
|
+
}); }
|
|
1846
|
+
: undefined;
|
|
1847
|
+
if (!comparator) {
|
|
1848
|
+
return rootLineItem;
|
|
1849
|
+
}
|
|
1850
|
+
var lineItem = findLineItemWithComparator([rootLineItem], comparator);
|
|
1851
|
+
if (!lineItem) {
|
|
1852
|
+
return rootLineItem;
|
|
1853
|
+
}
|
|
1854
|
+
var updated;
|
|
1855
|
+
if (params.dataType === 'LINEITEM') {
|
|
1856
|
+
updated = Object.assign(Object.assign({}, lineItem), { chargeItems: lineItem.chargeItems.map(function (chargeItem, index) {
|
|
1857
|
+
return index === 0 ? Object.assign(Object.assign({}, chargeItem), { priceAdjustment: params.newValue }) : chargeItem;
|
|
1858
|
+
}) });
|
|
1859
|
+
}
|
|
1860
|
+
else if (params.dataType === 'CHARGE') {
|
|
1861
|
+
updated = Object.assign(Object.assign({}, lineItem), { chargeItems: lineItem.chargeItems.map(function (chargeItem) {
|
|
1862
|
+
return chargeItem.id === params.id ? Object.assign(Object.assign({}, chargeItem), { priceAdjustment: params.newValue }) : chargeItem;
|
|
1863
|
+
}) });
|
|
1864
|
+
}
|
|
1865
|
+
else if (params.dataType === 'GROUP_CHARGE') {
|
|
1866
|
+
updated = Object.assign(Object.assign({}, lineItem), { chargeGroupItems: lineItem.chargeGroupItems.map(function (chargeGroupItem) {
|
|
1867
|
+
return chargeGroupItem.id === params.id
|
|
1868
|
+
? Object.assign(Object.assign({}, chargeGroupItem), { priceAdjustment: params.newValue }) : chargeGroupItem;
|
|
1869
|
+
}) });
|
|
1870
|
+
}
|
|
1871
|
+
var updatedRootLineItem = updated ? new LineItemWorker(rootLineItem).replace(updated).li : rootLineItem;
|
|
1872
|
+
return updatedRootLineItem;
|
|
1873
|
+
};
|
|
1874
|
+
return FlowUpdateService;
|
|
1875
|
+
}());
|
|
1876
|
+
FlowUpdateService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowUpdateService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1877
|
+
FlowUpdateService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowUpdateService });
|
|
1878
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowUpdateService, decorators: [{
|
|
1879
|
+
type: i0.Injectable
|
|
1880
|
+
}] });
|
|
1881
|
+
|
|
1882
|
+
var FlowConfigurationService = /** @class */ (function () {
|
|
1883
|
+
function FlowConfigurationService(priceApiService, contextService, messageService, updateService) {
|
|
1884
|
+
this.priceApiService = priceApiService;
|
|
1885
|
+
this.contextService = contextService;
|
|
1886
|
+
this.messageService = messageService;
|
|
1887
|
+
this.updateService = updateService;
|
|
1888
|
+
this.lineItems = new rxjs.BehaviorSubject([]);
|
|
1889
|
+
this.charges = new rxjs.BehaviorSubject({});
|
|
1890
|
+
}
|
|
1891
|
+
FlowConfigurationService.prototype.reset = function () {
|
|
1892
|
+
this.lineItems.next([]);
|
|
1893
|
+
this.charges.next({});
|
|
1894
|
+
};
|
|
1895
|
+
FlowConfigurationService.prototype.calculate$ = function (currentState) {
|
|
1896
|
+
var _this = this;
|
|
1897
|
+
var context = this.contextService.resolve();
|
|
1898
|
+
return this.priceApiService.calculate({ context: context, currentState: currentState }).pipe(rxjs.tap(function (result) {
|
|
1899
|
+
_this.lineItems.next(result.lineItems);
|
|
1900
|
+
_this.charges.next(result.charges);
|
|
1901
|
+
if (context) {
|
|
1902
|
+
_this.contextService.update({ properties: context.properties });
|
|
1903
|
+
}
|
|
1904
|
+
}), rxjs.catchError(function (error) { return _this.handleError(error); }));
|
|
1905
|
+
};
|
|
1906
|
+
FlowConfigurationService.prototype.calculate = function (currentState) {
|
|
1907
|
+
this.calculate$(currentState).subscribe();
|
|
1908
|
+
};
|
|
1909
|
+
FlowConfigurationService.prototype.update$ = function (params) {
|
|
1910
|
+
var _this = this;
|
|
1911
|
+
return rxjs.of([]).pipe(rxjs.map(function () { return _this.lineItems.value.map(function (li) { return _this.updateService.update(li, params); }); }), rxjs.catchError(function (error) { return _this.handleError(error); }), rxjs.switchMap(function (currentState) { return _this.calculate$(currentState); }));
|
|
1912
|
+
};
|
|
1913
|
+
FlowConfigurationService.prototype.update = function (params) {
|
|
1914
|
+
this.update$(params).subscribe();
|
|
1915
|
+
};
|
|
1916
|
+
FlowConfigurationService.prototype.delete$ = function (id) {
|
|
1917
|
+
var _this = this;
|
|
1918
|
+
return rxjs.of([]).pipe(rxjs.map(function () { return _this.updateService.delete(_this.lineItems.value, id); }), rxjs.catchError(function (error) { return _this.handleError(error); }), rxjs.switchMap(function (currentState) { return _this.calculate$(currentState); }));
|
|
1919
|
+
};
|
|
1920
|
+
FlowConfigurationService.prototype.delete = function (id) {
|
|
1921
|
+
this.delete$(id).subscribe();
|
|
1922
|
+
};
|
|
1923
|
+
FlowConfigurationService.prototype.get = function () {
|
|
1924
|
+
return this.lineItems.asObservable().pipe(rxjs.shareReplay());
|
|
1925
|
+
};
|
|
1926
|
+
FlowConfigurationService.prototype.getSnapshot = function () {
|
|
1927
|
+
return this.lineItems.value.slice();
|
|
1928
|
+
};
|
|
1929
|
+
Object.defineProperty(FlowConfigurationService.prototype, "charges$", {
|
|
1930
|
+
get: function () {
|
|
1931
|
+
return this.charges.asObservable();
|
|
1932
|
+
},
|
|
1933
|
+
enumerable: false,
|
|
1934
|
+
configurable: true
|
|
1935
|
+
});
|
|
1936
|
+
Object.defineProperty(FlowConfigurationService.prototype, "chargesSnapshot", {
|
|
1937
|
+
get: function () {
|
|
1938
|
+
return this.charges.value;
|
|
1939
|
+
},
|
|
1940
|
+
enumerable: false,
|
|
1941
|
+
configurable: true
|
|
1942
|
+
});
|
|
1943
|
+
Object.defineProperty(FlowConfigurationService.prototype, "contextSnapshot", {
|
|
1944
|
+
get: function () {
|
|
1945
|
+
return this.contextService.resolve();
|
|
1946
|
+
},
|
|
1947
|
+
enumerable: false,
|
|
1948
|
+
configurable: true
|
|
1949
|
+
});
|
|
1950
|
+
Object.defineProperty(FlowConfigurationService.prototype, "context$", {
|
|
1951
|
+
get: function () {
|
|
1952
|
+
return this.contextService.resolve$();
|
|
1953
|
+
},
|
|
1954
|
+
enumerable: false,
|
|
1955
|
+
configurable: true
|
|
1956
|
+
});
|
|
1957
|
+
FlowConfigurationService.prototype.handleError = function (error) {
|
|
1958
|
+
console.error(error);
|
|
1959
|
+
this.messageService.add({ severity: 'error', summary: error });
|
|
1960
|
+
// bounce back if configuration call has failed
|
|
1961
|
+
this.lineItems.next(this.lineItems.value.slice());
|
|
1962
|
+
return rxjs.throwError(function () { return error; });
|
|
1963
|
+
};
|
|
1964
|
+
return FlowConfigurationService;
|
|
1965
|
+
}());
|
|
1966
|
+
FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.PriceApiService }, { token: i2__namespace.ContextService }, { token: i3__namespace.MessageService }, { token: FlowUpdateService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1967
|
+
FlowConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService });
|
|
1968
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, decorators: [{
|
|
1969
|
+
type: i0.Injectable
|
|
1970
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.PriceApiService }, { type: i2__namespace.ContextService }, { type: i3__namespace.MessageService }, { type: FlowUpdateService }]; } });
|
|
1971
|
+
|
|
1972
|
+
var FlowConfigurationModule = /** @class */ (function () {
|
|
1973
|
+
function FlowConfigurationModule() {
|
|
1974
|
+
}
|
|
1975
|
+
return FlowConfigurationModule;
|
|
1976
|
+
}());
|
|
1977
|
+
FlowConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1978
|
+
FlowConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule });
|
|
1979
|
+
FlowConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, i2.ContextService, i1.PriceApiService] });
|
|
1980
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule, decorators: [{
|
|
1981
|
+
type: i0.NgModule,
|
|
1982
|
+
args: [{
|
|
1983
|
+
providers: [FlowConfigurationService, FlowUpdateService, i2.ContextService, i1.PriceApiService],
|
|
1984
|
+
}]
|
|
1985
|
+
}] });
|
|
1986
|
+
|
|
1765
1987
|
var vlCmsModules = /*#__PURE__*/Object.freeze({
|
|
1766
1988
|
__proto__: null,
|
|
1767
1989
|
getDefaultLineItem: getDefaultLineItem,
|
|
1768
1990
|
ConfigurationRuntimeService: ConfigurationRuntimeService,
|
|
1769
|
-
ConfigurationService: ConfigurationService
|
|
1991
|
+
ConfigurationService: ConfigurationService,
|
|
1992
|
+
FlowConfigurationModule: FlowConfigurationModule,
|
|
1993
|
+
FlowConfigurationService: FlowConfigurationService,
|
|
1994
|
+
FlowUpdateService: FlowUpdateService
|
|
1770
1995
|
});
|
|
1771
1996
|
|
|
1772
1997
|
var InitAction = { type: 'INIT' };
|
|
@@ -1829,6 +2054,7 @@
|
|
|
1829
2054
|
isValidScript: isValidScript,
|
|
1830
2055
|
parseBoundPath: parseBoundPath,
|
|
1831
2056
|
findLineItem: findLineItem,
|
|
2057
|
+
findLineItemWithComparator: findLineItemWithComparator,
|
|
1832
2058
|
insertLineItem: insertLineItem,
|
|
1833
2059
|
removeLineItem: removeLineItem,
|
|
1834
2060
|
replaceLineItem: replaceLineItem,
|
|
@@ -2051,7 +2277,6 @@
|
|
|
2051
2277
|
};
|
|
2052
2278
|
PreviewComponent.prototype.initializeConfiguration$ = function () {
|
|
2053
2279
|
var _this = this;
|
|
2054
|
-
var _a;
|
|
2055
2280
|
var isAlreadyInitialized = this.runtimeService.isInitialized;
|
|
2056
2281
|
if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
|
|
2057
2282
|
return rxjs.of({});
|
|
@@ -2061,9 +2286,8 @@
|
|
|
2061
2286
|
return rxjs.of({});
|
|
2062
2287
|
}
|
|
2063
2288
|
// If still not initialized - init configuration in Test mode
|
|
2064
|
-
var uiDefinitionProps = (_a = this.uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
|
|
2065
2289
|
return this.runtimeService
|
|
2066
|
-
.initTestMode(this.modelId,
|
|
2290
|
+
.initTestMode(this.modelId, this.uiDefinition)
|
|
2067
2291
|
.pipe(rxjs.switchMap(function () { return _this.configurationService.configure(); }));
|
|
2068
2292
|
};
|
|
2069
2293
|
PreviewComponent.prototype.elementToMetadataSafe = function (elements) {
|
|
@@ -2101,7 +2325,7 @@
|
|
|
2101
2325
|
};
|
|
2102
2326
|
return PreviewComponent;
|
|
2103
2327
|
}());
|
|
2104
|
-
PreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewComponent, deps: [{ token: LauncherService }, { token: ConfigurationService }, { token:
|
|
2328
|
+
PreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewComponent, deps: [{ token: LauncherService }, { token: ConfigurationService }, { token: i3__namespace.MessageService }, { token: ConfigurationRuntimeService }, { token: IntegrationState }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2105
2329
|
PreviewComponent.ɵcmp = i0__namespace.ɵɵ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__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: i6__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i8__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i8__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.ShadowDom });
|
|
2106
2330
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewComponent, decorators: [{
|
|
2107
2331
|
type: i0.Component,
|
|
@@ -2114,7 +2338,7 @@
|
|
|
2114
2338
|
// use shadow DOM to prevent UI from being affected by global styles
|
|
2115
2339
|
encapsulation: i0.ViewEncapsulation.ShadowDom,
|
|
2116
2340
|
}]
|
|
2117
|
-
}], ctorParameters: function () { return [{ type: LauncherService }, { type: ConfigurationService }, { type:
|
|
2341
|
+
}], ctorParameters: function () { return [{ type: LauncherService }, { type: ConfigurationService }, { type: i3__namespace.MessageService }, { type: ConfigurationRuntimeService }, { type: IntegrationState }]; }, propDecorators: { modelId: [{
|
|
2118
2342
|
type: i0.Input
|
|
2119
2343
|
}], uiDefinition: [{
|
|
2120
2344
|
type: i0.Input
|
|
@@ -2217,12 +2441,12 @@
|
|
|
2217
2441
|
return LauncherModule;
|
|
2218
2442
|
}());
|
|
2219
2443
|
LauncherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2220
|
-
LauncherModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, imports: [i8.CommonModule, core.CoreModule, i1.ApiModule, ConfigurationModule] });
|
|
2221
|
-
LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, providers: [LauncherService, IntegrationState, DynamicModuleService, i5.DialogService], imports: [[i8.CommonModule, core.CoreModule, i1.ApiModule, ConfigurationModule]] });
|
|
2444
|
+
LauncherModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, imports: [i8.CommonModule, core.CoreModule, i1.ApiModule, ConfigurationModule, FlowConfigurationModule] });
|
|
2445
|
+
LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, providers: [LauncherService, IntegrationState, DynamicModuleService, i5.DialogService], imports: [[i8.CommonModule, core.CoreModule, i1.ApiModule, ConfigurationModule, FlowConfigurationModule]] });
|
|
2222
2446
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, decorators: [{
|
|
2223
2447
|
type: i0.NgModule,
|
|
2224
2448
|
args: [{
|
|
2225
|
-
imports: [i8.CommonModule, core.CoreModule, i1.ApiModule, ConfigurationModule],
|
|
2449
|
+
imports: [i8.CommonModule, core.CoreModule, i1.ApiModule, ConfigurationModule, FlowConfigurationModule],
|
|
2226
2450
|
providers: [LauncherService, IntegrationState, DynamicModuleService, i5.DialogService],
|
|
2227
2451
|
}]
|
|
2228
2452
|
}] });
|
|
@@ -2237,6 +2461,9 @@
|
|
|
2237
2461
|
exports.ELEMENT_CONFIG = ELEMENT_CONFIG;
|
|
2238
2462
|
exports.ELEMENT_METADATA = ELEMENT_METADATA;
|
|
2239
2463
|
exports.ElementDefinition = ElementDefinition;
|
|
2464
|
+
exports.FlowConfigurationModule = FlowConfigurationModule;
|
|
2465
|
+
exports.FlowConfigurationService = FlowConfigurationService;
|
|
2466
|
+
exports.FlowUpdateService = FlowUpdateService;
|
|
2240
2467
|
exports.IntegrationState = IntegrationState;
|
|
2241
2468
|
exports.LauncherModule = LauncherModule;
|
|
2242
2469
|
exports.LauncherService = LauncherService;
|
|
@@ -2253,6 +2480,7 @@
|
|
|
2253
2480
|
exports.extendElementMetadata = extendElementMetadata;
|
|
2254
2481
|
exports.extractElementMetadata = extractElementMetadata;
|
|
2255
2482
|
exports.findLineItem = findLineItem;
|
|
2483
|
+
exports.findLineItemWithComparator = findLineItemWithComparator;
|
|
2256
2484
|
exports.generateLineItem = generateLineItem;
|
|
2257
2485
|
exports.getAttributeValue = getAttributeValue;
|
|
2258
2486
|
exports.getAttributes = getAttributes;
|