@veloceapps/sdk 8.0.0-4 → 8.0.0-40
Sign up to get free protection for your applications and to get access to all the features.
- package/cms/components/element.component.d.ts +0 -1
- package/cms/utils/element.utils.d.ts +3 -1
- package/cms/vendor-map.d.ts +2 -1
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +1 -1
- package/core/modules/configuration/services/configuration.service.d.ts +3 -0
- package/core/modules/flow-configuration/types/update.types.d.ts +1 -1
- package/core/services/context.service.d.ts +1 -0
- package/esm2020/cms/components/element-children/element-children.component.mjs +3 -3
- package/esm2020/cms/components/element-children/element-children.module.mjs +4 -4
- package/esm2020/cms/components/element-drop-handle/element-drop-handle.component.mjs +3 -3
- package/esm2020/cms/components/element-drop-handle/element-drop-handle.module.mjs +4 -4
- package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +3 -3
- package/esm2020/cms/components/element-renderer/element-renderer.module.mjs +4 -4
- package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +5 -5
- package/esm2020/cms/components/element.component.mjs +2 -11
- package/esm2020/cms/components/plugin.component.mjs +3 -3
- package/esm2020/cms/components/preview/preview.component.mjs +3 -3
- package/esm2020/cms/components/preview/preview.module.mjs +4 -4
- package/esm2020/cms/directives/custom-template.directive.mjs +7 -7
- package/esm2020/cms/launcher.module.mjs +4 -4
- package/esm2020/cms/modules/federated/federated-host.directive.mjs +3 -3
- package/esm2020/cms/modules/federated/federated.component.mjs +3 -3
- package/esm2020/cms/modules/federated/federated.module.mjs +4 -4
- package/esm2020/cms/modules/migrations/migrations.module.mjs +4 -4
- package/esm2020/cms/modules/migrations/services/migrations.service.mjs +3 -3
- package/esm2020/cms/modules/runtime/runtime.module.mjs +4 -4
- package/esm2020/cms/modules/runtime/services/compilation.service.mjs +3 -3
- package/esm2020/cms/modules/runtime/services/runtime-editor.service.mjs +3 -3
- package/esm2020/cms/modules/runtime/services/runtime.service.mjs +3 -3
- package/esm2020/cms/plugins/configuration.plugin.mjs +3 -3
- package/esm2020/cms/plugins/element-hover.plugin.mjs +3 -3
- package/esm2020/cms/plugins/io.plugin.mjs +14 -5
- package/esm2020/cms/plugins/page.plugin.mjs +3 -3
- package/esm2020/cms/plugins/region.plugin.mjs +3 -3
- package/esm2020/cms/plugins/script.plugin.mjs +3 -3
- package/esm2020/cms/services/element-context.service.mjs +3 -3
- package/esm2020/cms/services/integration.state.mjs +3 -3
- package/esm2020/cms/services/io-provider.service.mjs +3 -3
- package/esm2020/cms/services/resources.service.mjs +3 -3
- package/esm2020/cms/services/templates.service.mjs +3 -3
- package/esm2020/cms/utils/element.utils.mjs +13 -3
- package/esm2020/cms/utils/elements-resolver.mjs +2 -2
- package/esm2020/cms/vendor-map.mjs +3 -2
- package/esm2020/core/core.module.mjs +5 -5
- package/esm2020/core/directives/directives.module.mjs +4 -4
- package/esm2020/core/directives/primeng-calendar.directive.mjs +3 -3
- package/esm2020/core/modules/configuration/configuration.module.mjs +4 -4
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +8 -11
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +13 -5
- package/esm2020/core/modules/configuration/services/configuration.state.mjs +3 -3
- package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +3 -3
- package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +4 -4
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +3 -3
- package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +13 -4
- package/esm2020/core/modules/flow-configuration/types/update.types.mjs +1 -1
- package/esm2020/core/pipes/date.pipe.mjs +3 -3
- package/esm2020/core/pipes/number.pipe.mjs +3 -3
- package/esm2020/core/pipes/pipes.module.mjs +4 -4
- package/esm2020/core/pipes/price.pipe.mjs +3 -3
- package/esm2020/core/services/context.service.mjs +17 -5
- package/esm2020/core/services/metric-calculation/metric-calculation.service.mjs +3 -3
- package/esm2020/core/services/product-images.service.mjs +3 -3
- package/esm2020/core/services/quote-draft.service.mjs +3 -3
- package/esm2020/core/services/runtime-settings.service.mjs +3 -3
- package/esm2020/runtime/components/component-preview/component-preview.component.mjs +3 -3
- package/esm2020/runtime/components/section-renderer/section-renderer.component.mjs +3 -3
- package/esm2020/runtime/components/ui-runtime/runtime.component.mjs +3 -3
- package/esm2020/runtime/components/ui-runtime-preview/runtime-preview.component.mjs +3 -3
- package/esm2020/runtime/execution/components/children-placeholder/children-placeholder.component.mjs +6 -6
- package/esm2020/runtime/execution/components/context-provider/context-provider.component.mjs +3 -3
- package/esm2020/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.mjs +3 -3
- package/esm2020/runtime/execution/components/federated/federated.component.mjs +3 -3
- package/esm2020/runtime/execution/components/velo-attribute/velo-attribute.component.mjs +3 -3
- package/esm2020/runtime/execution/components/velo-multiselect/velo-multiselect.component.mjs +3 -3
- package/esm2020/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.mjs +3 -3
- package/esm2020/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.mjs +3 -3
- package/esm2020/runtime/execution/components/velo-port-radio/velo-port-radio.component.mjs +3 -3
- package/esm2020/runtime/execution/components/velo-type/velo-type.component.mjs +3 -3
- package/esm2020/runtime/execution/directives/section-script.directive.mjs +3 -3
- package/esm2020/runtime/execution/directives/sf-query.directive.mjs +3 -3
- package/esm2020/runtime/execution/directives/velo-attribute.directive.mjs +3 -3
- package/esm2020/runtime/execution/directives/velo-port.directive.mjs +18 -18
- package/esm2020/runtime/execution/directives/vl-approval.directive.mjs +3 -3
- package/esm2020/runtime/execution/directives/vl-document-attachments.directive.mjs +3 -3
- package/esm2020/runtime/execution/directives/vl-document-templates.directive.mjs +3 -3
- package/esm2020/runtime/execution/directives/vl-quote.directive.mjs +3 -3
- package/esm2020/runtime/execution/directives/vl-ramp.directive.mjs +3 -3
- package/esm2020/runtime/execution/runtime-execution.module.mjs +4 -4
- package/esm2020/runtime/runtime.module.mjs +4 -4
- package/esm2020/runtime/services/cart.service.mjs +3 -3
- package/esm2020/runtime/services/collapsible-state.service.mjs +3 -3
- package/esm2020/runtime/services/configuration.service.mjs +3 -3
- package/esm2020/runtime/services/current-state.service.mjs +3 -3
- package/esm2020/runtime/services/form-scope.service.mjs +3 -3
- package/esm2020/runtime/services/product-model-cache.service.mjs +3 -3
- package/esm2020/runtime/services/runtime-context.service.mjs +3 -3
- package/esm2020/runtime/services/runtime-form.service.mjs +3 -3
- package/esm2020/runtime/services/runtime.service.mjs +3 -3
- package/esm2020/runtime/services/section-helper.service.mjs +3 -3
- package/esm2020/runtime/services/section-scope.service.mjs +3 -3
- package/esm2020/runtime/services/section-store.service.mjs +3 -3
- package/esm2020/runtime/services/section.service.mjs +6 -6
- package/esm2020/src/components/dialog/dialog.component.mjs +3 -3
- package/esm2020/src/components/dialog/dialog.module.mjs +4 -4
- package/esm2020/src/components/doc-gen/doc-gen.component.mjs +11 -15
- package/esm2020/src/components/doc-gen/doc-gen.module.mjs +4 -4
- package/esm2020/src/components/guided-selling/guided-selling.component.mjs +10 -13
- package/esm2020/src/components/guided-selling/guided-selling.module.mjs +4 -4
- package/esm2020/src/components/header/cart-overlay/cart-preview.component.mjs +3 -3
- package/esm2020/src/components/header/cart-overlay/cart-preview.module.mjs +4 -4
- package/esm2020/src/components/header/header.component.mjs +4 -4
- package/esm2020/src/components/header/header.module.mjs +4 -4
- package/esm2020/src/components/header/metrics/metrics.component.mjs +4 -4
- package/esm2020/src/components/header/metrics/metrics.module.mjs +4 -4
- package/esm2020/src/flow-routing.module.mjs +4 -4
- package/esm2020/src/flow.component.mjs +3 -3
- package/esm2020/src/flow.module.mjs +4 -4
- package/esm2020/src/guards/context.guard.mjs +3 -3
- package/esm2020/src/guards/product-unload.guard.mjs +3 -3
- package/esm2020/src/guards/root.guard.mjs +3 -3
- package/esm2020/src/pages/assets/assets.component.mjs +3 -3
- package/esm2020/src/pages/assets/assets.module.mjs +4 -4
- package/esm2020/src/pages/catalog/catalog.component.mjs +3 -3
- package/esm2020/src/pages/catalog/catalog.module.mjs +4 -4
- package/esm2020/src/pages/debug/debug.component.mjs +3 -3
- package/esm2020/src/pages/debug/debug.module.mjs +4 -4
- package/esm2020/src/pages/empty-account/empty-account.component.mjs +3 -3
- package/esm2020/src/pages/empty-account/empty-account.module.mjs +4 -4
- package/esm2020/src/pages/legacy-product/legacy-product.component.mjs +3 -3
- package/esm2020/src/pages/legacy-product/legacy-product.module.mjs +4 -4
- package/esm2020/src/pages/product/product.component.mjs +3 -3
- package/esm2020/src/pages/product/product.module.mjs +4 -4
- package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +3 -3
- package/esm2020/src/pages/record-not-found/record-not-found.module.mjs +4 -4
- package/esm2020/src/pages/remote/remote.component.mjs +3 -3
- package/esm2020/src/pages/remote/remote.module.mjs +4 -4
- package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +3 -3
- package/esm2020/src/pages/shopping-cart/shopping-cart.module.mjs +4 -4
- package/esm2020/src/resolvers/flow.resolver.mjs +3 -3
- package/esm2020/src/resolvers/quote.resolver.mjs +3 -3
- package/esm2020/src/services/doc-gen.service.mjs +3 -3
- package/esm2020/src/services/flow-dialog.service.mjs +3 -3
- package/esm2020/src/services/flow-router.service.mjs +5 -5
- package/esm2020/src/services/flow.service.mjs +13 -5
- package/esm2020/src/services/guided-selling.service.mjs +3 -3
- package/fesm2015/veloceapps-sdk-cms.mjs +1192 -1181
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +777 -753
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-runtime.mjs +137 -137
- package/fesm2015/veloceapps-sdk.mjs +217 -211
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +1016 -1004
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +445 -419
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-runtime.mjs +137 -137
- package/fesm2020/veloceapps-sdk.mjs +216 -211
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +3 -3
- package/src/components/doc-gen/doc-gen.component.d.ts +3 -6
- package/src/components/guided-selling/guided-selling.component.d.ts +2 -4
@@ -1,17 +1,17 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
2
|
import { InjectionToken, Injectable, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
|
3
|
-
import { UUID, ConfigurationContextMode, ConfigurationContext,
|
4
|
-
import { BehaviorSubject,
|
5
|
-
import { filter, tap, map,
|
3
|
+
import { UUID, ConfigurationContextMode, ConfigurationContext, ChargeGroupUtils, ConfigurationMode, ConfigurationTranslatorUtils, getUIDefinitionProperties, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, parseJsonSafely, RuntimeModel, isLegacyUIDefinition, SalesforceIdUtils, EntityUtil, formatNumber } from '@veloceapps/core';
|
4
|
+
import { BehaviorSubject, zip, noop, combineLatest, throwError, shareReplay as shareReplay$1, tap as tap$1, map as map$2, of, switchMap as switchMap$1, catchError as catchError$1, Subject, take as take$1, distinctUntilChanged } from 'rxjs';
|
5
|
+
import { filter, tap, map, switchMap, skip, take, shareReplay, catchError, finalize, first } from 'rxjs/operators';
|
6
6
|
import * as i1 from '@veloceapps/api';
|
7
7
|
import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
|
8
|
-
import { merge, flatten, sortBy, map as map$1,
|
8
|
+
import { merge, isEqual, flatten, sortBy, map as map$1, omit, transform, cloneDeep, uniq } from 'lodash';
|
9
|
+
import moment from 'moment';
|
9
10
|
import { HttpErrorResponse } from '@angular/common/http';
|
10
11
|
import * as i4 from '@veloceapps/components';
|
11
12
|
import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
|
12
13
|
import * as i5 from 'primeng/api';
|
13
14
|
import * as i6 from 'primeng/dynamicdialog';
|
14
|
-
import moment from 'moment';
|
15
15
|
import { NgControl } from '@angular/forms';
|
16
16
|
import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
|
17
17
|
|
@@ -97,6 +97,13 @@ class ContextService {
|
|
97
97
|
create(headerId, mode) {
|
98
98
|
return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
|
99
99
|
}
|
100
|
+
initTestMode() {
|
101
|
+
return this.create('TestId', ConfigurationContextMode.TEST).pipe(map(context => {
|
102
|
+
return this.update({
|
103
|
+
properties: Object.assign(Object.assign({}, context.properties), { RuntimeMode: ConfigurationContextMode.TEST, StartDate: new Date().toISOString().substring(0, 10), standalone: 'true' }),
|
104
|
+
});
|
105
|
+
}));
|
106
|
+
}
|
100
107
|
update(partialContext) {
|
101
108
|
const originalContext = this.resolve();
|
102
109
|
const updatedContext = Object.assign(Object.assign(Object.assign({}, originalContext), partialContext), { properties: Object.assign(Object.assign({}, originalContext.properties), partialContext.properties) });
|
@@ -113,167 +120,294 @@ class ContextService {
|
|
113
120
|
this.context.next(null);
|
114
121
|
}
|
115
122
|
}
|
116
|
-
ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
117
|
-
ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
118
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
123
|
+
ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
124
|
+
ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, providedIn: 'root' });
|
125
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, decorators: [{
|
119
126
|
type: Injectable,
|
120
127
|
args: [{ providedIn: 'root' }]
|
121
128
|
}], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
|
122
129
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
130
|
+
function calculateMetricByMethod(lineItems, metric, method) {
|
131
|
+
const items = getLineItemsByMethod(lineItems, method);
|
132
|
+
return items.reduce((acc, li) => {
|
133
|
+
let value = li.reduce((accProduct, item) => accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0), 0);
|
134
|
+
if (method === 'avg' && li.length > 0) {
|
135
|
+
value /= li.length;
|
136
|
+
}
|
137
|
+
return acc + value;
|
138
|
+
}, 0);
|
139
|
+
}
|
140
|
+
function getLineItemsByMethod(lineItems, method) {
|
141
|
+
switch (method) {
|
142
|
+
case 'first': {
|
143
|
+
return lineItems.filter(li => !li.rampInstanceId).map(item => [item]);
|
144
|
+
}
|
145
|
+
case 'last': {
|
146
|
+
const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
|
147
|
+
const products = rootTermItems.map(lineItem => [
|
148
|
+
lineItem,
|
149
|
+
...lineItems.filter(li => li.rampInstanceId === lineItem.id),
|
150
|
+
]);
|
151
|
+
return products
|
152
|
+
.map(items => [...items].sort((a, b) => getDateValue(a.endDate || '') - getDateValue(b.endDate || '')).pop())
|
153
|
+
.filter((li) => Boolean(li))
|
154
|
+
.map(item => [item]);
|
155
|
+
}
|
156
|
+
case 'avg': {
|
157
|
+
const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
|
158
|
+
return rootTermItems.map(lineItem => [lineItem, ...lineItems.filter(li => li.rampInstanceId === lineItem.id)]);
|
159
|
+
}
|
160
|
+
case 'sum': {
|
161
|
+
return lineItems.map(item => [item]);
|
162
|
+
}
|
163
|
+
default: {
|
164
|
+
return lineItems.map(item => [item]);
|
165
|
+
}
|
153
166
|
}
|
154
167
|
}
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
type: Injectable
|
159
|
-
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
|
168
|
+
function getDateValue(date) {
|
169
|
+
return date ? new Date(date).getTime() : 0;
|
170
|
+
}
|
160
171
|
|
161
|
-
class
|
162
|
-
|
163
|
-
this.
|
164
|
-
this.contextService = contextService;
|
165
|
-
this.runtimeContextService = runtimeContextService;
|
166
|
-
this._isInitialized = false;
|
167
|
-
this.uiDefinitionProperties = {};
|
172
|
+
class QuoteDraftService {
|
173
|
+
get isInitialized() {
|
174
|
+
return this.isInitializedSubj$.getValue();
|
168
175
|
}
|
169
|
-
|
170
|
-
this.
|
171
|
-
|
172
|
-
|
173
|
-
this.uiDefinitionProperties = {};
|
176
|
+
set isInitialized(value) {
|
177
|
+
if (this.isInitialized !== value) {
|
178
|
+
this.isInitializedSubj$.next(value);
|
179
|
+
}
|
174
180
|
}
|
175
|
-
|
176
|
-
|
177
|
-
this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
178
|
-
const uiDefinitionExternals = (_a = uiDefinitionContainer.source.externals) !== null && _a !== void 0 ? _a : {};
|
179
|
-
return combineLatest([
|
180
|
-
this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
|
181
|
-
this.contextService.create('TestId', ConfigurationContextMode.TEST),
|
182
|
-
]).pipe(first(), map(([runtimeData, context]) => {
|
183
|
-
var _a;
|
184
|
-
this.contextService.update({
|
185
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: uiDefinitionContainer.modelId, RuntimeMode: ConfigurationContextMode.TEST, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: this.uiDefinitionProperties.priceList, offeringId: this.uiDefinitionProperties.offeringId, standalone: 'true' }), uiDefinitionExternals),
|
186
|
-
});
|
187
|
-
this._runtimeContext = {
|
188
|
-
modelId: uiDefinitionContainer.modelId,
|
189
|
-
runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
|
190
|
-
runtimeMode: RuntimeMode.TEST,
|
191
|
-
uiDefinitionContainer,
|
192
|
-
};
|
193
|
-
return this._runtimeContext;
|
194
|
-
}), tap(() => (this._isInitialized = true)));
|
181
|
+
get hasUnsavedChanges() {
|
182
|
+
return this._hasUnsavedChanges;
|
195
183
|
}
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
const { PriceListId } = (_a = context.properties) !== null && _a !== void 0 ? _a : {};
|
203
|
-
const mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
|
204
|
-
this.id15to18('AccountId', mergeContext.properties);
|
205
|
-
this._runtimeContext = mergeContext;
|
206
|
-
if (context.properties && ((_b = this._runtimeContext.properties) === null || _b === void 0 ? void 0 : _b.StartDate)) {
|
207
|
-
this.contextService.update({
|
208
|
-
properties: Object.assign(Object.assign({}, this._runtimeContext.properties), context.properties),
|
209
|
-
});
|
210
|
-
}
|
211
|
-
return this._runtimeContext;
|
212
|
-
}), tap(() => (this._isInitialized = true)));
|
184
|
+
set hasUnsavedChanges(value) {
|
185
|
+
var _a, _b;
|
186
|
+
this._hasUnsavedChanges = value;
|
187
|
+
if (!this._hasUnsavedChanges) {
|
188
|
+
this.initialCurrentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
189
|
+
}
|
213
190
|
}
|
214
|
-
|
215
|
-
|
191
|
+
get hasProducts$() {
|
192
|
+
return this.quoteSubj$.pipe(map(() => this.hasProducts));
|
193
|
+
}
|
194
|
+
get hasProducts() {
|
195
|
+
const quoteDraft = this.quoteSubj$.value;
|
196
|
+
return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
|
197
|
+
}
|
198
|
+
constructor(context, quoteApiService, priceApiService) {
|
199
|
+
this.context = context;
|
200
|
+
this.quoteApiService = quoteApiService;
|
201
|
+
this.priceApiService = priceApiService;
|
202
|
+
this.quoteSubj$ = new BehaviorSubject(null);
|
203
|
+
this.resetSubj$ = new BehaviorSubject(true);
|
204
|
+
this.isInitializedSubj$ = new BehaviorSubject(false);
|
205
|
+
this.initialCurrentState = [];
|
206
|
+
this._hasUnsavedChanges = false;
|
207
|
+
this.allPriceLists = [];
|
208
|
+
this.assetPriceLists = [];
|
209
|
+
this.reset$ = this.resetSubj$.asObservable();
|
210
|
+
this.activePriceList$ = this.context.resolve$().pipe(map(ctx => this.allPriceLists.find(priceList => priceList.id === ctx.properties.PriceListId)), map(priceList => priceList !== null && priceList !== void 0 ? priceList : null));
|
211
|
+
this.isInitializedSubj$
|
212
|
+
.pipe(filter(isInitialized => isInitialized), switchMap(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
|
213
|
+
.subscribe();
|
214
|
+
}
|
215
|
+
reset() {
|
216
|
+
this.resetSubj$.next(true);
|
217
|
+
this.quoteSubj$.next(null);
|
218
|
+
this.hasUnsavedChanges = false;
|
219
|
+
}
|
220
|
+
init(quoteId, params) {
|
221
|
+
return zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(tap(([quote, allPriceLists]) => {
|
222
|
+
this.allPriceLists = allPriceLists;
|
223
|
+
this.quoteSubj$.next(quote);
|
224
|
+
this.context.update(quote.context);
|
225
|
+
this.populateActivePriceLists$();
|
226
|
+
}), map(() => noop()), take(1));
|
227
|
+
}
|
228
|
+
setCurrentLineItemState(lineItems) {
|
229
|
+
const quoteDraft = this.quoteSubj$.value;
|
230
|
+
if (!quoteDraft) {
|
216
231
|
return;
|
217
232
|
}
|
218
|
-
this.
|
219
|
-
this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
233
|
+
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
|
220
234
|
}
|
221
|
-
|
222
|
-
|
235
|
+
updateQuoteDraft(update) {
|
236
|
+
const quoteDraft = this.quoteSubj$.value;
|
237
|
+
if (!quoteDraft) {
|
223
238
|
return;
|
224
239
|
}
|
225
|
-
|
226
|
-
|
227
|
-
source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
|
240
|
+
if (update.context) {
|
241
|
+
this.context.set(update.context);
|
228
242
|
}
|
243
|
+
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
|
229
244
|
}
|
230
|
-
|
231
|
-
|
245
|
+
updateByPriceSummary(priceSummary) {
|
246
|
+
const quoteDraft = this.quoteSubj$.value;
|
247
|
+
if (!quoteDraft) {
|
248
|
+
return;
|
249
|
+
}
|
250
|
+
const updatedCurrentState = this.currentState.map(lineItem => {
|
251
|
+
const updated = priceSummary.lineItems.find(li => li.id === lineItem.id);
|
252
|
+
return updated !== null && updated !== void 0 ? updated : lineItem;
|
253
|
+
});
|
254
|
+
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
|
232
255
|
}
|
233
|
-
get
|
234
|
-
|
235
|
-
return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
|
256
|
+
get quoteDraft$() {
|
257
|
+
return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
|
236
258
|
}
|
237
|
-
get
|
238
|
-
|
259
|
+
get quoteDraft() {
|
260
|
+
const quote = this.quoteSubj$.value;
|
261
|
+
if (!quote) {
|
262
|
+
return null;
|
263
|
+
}
|
264
|
+
return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
|
239
265
|
}
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
type: Injectable
|
245
|
-
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
|
246
|
-
|
247
|
-
const findLineItem = (id, lineItems) => {
|
248
|
-
return findLineItemWithComparator(lineItems, (li) => li.id === id);
|
249
|
-
};
|
250
|
-
const findLineItemWithComparator = (lineItems, comparator) => {
|
251
|
-
let currentLevel = lineItems;
|
252
|
-
while (currentLevel.length) {
|
253
|
-
const found = currentLevel.find(comparator);
|
254
|
-
if (found) {
|
255
|
-
return found;
|
266
|
+
get quoteDraftForActivePriceList() {
|
267
|
+
const quoteDraft = this.quoteDraft;
|
268
|
+
if (!quoteDraft) {
|
269
|
+
return null;
|
256
270
|
}
|
257
|
-
|
271
|
+
return Object.assign(Object.assign({}, quoteDraft), { initialState: this.filterByActivePriceList(quoteDraft.initialState), currentState: this.filterByActivePriceList(quoteDraft.currentState) });
|
258
272
|
}
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
273
|
+
get currentState$() {
|
274
|
+
return this.quoteDraft$.pipe(map(quote => quote.currentState));
|
275
|
+
}
|
276
|
+
get currentState() {
|
277
|
+
var _a, _b;
|
278
|
+
return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
279
|
+
}
|
280
|
+
/**
|
281
|
+
* Stream of activeCurrentState
|
282
|
+
*/
|
283
|
+
get activeCurrentState$() {
|
284
|
+
return this.quoteDraft$.pipe(map(() => this.activeCurrentState));
|
285
|
+
}
|
286
|
+
/**
|
287
|
+
* activeCurrentState is currentState passed through additional filters
|
288
|
+
*/
|
289
|
+
get activeCurrentState() {
|
290
|
+
var _a, _b;
|
291
|
+
let currentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
292
|
+
currentState = this.filterByActivePriceList(currentState);
|
293
|
+
return currentState;
|
294
|
+
}
|
295
|
+
/**
|
296
|
+
* Stream of activeInitialState
|
297
|
+
*/
|
298
|
+
get activeInitialState$() {
|
299
|
+
return this.quoteDraft$.pipe(map(() => this.activeInitialState));
|
300
|
+
}
|
301
|
+
/**
|
302
|
+
* activeInitialState is initialState passed through additional filters
|
303
|
+
*/
|
304
|
+
get activeInitialState() {
|
305
|
+
var _a, _b;
|
306
|
+
const ctx = this.context.resolve();
|
307
|
+
let initialState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState) !== null && _b !== void 0 ? _b : [];
|
308
|
+
if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
|
309
|
+
initialState = this.filterByActivePriceList(initialState);
|
310
|
+
}
|
311
|
+
return initialState;
|
312
|
+
}
|
313
|
+
get isStandalone() {
|
314
|
+
return this.context.resolve().properties.standalone === 'true';
|
315
|
+
}
|
316
|
+
get isStandalone$() {
|
317
|
+
return this.context.resolve$().pipe(map(() => this.isStandalone));
|
318
|
+
}
|
319
|
+
getInitialCurrentState() {
|
320
|
+
return this.initialCurrentState;
|
321
|
+
}
|
322
|
+
isEditMode$() {
|
323
|
+
return this.context.resolve$().pipe(map(() => this.isEditMode()));
|
324
|
+
}
|
325
|
+
isEditMode() {
|
326
|
+
const context = this.context.resolve();
|
327
|
+
if (context.mode === ConfigurationContextMode.ACCOUNT) {
|
328
|
+
return true;
|
329
|
+
}
|
330
|
+
if (context.mode === ConfigurationContextMode.QUOTE) {
|
331
|
+
return context.properties.Status === 'Draft';
|
332
|
+
}
|
333
|
+
return false;
|
334
|
+
}
|
335
|
+
updateActivePriceList(priceListId) {
|
336
|
+
this.context.update({ properties: { PriceListId: priceListId } });
|
337
|
+
}
|
338
|
+
populateActivePriceLists$() {
|
339
|
+
const ctx = this.context.resolve();
|
340
|
+
const quoteDraft = this.quoteDraft;
|
341
|
+
if (!quoteDraft) {
|
342
|
+
return;
|
343
|
+
}
|
344
|
+
// In ACCOUNT mode populate price lists from related assets
|
345
|
+
if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
|
346
|
+
// Populate list of price lists
|
347
|
+
this.assetPriceLists = quoteDraft.currentState
|
348
|
+
.map(({ priceListId }) => priceListId)
|
349
|
+
.reduce((trunk, priceListId) => {
|
350
|
+
var _a, _b;
|
351
|
+
if (!priceListId || trunk.some(item => item.id === priceListId)) {
|
352
|
+
return trunk;
|
353
|
+
}
|
354
|
+
return [
|
355
|
+
...trunk,
|
356
|
+
{ id: priceListId, name: (_b = (_a = this.allPriceLists.find(item => item.id === priceListId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
|
357
|
+
];
|
358
|
+
}, []);
|
359
|
+
}
|
360
|
+
}
|
361
|
+
filterByActivePriceList(lineItems) {
|
362
|
+
const ctx = this.context.resolve();
|
363
|
+
return lineItems.filter(li => !li.priceListId || li.priceListId === ctx.properties.PriceListId);
|
364
|
+
}
|
365
|
+
markAsUpdated(quote) {
|
366
|
+
if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === ConfigurationContextMode.ACCOUNT) {
|
367
|
+
this.hasUnsavedChanges = !!quote && !quote.currentState.every(li => li.actionCode === 'EXIST');
|
368
|
+
}
|
369
|
+
else {
|
370
|
+
this.hasUnsavedChanges = !isEqual(this.initialCurrentState, quote === null || quote === void 0 ? void 0 : quote.currentState);
|
371
|
+
}
|
372
|
+
}
|
373
|
+
}
|
374
|
+
QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
375
|
+
QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, providedIn: 'root' });
|
376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, decorators: [{
|
377
|
+
type: Injectable,
|
378
|
+
args: [{ providedIn: 'root' }]
|
379
|
+
}], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }]; } });
|
380
|
+
|
381
|
+
const findLineItem = (id, lineItems) => {
|
382
|
+
return findLineItemWithComparator(lineItems, (li) => li.id === id);
|
383
|
+
};
|
384
|
+
const findLineItemWithComparator = (lineItems, comparator) => {
|
385
|
+
let currentLevel = lineItems;
|
386
|
+
while (currentLevel.length) {
|
387
|
+
const found = currentLevel.find(comparator);
|
388
|
+
if (found) {
|
389
|
+
return found;
|
390
|
+
}
|
391
|
+
currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
|
392
|
+
}
|
393
|
+
return;
|
394
|
+
};
|
395
|
+
const insertLineItem = (lineItem, parentId, toInsert) => {
|
396
|
+
const insertData = lineItem.id === parentId ? [toInsert] : [];
|
397
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: [
|
398
|
+
...insertData,
|
399
|
+
...lineItem.lineItems.map(li => {
|
400
|
+
return insertLineItem(li, parentId, toInsert);
|
401
|
+
}),
|
402
|
+
] });
|
403
|
+
};
|
404
|
+
const removeLineItem = (lineItem, idToRemove) => {
|
405
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems
|
406
|
+
.map(li => {
|
407
|
+
if (li.id === idToRemove) {
|
408
|
+
return;
|
409
|
+
}
|
410
|
+
else if (li.lineItems.length) {
|
277
411
|
return removeLineItem(li, idToRemove);
|
278
412
|
}
|
279
413
|
return li;
|
@@ -452,214 +586,145 @@ class LineItemWorker {
|
|
452
586
|
}
|
453
587
|
}
|
454
588
|
|
455
|
-
|
456
|
-
|
457
|
-
|
589
|
+
function extractMetadata(uiDefinition) {
|
590
|
+
return omit(uiDefinition, [
|
591
|
+
'children',
|
592
|
+
'pages',
|
593
|
+
'components',
|
594
|
+
]);
|
595
|
+
}
|
596
|
+
|
597
|
+
class FlowUpdateService {
|
598
|
+
update(rootLineItems, updates, charges) {
|
599
|
+
let remainingUpdates = [...updates];
|
600
|
+
let currentLevel = rootLineItems;
|
601
|
+
while (currentLevel.length && remainingUpdates.length) {
|
602
|
+
currentLevel.forEach(li => {
|
603
|
+
const unhandledUpdates = [];
|
604
|
+
remainingUpdates.forEach(update => {
|
605
|
+
let updated = false;
|
606
|
+
switch (update.dataType) {
|
607
|
+
case 'LINEITEM':
|
608
|
+
updated = this.applyLineItemUpdate(li, update, charges);
|
609
|
+
break;
|
610
|
+
case 'CHARGE':
|
611
|
+
updated = this.applyChargeUpdate(li, update);
|
612
|
+
break;
|
613
|
+
case 'GROUP_CHARGE':
|
614
|
+
updated = this.applyChargeGroupUpdate(li, update);
|
615
|
+
break;
|
616
|
+
default:
|
617
|
+
// Unknown dataType. Do not try to handle it anymore
|
618
|
+
updated = true;
|
619
|
+
}
|
620
|
+
if (!updated) {
|
621
|
+
unhandledUpdates.push(update);
|
622
|
+
}
|
623
|
+
});
|
624
|
+
remainingUpdates = unhandledUpdates;
|
625
|
+
});
|
626
|
+
currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
|
627
|
+
}
|
458
628
|
}
|
459
|
-
|
460
|
-
|
461
|
-
|
629
|
+
delete(lineItems, id) {
|
630
|
+
const idsToRemove = [id];
|
631
|
+
const topLevelLineItem = lineItems.find(li => li.id === id);
|
632
|
+
if (topLevelLineItem) {
|
633
|
+
// find term-related line items (which are only top level)
|
634
|
+
// expired term line items won't be deleted
|
635
|
+
let foundTermLineItem = topLevelLineItem;
|
636
|
+
while (foundTermLineItem) {
|
637
|
+
foundTermLineItem = lineItems.find(li => foundTermLineItem && li.rampInstanceId === foundTermLineItem.id);
|
638
|
+
if (foundTermLineItem) {
|
639
|
+
idsToRemove.push(foundTermLineItem.id);
|
640
|
+
}
|
641
|
+
}
|
462
642
|
}
|
643
|
+
const filtered = lineItems.filter(lineItem => !idsToRemove.includes(lineItem.id));
|
644
|
+
return filtered.map(lineItem => new LineItemWorker(lineItem).remove(id).li);
|
463
645
|
}
|
464
|
-
|
465
|
-
|
646
|
+
applyLineItemUpdate(lineItem, update, charges) {
|
647
|
+
if (lineItem.id !== update.id) {
|
648
|
+
return false;
|
649
|
+
}
|
650
|
+
switch (update.attributeType) {
|
651
|
+
case 'QTY':
|
652
|
+
lineItem.qty = update.newValue;
|
653
|
+
break;
|
654
|
+
case 'EFFECTIVE_START_DATE':
|
655
|
+
lineItem.properties['StartDate'] = moment(update.newValue).format('YYYY-MM-DD');
|
656
|
+
break;
|
657
|
+
case 'END_DATE':
|
658
|
+
lineItem.properties['EndDate'] = moment(update.newValue).format('YYYY-MM-DD');
|
659
|
+
break;
|
660
|
+
case 'PRICE_ADJUSTMENT':
|
661
|
+
{
|
662
|
+
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
663
|
+
if (charge) {
|
664
|
+
charge.priceAdjustment = update.newValue;
|
665
|
+
}
|
666
|
+
}
|
667
|
+
break;
|
668
|
+
case 'LIST_PRICE_ADJUSTMENT':
|
669
|
+
case 'MARGIN_ADJUSTMENT':
|
670
|
+
{
|
671
|
+
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
672
|
+
if (charge) {
|
673
|
+
charge.listPriceAdjustment = update.newValue;
|
674
|
+
}
|
675
|
+
}
|
676
|
+
break;
|
677
|
+
case 'COST_ADJUSTMENT':
|
678
|
+
{
|
679
|
+
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
680
|
+
if (charge) {
|
681
|
+
charge.costAdjustment = update.newValue;
|
682
|
+
}
|
683
|
+
}
|
684
|
+
break;
|
685
|
+
default:
|
686
|
+
throw new Error(`Not suppored AttributeType for LineItem update: ${update.attributeType}`);
|
687
|
+
}
|
688
|
+
return true;
|
466
689
|
}
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
690
|
+
applyChargeUpdate(lineItem, update) {
|
691
|
+
const foundCharge = lineItem.chargeItems.find(({ id }) => id === update.id);
|
692
|
+
if (!foundCharge) {
|
693
|
+
return false;
|
694
|
+
}
|
695
|
+
if (update.attributeType === 'PRICE_ADJUSTMENT') {
|
696
|
+
foundCharge.priceAdjustment = update.newValue;
|
697
|
+
}
|
698
|
+
else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
|
699
|
+
foundCharge.listPriceAdjustment = update.newValue;
|
472
700
|
}
|
701
|
+
else {
|
702
|
+
throw new Error(`Not suppored AttributeType for Charge Item update: ${update.attributeType}`);
|
703
|
+
}
|
704
|
+
return true;
|
473
705
|
}
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
const quoteDraft = this.quoteSubj$.value;
|
479
|
-
return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
|
480
|
-
}
|
481
|
-
constructor(context, quoteApiService, priceApiService) {
|
482
|
-
this.context = context;
|
483
|
-
this.quoteApiService = quoteApiService;
|
484
|
-
this.priceApiService = priceApiService;
|
485
|
-
this.quoteSubj$ = new BehaviorSubject(null);
|
486
|
-
this.resetSubj$ = new BehaviorSubject(true);
|
487
|
-
this.isInitializedSubj$ = new BehaviorSubject(false);
|
488
|
-
this.initialCurrentState = [];
|
489
|
-
this._hasUnsavedChanges = false;
|
490
|
-
this.allPriceLists = [];
|
491
|
-
this.assetPriceLists = [];
|
492
|
-
this.reset$ = this.resetSubj$.asObservable();
|
493
|
-
this.activePriceList$ = this.context.resolve$().pipe(map(ctx => this.allPriceLists.find(priceList => priceList.id === ctx.properties.PriceListId)), map(priceList => priceList !== null && priceList !== void 0 ? priceList : null));
|
494
|
-
this.isInitializedSubj$
|
495
|
-
.pipe(filter(isInitialized => isInitialized), switchMap(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
|
496
|
-
.subscribe();
|
497
|
-
}
|
498
|
-
reset() {
|
499
|
-
this.resetSubj$.next(true);
|
500
|
-
this.quoteSubj$.next(null);
|
501
|
-
this.hasUnsavedChanges = false;
|
502
|
-
}
|
503
|
-
init(quoteId, params) {
|
504
|
-
return zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(tap(([quote, allPriceLists]) => {
|
505
|
-
this.allPriceLists = allPriceLists;
|
506
|
-
this.quoteSubj$.next(quote);
|
507
|
-
this.context.update(quote.context);
|
508
|
-
this.populateActivePriceLists$();
|
509
|
-
}), map(() => noop()), take(1));
|
510
|
-
}
|
511
|
-
setCurrentLineItemState(lineItems) {
|
512
|
-
const quoteDraft = this.quoteSubj$.value;
|
513
|
-
if (!quoteDraft) {
|
514
|
-
return;
|
515
|
-
}
|
516
|
-
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
|
517
|
-
}
|
518
|
-
updateQuoteDraft(update) {
|
519
|
-
const quoteDraft = this.quoteSubj$.value;
|
520
|
-
if (!quoteDraft) {
|
521
|
-
return;
|
522
|
-
}
|
523
|
-
if (update.context) {
|
524
|
-
this.context.set(update.context);
|
525
|
-
}
|
526
|
-
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
|
527
|
-
}
|
528
|
-
updateByPriceSummary(priceSummary) {
|
529
|
-
const quoteDraft = this.quoteSubj$.value;
|
530
|
-
if (!quoteDraft) {
|
531
|
-
return;
|
532
|
-
}
|
533
|
-
const updatedCurrentState = this.currentState.map(lineItem => {
|
534
|
-
const updated = priceSummary.lineItems.find(li => li.id === lineItem.id);
|
535
|
-
return updated !== null && updated !== void 0 ? updated : lineItem;
|
536
|
-
});
|
537
|
-
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
|
538
|
-
}
|
539
|
-
get quoteDraft$() {
|
540
|
-
return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
|
541
|
-
}
|
542
|
-
get quoteDraft() {
|
543
|
-
const quote = this.quoteSubj$.value;
|
544
|
-
if (!quote) {
|
545
|
-
return null;
|
546
|
-
}
|
547
|
-
return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
|
548
|
-
}
|
549
|
-
get quoteDraftForActivePriceList() {
|
550
|
-
const quoteDraft = this.quoteDraft;
|
551
|
-
if (!quoteDraft) {
|
552
|
-
return null;
|
553
|
-
}
|
554
|
-
return Object.assign(Object.assign({}, quoteDraft), { initialState: this.filterByActivePriceList(quoteDraft.initialState), currentState: this.filterByActivePriceList(quoteDraft.currentState) });
|
555
|
-
}
|
556
|
-
get currentState$() {
|
557
|
-
return this.quoteDraft$.pipe(map(quote => quote.currentState));
|
558
|
-
}
|
559
|
-
get currentState() {
|
560
|
-
var _a, _b;
|
561
|
-
return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
562
|
-
}
|
563
|
-
/**
|
564
|
-
* Stream of activeCurrentState
|
565
|
-
*/
|
566
|
-
get activeCurrentState$() {
|
567
|
-
return this.quoteDraft$.pipe(map(() => this.activeCurrentState));
|
568
|
-
}
|
569
|
-
/**
|
570
|
-
* activeCurrentState is currentState passed through additional filters
|
571
|
-
*/
|
572
|
-
get activeCurrentState() {
|
573
|
-
var _a, _b;
|
574
|
-
let currentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
575
|
-
currentState = this.filterByActivePriceList(currentState);
|
576
|
-
return currentState;
|
577
|
-
}
|
578
|
-
/**
|
579
|
-
* Stream of activeInitialState
|
580
|
-
*/
|
581
|
-
get activeInitialState$() {
|
582
|
-
return this.quoteDraft$.pipe(map(() => this.activeInitialState));
|
583
|
-
}
|
584
|
-
/**
|
585
|
-
* activeInitialState is initialState passed through additional filters
|
586
|
-
*/
|
587
|
-
get activeInitialState() {
|
588
|
-
var _a, _b;
|
589
|
-
const ctx = this.context.resolve();
|
590
|
-
let initialState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState) !== null && _b !== void 0 ? _b : [];
|
591
|
-
if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
|
592
|
-
initialState = this.filterByActivePriceList(initialState);
|
593
|
-
}
|
594
|
-
return initialState;
|
595
|
-
}
|
596
|
-
get isStandalone() {
|
597
|
-
return this.context.resolve().properties.standalone === 'true';
|
598
|
-
}
|
599
|
-
get isStandalone$() {
|
600
|
-
return this.context.resolve$().pipe(map(() => this.isStandalone));
|
601
|
-
}
|
602
|
-
getInitialCurrentState() {
|
603
|
-
return this.initialCurrentState;
|
604
|
-
}
|
605
|
-
isEditMode$() {
|
606
|
-
return this.context.resolve$().pipe(map(() => this.isEditMode()));
|
607
|
-
}
|
608
|
-
isEditMode() {
|
609
|
-
const context = this.context.resolve();
|
610
|
-
if (context.mode === ConfigurationContextMode.ACCOUNT) {
|
611
|
-
return true;
|
612
|
-
}
|
613
|
-
if (context.mode === ConfigurationContextMode.QUOTE) {
|
614
|
-
return context.properties.Status === 'Draft';
|
615
|
-
}
|
616
|
-
return false;
|
617
|
-
}
|
618
|
-
updateActivePriceList(priceListId) {
|
619
|
-
this.context.update({ properties: { PriceListId: priceListId } });
|
620
|
-
}
|
621
|
-
populateActivePriceLists$() {
|
622
|
-
const ctx = this.context.resolve();
|
623
|
-
const quoteDraft = this.quoteDraft;
|
624
|
-
if (!quoteDraft) {
|
625
|
-
return;
|
706
|
+
applyChargeGroupUpdate(lineItem, update) {
|
707
|
+
const foundChargeGroup = ChargeGroupUtils.findChargeGroupById(update.id, lineItem);
|
708
|
+
if (!foundChargeGroup) {
|
709
|
+
return false;
|
626
710
|
}
|
627
|
-
|
628
|
-
|
629
|
-
// Populate list of price lists
|
630
|
-
this.assetPriceLists = quoteDraft.currentState
|
631
|
-
.map(({ priceListId }) => priceListId)
|
632
|
-
.reduce((trunk, priceListId) => {
|
633
|
-
var _a, _b;
|
634
|
-
if (!priceListId || trunk.some(item => item.id === priceListId)) {
|
635
|
-
return trunk;
|
636
|
-
}
|
637
|
-
return [
|
638
|
-
...trunk,
|
639
|
-
{ id: priceListId, name: (_b = (_a = this.allPriceLists.find(item => item.id === priceListId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
|
640
|
-
];
|
641
|
-
}, []);
|
711
|
+
if (update.attributeType === 'PRICE_ADJUSTMENT') {
|
712
|
+
foundChargeGroup.priceAdjustment = update.newValue;
|
642
713
|
}
|
643
|
-
|
644
|
-
|
645
|
-
const ctx = this.context.resolve();
|
646
|
-
return lineItems.filter(li => !li.priceListId || li.priceListId === ctx.properties.PriceListId);
|
647
|
-
}
|
648
|
-
markAsUpdated(quote) {
|
649
|
-
if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === ConfigurationContextMode.ACCOUNT) {
|
650
|
-
this.hasUnsavedChanges = !!quote && !quote.currentState.every(li => li.actionCode === 'EXIST');
|
714
|
+
else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
|
715
|
+
foundChargeGroup.listPriceAdjustment = update.newValue;
|
651
716
|
}
|
652
717
|
else {
|
653
|
-
|
718
|
+
throw new Error(`Not suppored AttributeType for Charge Group Item update: ${update.attributeType}`);
|
654
719
|
}
|
720
|
+
return true;
|
655
721
|
}
|
656
722
|
}
|
657
|
-
|
658
|
-
|
659
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
660
|
-
type: Injectable
|
661
|
-
|
662
|
-
}], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }]; } });
|
723
|
+
FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
724
|
+
FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService });
|
725
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService, decorators: [{
|
726
|
+
type: Injectable
|
727
|
+
}] });
|
663
728
|
|
664
729
|
class ConfigurationService {
|
665
730
|
constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
|
@@ -673,6 +738,7 @@ class ConfigurationService {
|
|
673
738
|
this.lineItem = new BehaviorSubject(undefined);
|
674
739
|
this.charges = new BehaviorSubject({});
|
675
740
|
this.pricePlans = new BehaviorSubject({});
|
741
|
+
this.procedureContext = new BehaviorSubject({});
|
676
742
|
this.isLoadingSubj$ = new BehaviorSubject(false);
|
677
743
|
this.isLoading$ = this.isLoadingSubj$.asObservable();
|
678
744
|
this.hasUnsavedChanges = false;
|
@@ -749,6 +815,12 @@ class ConfigurationService {
|
|
749
815
|
get pricePlansSnapshot() {
|
750
816
|
return this.pricePlans.value;
|
751
817
|
}
|
818
|
+
get procedureContext$() {
|
819
|
+
return this.procedureContext.asObservable();
|
820
|
+
}
|
821
|
+
get procedureContextSnapshot() {
|
822
|
+
return this.procedureContext.value;
|
823
|
+
}
|
752
824
|
configure() {
|
753
825
|
return this.configureRequest$(this.generateRequest());
|
754
826
|
}
|
@@ -760,10 +832,11 @@ class ConfigurationService {
|
|
760
832
|
const mainPricingEnabled = (_a = runtimeContext.properties) === null || _a === void 0 ? void 0 : _a.PricingEnabled;
|
761
833
|
const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
|
762
834
|
this.isLoadingSubj$.next(true);
|
763
|
-
return this.configurationApiService.configureLineItem({ configurationRequest, runtimeModel, pricingEnabled }).pipe(tap(({ lineItem, context, charges, pricePlans, deletedLineItems }) => {
|
835
|
+
return this.configurationApiService.configureLineItem({ configurationRequest, runtimeModel, pricingEnabled }).pipe(tap(({ lineItem, context, charges, pricePlans, deletedLineItems, procedureContext }) => {
|
764
836
|
this.contextService.update(context !== null && context !== void 0 ? context : {});
|
765
837
|
this.charges.next(charges !== null && charges !== void 0 ? charges : {});
|
766
838
|
this.pricePlans.next(pricePlans !== null && pricePlans !== void 0 ? pricePlans : {});
|
839
|
+
this.procedureContext.next(procedureContext !== null && procedureContext !== void 0 ? procedureContext : {});
|
767
840
|
if (lineItem) {
|
768
841
|
this.lineItem.next(lineItem);
|
769
842
|
}
|
@@ -856,309 +929,46 @@ class ConfigurationService {
|
|
856
929
|
return (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
|
857
930
|
}
|
858
931
|
}
|
859
|
-
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
860
|
-
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
861
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
932
|
+
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i5.MessageService }, { token: i6.DialogService }], target: i0.ɵɵFactoryTarget.Injectable });
|
933
|
+
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService });
|
934
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, decorators: [{
|
862
935
|
type: Injectable
|
863
936
|
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6.DialogService }]; } });
|
864
937
|
|
865
|
-
class
|
866
|
-
constructor(
|
867
|
-
this.
|
868
|
-
this.
|
938
|
+
class FlowConfigurationService {
|
939
|
+
constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
|
940
|
+
this.proceduresApiService = proceduresApiService;
|
941
|
+
this.contextService = contextService;
|
942
|
+
this.quoteDraftService = quoteDraftService;
|
943
|
+
this.updateService = updateService;
|
869
944
|
this.configurationService = configurationService;
|
870
|
-
this.toastService = toastService;
|
871
|
-
this.stateSubj$ = new BehaviorSubject({});
|
872
|
-
this.state$ = this.stateSubj$.asObservable();
|
873
|
-
this.stateId = null;
|
874
945
|
}
|
875
|
-
|
876
|
-
return this.
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
actions: actions === null || actions === void 0 ? void 0 : actions.map(action => ({ name: action.apiName, script: action.script })),
|
885
|
-
selectors: selectors === null || selectors === void 0 ? void 0 : selectors.map(selector => ({ name: selector.apiName, script: selector.script })),
|
886
|
-
});
|
887
|
-
}), tap$1(stateId => (this.stateId = stateId || null)), map$2(() => undefined));
|
946
|
+
calculate$(quoteDraft) {
|
947
|
+
return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
|
948
|
+
// sort the result current state based on the quote draft initial state
|
949
|
+
const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
|
950
|
+
result.currentState = result.currentState
|
951
|
+
.slice()
|
952
|
+
.sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
|
953
|
+
this.quoteDraftService.updateQuoteDraft(result);
|
954
|
+
}), map$2(noop));
|
888
955
|
}
|
889
|
-
|
890
|
-
this.
|
891
|
-
this.configurationService.reset();
|
892
|
-
this.stateSubj$.next({});
|
956
|
+
calculate(quoteDraft) {
|
957
|
+
this.calculate$(quoteDraft).subscribe();
|
893
958
|
}
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
else {
|
899
|
-
return this.executeStateless$(req);
|
959
|
+
update$(updates) {
|
960
|
+
const quoteDraft = this.quoteDraftService.quoteDraft;
|
961
|
+
if (!quoteDraft) {
|
962
|
+
return of(null);
|
900
963
|
}
|
964
|
+
return of([]).pipe(map$2(() => {
|
965
|
+
const updatedState = cloneDeep(quoteDraft.currentState);
|
966
|
+
this.updateService.update(updatedState, updates, quoteDraft.charges);
|
967
|
+
return updatedState;
|
968
|
+
}), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
901
969
|
}
|
902
|
-
|
903
|
-
|
904
|
-
}
|
905
|
-
select$(selectorName, inputData) {
|
906
|
-
const requestId = UUID.UUID();
|
907
|
-
return this.execute$({
|
908
|
-
selectors: {
|
909
|
-
[requestId]: {
|
910
|
-
name: selectorName,
|
911
|
-
inputData,
|
912
|
-
},
|
913
|
-
},
|
914
|
-
}).pipe(map$2(() => this.stateSubj$.value[requestId]), tap$1(() => this.stateSubj$.next(omit(this.stateSubj$.value, requestId))));
|
915
|
-
}
|
916
|
-
get isStatefulConfiguration() {
|
917
|
-
var _a;
|
918
|
-
return (_a = this.runtimeService.uiDefinitionProperties.statefulConfigurationEnabled) !== null && _a !== void 0 ? _a : false;
|
919
|
-
}
|
920
|
-
executeStateless$(request) {
|
921
|
-
return of(undefined).pipe(switchMap$1(() => {
|
922
|
-
var _a;
|
923
|
-
// Apply actions and execute configuration/price call
|
924
|
-
// No need to run configuration if no actions in the request
|
925
|
-
if (!((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length)) {
|
926
|
-
return of(undefined);
|
927
|
-
}
|
928
|
-
let configurationRequest = this.configurationService.generateRequest();
|
929
|
-
request.actions.forEach(action => {
|
930
|
-
var _a;
|
931
|
-
configurationRequest = (_a = this.executeActionScript(configurationRequest, action)) !== null && _a !== void 0 ? _a : configurationRequest;
|
932
|
-
});
|
933
|
-
return this.configurationService.configureRequest$(configurationRequest);
|
934
|
-
}), tap$1(() => {
|
935
|
-
if (!request.selectors) {
|
936
|
-
return;
|
937
|
-
}
|
938
|
-
// Run selectors and apply them to the state
|
939
|
-
const finalConfigurationRequest = this.configurationService.generateRequest();
|
940
|
-
const selectorsResult = EntityUtil.entries(request.selectors).reduce((trunk, [key, selector]) => {
|
941
|
-
trunk[key] = this.executeSelectorScript(finalConfigurationRequest, selector);
|
942
|
-
return trunk;
|
943
|
-
}, {});
|
944
|
-
this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.value), selectorsResult));
|
945
|
-
}), map$2(() => undefined));
|
946
|
-
}
|
947
|
-
executeStateful$(request) {
|
948
|
-
if (!this.stateId) {
|
949
|
-
return of(undefined);
|
950
|
-
}
|
951
|
-
return this.statefulConfigurationApiService.execute(this.stateId, request).pipe(tap$1(response => {
|
952
|
-
this.stateId = response.stateId;
|
953
|
-
const updatedState = this.stateSubj$.value;
|
954
|
-
EntityUtil.entries(response.selectors).forEach(([key, value]) => {
|
955
|
-
if (!value.success) {
|
956
|
-
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
957
|
-
this.toastService.add({ summary: value.errorMessage, severity: ToastType.error });
|
958
|
-
}
|
959
|
-
return;
|
960
|
-
}
|
961
|
-
updatedState[key] = value.result;
|
962
|
-
});
|
963
|
-
this.stateSubj$.next(updatedState);
|
964
|
-
}), map$2(() => undefined));
|
965
|
-
}
|
966
|
-
executeActionScript(request, processor) {
|
967
|
-
var _a, _b, _c;
|
968
|
-
const { actions } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
|
969
|
-
const script = (_c = actions === null || actions === void 0 ? void 0 : actions.find(action => action.apiName === processor.name)) === null || _c === void 0 ? void 0 : _c.script;
|
970
|
-
if (!script) {
|
971
|
-
return null;
|
972
|
-
}
|
973
|
-
return this.executeProcessorScript(request, script, processor.inputData);
|
974
|
-
}
|
975
|
-
executeSelectorScript(request, processor) {
|
976
|
-
var _a, _b, _c;
|
977
|
-
const { selectors } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
|
978
|
-
const script = (_c = selectors === null || selectors === void 0 ? void 0 : selectors.find(selector => selector.apiName === processor.name)) === null || _c === void 0 ? void 0 : _c.script;
|
979
|
-
if (!script) {
|
980
|
-
return null;
|
981
|
-
}
|
982
|
-
return this.executeProcessorScript(request, script, processor.inputData);
|
983
|
-
}
|
984
|
-
executeProcessorScript(request, script, inputData) {
|
985
|
-
return new Function(`${script}\nreturn transform;`)()({
|
986
|
-
request,
|
987
|
-
inputData: inputData,
|
988
|
-
});
|
989
|
-
}
|
990
|
-
}
|
991
|
-
ConfigurationState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationState, deps: [{ token: i1.StatefulConfigurationApiService }, { token: ConfigurationRuntimeService }, { token: ConfigurationService }, { token: i4.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
992
|
-
ConfigurationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationState });
|
993
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationState, decorators: [{
|
994
|
-
type: Injectable
|
995
|
-
}], ctorParameters: function () { return [{ type: i1.StatefulConfigurationApiService }, { type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type: i4.ToastService }]; } });
|
996
|
-
|
997
|
-
function extractMetadata(uiDefinition) {
|
998
|
-
return omit(uiDefinition, [
|
999
|
-
'children',
|
1000
|
-
'pages',
|
1001
|
-
'components',
|
1002
|
-
]);
|
1003
|
-
}
|
1004
|
-
|
1005
|
-
class FlowUpdateService {
|
1006
|
-
update(rootLineItems, updates, charges) {
|
1007
|
-
let remainingUpdates = [...updates];
|
1008
|
-
let currentLevel = rootLineItems;
|
1009
|
-
while (currentLevel.length && remainingUpdates.length) {
|
1010
|
-
currentLevel.forEach(li => {
|
1011
|
-
const unhandledUpdates = [];
|
1012
|
-
remainingUpdates.forEach(update => {
|
1013
|
-
let updated = false;
|
1014
|
-
switch (update.dataType) {
|
1015
|
-
case 'LINEITEM':
|
1016
|
-
updated = this.applyLineItemUpdate(li, update, charges);
|
1017
|
-
break;
|
1018
|
-
case 'CHARGE':
|
1019
|
-
updated = this.applyChargeUpdate(li, update);
|
1020
|
-
break;
|
1021
|
-
case 'GROUP_CHARGE':
|
1022
|
-
updated = this.applyChargeGroupUpdate(li, update);
|
1023
|
-
break;
|
1024
|
-
default:
|
1025
|
-
// Unknown dataType. Do not try to handle it anymore
|
1026
|
-
updated = true;
|
1027
|
-
}
|
1028
|
-
if (!updated) {
|
1029
|
-
unhandledUpdates.push(update);
|
1030
|
-
}
|
1031
|
-
});
|
1032
|
-
remainingUpdates = unhandledUpdates;
|
1033
|
-
});
|
1034
|
-
currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
|
1035
|
-
}
|
1036
|
-
}
|
1037
|
-
delete(lineItems, id) {
|
1038
|
-
const idsToRemove = [id];
|
1039
|
-
const topLevelLineItem = lineItems.find(li => li.id === id);
|
1040
|
-
if (topLevelLineItem) {
|
1041
|
-
// find term-related line items (which are only top level)
|
1042
|
-
// expired term line items won't be deleted
|
1043
|
-
let foundTermLineItem = topLevelLineItem;
|
1044
|
-
while (foundTermLineItem) {
|
1045
|
-
foundTermLineItem = lineItems.find(li => foundTermLineItem && li.rampInstanceId === foundTermLineItem.id);
|
1046
|
-
if (foundTermLineItem) {
|
1047
|
-
idsToRemove.push(foundTermLineItem.id);
|
1048
|
-
}
|
1049
|
-
}
|
1050
|
-
}
|
1051
|
-
const filtered = lineItems.filter(lineItem => !idsToRemove.includes(lineItem.id));
|
1052
|
-
return filtered.map(lineItem => new LineItemWorker(lineItem).remove(id).li);
|
1053
|
-
}
|
1054
|
-
applyLineItemUpdate(lineItem, update, charges) {
|
1055
|
-
if (lineItem.id !== update.id) {
|
1056
|
-
return false;
|
1057
|
-
}
|
1058
|
-
switch (update.attributeType) {
|
1059
|
-
case 'QTY':
|
1060
|
-
lineItem.qty = update.newValue;
|
1061
|
-
break;
|
1062
|
-
case 'EFFECTIVE_START_DATE':
|
1063
|
-
lineItem.properties['StartDate'] = moment(update.newValue).format('YYYY-MM-DD');
|
1064
|
-
break;
|
1065
|
-
case 'END_DATE':
|
1066
|
-
lineItem.properties['EndDate'] = moment(update.newValue).format('YYYY-MM-DD');
|
1067
|
-
break;
|
1068
|
-
case 'PRICE_ADJUSTMENT':
|
1069
|
-
{
|
1070
|
-
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
1071
|
-
if (charge) {
|
1072
|
-
charge.priceAdjustment = update.newValue;
|
1073
|
-
}
|
1074
|
-
}
|
1075
|
-
break;
|
1076
|
-
case 'LIST_PRICE_ADJUSTMENT':
|
1077
|
-
{
|
1078
|
-
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
1079
|
-
if (charge) {
|
1080
|
-
charge.listPriceAdjustment = update.newValue;
|
1081
|
-
}
|
1082
|
-
}
|
1083
|
-
break;
|
1084
|
-
default:
|
1085
|
-
throw new Error(`Not suppored AttributeType for LineItem update: ${update.attributeType}`);
|
1086
|
-
}
|
1087
|
-
return true;
|
1088
|
-
}
|
1089
|
-
applyChargeUpdate(lineItem, update) {
|
1090
|
-
const foundCharge = lineItem.chargeItems.find(({ id }) => id === update.id);
|
1091
|
-
if (!foundCharge) {
|
1092
|
-
return false;
|
1093
|
-
}
|
1094
|
-
if (update.attributeType === 'PRICE_ADJUSTMENT') {
|
1095
|
-
foundCharge.priceAdjustment = update.newValue;
|
1096
|
-
}
|
1097
|
-
else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
|
1098
|
-
foundCharge.listPriceAdjustment = update.newValue;
|
1099
|
-
}
|
1100
|
-
else {
|
1101
|
-
throw new Error(`Not suppored AttributeType for Charge Item update: ${update.attributeType}`);
|
1102
|
-
}
|
1103
|
-
return true;
|
1104
|
-
}
|
1105
|
-
applyChargeGroupUpdate(lineItem, update) {
|
1106
|
-
const foundChargeGroup = ChargeGroupUtils.findChargeGroupById(update.id, lineItem);
|
1107
|
-
if (!foundChargeGroup) {
|
1108
|
-
return false;
|
1109
|
-
}
|
1110
|
-
if (update.attributeType === 'PRICE_ADJUSTMENT') {
|
1111
|
-
foundChargeGroup.priceAdjustment = update.newValue;
|
1112
|
-
}
|
1113
|
-
else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
|
1114
|
-
foundChargeGroup.listPriceAdjustment = update.newValue;
|
1115
|
-
}
|
1116
|
-
else {
|
1117
|
-
throw new Error(`Not suppored AttributeType for Charge Group Item update: ${update.attributeType}`);
|
1118
|
-
}
|
1119
|
-
return true;
|
1120
|
-
}
|
1121
|
-
}
|
1122
|
-
FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1123
|
-
FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowUpdateService });
|
1124
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowUpdateService, decorators: [{
|
1125
|
-
type: Injectable
|
1126
|
-
}] });
|
1127
|
-
|
1128
|
-
class FlowConfigurationService {
|
1129
|
-
constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
|
1130
|
-
this.proceduresApiService = proceduresApiService;
|
1131
|
-
this.contextService = contextService;
|
1132
|
-
this.quoteDraftService = quoteDraftService;
|
1133
|
-
this.updateService = updateService;
|
1134
|
-
this.configurationService = configurationService;
|
1135
|
-
}
|
1136
|
-
calculate$(quoteDraft) {
|
1137
|
-
return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
|
1138
|
-
// sort the result current state based on the quote draft initial state
|
1139
|
-
const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
|
1140
|
-
result.currentState = result.currentState
|
1141
|
-
.slice()
|
1142
|
-
.sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
|
1143
|
-
this.quoteDraftService.updateQuoteDraft(result);
|
1144
|
-
}), map$2(noop));
|
1145
|
-
}
|
1146
|
-
calculate(quoteDraft) {
|
1147
|
-
this.calculate$(quoteDraft).subscribe();
|
1148
|
-
}
|
1149
|
-
update$(updates) {
|
1150
|
-
const quoteDraft = this.quoteDraftService.quoteDraft;
|
1151
|
-
if (!quoteDraft) {
|
1152
|
-
return of(null);
|
1153
|
-
}
|
1154
|
-
return of([]).pipe(map$2(() => {
|
1155
|
-
const updatedState = cloneDeep(quoteDraft.currentState);
|
1156
|
-
this.updateService.update(updatedState, updates, quoteDraft.charges);
|
1157
|
-
return updatedState;
|
1158
|
-
}), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
1159
|
-
}
|
1160
|
-
update(updates) {
|
1161
|
-
this.update$(updates).subscribe();
|
970
|
+
update(updates) {
|
971
|
+
this.update$(updates).subscribe();
|
1162
972
|
}
|
1163
973
|
revert$(lineItemId) {
|
1164
974
|
const quoteDraft = this.quoteDraftService.quoteDraft;
|
@@ -1259,96 +1069,12 @@ class FlowConfigurationService {
|
|
1259
1069
|
};
|
1260
1070
|
}
|
1261
1071
|
}
|
1262
|
-
FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1263
|
-
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
1264
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1072
|
+
FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1073
|
+
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
|
1074
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
|
1265
1075
|
type: Injectable
|
1266
1076
|
}], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
|
1267
1077
|
|
1268
|
-
class FlowConfigurationModule {
|
1269
|
-
}
|
1270
|
-
FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1271
|
-
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule });
|
1272
|
-
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService] });
|
1273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule, decorators: [{
|
1274
|
-
type: NgModule,
|
1275
|
-
args: [{
|
1276
|
-
imports: [],
|
1277
|
-
providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
|
1278
|
-
}]
|
1279
|
-
}] });
|
1280
|
-
|
1281
|
-
class ConfigurationModule {
|
1282
|
-
}
|
1283
|
-
ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1284
|
-
ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
|
1285
|
-
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, providers: [
|
1286
|
-
ContextApiService,
|
1287
|
-
ProductModelApiService,
|
1288
|
-
ConfigurationApiService,
|
1289
|
-
ConfigurationRuntimeService,
|
1290
|
-
RuntimeContextService,
|
1291
|
-
ConfigurationService,
|
1292
|
-
ConfigurationState,
|
1293
|
-
], imports: [ConfirmationDialogModule] });
|
1294
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, decorators: [{
|
1295
|
-
type: NgModule,
|
1296
|
-
args: [{
|
1297
|
-
imports: [ConfirmationDialogModule],
|
1298
|
-
providers: [
|
1299
|
-
ContextApiService,
|
1300
|
-
ProductModelApiService,
|
1301
|
-
ConfigurationApiService,
|
1302
|
-
ConfigurationRuntimeService,
|
1303
|
-
RuntimeContextService,
|
1304
|
-
ConfigurationService,
|
1305
|
-
ConfigurationState,
|
1306
|
-
],
|
1307
|
-
}]
|
1308
|
-
}] });
|
1309
|
-
|
1310
|
-
function calculateMetricByMethod(lineItems, metric, method) {
|
1311
|
-
const items = getLineItemsByMethod(lineItems, method);
|
1312
|
-
return items.reduce((acc, li) => {
|
1313
|
-
let value = li.reduce((accProduct, item) => accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0), 0);
|
1314
|
-
if (method === 'avg' && li.length > 0) {
|
1315
|
-
value /= li.length;
|
1316
|
-
}
|
1317
|
-
return acc + value;
|
1318
|
-
}, 0);
|
1319
|
-
}
|
1320
|
-
function getLineItemsByMethod(lineItems, method) {
|
1321
|
-
switch (method) {
|
1322
|
-
case 'first': {
|
1323
|
-
return lineItems.filter(li => !li.rampInstanceId).map(item => [item]);
|
1324
|
-
}
|
1325
|
-
case 'last': {
|
1326
|
-
const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
|
1327
|
-
const products = rootTermItems.map(lineItem => [
|
1328
|
-
lineItem,
|
1329
|
-
...lineItems.filter(li => li.rampInstanceId === lineItem.id),
|
1330
|
-
]);
|
1331
|
-
return products
|
1332
|
-
.map(items => [...items].sort((a, b) => getDateValue(a.endDate || '') - getDateValue(b.endDate || '')).pop())
|
1333
|
-
.filter((li) => Boolean(li))
|
1334
|
-
.map(item => [item]);
|
1335
|
-
}
|
1336
|
-
case 'avg': {
|
1337
|
-
const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
|
1338
|
-
return rootTermItems.map(lineItem => [lineItem, ...lineItems.filter(li => li.rampInstanceId === lineItem.id)]);
|
1339
|
-
}
|
1340
|
-
case 'sum': {
|
1341
|
-
return lineItems.map(item => [item]);
|
1342
|
-
}
|
1343
|
-
default: {
|
1344
|
-
return lineItems.map(item => [item]);
|
1345
|
-
}
|
1346
|
-
}
|
1347
|
-
}
|
1348
|
-
function getDateValue(date) {
|
1349
|
-
return date ? new Date(date).getTime() : 0;
|
1350
|
-
}
|
1351
|
-
|
1352
1078
|
class MetricsCalculationService {
|
1353
1079
|
get onMetricsUpdate$() {
|
1354
1080
|
return this.metricsUpdated$.asObservable();
|
@@ -1417,9 +1143,9 @@ class MetricsCalculationService {
|
|
1417
1143
|
return this.activeMetricRules.find(metricRule => metricRule.metrics.find(metric => metric.totalName === name));
|
1418
1144
|
}
|
1419
1145
|
}
|
1420
|
-
MetricsCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1421
|
-
MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
1422
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1146
|
+
MetricsCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: FlowConfigurationService }, { token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1147
|
+
MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, providedIn: 'root' });
|
1148
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, decorators: [{
|
1423
1149
|
type: Injectable,
|
1424
1150
|
args: [{ providedIn: 'root' }]
|
1425
1151
|
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: FlowConfigurationService }, { type: i1.ConfigurationSettingsApiService }]; } });
|
@@ -1443,9 +1169,9 @@ class ProductImagesService {
|
|
1443
1169
|
.subscribe();
|
1444
1170
|
}
|
1445
1171
|
}
|
1446
|
-
ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1447
|
-
ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
1448
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1172
|
+
ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1173
|
+
ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, providedIn: 'root' });
|
1174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, decorators: [{
|
1449
1175
|
type: Injectable,
|
1450
1176
|
args: [{ providedIn: 'root' }]
|
1451
1177
|
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
@@ -1533,13 +1259,311 @@ class RuntimeSettingsService {
|
|
1533
1259
|
}, {});
|
1534
1260
|
}
|
1535
1261
|
}
|
1536
|
-
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1537
|
-
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
1538
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1262
|
+
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1263
|
+
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
|
1264
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
1539
1265
|
type: Injectable,
|
1540
1266
|
args: [{ providedIn: 'root' }]
|
1541
1267
|
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
1542
1268
|
|
1269
|
+
class RuntimeContextService {
|
1270
|
+
constructor(configurationApiService) {
|
1271
|
+
this.configurationApiService = configurationApiService;
|
1272
|
+
}
|
1273
|
+
getRuntimeContext(productId, offeringId) {
|
1274
|
+
return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
|
1275
|
+
var _a;
|
1276
|
+
const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
|
1277
|
+
const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
|
1278
|
+
const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
|
1279
|
+
const uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
1280
|
+
return {
|
1281
|
+
modelId: runtimeData.modelId,
|
1282
|
+
uiDefinitionContainer: uiDefinitionContainer,
|
1283
|
+
runtimeModel: runtimeModel,
|
1284
|
+
runtimeMode: RuntimeMode.PROD,
|
1285
|
+
productId: productId,
|
1286
|
+
productType: (properties === null || properties === void 0 ? void 0 : properties['displayName']) || productName,
|
1287
|
+
offeringId: offeringId,
|
1288
|
+
properties: {
|
1289
|
+
PricingEnabled: uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
|
1290
|
+
PriceListId: uiDefinitionProperties.priceList,
|
1291
|
+
},
|
1292
|
+
};
|
1293
|
+
}));
|
1294
|
+
}
|
1295
|
+
getUIDefinitionContainer(runtimeData) {
|
1296
|
+
var _a;
|
1297
|
+
const containers = runtimeData.uiDefinitions.filter(container => !isLegacyUIDefinition(container.source));
|
1298
|
+
return (_a = containers.find(container => container.source.primary)) !== null && _a !== void 0 ? _a : containers[0];
|
1299
|
+
}
|
1300
|
+
}
|
1301
|
+
RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1302
|
+
RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService });
|
1303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService, decorators: [{
|
1304
|
+
type: Injectable
|
1305
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
|
1306
|
+
|
1307
|
+
class ConfigurationRuntimeService {
|
1308
|
+
constructor(apiService, contextService, runtimeContextService) {
|
1309
|
+
this.apiService = apiService;
|
1310
|
+
this.contextService = contextService;
|
1311
|
+
this.runtimeContextService = runtimeContextService;
|
1312
|
+
this._isInitialized = false;
|
1313
|
+
this.uiDefinitionProperties = {};
|
1314
|
+
}
|
1315
|
+
reset() {
|
1316
|
+
this._isInitialized = false;
|
1317
|
+
this._runtimeContext = undefined;
|
1318
|
+
this.initializationProps = undefined;
|
1319
|
+
this.uiDefinitionProperties = {};
|
1320
|
+
}
|
1321
|
+
initTestMode(uiDefinitionContainer) {
|
1322
|
+
var _a;
|
1323
|
+
this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
1324
|
+
const uiDefinitionExternals = (_a = uiDefinitionContainer.source.externals) !== null && _a !== void 0 ? _a : {};
|
1325
|
+
return combineLatest([
|
1326
|
+
this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
|
1327
|
+
this.contextService.initTestMode(),
|
1328
|
+
]).pipe(first(), map(([runtimeData, context]) => {
|
1329
|
+
var _a;
|
1330
|
+
this.contextService.update({
|
1331
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: uiDefinitionContainer.modelId, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', PriceListId: this.uiDefinitionProperties.priceList, offeringId: this.uiDefinitionProperties.offeringId }), uiDefinitionExternals),
|
1332
|
+
});
|
1333
|
+
this._runtimeContext = {
|
1334
|
+
modelId: uiDefinitionContainer.modelId,
|
1335
|
+
runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
|
1336
|
+
runtimeMode: RuntimeMode.TEST,
|
1337
|
+
uiDefinitionContainer,
|
1338
|
+
};
|
1339
|
+
return this._runtimeContext;
|
1340
|
+
}), tap(() => (this._isInitialized = true)));
|
1341
|
+
}
|
1342
|
+
init(props) {
|
1343
|
+
this.initializationProps = props;
|
1344
|
+
const context = this.contextService.resolve();
|
1345
|
+
return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
|
1346
|
+
var _a, _b;
|
1347
|
+
this.uiDefinitionProperties = getUIDefinitionProperties(runtimeContext.uiDefinitionContainer);
|
1348
|
+
const { PriceListId } = (_a = context.properties) !== null && _a !== void 0 ? _a : {};
|
1349
|
+
const mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
|
1350
|
+
this.id15to18('AccountId', mergeContext.properties);
|
1351
|
+
this._runtimeContext = mergeContext;
|
1352
|
+
if (context.properties && ((_b = this._runtimeContext.properties) === null || _b === void 0 ? void 0 : _b.StartDate)) {
|
1353
|
+
this.contextService.update({
|
1354
|
+
properties: Object.assign(Object.assign({}, this._runtimeContext.properties), context.properties),
|
1355
|
+
});
|
1356
|
+
}
|
1357
|
+
return this._runtimeContext;
|
1358
|
+
}), tap(() => (this._isInitialized = true)));
|
1359
|
+
}
|
1360
|
+
overrideUIDefinition(uiDefinitionContainer) {
|
1361
|
+
if (!this._runtimeContext) {
|
1362
|
+
return;
|
1363
|
+
}
|
1364
|
+
this._runtimeContext.uiDefinitionContainer = uiDefinitionContainer;
|
1365
|
+
this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
1366
|
+
}
|
1367
|
+
id15to18(propertyName, source) {
|
1368
|
+
if (!source) {
|
1369
|
+
return;
|
1370
|
+
}
|
1371
|
+
const value = source[propertyName];
|
1372
|
+
if (typeof value === 'string' && value.length === 15) {
|
1373
|
+
source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
|
1374
|
+
}
|
1375
|
+
}
|
1376
|
+
get isInitialized() {
|
1377
|
+
return this._isInitialized;
|
1378
|
+
}
|
1379
|
+
get runtimeModel() {
|
1380
|
+
var _a;
|
1381
|
+
return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
|
1382
|
+
}
|
1383
|
+
get runtimeContext() {
|
1384
|
+
return this._runtimeContext;
|
1385
|
+
}
|
1386
|
+
}
|
1387
|
+
ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1388
|
+
ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService });
|
1389
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
|
1390
|
+
type: Injectable
|
1391
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
|
1392
|
+
|
1393
|
+
class ConfigurationState {
|
1394
|
+
constructor(statefulConfigurationApiService, runtimeService, configurationService, toastService) {
|
1395
|
+
this.statefulConfigurationApiService = statefulConfigurationApiService;
|
1396
|
+
this.runtimeService = runtimeService;
|
1397
|
+
this.configurationService = configurationService;
|
1398
|
+
this.toastService = toastService;
|
1399
|
+
this.stateSubj$ = new BehaviorSubject({});
|
1400
|
+
this.state$ = this.stateSubj$.asObservable();
|
1401
|
+
this.stateId = null;
|
1402
|
+
}
|
1403
|
+
init$() {
|
1404
|
+
return this.configurationService.configure().pipe(switchMap$1(() => {
|
1405
|
+
var _a, _b;
|
1406
|
+
if (!this.isStatefulConfiguration) {
|
1407
|
+
return of(undefined);
|
1408
|
+
}
|
1409
|
+
const { actions, selectors } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
|
1410
|
+
return this.statefulConfigurationApiService.init({
|
1411
|
+
request: this.configurationService.generateRequest(),
|
1412
|
+
actions: actions === null || actions === void 0 ? void 0 : actions.map(action => ({ name: action.apiName, script: action.script })),
|
1413
|
+
selectors: selectors === null || selectors === void 0 ? void 0 : selectors.map(selector => ({ name: selector.apiName, script: selector.script })),
|
1414
|
+
});
|
1415
|
+
}), tap$1(stateId => (this.stateId = stateId || null)), map$2(() => undefined));
|
1416
|
+
}
|
1417
|
+
cleanup() {
|
1418
|
+
this.stateId = null;
|
1419
|
+
this.configurationService.reset();
|
1420
|
+
this.stateSubj$.next({});
|
1421
|
+
}
|
1422
|
+
execute$(req) {
|
1423
|
+
if (this.isStatefulConfiguration) {
|
1424
|
+
return this.executeStateful$(req);
|
1425
|
+
}
|
1426
|
+
else {
|
1427
|
+
return this.executeStateless$(req);
|
1428
|
+
}
|
1429
|
+
}
|
1430
|
+
dispatch$(actionName, inputData) {
|
1431
|
+
return this.execute$({ actions: [{ name: actionName, inputData }] });
|
1432
|
+
}
|
1433
|
+
select$(selectorName, inputData) {
|
1434
|
+
const requestId = UUID.UUID();
|
1435
|
+
return this.execute$({
|
1436
|
+
selectors: {
|
1437
|
+
[requestId]: {
|
1438
|
+
name: selectorName,
|
1439
|
+
inputData,
|
1440
|
+
},
|
1441
|
+
},
|
1442
|
+
}).pipe(map$2(() => this.stateSubj$.value[requestId]), tap$1(() => this.stateSubj$.next(omit(this.stateSubj$.value, requestId))));
|
1443
|
+
}
|
1444
|
+
get isStatefulConfiguration() {
|
1445
|
+
var _a;
|
1446
|
+
return (_a = this.runtimeService.uiDefinitionProperties.statefulConfigurationEnabled) !== null && _a !== void 0 ? _a : false;
|
1447
|
+
}
|
1448
|
+
executeStateless$(request) {
|
1449
|
+
return of(undefined).pipe(switchMap$1(() => {
|
1450
|
+
var _a;
|
1451
|
+
// Apply actions and execute configuration/price call
|
1452
|
+
// No need to run configuration if no actions in the request
|
1453
|
+
if (!((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length)) {
|
1454
|
+
return of(undefined);
|
1455
|
+
}
|
1456
|
+
let configurationRequest = this.configurationService.generateRequest();
|
1457
|
+
request.actions.forEach(action => {
|
1458
|
+
var _a;
|
1459
|
+
configurationRequest = (_a = this.executeActionScript(configurationRequest, action)) !== null && _a !== void 0 ? _a : configurationRequest;
|
1460
|
+
});
|
1461
|
+
return this.configurationService.configureRequest$(configurationRequest);
|
1462
|
+
}), tap$1(() => {
|
1463
|
+
if (!request.selectors) {
|
1464
|
+
return;
|
1465
|
+
}
|
1466
|
+
// Run selectors and apply them to the state
|
1467
|
+
const finalConfigurationRequest = this.configurationService.generateRequest();
|
1468
|
+
const selectorsResult = EntityUtil.entries(request.selectors).reduce((trunk, [key, selector]) => {
|
1469
|
+
trunk[key] = this.executeSelectorScript(finalConfigurationRequest, selector);
|
1470
|
+
return trunk;
|
1471
|
+
}, {});
|
1472
|
+
this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.value), selectorsResult));
|
1473
|
+
}), map$2(() => undefined));
|
1474
|
+
}
|
1475
|
+
executeStateful$(request) {
|
1476
|
+
if (!this.stateId) {
|
1477
|
+
return of(undefined);
|
1478
|
+
}
|
1479
|
+
return this.statefulConfigurationApiService.execute(this.stateId, request).pipe(tap$1(response => {
|
1480
|
+
this.stateId = response.stateId;
|
1481
|
+
const updatedState = this.stateSubj$.value;
|
1482
|
+
EntityUtil.entries(response.selectors).forEach(([key, value]) => {
|
1483
|
+
if (!value.success) {
|
1484
|
+
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
1485
|
+
this.toastService.add({ summary: value.errorMessage, severity: ToastType.error });
|
1486
|
+
}
|
1487
|
+
return;
|
1488
|
+
}
|
1489
|
+
updatedState[key] = value.result;
|
1490
|
+
});
|
1491
|
+
this.stateSubj$.next(updatedState);
|
1492
|
+
}), map$2(() => undefined));
|
1493
|
+
}
|
1494
|
+
executeActionScript(request, processor) {
|
1495
|
+
var _a, _b, _c;
|
1496
|
+
const { actions } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
|
1497
|
+
const script = (_c = actions === null || actions === void 0 ? void 0 : actions.find(action => action.apiName === processor.name)) === null || _c === void 0 ? void 0 : _c.script;
|
1498
|
+
if (!script) {
|
1499
|
+
return null;
|
1500
|
+
}
|
1501
|
+
return this.executeProcessorScript(request, script, processor.inputData);
|
1502
|
+
}
|
1503
|
+
executeSelectorScript(request, processor) {
|
1504
|
+
var _a, _b, _c;
|
1505
|
+
const { selectors } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
|
1506
|
+
const script = (_c = selectors === null || selectors === void 0 ? void 0 : selectors.find(selector => selector.apiName === processor.name)) === null || _c === void 0 ? void 0 : _c.script;
|
1507
|
+
if (!script) {
|
1508
|
+
return null;
|
1509
|
+
}
|
1510
|
+
return this.executeProcessorScript(request, script, processor.inputData);
|
1511
|
+
}
|
1512
|
+
executeProcessorScript(request, script, inputData) {
|
1513
|
+
return new Function(`${script}\nreturn transform;`)()({
|
1514
|
+
request,
|
1515
|
+
inputData: inputData,
|
1516
|
+
});
|
1517
|
+
}
|
1518
|
+
}
|
1519
|
+
ConfigurationState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationState, deps: [{ token: i1.StatefulConfigurationApiService }, { token: ConfigurationRuntimeService }, { token: ConfigurationService }, { token: i4.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1520
|
+
ConfigurationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationState });
|
1521
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationState, decorators: [{
|
1522
|
+
type: Injectable
|
1523
|
+
}], ctorParameters: function () { return [{ type: i1.StatefulConfigurationApiService }, { type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type: i4.ToastService }]; } });
|
1524
|
+
|
1525
|
+
class FlowConfigurationModule {
|
1526
|
+
}
|
1527
|
+
FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1528
|
+
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule });
|
1529
|
+
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService] });
|
1530
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, decorators: [{
|
1531
|
+
type: NgModule,
|
1532
|
+
args: [{
|
1533
|
+
imports: [],
|
1534
|
+
providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
|
1535
|
+
}]
|
1536
|
+
}] });
|
1537
|
+
|
1538
|
+
class ConfigurationModule {
|
1539
|
+
}
|
1540
|
+
ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1541
|
+
ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
|
1542
|
+
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [
|
1543
|
+
ContextApiService,
|
1544
|
+
ProductModelApiService,
|
1545
|
+
ConfigurationApiService,
|
1546
|
+
ConfigurationRuntimeService,
|
1547
|
+
RuntimeContextService,
|
1548
|
+
ConfigurationService,
|
1549
|
+
ConfigurationState,
|
1550
|
+
], imports: [ConfirmationDialogModule] });
|
1551
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, decorators: [{
|
1552
|
+
type: NgModule,
|
1553
|
+
args: [{
|
1554
|
+
imports: [ConfirmationDialogModule],
|
1555
|
+
providers: [
|
1556
|
+
ContextApiService,
|
1557
|
+
ProductModelApiService,
|
1558
|
+
ConfigurationApiService,
|
1559
|
+
ConfigurationRuntimeService,
|
1560
|
+
RuntimeContextService,
|
1561
|
+
ConfigurationService,
|
1562
|
+
ConfigurationState,
|
1563
|
+
],
|
1564
|
+
}]
|
1565
|
+
}] });
|
1566
|
+
|
1543
1567
|
const DEFAULT_FORMATTING_SETTINGS = {
|
1544
1568
|
currencySymbol: DEFAULT_CURRENCY_SYMBOL,
|
1545
1569
|
decimalsCount: DEFAULT_DECIMALS_COUNT,
|
@@ -1549,9 +1573,9 @@ const DEFAULT_FORMATTING_SETTINGS = {
|
|
1549
1573
|
};
|
1550
1574
|
class SdkCoreModule {
|
1551
1575
|
}
|
1552
|
-
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1553
|
-
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.
|
1554
|
-
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.
|
1576
|
+
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1577
|
+
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
1578
|
+
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, providers: [
|
1555
1579
|
ContextService,
|
1556
1580
|
QuoteDraftService,
|
1557
1581
|
ProductImagesService,
|
@@ -1562,7 +1586,7 @@ SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version:
|
|
1562
1586
|
useExisting: RuntimeSettingsService,
|
1563
1587
|
},
|
1564
1588
|
], imports: [ConfigurationModule, FlowConfigurationModule] });
|
1565
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1589
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, decorators: [{
|
1566
1590
|
type: NgModule,
|
1567
1591
|
args: [{
|
1568
1592
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
@@ -1605,9 +1629,9 @@ class CalendarDirective {
|
|
1605
1629
|
}
|
1606
1630
|
}
|
1607
1631
|
}
|
1608
|
-
CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1609
|
-
CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
1610
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1632
|
+
CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
1633
|
+
CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: CalendarDirective, selector: "[vlCalendar]", inputs: { vlCalendar: "vlCalendar" }, ngImport: i0 });
|
1634
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarDirective, decorators: [{
|
1611
1635
|
type: Directive,
|
1612
1636
|
args: [{
|
1613
1637
|
selector: '[vlCalendar]',
|
@@ -1618,10 +1642,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
1618
1642
|
|
1619
1643
|
class SdkDirectivesModule {
|
1620
1644
|
}
|
1621
|
-
SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1622
|
-
SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.
|
1623
|
-
SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.
|
1624
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1645
|
+
SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1646
|
+
SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule, declarations: [CalendarDirective], exports: [CalendarDirective] });
|
1647
|
+
SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule });
|
1648
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule, decorators: [{
|
1625
1649
|
type: NgModule,
|
1626
1650
|
args: [{
|
1627
1651
|
declarations: [CalendarDirective],
|
@@ -1654,9 +1678,9 @@ class DatePipe {
|
|
1654
1678
|
}
|
1655
1679
|
}
|
1656
1680
|
}
|
1657
|
-
DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1658
|
-
DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.
|
1659
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1681
|
+
DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
1682
|
+
DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DatePipe, name: "vlDate" });
|
1683
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DatePipe, decorators: [{
|
1660
1684
|
type: Pipe,
|
1661
1685
|
args: [{
|
1662
1686
|
name: 'vlDate',
|
@@ -1678,9 +1702,9 @@ class NumberPipe {
|
|
1678
1702
|
return formatNumber(price, (_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.thousandsSeparator, (_b = this.formattingSettings) === null || _b === void 0 ? void 0 : _b.decimalSeparator, (_c = this.formattingSettings) === null || _c === void 0 ? void 0 : _c.decimalsCount);
|
1679
1703
|
}
|
1680
1704
|
}
|
1681
|
-
NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1682
|
-
NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.
|
1683
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1705
|
+
NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
1706
|
+
NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NumberPipe, name: "vlNumber" });
|
1707
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NumberPipe, decorators: [{
|
1684
1708
|
type: Pipe,
|
1685
1709
|
args: [{
|
1686
1710
|
name: 'vlNumber',
|
@@ -1705,9 +1729,9 @@ class PricePipe {
|
|
1705
1729
|
return `${((_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.currencySymbol) || DEFAULT_CURRENCY_SYMBOL}${formatNumber(price, (_b = this.formattingSettings) === null || _b === void 0 ? void 0 : _b.thousandsSeparator, (_c = this.formattingSettings) === null || _c === void 0 ? void 0 : _c.decimalSeparator, (_d = this.formattingSettings) === null || _d === void 0 ? void 0 : _d.decimalsCount)}`;
|
1706
1730
|
}
|
1707
1731
|
}
|
1708
|
-
PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1709
|
-
PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.
|
1710
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1732
|
+
PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PricePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
1733
|
+
PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: PricePipe, name: "vlPrice" });
|
1734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PricePipe, decorators: [{
|
1711
1735
|
type: Pipe,
|
1712
1736
|
args: [{
|
1713
1737
|
name: 'vlPrice',
|
@@ -1716,10 +1740,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
1716
1740
|
|
1717
1741
|
class SdkPipesModule {
|
1718
1742
|
}
|
1719
|
-
SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1720
|
-
SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.
|
1721
|
-
SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.
|
1722
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1743
|
+
SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1744
|
+
SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule, declarations: [NumberPipe, PricePipe, DatePipe], exports: [NumberPipe, PricePipe, DatePipe] });
|
1745
|
+
SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule });
|
1746
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule, decorators: [{
|
1723
1747
|
type: NgModule,
|
1724
1748
|
args: [{
|
1725
1749
|
declarations: [NumberPipe, PricePipe, DatePipe],
|