@veloceapps/sdk 7.0.2-9 → 7.0.2-90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cms/cms.actions.d.ts +102 -11
- package/cms/cms.default.d.ts +2 -2
- package/cms/components/element-children/element-children.component.d.ts +3 -1
- package/cms/components/element-tools-panel/element-tools-panel.component.d.ts +14 -0
- package/cms/components/preview/preview.component.d.ts +10 -12
- package/cms/components/preview/preview.module.d.ts +2 -1
- package/cms/components/preview/preview.types.d.ts +9 -0
- package/cms/definitions/index.d.ts +1 -0
- package/cms/definitions/ui-builder.definitions.d.ts +6 -0
- package/cms/index.d.ts +2 -0
- package/cms/injection-tokens.d.ts +2 -4
- package/cms/modules/migrations/services/migrations.service.d.ts +1 -1
- package/cms/modules/migrations/types/migrations.types.d.ts +1 -1
- package/cms/modules/runtime/index.d.ts +1 -0
- package/cms/modules/runtime/services/compilation.service.d.ts +3 -2
- package/cms/modules/runtime/services/runtime-editor.service.d.ts +6 -4
- package/cms/modules/runtime/services/runtime.service.d.ts +6 -2
- package/cms/modules/runtime/types/runtime.actions.d.ts +5 -2
- package/cms/plugins/element-hover.plugin.d.ts +33 -0
- package/cms/plugins/page.plugin.d.ts +15 -0
- package/cms/plugins/script.plugin.d.ts +0 -3
- package/cms/services/resources.service.d.ts +9 -0
- package/cms/types/common.types.d.ts +11 -1
- package/cms/types/index.d.ts +2 -0
- package/cms/types/integration.types.d.ts +1 -0
- package/cms/types/layouts.types.d.ts +30 -2
- package/cms/types/pages.types.d.ts +1 -0
- package/cms/utils/element.utils.d.ts +1 -1
- package/cms/utils/elements-resolver.d.ts +6 -2
- package/cms/utils/encoding.utils.d.ts +2 -0
- package/cms/utils/index.d.ts +1 -0
- package/cms/utils/script.utils.d.ts +2 -0
- package/cms/utils/ui-builder-layout.utils.d.ts +4 -0
- package/cms/vendor-map.d.ts +16 -19
- package/core/core.module.d.ts +2 -0
- package/core/directives/directives.module.d.ts +7 -0
- package/core/directives/index.d.ts +2 -0
- package/core/directives/primeng-calendar.directive.d.ts +14 -0
- package/core/index.d.ts +2 -0
- package/core/modules/configuration/helpers.d.ts +4 -2
- package/core/modules/configuration/index.d.ts +2 -0
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +5 -4
- package/core/modules/configuration/services/configuration.service.d.ts +13 -7
- package/core/modules/configuration/services/configuration.state.d.ts +30 -0
- package/core/modules/configuration/services/runtime-context.service.d.ts +1 -1
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +1 -0
- package/core/modules/configuration/types/configuration.types.d.ts +10 -0
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +2 -1
- package/core/pipes/date.pipe.d.ts +12 -0
- package/core/pipes/index.d.ts +4 -0
- package/core/pipes/number.pipe.d.ts +10 -0
- package/core/pipes/pipes.module.d.ts +9 -0
- package/core/pipes/price.pipe.d.ts +10 -0
- package/core/services/index.d.ts +1 -0
- package/core/services/runtime-settings.service.d.ts +21 -0
- package/core/types/formatting-settings.types.d.ts +11 -0
- package/core/types/index.d.ts +1 -0
- package/core/types/runtime.types.d.ts +2 -3
- package/core/types/ui-definition.types.d.ts +1 -41
- package/core/utils/line-item.utils.d.ts +10 -15
- package/core/utils/line-item.worker.d.ts +3 -6
- package/core/utils/ui-definition.utils.d.ts +1 -1
- package/esm2020/cms/cms.actions.mjs +140 -40
- package/esm2020/cms/cms.default.mjs +1 -1
- package/esm2020/cms/cms.elements.mjs +16 -4
- package/esm2020/cms/cms.layouts.mjs +73 -13
- package/esm2020/cms/components/element-children/element-children.component.mjs +11 -6
- package/esm2020/cms/components/element-drop-handle/element-drop-handle.component.mjs +2 -2
- package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +35 -0
- package/esm2020/cms/components/preview/preview.component.mjs +30 -48
- package/esm2020/cms/components/preview/preview.module.mjs +22 -4
- package/esm2020/cms/components/preview/preview.types.mjs +1 -1
- package/esm2020/cms/definitions/index.mjs +2 -0
- package/esm2020/cms/definitions/ui-builder.definitions.mjs +18 -0
- package/esm2020/cms/index.mjs +3 -1
- package/esm2020/cms/injection-tokens.mjs +1 -2
- package/esm2020/cms/modules/migrations/migrations.mjs +10 -3
- package/esm2020/cms/modules/migrations/services/migrations.service.mjs +1 -1
- package/esm2020/cms/modules/migrations/types/migrations.types.mjs +1 -1
- package/esm2020/cms/modules/runtime/index.mjs +2 -1
- package/esm2020/cms/modules/runtime/services/compilation.service.mjs +5 -3
- package/esm2020/cms/modules/runtime/services/runtime-editor.service.mjs +5 -3
- package/esm2020/cms/modules/runtime/services/runtime.service.mjs +41 -6
- package/esm2020/cms/modules/runtime/types/runtime.actions.mjs +1 -1
- package/esm2020/cms/plugins/element-hover.plugin.mjs +121 -0
- package/esm2020/cms/plugins/page.plugin.mjs +37 -0
- package/esm2020/cms/plugins/region.plugin.mjs +3 -2
- package/esm2020/cms/plugins/script.plugin.mjs +6 -40
- package/esm2020/cms/services/integration.state.mjs +3 -6
- package/esm2020/cms/services/io-provider.service.mjs +7 -5
- package/esm2020/cms/services/resources.service.mjs +19 -1
- package/esm2020/cms/types/common.types.mjs +1 -1
- package/esm2020/cms/types/index.mjs +3 -1
- package/esm2020/cms/types/integration.types.mjs +1 -1
- package/esm2020/cms/types/layouts.types.mjs +70 -1
- package/esm2020/cms/types/pages.types.mjs +2 -0
- package/esm2020/cms/utils/element.utils.mjs +9 -9
- package/esm2020/cms/utils/elements-resolver.mjs +22 -8
- package/esm2020/cms/utils/encoding.utils.mjs +28 -0
- package/esm2020/cms/utils/index.mjs +2 -1
- package/esm2020/cms/utils/script.utils.mjs +42 -0
- package/esm2020/cms/utils/ui-builder-layout.utils.mjs +46 -0
- package/esm2020/cms/vendor-map.mjs +6 -3
- package/esm2020/core/core.module.mjs +33 -4
- package/esm2020/core/directives/directives.module.mjs +16 -0
- package/esm2020/core/directives/index.mjs +3 -0
- package/esm2020/core/directives/primeng-calendar.directive.mjs +41 -0
- package/esm2020/core/index.mjs +3 -1
- package/esm2020/core/modules/configuration/configuration.module.mjs +5 -2
- package/esm2020/core/modules/configuration/helpers.mjs +37 -7
- package/esm2020/core/modules/configuration/index.mjs +3 -1
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +28 -19
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +68 -28
- package/esm2020/core/modules/configuration/services/configuration.state.mjs +142 -0
- package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +10 -17
- package/esm2020/core/modules/configuration/types/configuration-runtime.types.mjs +1 -1
- package/esm2020/core/modules/configuration/types/configuration.types.mjs +2 -0
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +4 -4
- package/esm2020/core/pipes/date.pipe.mjs +38 -0
- package/esm2020/core/pipes/index.mjs +5 -0
- package/esm2020/core/pipes/number.pipe.mjs +27 -0
- package/esm2020/core/pipes/pipes.module.mjs +18 -0
- package/esm2020/core/pipes/price.pipe.mjs +30 -0
- package/esm2020/core/services/index.mjs +2 -1
- package/esm2020/core/services/quote-draft.service.mjs +1 -1
- package/esm2020/core/services/runtime-settings.service.mjs +95 -0
- package/esm2020/core/types/formatting-settings.types.mjs +3 -0
- package/esm2020/core/types/index.mjs +2 -1
- package/esm2020/core/types/runtime.types.mjs +1 -1
- package/esm2020/core/types/ui-definition.types.mjs +2 -2
- package/esm2020/core/utils/line-item.utils.mjs +24 -11
- package/esm2020/core/utils/line-item.worker.mjs +5 -5
- package/esm2020/core/utils/ui-definition.utils.mjs +1 -1
- package/esm2020/runtime/components/ui-runtime-preview/runtime-preview.component.mjs +2 -2
- package/esm2020/runtime/services/runtime-context.service.mjs +8 -5
- package/esm2020/runtime/services/runtime.service.mjs +1 -1
- package/esm2020/runtime/types/runtime.types.mjs +1 -1
- package/esm2020/src/components/dialog/dialog.component.mjs +3 -3
- package/esm2020/src/components/doc-gen/doc-gen.component.mjs +34 -15
- package/esm2020/src/components/guided-selling/guided-selling.component.mjs +114 -0
- package/esm2020/src/components/guided-selling/guided-selling.module.mjs +19 -0
- package/esm2020/src/components/header/cart-overlay/cart-preview.component.mjs +5 -6
- package/esm2020/src/components/header/cart-overlay/cart-preview.module.mjs +7 -4
- package/esm2020/src/components/header/header.component.mjs +46 -36
- package/esm2020/src/components/header/header.module.mjs +7 -3
- package/esm2020/src/components/header/metrics/metrics.component.mjs +35 -7
- package/esm2020/src/components/header/metrics/metrics.module.mjs +7 -3
- package/esm2020/src/flow-routing.module.mjs +1 -1
- package/esm2020/src/flow.component.mjs +4 -3
- package/esm2020/src/flow.module.mjs +11 -6
- package/esm2020/src/guards/context.guard.mjs +11 -8
- package/esm2020/src/pages/assets/assets.component.mjs +3 -3
- package/esm2020/src/pages/catalog/catalog.component.mjs +4 -4
- package/esm2020/src/pages/legacy-product/legacy-product.component.mjs +4 -4
- package/esm2020/src/pages/product/product.component.mjs +52 -61
- package/esm2020/src/pages/remote/remote.component.mjs +19 -19
- package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +4 -4
- package/esm2020/src/services/flow-dialog.service.mjs +15 -15
- package/esm2020/src/services/flow-router.service.mjs +10 -5
- package/esm2020/src/services/flow.service.mjs +2 -2
- package/esm2020/src/services/guided-selling.service.mjs +33 -0
- package/esm2020/src/types/flow-customization.types.mjs +1 -1
- package/fesm2015/veloceapps-sdk-cms.mjs +947 -440
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +579 -90
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-runtime.mjs +7 -4
- package/fesm2015/veloceapps-sdk-runtime.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +435 -216
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +1027 -442
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +564 -86
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-runtime.mjs +7 -4
- package/fesm2020/veloceapps-sdk-runtime.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +424 -212
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +3 -3
- package/runtime/services/runtime.service.d.ts +2 -2
- package/runtime/types/runtime.types.d.ts +2 -2
- package/src/components/doc-gen/doc-gen.component.d.ts +8 -7
- package/src/components/guided-selling/guided-selling.component.d.ts +27 -0
- package/src/components/guided-selling/guided-selling.module.d.ts +9 -0
- package/src/components/header/cart-overlay/cart-preview.component.d.ts +1 -1
- package/src/components/header/cart-overlay/cart-preview.module.d.ts +1 -1
- package/src/components/header/header.component.d.ts +3 -4
- package/src/components/header/header.module.d.ts +2 -1
- package/src/components/header/metrics/metrics.component.d.ts +10 -2
- package/src/components/header/metrics/metrics.module.d.ts +2 -1
- package/src/flow.module.d.ts +6 -5
- package/src/guards/context.guard.d.ts +3 -2
- package/src/pages/assets/assets.component.d.ts +2 -1
- package/src/pages/catalog/catalog.component.d.ts +2 -1
- package/src/pages/product/product.component.d.ts +13 -21
- package/src/pages/remote/remote.component.d.ts +4 -4
- package/src/pages/shopping-cart/shopping-cart.component.d.ts +2 -1
- package/src/services/flow-router.service.d.ts +3 -1
- package/src/services/guided-selling.service.d.ts +13 -0
- package/src/types/flow-customization.types.d.ts +4 -4
|
@@ -1,25 +1,61 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, NgModule } from '@angular/core';
|
|
3
|
-
import { UUID, ConfigurationContext, RuntimeModel,
|
|
4
|
-
import { BehaviorSubject, combineLatest, zip, noop, throwError, shareReplay as shareReplay$1,
|
|
2
|
+
import { InjectionToken, Injectable, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
|
|
3
|
+
import { UUID, ConfigurationContextMode, ConfigurationContext, RuntimeModel, getUIDefinitionProperties, isLegacyUIDefinition, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, EntityUtil, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, parseJsonSafely, formatNumber } from '@veloceapps/core';
|
|
4
|
+
import { BehaviorSubject, combineLatest, zip, noop, throwError, shareReplay as shareReplay$1, switchMap as switchMap$1, of, tap as tap$1, map as map$2, catchError as catchError$1, Subject, take as take$1, distinctUntilChanged } from 'rxjs';
|
|
5
5
|
import { filter, tap, map, first, switchMap, skip, take, shareReplay, catchError, finalize } 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, isEqual, omit, cloneDeep, uniq } from 'lodash';
|
|
8
|
+
import { merge, flatten, sortBy, map as map$1, isEqual, transform, omit, cloneDeep, uniq } from 'lodash';
|
|
9
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
10
|
+
import * as i4 from '@veloceapps/components';
|
|
9
11
|
import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
|
|
10
12
|
import * as i5 from 'primeng/api';
|
|
11
13
|
import * as i6 from 'primeng/dynamicdialog';
|
|
12
14
|
import moment from 'moment';
|
|
15
|
+
import { NgControl } from '@angular/forms';
|
|
16
|
+
import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
|
|
13
17
|
|
|
14
18
|
const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
|
|
15
19
|
var _a, _b, _c;
|
|
16
20
|
const id = UUID.UUID();
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
const attributes = [];
|
|
22
|
+
const lineItems = [];
|
|
23
|
+
return Object.assign({ id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty,
|
|
24
|
+
attributes,
|
|
25
|
+
lineItems, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b['displayName']) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (uiDefinitionProperties.offeringId ? { offeringId: uiDefinitionProperties.offeringId } : {}));
|
|
26
|
+
};
|
|
27
|
+
const getGuidedSellingConfigurationRequest = (data) => {
|
|
28
|
+
return {
|
|
29
|
+
mode: 'SEARCH',
|
|
30
|
+
step: 'START',
|
|
31
|
+
attributeDomainMode: 'ALL',
|
|
32
|
+
context: {
|
|
33
|
+
headerId: 'TestId',
|
|
34
|
+
mode: ConfigurationContextMode.TEST,
|
|
35
|
+
properties: {
|
|
36
|
+
ModelId: data.modelId,
|
|
37
|
+
Name: 'Veloce Guided Selling',
|
|
38
|
+
PricingEnabled: 'false',
|
|
39
|
+
RuntimeMode: 'TEST',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
lineItem: {
|
|
43
|
+
actionCode: 'ADD',
|
|
44
|
+
cfgStatus: 'Default',
|
|
45
|
+
id: UUID.UUID(),
|
|
46
|
+
qty: 1,
|
|
47
|
+
type: data.modelType,
|
|
48
|
+
attributes: Object.entries(data.attributesMap).map(([name, value]) => ({
|
|
49
|
+
name,
|
|
50
|
+
value,
|
|
51
|
+
cfgStatus: 'User',
|
|
52
|
+
})),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
21
55
|
};
|
|
22
56
|
|
|
57
|
+
const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
|
|
58
|
+
|
|
23
59
|
var RuntimeMode;
|
|
24
60
|
(function (RuntimeMode) {
|
|
25
61
|
RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
|
|
@@ -36,7 +72,7 @@ var RuntimeStep;
|
|
|
36
72
|
RuntimeStep["UPDATE"] = "UPDATE";
|
|
37
73
|
})(RuntimeStep || (RuntimeStep = {}));
|
|
38
74
|
|
|
39
|
-
const UI_DEFINITION_VERSION =
|
|
75
|
+
const UI_DEFINITION_VERSION = 2;
|
|
40
76
|
|
|
41
77
|
class ContextService {
|
|
42
78
|
constructor(contextApiService) {
|
|
@@ -90,37 +126,30 @@ class RuntimeContextService {
|
|
|
90
126
|
}
|
|
91
127
|
getRuntimeContext(productId, offeringId) {
|
|
92
128
|
return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
|
|
93
|
-
var _a
|
|
94
|
-
const
|
|
129
|
+
var _a;
|
|
130
|
+
const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
|
|
95
131
|
const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
|
|
96
132
|
const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
|
|
133
|
+
const uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
|
97
134
|
return {
|
|
98
135
|
modelId: runtimeData.modelId,
|
|
99
|
-
|
|
136
|
+
uiDefinitionContainer: uiDefinitionContainer,
|
|
100
137
|
runtimeModel: runtimeModel,
|
|
101
138
|
runtimeMode: RuntimeMode.PROD,
|
|
102
139
|
productId: productId,
|
|
103
140
|
productType: (properties === null || properties === void 0 ? void 0 : properties['displayName']) || productName,
|
|
104
141
|
offeringId: offeringId,
|
|
105
142
|
properties: {
|
|
106
|
-
PricingEnabled:
|
|
107
|
-
PriceListId:
|
|
143
|
+
PricingEnabled: uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
|
|
144
|
+
PriceListId: uiDefinitionProperties.priceList,
|
|
108
145
|
},
|
|
109
146
|
};
|
|
110
147
|
}));
|
|
111
148
|
}
|
|
112
|
-
|
|
149
|
+
getUIDefinitionContainer(runtimeData) {
|
|
113
150
|
var _a;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
|
|
117
|
-
}
|
|
118
|
-
catch (e) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const uiDefinitions = rawUiDefinitions.filter(uiDef => uiDef.version);
|
|
122
|
-
const uiDefinition = (_a = uiDefinitions.find(uiDef => uiDef.primary)) !== null && _a !== void 0 ? _a : uiDefinitions[0];
|
|
123
|
-
return uiDefinition;
|
|
151
|
+
const containers = runtimeData.uiDefinitions.filter(container => !isLegacyUIDefinition(container.source));
|
|
152
|
+
return (_a = containers.find(container => container.source.primary)) !== null && _a !== void 0 ? _a : containers[0];
|
|
124
153
|
}
|
|
125
154
|
}
|
|
126
155
|
RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -143,43 +172,51 @@ class ConfigurationRuntimeService {
|
|
|
143
172
|
this.initializationProps = undefined;
|
|
144
173
|
this.uiDefinitionProperties = {};
|
|
145
174
|
}
|
|
146
|
-
initTestMode(
|
|
147
|
-
var _a
|
|
148
|
-
this.uiDefinitionProperties = (
|
|
149
|
-
const uiDefinitionExternals = (
|
|
175
|
+
initTestMode(uiDefinitionContainer) {
|
|
176
|
+
var _a;
|
|
177
|
+
this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
|
178
|
+
const uiDefinitionExternals = (_a = uiDefinitionContainer.source.externals) !== null && _a !== void 0 ? _a : {};
|
|
150
179
|
return combineLatest([
|
|
151
|
-
this.apiService.getRuntimeDataByModelId(modelId),
|
|
180
|
+
this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
|
|
152
181
|
this.contextService.create('TestId', ConfigurationContextMode.TEST),
|
|
153
|
-
]).pipe(first(),
|
|
182
|
+
]).pipe(first(), map(([runtimeData, context]) => {
|
|
154
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
|
+
});
|
|
155
187
|
this._runtimeContext = {
|
|
156
|
-
modelId: modelId,
|
|
188
|
+
modelId: uiDefinitionContainer.modelId,
|
|
157
189
|
runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
|
|
158
190
|
runtimeMode: RuntimeMode.TEST,
|
|
191
|
+
uiDefinitionContainer,
|
|
159
192
|
};
|
|
160
|
-
this.
|
|
161
|
-
|
|
162
|
-
});
|
|
163
|
-
this._isInitialized = true;
|
|
164
|
-
}));
|
|
193
|
+
return this._runtimeContext;
|
|
194
|
+
}), tap(() => (this._isInitialized = true)));
|
|
165
195
|
}
|
|
166
196
|
init(props) {
|
|
167
197
|
this.initializationProps = props;
|
|
168
198
|
const context = this.contextService.resolve();
|
|
169
199
|
return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
|
|
170
|
-
var _a, _b
|
|
171
|
-
this.uiDefinitionProperties = (
|
|
172
|
-
const { PriceListId } = (
|
|
200
|
+
var _a, _b;
|
|
201
|
+
this.uiDefinitionProperties = getUIDefinitionProperties(runtimeContext.uiDefinitionContainer);
|
|
202
|
+
const { PriceListId } = (_a = context.properties) !== null && _a !== void 0 ? _a : {};
|
|
173
203
|
const mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
|
|
174
204
|
this.id15to18('AccountId', mergeContext.properties);
|
|
175
205
|
this._runtimeContext = mergeContext;
|
|
176
|
-
if (context.properties && ((
|
|
206
|
+
if (context.properties && ((_b = this._runtimeContext.properties) === null || _b === void 0 ? void 0 : _b.StartDate)) {
|
|
177
207
|
this.contextService.update({
|
|
178
208
|
properties: Object.assign(Object.assign({}, this._runtimeContext.properties), context.properties),
|
|
179
209
|
});
|
|
180
210
|
}
|
|
181
|
-
this.
|
|
182
|
-
}));
|
|
211
|
+
return this._runtimeContext;
|
|
212
|
+
}), tap(() => (this._isInitialized = true)));
|
|
213
|
+
}
|
|
214
|
+
overrideUIDefinition(uiDefinitionContainer) {
|
|
215
|
+
if (!this._runtimeContext) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
this._runtimeContext.uiDefinitionContainer = uiDefinitionContainer;
|
|
219
|
+
this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
|
183
220
|
}
|
|
184
221
|
id15to18(propertyName, source) {
|
|
185
222
|
if (!source) {
|
|
@@ -243,15 +280,22 @@ const removeLineItem = (lineItem, idToRemove) => {
|
|
|
243
280
|
})
|
|
244
281
|
.filter(r => !!r) });
|
|
245
282
|
};
|
|
246
|
-
const replaceLineItem = (lineItem, replaceTo) => {
|
|
283
|
+
const replaceLineItem = (lineItem, replaceTo, skipCardinalityCalculation = false) => {
|
|
247
284
|
if (lineItem.id === replaceTo.id) {
|
|
248
|
-
|
|
285
|
+
if (!skipCardinalityCalculation) {
|
|
286
|
+
return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
return Object.assign({}, replaceTo);
|
|
290
|
+
}
|
|
249
291
|
}
|
|
250
|
-
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo)) });
|
|
292
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo, skipCardinalityCalculation)) });
|
|
251
293
|
};
|
|
252
294
|
const calculateCardinalityVariables = (lineItems) => {
|
|
253
295
|
const cardVars = new Map();
|
|
254
|
-
lineItems
|
|
296
|
+
lineItems
|
|
297
|
+
.filter(({ port, type }) => !!port && !!type)
|
|
298
|
+
.forEach(li => {
|
|
255
299
|
var _a;
|
|
256
300
|
const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
|
|
257
301
|
cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
|
|
@@ -271,7 +315,7 @@ const recalculateCardinalityVariables = (original, updated) => {
|
|
|
271
315
|
cardinalityVariables.set(key, 0);
|
|
272
316
|
}
|
|
273
317
|
});
|
|
274
|
-
return Object.assign(Object.assign({}, updated), { attributes: upsertAttributes(updated.attributes, [...cardinalityVariables].map(([name, value]) => ({ name, value }))) });
|
|
318
|
+
return Object.assign(Object.assign({}, updated), { attributes: upsertAttributes(updated.attributes, [...cardinalityVariables].map(([name, value]) => ({ name, value, cfgStatus: 'Changed' }))) });
|
|
275
319
|
};
|
|
276
320
|
const mapAttributes = (attributes) => {
|
|
277
321
|
return attributes.reduce((acc, { name, value }) => (Object.assign(Object.assign({}, acc), { [name]: value })), {});
|
|
@@ -285,17 +329,17 @@ const upsertAttributes = (originalAttributes, attributesToUpsert) => {
|
|
|
285
329
|
const [origAttr] = getAttributes(acc, [name]);
|
|
286
330
|
return [
|
|
287
331
|
...acc.filter(attr => attr.name !== name),
|
|
288
|
-
Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name })), { cfgStatus: 'User', value }),
|
|
332
|
+
Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name })), { cfgStatus: origAttr ? 'Changed' : 'User', value }),
|
|
289
333
|
];
|
|
290
334
|
}, originalAttributes);
|
|
291
335
|
};
|
|
292
|
-
const patchAttributes = (rootLineItem, id, attrs) => {
|
|
336
|
+
const patchAttributes = (rootLineItem, id, attrs, skipCardinalityCalculation = false) => {
|
|
293
337
|
const lineItem = findLineItem(id, [rootLineItem]);
|
|
294
338
|
if (!lineItem) {
|
|
295
339
|
return rootLineItem;
|
|
296
340
|
}
|
|
297
341
|
const attributes = upsertAttributes(lineItem.attributes, attrs);
|
|
298
|
-
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }));
|
|
342
|
+
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }), skipCardinalityCalculation);
|
|
299
343
|
};
|
|
300
344
|
const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
|
|
301
345
|
const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
|
|
@@ -343,10 +387,10 @@ const getOriginParent = (lineItems, currentLineItem) => {
|
|
|
343
387
|
return target;
|
|
344
388
|
};
|
|
345
389
|
const isLineItemModified = (lineItem) => {
|
|
346
|
-
if (lineItem.
|
|
390
|
+
if (lineItem.actionCode === 'EXIST' && lineItem.status === 'PENDING') {
|
|
347
391
|
return false;
|
|
348
392
|
}
|
|
349
|
-
return lineItem.
|
|
393
|
+
return lineItem.actionCode !== 'EXIST';
|
|
350
394
|
};
|
|
351
395
|
const multiplyLineItems = (lineItem, qty, split) => {
|
|
352
396
|
if (split) {
|
|
@@ -359,10 +403,17 @@ const multiplyLineItems = (lineItem, qty, split) => {
|
|
|
359
403
|
];
|
|
360
404
|
}
|
|
361
405
|
};
|
|
406
|
+
const isTechnicalAttribute = (name) => {
|
|
407
|
+
return name.startsWith('#') || name.startsWith('$');
|
|
408
|
+
};
|
|
409
|
+
const filterOutTechnicalAttributes = (attributes) => {
|
|
410
|
+
return attributes.filter(({ name }) => !isTechnicalAttribute(name));
|
|
411
|
+
};
|
|
362
412
|
|
|
363
413
|
var lineItem_utils = /*#__PURE__*/Object.freeze({
|
|
364
414
|
__proto__: null,
|
|
365
415
|
calculateCardinalityVariables: calculateCardinalityVariables,
|
|
416
|
+
filterOutTechnicalAttributes: filterOutTechnicalAttributes,
|
|
366
417
|
findLineItem: findLineItem,
|
|
367
418
|
findLineItemWithComparator: findLineItemWithComparator,
|
|
368
419
|
generateLineItem: generateLineItem,
|
|
@@ -373,6 +424,7 @@ var lineItem_utils = /*#__PURE__*/Object.freeze({
|
|
|
373
424
|
getRecommendedPrices: getRecommendedPrices,
|
|
374
425
|
insertLineItem: insertLineItem,
|
|
375
426
|
isLineItemModified: isLineItemModified,
|
|
427
|
+
isTechnicalAttribute: isTechnicalAttribute,
|
|
376
428
|
mapAttributes: mapAttributes,
|
|
377
429
|
multiplyLineItems: multiplyLineItems,
|
|
378
430
|
patchAttributes: patchAttributes,
|
|
@@ -392,11 +444,11 @@ class LineItemWorker {
|
|
|
392
444
|
remove(id) {
|
|
393
445
|
return new LineItemWorker(removeLineItem(this.li, id));
|
|
394
446
|
}
|
|
395
|
-
replace(toReplace) {
|
|
396
|
-
return new LineItemWorker(replaceLineItem(this.li, toReplace));
|
|
447
|
+
replace(toReplace, skipCardinalityCalculation = false) {
|
|
448
|
+
return new LineItemWorker(replaceLineItem(this.li, toReplace, skipCardinalityCalculation));
|
|
397
449
|
}
|
|
398
|
-
patchAttribute(attrs, id) {
|
|
399
|
-
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
|
|
450
|
+
patchAttribute(attrs, id, skipCardinalityCalculation = false) {
|
|
451
|
+
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs, skipCardinalityCalculation));
|
|
400
452
|
}
|
|
401
453
|
}
|
|
402
454
|
|
|
@@ -621,6 +673,8 @@ class ConfigurationService {
|
|
|
621
673
|
this.lineItem = new BehaviorSubject(undefined);
|
|
622
674
|
this.charges = new BehaviorSubject({});
|
|
623
675
|
this.pricePlans = new BehaviorSubject({});
|
|
676
|
+
this.isLoadingSubj$ = new BehaviorSubject(false);
|
|
677
|
+
this.isLoading$ = this.isLoadingSubj$.asObservable();
|
|
624
678
|
this.hasUnsavedChanges = false;
|
|
625
679
|
}
|
|
626
680
|
reset() {
|
|
@@ -631,11 +685,12 @@ class ConfigurationService {
|
|
|
631
685
|
this.charges.next({});
|
|
632
686
|
this.pricePlans.next({});
|
|
633
687
|
}
|
|
634
|
-
patch$(lineItem) {
|
|
688
|
+
patch$(lineItem, options) {
|
|
635
689
|
if (!this.lineItem.value) {
|
|
636
690
|
return throwError(() => new Error(`Source LineItem not found`));
|
|
637
691
|
}
|
|
638
|
-
|
|
692
|
+
const skipCardinalityCalculation = (options === null || options === void 0 ? void 0 : options.skipCardinalityCalculation) || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
|
|
693
|
+
this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
|
|
639
694
|
return this.configure().pipe(catchError(error => {
|
|
640
695
|
console.error(error);
|
|
641
696
|
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
|
@@ -650,8 +705,8 @@ class ConfigurationService {
|
|
|
650
705
|
}
|
|
651
706
|
}));
|
|
652
707
|
}
|
|
653
|
-
patch(lineItem) {
|
|
654
|
-
this.patch$(lineItem).subscribe();
|
|
708
|
+
patch(lineItem, options) {
|
|
709
|
+
this.patch$(lineItem, options).subscribe();
|
|
655
710
|
}
|
|
656
711
|
setConfigurableRamp(lineItem) {
|
|
657
712
|
this.configurableRamp = lineItem;
|
|
@@ -663,10 +718,18 @@ class ConfigurationService {
|
|
|
663
718
|
return this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined;
|
|
664
719
|
}
|
|
665
720
|
getRuntimeModel() {
|
|
666
|
-
|
|
721
|
+
const runtimeModel = this.runtimeService.runtimeModel;
|
|
722
|
+
if (!runtimeModel) {
|
|
723
|
+
throw new Error('Runtime model not initialized');
|
|
724
|
+
}
|
|
725
|
+
return runtimeModel;
|
|
667
726
|
}
|
|
668
727
|
getRuntimeContext() {
|
|
669
|
-
|
|
728
|
+
const runtimeContext = this.runtimeService.runtimeContext;
|
|
729
|
+
if (!runtimeContext) {
|
|
730
|
+
throw new Error('Runtime context not initialized');
|
|
731
|
+
}
|
|
732
|
+
return runtimeContext;
|
|
670
733
|
}
|
|
671
734
|
get contextSnapshot() {
|
|
672
735
|
return this.contextService.resolve();
|
|
@@ -687,51 +750,79 @@ class ConfigurationService {
|
|
|
687
750
|
return this.pricePlans.value;
|
|
688
751
|
}
|
|
689
752
|
configure() {
|
|
690
|
-
|
|
753
|
+
return this.configureRequest$(this.generateRequest());
|
|
754
|
+
}
|
|
755
|
+
configureRequest$(configurationRequest) {
|
|
756
|
+
var _a;
|
|
691
757
|
const runtimeContext = this.getRuntimeContext();
|
|
692
758
|
const runtimeModel = this.getRuntimeModel();
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}
|
|
696
|
-
const uiDefinitionProperties = Object.assign(Object.assign({}, ((_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {})), ((_c = this.runtimeService.uiDefinitionProperties) !== null && _c !== void 0 ? _c : {}));
|
|
697
|
-
const qty = (_d = this.runtimeService.initializationProps) === null || _d === void 0 ? void 0 : _d.defaultQty;
|
|
698
|
-
const lineItem = (_e = this.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
|
|
699
|
-
const configurationRequest = this.createRequest(lineItem);
|
|
700
|
-
const mainPricingEnabled = (_f = runtimeContext.properties) === null || _f === void 0 ? void 0 : _f.PricingEnabled;
|
|
759
|
+
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
|
760
|
+
const mainPricingEnabled = (_a = runtimeContext.properties) === null || _a === void 0 ? void 0 : _a.PricingEnabled;
|
|
701
761
|
const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
.pipe(map(({ lineItem, context, charges, pricePlans, deletedLineItems }) => {
|
|
762
|
+
this.isLoadingSubj$.next(true);
|
|
763
|
+
return this.configurationApiService.configureLineItem({ configurationRequest, runtimeModel, pricingEnabled }).pipe(tap(({ lineItem, context, charges, pricePlans, deletedLineItems }) => {
|
|
705
764
|
this.contextService.update(context !== null && context !== void 0 ? context : {});
|
|
706
765
|
this.charges.next(charges !== null && charges !== void 0 ? charges : {});
|
|
707
766
|
this.pricePlans.next(pricePlans !== null && pricePlans !== void 0 ? pricePlans : {});
|
|
767
|
+
if (lineItem) {
|
|
768
|
+
this.lineItem.next(lineItem);
|
|
769
|
+
}
|
|
708
770
|
if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
|
|
709
771
|
this.showInactiveProductsConfirmation();
|
|
710
772
|
}
|
|
711
|
-
|
|
712
|
-
}))
|
|
713
|
-
.pipe(tap(lineItem => lineItem && this.lineItem.next(lineItem)), catchError(error => throwError(() => { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); })));
|
|
773
|
+
this.configurableRamp = lineItem;
|
|
774
|
+
}), map(({ lineItem }) => lineItem), catchError(error => throwError(() => { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); })), finalize(() => this.isLoadingSubj$.next(false)));
|
|
714
775
|
}
|
|
715
|
-
configureExternal$(
|
|
716
|
-
return this.runtimeService
|
|
776
|
+
configureExternal$(props) {
|
|
777
|
+
return this.runtimeService
|
|
778
|
+
.init({ productId: props.productId, defaultQty: props.qty, attributesMap: props.attributesMap })
|
|
779
|
+
.pipe(switchMap(() => this.configure()), first(), catchError(error => {
|
|
717
780
|
this.messageService.add({ severity: ToastType.error, summary: error });
|
|
718
781
|
throw error;
|
|
719
782
|
}), finalize(() => this.reset()));
|
|
720
783
|
}
|
|
721
|
-
|
|
722
|
-
|
|
784
|
+
configureGuidedSelling$(data) {
|
|
785
|
+
return this.configurationApiService
|
|
786
|
+
.configureLineItem({
|
|
787
|
+
configurationRequest: getGuidedSellingConfigurationRequest(data),
|
|
788
|
+
})
|
|
789
|
+
.pipe(catchError(error => {
|
|
790
|
+
if (error instanceof HttpErrorResponse) {
|
|
791
|
+
this.messageService.add({ severity: ToastType.error, summary: error.error.message || error.error });
|
|
792
|
+
}
|
|
793
|
+
throw error;
|
|
794
|
+
}));
|
|
795
|
+
}
|
|
796
|
+
generateRequest() {
|
|
797
|
+
var _a, _b;
|
|
798
|
+
const runtimeContext = this.getRuntimeContext();
|
|
799
|
+
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
|
800
|
+
let lineItem = this.configurableRamp;
|
|
801
|
+
if (!lineItem) {
|
|
802
|
+
const { initializationProps } = (_a = this.runtimeService) !== null && _a !== void 0 ? _a : {};
|
|
803
|
+
lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.defaultQty);
|
|
804
|
+
// Set default attributes
|
|
805
|
+
if (initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap) {
|
|
806
|
+
const attributes = transform(initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap, (acc, value, name) => acc.push({ name, value }), []);
|
|
807
|
+
lineItem = new LineItemWorker(lineItem).patchAttribute(attributes).li;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
723
810
|
let request = {
|
|
724
811
|
lineItem,
|
|
725
812
|
mode: this.mode,
|
|
726
813
|
step: !this.lineItem.value ? RuntimeStep.START : RuntimeStep.UPDATE,
|
|
727
814
|
attributeDomainMode: 'ALL',
|
|
728
815
|
context: this.contextService.resolve(),
|
|
729
|
-
lineItems: ((
|
|
816
|
+
lineItems: ((_b = this.quoteDraftService.quoteDraft) === null || _b === void 0 ? void 0 : _b.currentState) || [],
|
|
730
817
|
asset: this.getAsset(),
|
|
731
818
|
};
|
|
732
819
|
request = ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
|
|
733
820
|
return request;
|
|
734
821
|
}
|
|
822
|
+
getUIDefinitionProperties() {
|
|
823
|
+
var _a;
|
|
824
|
+
return Object.assign(Object.assign({}, getUIDefinitionProperties(this.getRuntimeContext().uiDefinitionContainer)), ((_a = this.runtimeService.uiDefinitionProperties) !== null && _a !== void 0 ? _a : {}));
|
|
825
|
+
}
|
|
735
826
|
showInactiveProductsConfirmation() {
|
|
736
827
|
const confirmationConfig = {
|
|
737
828
|
title: ' ',
|
|
@@ -771,6 +862,138 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
771
862
|
type: Injectable
|
|
772
863
|
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6.DialogService }]; } });
|
|
773
864
|
|
|
865
|
+
class ConfigurationState {
|
|
866
|
+
constructor(statefulConfigurationApiService, runtimeService, configurationService, toastService) {
|
|
867
|
+
this.statefulConfigurationApiService = statefulConfigurationApiService;
|
|
868
|
+
this.runtimeService = runtimeService;
|
|
869
|
+
this.configurationService = configurationService;
|
|
870
|
+
this.toastService = toastService;
|
|
871
|
+
this.stateSubj$ = new BehaviorSubject({});
|
|
872
|
+
this.state$ = this.stateSubj$.asObservable();
|
|
873
|
+
this.stateId = null;
|
|
874
|
+
}
|
|
875
|
+
init$() {
|
|
876
|
+
return this.configurationService.configure().pipe(switchMap$1(() => {
|
|
877
|
+
var _a, _b;
|
|
878
|
+
if (!this.isStatefulConfiguration) {
|
|
879
|
+
return of(undefined);
|
|
880
|
+
}
|
|
881
|
+
const { actions, selectors } = (_b = (_a = this.runtimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
|
|
882
|
+
return this.statefulConfigurationApiService.init({
|
|
883
|
+
request: this.configurationService.generateRequest(),
|
|
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));
|
|
888
|
+
}
|
|
889
|
+
cleanup() {
|
|
890
|
+
this.stateId = null;
|
|
891
|
+
this.configurationService.reset();
|
|
892
|
+
this.stateSubj$.next({});
|
|
893
|
+
}
|
|
894
|
+
execute$(req) {
|
|
895
|
+
if (this.isStatefulConfiguration) {
|
|
896
|
+
return this.executeStateful$(req);
|
|
897
|
+
}
|
|
898
|
+
else {
|
|
899
|
+
return this.executeStateless$(req);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
dispatch$(actionName, inputData) {
|
|
903
|
+
return this.execute$({ actions: [{ name: actionName, inputData }] });
|
|
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
|
+
|
|
774
997
|
function extractMetadata(uiDefinition) {
|
|
775
998
|
return omit(uiDefinition, [
|
|
776
999
|
'children',
|
|
@@ -975,16 +1198,16 @@ class FlowConfigurationService {
|
|
|
975
1198
|
const updatedState = [...quoteDraft.currentState, term];
|
|
976
1199
|
return of([]).pipe(switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
|
977
1200
|
}
|
|
978
|
-
addToCart$(
|
|
1201
|
+
addToCart$(props) {
|
|
979
1202
|
const quoteDraft = this.quoteDraftService.quoteDraft;
|
|
980
1203
|
if (!quoteDraft) {
|
|
981
1204
|
return of(null);
|
|
982
1205
|
}
|
|
983
|
-
return this.configurationService.configureExternal$(
|
|
984
|
-
var _a, _b;
|
|
1206
|
+
return this.configurationService.configureExternal$(props).pipe(map$2(lineItem => {
|
|
1207
|
+
var _a, _b, _c;
|
|
985
1208
|
const model = this.configurationService.getRuntimeModel();
|
|
986
1209
|
const split = (_b = (_a = model === null || model === void 0 ? void 0 : model.types.find(type => type.name === lineItem.type)) === null || _a === void 0 ? void 0 : _a.split) !== null && _b !== void 0 ? _b : false;
|
|
987
|
-
const lineItems = multiplyLineItems(lineItem, qty !== null &&
|
|
1210
|
+
const lineItems = multiplyLineItems(lineItem, (_c = props.qty) !== null && _c !== void 0 ? _c : 1, split);
|
|
988
1211
|
return [...quoteDraft.currentState, ...lineItems];
|
|
989
1212
|
}), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
|
990
1213
|
}
|
|
@@ -1066,6 +1289,7 @@ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
|
|
|
1066
1289
|
ConfigurationRuntimeService,
|
|
1067
1290
|
RuntimeContextService,
|
|
1068
1291
|
ConfigurationService,
|
|
1292
|
+
ConfigurationState,
|
|
1069
1293
|
], imports: [ConfirmationDialogModule] });
|
|
1070
1294
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, decorators: [{
|
|
1071
1295
|
type: NgModule,
|
|
@@ -1078,6 +1302,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
1078
1302
|
ConfigurationRuntimeService,
|
|
1079
1303
|
RuntimeContextService,
|
|
1080
1304
|
ConfigurationService,
|
|
1305
|
+
ConfigurationState,
|
|
1081
1306
|
],
|
|
1082
1307
|
}]
|
|
1083
1308
|
}] });
|
|
@@ -1225,16 +1450,280 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
1225
1450
|
args: [{ providedIn: 'root' }]
|
|
1226
1451
|
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
|
1227
1452
|
|
|
1453
|
+
class RuntimeSettingsService {
|
|
1454
|
+
constructor(configurationSettingsApiService) {
|
|
1455
|
+
this.configurationSettingsApiService = configurationSettingsApiService;
|
|
1456
|
+
this.configurationSettings$ = new BehaviorSubject({});
|
|
1457
|
+
this.currencySettings$ = new BehaviorSubject({
|
|
1458
|
+
iso: DEFAULT_CURRENCY_ISO_CODE,
|
|
1459
|
+
symbol: DEFAULT_CURRENCY_SYMBOL,
|
|
1460
|
+
});
|
|
1461
|
+
this.getCurrencySymbol = (locale, currency) => {
|
|
1462
|
+
return (0)
|
|
1463
|
+
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
|
1464
|
+
.replace(/\d/g, '')
|
|
1465
|
+
.trim();
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
create() {
|
|
1469
|
+
return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
|
|
1470
|
+
this.configurationSettings$.next(configurationSettings);
|
|
1471
|
+
this.formattingSettings = this.getFormattingSettings();
|
|
1472
|
+
}), map$2(() => undefined));
|
|
1473
|
+
}
|
|
1474
|
+
initCurrency(iso) {
|
|
1475
|
+
if (iso) {
|
|
1476
|
+
const symbol = this.getCurrencySymbol('en-US', iso);
|
|
1477
|
+
this.currencySettings$.next({ iso, symbol });
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
getFormattingSettings() {
|
|
1481
|
+
var _a, _b;
|
|
1482
|
+
if (this.formattingSettings) {
|
|
1483
|
+
return this.formattingSettings;
|
|
1484
|
+
}
|
|
1485
|
+
const shoppingCartSettings = (_a = this.getConfigurationSettings()['shopping-cart']) === null || _a === void 0 ? void 0 : _a.reduce((acc, setting) => {
|
|
1486
|
+
return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
|
|
1487
|
+
}, {});
|
|
1488
|
+
const currencySettings = this.getCurrencySettings();
|
|
1489
|
+
const dateFormat = (validateDateFormat((_b = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT) !== null && _b !== void 0 ? _b : '') && (shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT)) ||
|
|
1490
|
+
DEFAULT_DATE_FORMAT;
|
|
1491
|
+
const decimalSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DECIMAL_SEPARATOR;
|
|
1492
|
+
const thousandsSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.THOUSANDS_SEPARATOR;
|
|
1493
|
+
// the number of decimal places can be 0
|
|
1494
|
+
const priceScale = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE;
|
|
1495
|
+
const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
|
|
1496
|
+
? Number(priceScale)
|
|
1497
|
+
: DEFAULT_DECIMALS_COUNT;
|
|
1498
|
+
return {
|
|
1499
|
+
currencySymbol: currencySettings.symbol,
|
|
1500
|
+
dateFormats: getSupportedDateFormats(dateFormat),
|
|
1501
|
+
decimalsCount,
|
|
1502
|
+
decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
|
|
1503
|
+
? decimalSeparator
|
|
1504
|
+
: DEFAULT_DECIMAL_SEPARATOR,
|
|
1505
|
+
// thousands separator can be a blank value, so it can also be null
|
|
1506
|
+
thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
|
|
1507
|
+
? thousandsSeparator || ''
|
|
1508
|
+
: DEFAULT_THOUSANDS_SEPARATOR,
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1511
|
+
getConfigurationSettings() {
|
|
1512
|
+
return this.configurationSettings$.value;
|
|
1513
|
+
}
|
|
1514
|
+
getCurrencySettings() {
|
|
1515
|
+
return this.currencySettings$.value;
|
|
1516
|
+
}
|
|
1517
|
+
parseConfigurationSettings(settings) {
|
|
1518
|
+
return settings.reduce((acc, setting) => {
|
|
1519
|
+
switch (setting.key) {
|
|
1520
|
+
case 'shopping-cart':
|
|
1521
|
+
acc['shopping-cart'] = parseJsonSafely(setting.value, []);
|
|
1522
|
+
break;
|
|
1523
|
+
case 'navigation':
|
|
1524
|
+
acc.navigation = parseJsonSafely(setting.value, {});
|
|
1525
|
+
break;
|
|
1526
|
+
case 'flows':
|
|
1527
|
+
acc.flows = parseJsonSafely(setting.value, []);
|
|
1528
|
+
break;
|
|
1529
|
+
default:
|
|
1530
|
+
acc[setting.key] = setting.value;
|
|
1531
|
+
}
|
|
1532
|
+
return acc;
|
|
1533
|
+
}, {});
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1537
|
+
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
|
|
1538
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
|
1539
|
+
type: Injectable,
|
|
1540
|
+
args: [{ providedIn: 'root' }]
|
|
1541
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
|
1542
|
+
|
|
1543
|
+
const DEFAULT_FORMATTING_SETTINGS = {
|
|
1544
|
+
currencySymbol: DEFAULT_CURRENCY_SYMBOL,
|
|
1545
|
+
decimalsCount: DEFAULT_DECIMALS_COUNT,
|
|
1546
|
+
dateFormats: getSupportedDateFormats(DEFAULT_DATE_FORMAT),
|
|
1547
|
+
decimalSeparator: DEFAULT_DECIMAL_SEPARATOR,
|
|
1548
|
+
thousandsSeparator: DEFAULT_THOUSANDS_SEPARATOR,
|
|
1549
|
+
};
|
|
1228
1550
|
class SdkCoreModule {
|
|
1229
1551
|
}
|
|
1230
1552
|
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1231
1553
|
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
|
1232
|
-
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
|
1554
|
+
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
|
1555
|
+
ContextService,
|
|
1556
|
+
QuoteDraftService,
|
|
1557
|
+
ProductImagesService,
|
|
1558
|
+
MetricsCalculationService,
|
|
1559
|
+
RuntimeSettingsService,
|
|
1560
|
+
{
|
|
1561
|
+
provide: FORMATTING_SETTINGS_TOKEN,
|
|
1562
|
+
useExisting: RuntimeSettingsService,
|
|
1563
|
+
},
|
|
1564
|
+
], imports: [ConfigurationModule, FlowConfigurationModule] });
|
|
1233
1565
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
|
|
1234
1566
|
type: NgModule,
|
|
1235
1567
|
args: [{
|
|
1236
1568
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
|
1237
|
-
providers: [
|
|
1569
|
+
providers: [
|
|
1570
|
+
ContextService,
|
|
1571
|
+
QuoteDraftService,
|
|
1572
|
+
ProductImagesService,
|
|
1573
|
+
MetricsCalculationService,
|
|
1574
|
+
RuntimeSettingsService,
|
|
1575
|
+
{
|
|
1576
|
+
provide: FORMATTING_SETTINGS_TOKEN,
|
|
1577
|
+
useExisting: RuntimeSettingsService,
|
|
1578
|
+
},
|
|
1579
|
+
],
|
|
1580
|
+
}]
|
|
1581
|
+
}] });
|
|
1582
|
+
|
|
1583
|
+
class CalendarDirective {
|
|
1584
|
+
constructor() {
|
|
1585
|
+
var _a;
|
|
1586
|
+
this.ngControl = inject(NgControl, { host: true, optional: true });
|
|
1587
|
+
this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
|
|
1588
|
+
this.destroy$ = new Subject();
|
|
1589
|
+
}
|
|
1590
|
+
set vlCalendar(calendar) {
|
|
1591
|
+
this.calendar = calendar;
|
|
1592
|
+
}
|
|
1593
|
+
ngOnDestroy() {
|
|
1594
|
+
this.destroy$.next();
|
|
1595
|
+
this.destroy$.complete();
|
|
1596
|
+
}
|
|
1597
|
+
ngOnInit() {
|
|
1598
|
+
var _a, _b;
|
|
1599
|
+
if (this.calendar) {
|
|
1600
|
+
this.calendar.dateFormat = (_b = (_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.dateFormats.primengFormat) !== null && _b !== void 0 ? _b : DEFAULT_DATE_FORMAT;
|
|
1601
|
+
if (this.ngControl && this.ngControl.control) {
|
|
1602
|
+
const control = this.ngControl.control;
|
|
1603
|
+
control.setValue(control.value, { emitEvent: false });
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1609
|
+
CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: CalendarDirective, selector: "[vlCalendar]", inputs: { vlCalendar: "vlCalendar" }, ngImport: i0 });
|
|
1610
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, decorators: [{
|
|
1611
|
+
type: Directive,
|
|
1612
|
+
args: [{
|
|
1613
|
+
selector: '[vlCalendar]',
|
|
1614
|
+
}]
|
|
1615
|
+
}], propDecorators: { vlCalendar: [{
|
|
1616
|
+
type: Input
|
|
1617
|
+
}] } });
|
|
1618
|
+
|
|
1619
|
+
class SdkDirectivesModule {
|
|
1620
|
+
}
|
|
1621
|
+
SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1622
|
+
SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, declarations: [CalendarDirective], exports: [CalendarDirective] });
|
|
1623
|
+
SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule });
|
|
1624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, decorators: [{
|
|
1625
|
+
type: NgModule,
|
|
1626
|
+
args: [{
|
|
1627
|
+
declarations: [CalendarDirective],
|
|
1628
|
+
exports: [CalendarDirective],
|
|
1629
|
+
}]
|
|
1630
|
+
}] });
|
|
1631
|
+
|
|
1632
|
+
class DatePipe {
|
|
1633
|
+
constructor() {
|
|
1634
|
+
var _a;
|
|
1635
|
+
this.locale = inject(LOCALE_ID);
|
|
1636
|
+
this.defaultOptions = inject(DATE_PIPE_DEFAULT_OPTIONS, { optional: true });
|
|
1637
|
+
this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
|
|
1638
|
+
this.destroy$ = new Subject();
|
|
1639
|
+
}
|
|
1640
|
+
ngOnDestroy() {
|
|
1641
|
+
this.destroy$.next();
|
|
1642
|
+
this.destroy$.complete();
|
|
1643
|
+
}
|
|
1644
|
+
transform(date) {
|
|
1645
|
+
var _a, _b;
|
|
1646
|
+
if (!date) {
|
|
1647
|
+
return '';
|
|
1648
|
+
}
|
|
1649
|
+
try {
|
|
1650
|
+
return formatDate(date, ((_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.dateFormats.datePipeFormat) || DEFAULT_DATE_FORMAT, this.locale, (_b = this.defaultOptions) === null || _b === void 0 ? void 0 : _b.timezone);
|
|
1651
|
+
}
|
|
1652
|
+
catch (error) {
|
|
1653
|
+
return new Date(date).toString();
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1658
|
+
DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, name: "vlDate" });
|
|
1659
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, decorators: [{
|
|
1660
|
+
type: Pipe,
|
|
1661
|
+
args: [{
|
|
1662
|
+
name: 'vlDate',
|
|
1663
|
+
}]
|
|
1664
|
+
}] });
|
|
1665
|
+
|
|
1666
|
+
class NumberPipe {
|
|
1667
|
+
constructor() {
|
|
1668
|
+
var _a;
|
|
1669
|
+
this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
|
|
1670
|
+
this.destroy$ = new Subject();
|
|
1671
|
+
}
|
|
1672
|
+
ngOnDestroy() {
|
|
1673
|
+
this.destroy$.next();
|
|
1674
|
+
this.destroy$.complete();
|
|
1675
|
+
}
|
|
1676
|
+
transform(price) {
|
|
1677
|
+
var _a, _b, _c;
|
|
1678
|
+
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
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1682
|
+
NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, name: "vlNumber" });
|
|
1683
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, decorators: [{
|
|
1684
|
+
type: Pipe,
|
|
1685
|
+
args: [{
|
|
1686
|
+
name: 'vlNumber',
|
|
1687
|
+
}]
|
|
1688
|
+
}] });
|
|
1689
|
+
|
|
1690
|
+
class PricePipe {
|
|
1691
|
+
constructor() {
|
|
1692
|
+
var _a;
|
|
1693
|
+
this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
|
|
1694
|
+
this.destroy$ = new Subject();
|
|
1695
|
+
}
|
|
1696
|
+
ngOnDestroy() {
|
|
1697
|
+
this.destroy$.next();
|
|
1698
|
+
this.destroy$.complete();
|
|
1699
|
+
}
|
|
1700
|
+
transform(price) {
|
|
1701
|
+
var _a, _b, _c, _d;
|
|
1702
|
+
if (price == null || price === '') {
|
|
1703
|
+
return '';
|
|
1704
|
+
}
|
|
1705
|
+
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
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1709
|
+
PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, name: "vlPrice" });
|
|
1710
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, decorators: [{
|
|
1711
|
+
type: Pipe,
|
|
1712
|
+
args: [{
|
|
1713
|
+
name: 'vlPrice',
|
|
1714
|
+
}]
|
|
1715
|
+
}] });
|
|
1716
|
+
|
|
1717
|
+
class SdkPipesModule {
|
|
1718
|
+
}
|
|
1719
|
+
SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1720
|
+
SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, declarations: [NumberPipe, PricePipe, DatePipe], exports: [NumberPipe, PricePipe, DatePipe] });
|
|
1721
|
+
SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule });
|
|
1722
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, decorators: [{
|
|
1723
|
+
type: NgModule,
|
|
1724
|
+
args: [{
|
|
1725
|
+
declarations: [NumberPipe, PricePipe, DatePipe],
|
|
1726
|
+
exports: [NumberPipe, PricePipe, DatePipe],
|
|
1238
1727
|
}]
|
|
1239
1728
|
}] });
|
|
1240
1729
|
|
|
@@ -1242,5 +1731,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
1242
1731
|
* Generated bundle index. Do not edit.
|
|
1243
1732
|
*/
|
|
1244
1733
|
|
|
1245
|
-
export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeStep, SdkCoreModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
|
1734
|
+
export { CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationState, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, filterOutTechnicalAttributes, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getGuidedSellingConfigurationRequest, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, isTechnicalAttribute, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
|
1246
1735
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|