@veloceapps/sdk 7.0.2-7 → 7.0.2-70
Sign up to get free protection for your applications and to get access to all the features.
- 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 +6 -5
- package/cms/components/preview/preview.module.d.ts +2 -1
- package/cms/components/preview/preview.types.d.ts +4 -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/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/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 +15 -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 +1 -0
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +2 -2
- package/core/modules/configuration/services/configuration.service.d.ts +6 -4
- 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 +1 -2
- package/core/types/ui-definition.types.d.ts +0 -40
- 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 +18 -16
- 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/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 +1 -1
- package/esm2020/cms/utils/elements-resolver.mjs +22 -8
- 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 +5 -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 +2 -2
- package/esm2020/core/modules/configuration/helpers.mjs +37 -7
- package/esm2020/core/modules/configuration/index.mjs +2 -1
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +3 -2
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +35 -10
- package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +6 -12
- 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/runtime-settings.service.mjs +88 -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 +1 -1
- package/esm2020/core/utils/line-item.utils.mjs +22 -9
- 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 +30 -7
- package/esm2020/src/components/guided-selling/guided-selling.component.mjs +117 -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 +59 -45
- 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 +2 -2
- package/esm2020/src/pages/catalog/catalog.component.mjs +3 -3
- package/esm2020/src/pages/product/product.component.mjs +16 -9
- package/esm2020/src/pages/remote/remote.component.mjs +1 -1
- package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +3 -3
- 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 +872 -394
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +371 -47
- 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 +374 -135
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +955 -396
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +361 -44
- 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 +364 -133
- 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 +7 -3
- package/src/components/guided-selling/guided-selling.component.d.ts +29 -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 +6 -3
- package/src/pages/remote/remote.component.d.ts +2 -1
- 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 +2 -2
@@ -1,24 +1,59 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Injectable, NgModule } from '@angular/core';
|
3
|
-
import { UUID, ConfigurationContext, RuntimeModel,
|
2
|
+
import { InjectionToken, Injectable, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
|
3
|
+
import { UUID, ConfigurationContextMode, ConfigurationContext, RuntimeModel, isLegacyUIDefinition, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, getSupportedDateFormats, DEFAULT_DECIMALS_COUNT, parseJsonSafely, formatNumber } from '@veloceapps/core';
|
4
4
|
import { BehaviorSubject, combineLatest, zip, noop, 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
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';
|
9
10
|
import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
|
10
11
|
import * as i5 from 'primeng/api';
|
11
12
|
import * as i6 from 'primeng/dynamicdialog';
|
12
13
|
import moment from 'moment';
|
14
|
+
import { NgControl } from '@angular/forms';
|
15
|
+
import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
|
13
16
|
|
14
17
|
const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
|
15
18
|
var _a, _b, _c;
|
16
19
|
const id = UUID.UUID();
|
17
|
-
const
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
const attributes = [];
|
21
|
+
const lineItems = [];
|
22
|
+
return Object.assign({ id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty,
|
23
|
+
attributes,
|
24
|
+
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 } : {}));
|
21
25
|
};
|
26
|
+
const getGuidedSellingConfigurationRequest = (data) => {
|
27
|
+
return {
|
28
|
+
mode: 'SEARCH',
|
29
|
+
step: 'START',
|
30
|
+
attributeDomainMode: 'ALL',
|
31
|
+
context: {
|
32
|
+
headerId: 'TestId',
|
33
|
+
mode: ConfigurationContextMode.TEST,
|
34
|
+
properties: {
|
35
|
+
ModelId: data.modelId,
|
36
|
+
Name: 'Veloce Guided Selling',
|
37
|
+
PricingEnabled: 'false',
|
38
|
+
RuntimeMode: 'TEST',
|
39
|
+
},
|
40
|
+
},
|
41
|
+
lineItem: {
|
42
|
+
actionCode: 'ADD',
|
43
|
+
cfgStatus: 'Default',
|
44
|
+
id: UUID.UUID(),
|
45
|
+
qty: 1,
|
46
|
+
type: data.modelType,
|
47
|
+
attributes: Object.entries(data.attributesMap).map(([name, value]) => ({
|
48
|
+
name,
|
49
|
+
value,
|
50
|
+
cfgStatus: 'User',
|
51
|
+
})),
|
52
|
+
},
|
53
|
+
};
|
54
|
+
};
|
55
|
+
|
56
|
+
const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
|
22
57
|
|
23
58
|
var RuntimeMode;
|
24
59
|
(function (RuntimeMode) {
|
@@ -111,16 +146,10 @@ class RuntimeContextService {
|
|
111
146
|
}
|
112
147
|
getUIDefinition(runtimeData) {
|
113
148
|
var _a;
|
114
|
-
|
115
|
-
|
116
|
-
|
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;
|
149
|
+
const uiDefinitions = runtimeData.uiDefinitions
|
150
|
+
.map(({ source }) => source)
|
151
|
+
.filter((uiDefinition) => !isLegacyUIDefinition(uiDefinition));
|
152
|
+
return (_a = uiDefinitions.find(uiDef => uiDef.primary)) !== null && _a !== void 0 ? _a : uiDefinitions[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 });
|
@@ -158,7 +187,7 @@ class ConfigurationRuntimeService {
|
|
158
187
|
runtimeMode: RuntimeMode.TEST,
|
159
188
|
};
|
160
189
|
this.contextService.update({
|
161
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: modelId, RuntimeMode: ConfigurationContextMode.TEST, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: this.uiDefinitionProperties.priceList, standalone: 'true' }), uiDefinitionExternals),
|
190
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: 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),
|
162
191
|
});
|
163
192
|
this._isInitialized = true;
|
164
193
|
}));
|
@@ -243,15 +272,22 @@ const removeLineItem = (lineItem, idToRemove) => {
|
|
243
272
|
})
|
244
273
|
.filter(r => !!r) });
|
245
274
|
};
|
246
|
-
const replaceLineItem = (lineItem, replaceTo) => {
|
275
|
+
const replaceLineItem = (lineItem, replaceTo, skipCardinalityCalculation = false) => {
|
247
276
|
if (lineItem.id === replaceTo.id) {
|
248
|
-
|
277
|
+
if (!skipCardinalityCalculation) {
|
278
|
+
return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
|
279
|
+
}
|
280
|
+
else {
|
281
|
+
return Object.assign({}, replaceTo);
|
282
|
+
}
|
249
283
|
}
|
250
|
-
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo)) });
|
284
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo, skipCardinalityCalculation)) });
|
251
285
|
};
|
252
286
|
const calculateCardinalityVariables = (lineItems) => {
|
253
287
|
const cardVars = new Map();
|
254
|
-
lineItems
|
288
|
+
lineItems
|
289
|
+
.filter(({ port, type }) => !!port && !!type)
|
290
|
+
.forEach(li => {
|
255
291
|
var _a;
|
256
292
|
const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
|
257
293
|
cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
|
@@ -289,13 +325,13 @@ const upsertAttributes = (originalAttributes, attributesToUpsert) => {
|
|
289
325
|
];
|
290
326
|
}, originalAttributes);
|
291
327
|
};
|
292
|
-
const patchAttributes = (rootLineItem, id, attrs) => {
|
328
|
+
const patchAttributes = (rootLineItem, id, attrs, skipCardinalityCalculation = false) => {
|
293
329
|
const lineItem = findLineItem(id, [rootLineItem]);
|
294
330
|
if (!lineItem) {
|
295
331
|
return rootLineItem;
|
296
332
|
}
|
297
333
|
const attributes = upsertAttributes(lineItem.attributes, attrs);
|
298
|
-
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }));
|
334
|
+
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }), skipCardinalityCalculation);
|
299
335
|
};
|
300
336
|
const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
|
301
337
|
const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
|
@@ -343,10 +379,10 @@ const getOriginParent = (lineItems, currentLineItem) => {
|
|
343
379
|
return target;
|
344
380
|
};
|
345
381
|
const isLineItemModified = (lineItem) => {
|
346
|
-
if (lineItem.
|
382
|
+
if (lineItem.actionCode === 'EXIST' && lineItem.status === 'PENDING') {
|
347
383
|
return false;
|
348
384
|
}
|
349
|
-
return lineItem.
|
385
|
+
return lineItem.actionCode !== 'EXIST';
|
350
386
|
};
|
351
387
|
const multiplyLineItems = (lineItem, qty, split) => {
|
352
388
|
if (split) {
|
@@ -359,10 +395,17 @@ const multiplyLineItems = (lineItem, qty, split) => {
|
|
359
395
|
];
|
360
396
|
}
|
361
397
|
};
|
398
|
+
const isTechnicalAttribute = (name) => {
|
399
|
+
return name.startsWith('#') || name.startsWith('$');
|
400
|
+
};
|
401
|
+
const filterOutTechnicalAttributes = (attributes) => {
|
402
|
+
return attributes.filter(({ name }) => !isTechnicalAttribute(name));
|
403
|
+
};
|
362
404
|
|
363
405
|
var lineItem_utils = /*#__PURE__*/Object.freeze({
|
364
406
|
__proto__: null,
|
365
407
|
calculateCardinalityVariables: calculateCardinalityVariables,
|
408
|
+
filterOutTechnicalAttributes: filterOutTechnicalAttributes,
|
366
409
|
findLineItem: findLineItem,
|
367
410
|
findLineItemWithComparator: findLineItemWithComparator,
|
368
411
|
generateLineItem: generateLineItem,
|
@@ -373,6 +416,7 @@ var lineItem_utils = /*#__PURE__*/Object.freeze({
|
|
373
416
|
getRecommendedPrices: getRecommendedPrices,
|
374
417
|
insertLineItem: insertLineItem,
|
375
418
|
isLineItemModified: isLineItemModified,
|
419
|
+
isTechnicalAttribute: isTechnicalAttribute,
|
376
420
|
mapAttributes: mapAttributes,
|
377
421
|
multiplyLineItems: multiplyLineItems,
|
378
422
|
patchAttributes: patchAttributes,
|
@@ -392,11 +436,11 @@ class LineItemWorker {
|
|
392
436
|
remove(id) {
|
393
437
|
return new LineItemWorker(removeLineItem(this.li, id));
|
394
438
|
}
|
395
|
-
replace(toReplace) {
|
396
|
-
return new LineItemWorker(replaceLineItem(this.li, toReplace));
|
439
|
+
replace(toReplace, skipCardinalityCalculation = false) {
|
440
|
+
return new LineItemWorker(replaceLineItem(this.li, toReplace, skipCardinalityCalculation));
|
397
441
|
}
|
398
|
-
patchAttribute(attrs, id) {
|
399
|
-
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
|
442
|
+
patchAttribute(attrs, id, skipCardinalityCalculation = false) {
|
443
|
+
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs, skipCardinalityCalculation));
|
400
444
|
}
|
401
445
|
}
|
402
446
|
|
@@ -631,11 +675,12 @@ class ConfigurationService {
|
|
631
675
|
this.charges.next({});
|
632
676
|
this.pricePlans.next({});
|
633
677
|
}
|
634
|
-
patch$(lineItem) {
|
678
|
+
patch$(lineItem, options) {
|
635
679
|
if (!this.lineItem.value) {
|
636
680
|
return throwError(() => new Error(`Source LineItem not found`));
|
637
681
|
}
|
638
|
-
|
682
|
+
const skipCardinalityCalculation = (options === null || options === void 0 ? void 0 : options.skipCardinalityCalculation) || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
|
683
|
+
this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
|
639
684
|
return this.configure().pipe(catchError(error => {
|
640
685
|
console.error(error);
|
641
686
|
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
@@ -650,8 +695,8 @@ class ConfigurationService {
|
|
650
695
|
}
|
651
696
|
}));
|
652
697
|
}
|
653
|
-
patch(lineItem) {
|
654
|
-
this.patch$(lineItem).subscribe();
|
698
|
+
patch(lineItem, options) {
|
699
|
+
this.patch$(lineItem, options).subscribe();
|
655
700
|
}
|
656
701
|
setConfigurableRamp(lineItem) {
|
657
702
|
this.configurableRamp = lineItem;
|
@@ -687,17 +732,25 @@ class ConfigurationService {
|
|
687
732
|
return this.pricePlans.value;
|
688
733
|
}
|
689
734
|
configure() {
|
690
|
-
var _a, _b, _c, _d, _e
|
735
|
+
var _a, _b, _c, _d, _e;
|
691
736
|
const runtimeContext = this.getRuntimeContext();
|
692
737
|
const runtimeModel = this.getRuntimeModel();
|
693
738
|
if (!runtimeContext || !runtimeModel) {
|
694
739
|
return throwError(() => new Error('Runtime context/model not initialized'));
|
695
740
|
}
|
696
741
|
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
|
-
|
698
|
-
|
742
|
+
let lineItem = this.configurableRamp;
|
743
|
+
if (!lineItem) {
|
744
|
+
const { initializationProps } = (_d = this.runtimeService) !== null && _d !== void 0 ? _d : {};
|
745
|
+
lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.defaultQty);
|
746
|
+
// Set default attributes
|
747
|
+
if (initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap) {
|
748
|
+
const attributes = transform(initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap, (acc, value, name) => acc.push({ name, value }), []);
|
749
|
+
lineItem = new LineItemWorker(lineItem).patchAttribute(attributes).li;
|
750
|
+
}
|
751
|
+
}
|
699
752
|
const configurationRequest = this.createRequest(lineItem);
|
700
|
-
const mainPricingEnabled = (
|
753
|
+
const mainPricingEnabled = (_e = runtimeContext.properties) === null || _e === void 0 ? void 0 : _e.PricingEnabled;
|
701
754
|
const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
|
702
755
|
return this.configurationApiService
|
703
756
|
.configureLineItem({ configurationRequest, runtimeModel, pricingEnabled })
|
@@ -712,12 +765,26 @@ class ConfigurationService {
|
|
712
765
|
}))
|
713
766
|
.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)); })));
|
714
767
|
}
|
715
|
-
configureExternal$(
|
716
|
-
return this.runtimeService
|
768
|
+
configureExternal$(props) {
|
769
|
+
return this.runtimeService
|
770
|
+
.init({ productId: props.productId, defaultQty: props.qty, attributesMap: props.attributesMap })
|
771
|
+
.pipe(switchMap(() => this.configure()), first(), catchError(error => {
|
717
772
|
this.messageService.add({ severity: ToastType.error, summary: error });
|
718
773
|
throw error;
|
719
774
|
}), finalize(() => this.reset()));
|
720
775
|
}
|
776
|
+
configureGuidedSelling$(data) {
|
777
|
+
return this.configurationApiService
|
778
|
+
.configureLineItem({
|
779
|
+
configurationRequest: getGuidedSellingConfigurationRequest(data),
|
780
|
+
})
|
781
|
+
.pipe(catchError(error => {
|
782
|
+
if (error instanceof HttpErrorResponse) {
|
783
|
+
this.messageService.add({ severity: ToastType.error, summary: error.error.message || error.error });
|
784
|
+
}
|
785
|
+
throw error;
|
786
|
+
}));
|
787
|
+
}
|
721
788
|
createRequest(lineItem) {
|
722
789
|
var _a;
|
723
790
|
let request = {
|
@@ -975,16 +1042,16 @@ class FlowConfigurationService {
|
|
975
1042
|
const updatedState = [...quoteDraft.currentState, term];
|
976
1043
|
return of([]).pipe(switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
977
1044
|
}
|
978
|
-
addToCart$(
|
1045
|
+
addToCart$(props) {
|
979
1046
|
const quoteDraft = this.quoteDraftService.quoteDraft;
|
980
1047
|
if (!quoteDraft) {
|
981
1048
|
return of(null);
|
982
1049
|
}
|
983
|
-
return this.configurationService.configureExternal$(
|
984
|
-
var _a, _b;
|
1050
|
+
return this.configurationService.configureExternal$(props).pipe(map$2(lineItem => {
|
1051
|
+
var _a, _b, _c;
|
985
1052
|
const model = this.configurationService.getRuntimeModel();
|
986
1053
|
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 &&
|
1054
|
+
const lineItems = multiplyLineItems(lineItem, (_c = props.qty) !== null && _c !== void 0 ? _c : 1, split);
|
988
1055
|
return [...quoteDraft.currentState, ...lineItems];
|
989
1056
|
}), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
990
1057
|
}
|
@@ -1225,16 +1292,273 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
1225
1292
|
args: [{ providedIn: 'root' }]
|
1226
1293
|
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
1227
1294
|
|
1295
|
+
class RuntimeSettingsService {
|
1296
|
+
constructor(configurationSettingsApiService) {
|
1297
|
+
this.configurationSettingsApiService = configurationSettingsApiService;
|
1298
|
+
this.configurationSettings$ = new BehaviorSubject({});
|
1299
|
+
this.currencySettings$ = new BehaviorSubject({
|
1300
|
+
iso: DEFAULT_CURRENCY_ISO_CODE,
|
1301
|
+
symbol: DEFAULT_CURRENCY_SYMBOL,
|
1302
|
+
});
|
1303
|
+
this.getCurrencySymbol = (locale, currency) => {
|
1304
|
+
return (0)
|
1305
|
+
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
1306
|
+
.replace(/\d/g, '')
|
1307
|
+
.trim();
|
1308
|
+
};
|
1309
|
+
}
|
1310
|
+
create() {
|
1311
|
+
return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
|
1312
|
+
this.configurationSettings$.next(configurationSettings);
|
1313
|
+
this.formattingSettings = this.getFormattingSettings();
|
1314
|
+
}), map$2(() => undefined));
|
1315
|
+
}
|
1316
|
+
initCurrency(iso) {
|
1317
|
+
if (iso) {
|
1318
|
+
const symbol = this.getCurrencySymbol('en-US', iso);
|
1319
|
+
this.currencySettings$.next({ iso, symbol });
|
1320
|
+
}
|
1321
|
+
}
|
1322
|
+
getFormattingSettings() {
|
1323
|
+
var _a, _b, _c, _d;
|
1324
|
+
if (this.formattingSettings) {
|
1325
|
+
return this.formattingSettings;
|
1326
|
+
}
|
1327
|
+
const shoppingCartSettings = (_a = this.getConfigurationSettings()['shopping-cart']) === null || _a === void 0 ? void 0 : _a.reduce((acc, setting) => {
|
1328
|
+
return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
|
1329
|
+
}, {});
|
1330
|
+
const currencySettings = this.getCurrencySettings();
|
1331
|
+
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)) ||
|
1332
|
+
DEFAULT_DATE_FORMAT;
|
1333
|
+
const decimalSeparator = (_c = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DECIMAL_SEPARATOR) !== null && _c !== void 0 ? _c : DEFAULT_DECIMAL_SEPARATOR;
|
1334
|
+
const thousandsSeparator = (_d = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.THOUSANDS_SEPARATOR) !== null && _d !== void 0 ? _d : DEFAULT_THOUSANDS_SEPARATOR;
|
1335
|
+
return {
|
1336
|
+
currencySymbol: currencySettings.symbol,
|
1337
|
+
dateFormats: getSupportedDateFormats(dateFormat),
|
1338
|
+
decimalSeparator: (['.', ','].includes(decimalSeparator) && decimalSeparator) || DEFAULT_DECIMAL_SEPARATOR,
|
1339
|
+
decimalsCount: (!isNaN(Number(shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE)) && Number(shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE)) ||
|
1340
|
+
DEFAULT_DECIMALS_COUNT,
|
1341
|
+
thousandsSeparator: ['.', ',', ''].includes(thousandsSeparator)
|
1342
|
+
? thousandsSeparator
|
1343
|
+
: DEFAULT_THOUSANDS_SEPARATOR,
|
1344
|
+
};
|
1345
|
+
}
|
1346
|
+
getConfigurationSettings() {
|
1347
|
+
return this.configurationSettings$.value;
|
1348
|
+
}
|
1349
|
+
getCurrencySettings() {
|
1350
|
+
return this.currencySettings$.value;
|
1351
|
+
}
|
1352
|
+
parseConfigurationSettings(settings) {
|
1353
|
+
return settings.reduce((acc, setting) => {
|
1354
|
+
switch (setting.key) {
|
1355
|
+
case 'shopping-cart':
|
1356
|
+
acc['shopping-cart'] = parseJsonSafely(setting.value, []);
|
1357
|
+
break;
|
1358
|
+
case 'navigation':
|
1359
|
+
acc.navigation = parseJsonSafely(setting.value, {});
|
1360
|
+
break;
|
1361
|
+
case 'flows':
|
1362
|
+
acc.flows = parseJsonSafely(setting.value, []);
|
1363
|
+
break;
|
1364
|
+
default:
|
1365
|
+
acc[setting.key] = setting.value;
|
1366
|
+
}
|
1367
|
+
return acc;
|
1368
|
+
}, {});
|
1369
|
+
}
|
1370
|
+
}
|
1371
|
+
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1372
|
+
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
|
1373
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
1374
|
+
type: Injectable,
|
1375
|
+
args: [{ providedIn: 'root' }]
|
1376
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
1377
|
+
|
1378
|
+
const DEFAULT_FORMATTING_SETTINGS = {
|
1379
|
+
currencySymbol: DEFAULT_CURRENCY_SYMBOL,
|
1380
|
+
decimalsCount: DEFAULT_DECIMALS_COUNT,
|
1381
|
+
dateFormats: getSupportedDateFormats(DEFAULT_DATE_FORMAT),
|
1382
|
+
decimalSeparator: DEFAULT_DECIMAL_SEPARATOR,
|
1383
|
+
thousandsSeparator: DEFAULT_THOUSANDS_SEPARATOR,
|
1384
|
+
};
|
1228
1385
|
class SdkCoreModule {
|
1229
1386
|
}
|
1230
1387
|
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1231
1388
|
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: [
|
1389
|
+
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
1390
|
+
ContextService,
|
1391
|
+
QuoteDraftService,
|
1392
|
+
ProductImagesService,
|
1393
|
+
MetricsCalculationService,
|
1394
|
+
RuntimeSettingsService,
|
1395
|
+
{
|
1396
|
+
provide: FORMATTING_SETTINGS_TOKEN,
|
1397
|
+
useExisting: RuntimeSettingsService,
|
1398
|
+
},
|
1399
|
+
], imports: [ConfigurationModule, FlowConfigurationModule] });
|
1233
1400
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
|
1234
1401
|
type: NgModule,
|
1235
1402
|
args: [{
|
1236
1403
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
1237
|
-
providers: [
|
1404
|
+
providers: [
|
1405
|
+
ContextService,
|
1406
|
+
QuoteDraftService,
|
1407
|
+
ProductImagesService,
|
1408
|
+
MetricsCalculationService,
|
1409
|
+
RuntimeSettingsService,
|
1410
|
+
{
|
1411
|
+
provide: FORMATTING_SETTINGS_TOKEN,
|
1412
|
+
useExisting: RuntimeSettingsService,
|
1413
|
+
},
|
1414
|
+
],
|
1415
|
+
}]
|
1416
|
+
}] });
|
1417
|
+
|
1418
|
+
class CalendarDirective {
|
1419
|
+
constructor() {
|
1420
|
+
var _a;
|
1421
|
+
this.ngControl = inject(NgControl, { host: true, optional: true });
|
1422
|
+
this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
|
1423
|
+
this.destroy$ = new Subject();
|
1424
|
+
}
|
1425
|
+
set vlCalendar(calendar) {
|
1426
|
+
this.calendar = calendar;
|
1427
|
+
}
|
1428
|
+
ngOnDestroy() {
|
1429
|
+
this.destroy$.next();
|
1430
|
+
this.destroy$.complete();
|
1431
|
+
}
|
1432
|
+
ngOnInit() {
|
1433
|
+
var _a, _b;
|
1434
|
+
if (this.calendar) {
|
1435
|
+
this.calendar.dateFormat = (_b = (_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.dateFormats.primengFormat) !== null && _b !== void 0 ? _b : DEFAULT_DATE_FORMAT;
|
1436
|
+
if (this.ngControl && this.ngControl.control) {
|
1437
|
+
const control = this.ngControl.control;
|
1438
|
+
control.setValue(control.value, { emitEvent: false });
|
1439
|
+
}
|
1440
|
+
}
|
1441
|
+
}
|
1442
|
+
}
|
1443
|
+
CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
1444
|
+
CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: CalendarDirective, selector: "[vlCalendar]", inputs: { vlCalendar: "vlCalendar" }, ngImport: i0 });
|
1445
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, decorators: [{
|
1446
|
+
type: Directive,
|
1447
|
+
args: [{
|
1448
|
+
selector: '[vlCalendar]',
|
1449
|
+
}]
|
1450
|
+
}], propDecorators: { vlCalendar: [{
|
1451
|
+
type: Input
|
1452
|
+
}] } });
|
1453
|
+
|
1454
|
+
class SdkDirectivesModule {
|
1455
|
+
}
|
1456
|
+
SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1457
|
+
SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, declarations: [CalendarDirective], exports: [CalendarDirective] });
|
1458
|
+
SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule });
|
1459
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, decorators: [{
|
1460
|
+
type: NgModule,
|
1461
|
+
args: [{
|
1462
|
+
declarations: [CalendarDirective],
|
1463
|
+
exports: [CalendarDirective],
|
1464
|
+
}]
|
1465
|
+
}] });
|
1466
|
+
|
1467
|
+
class DatePipe {
|
1468
|
+
constructor() {
|
1469
|
+
var _a;
|
1470
|
+
this.locale = inject(LOCALE_ID);
|
1471
|
+
this.defaultOptions = inject(DATE_PIPE_DEFAULT_OPTIONS, { optional: true });
|
1472
|
+
this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
|
1473
|
+
this.destroy$ = new Subject();
|
1474
|
+
}
|
1475
|
+
ngOnDestroy() {
|
1476
|
+
this.destroy$.next();
|
1477
|
+
this.destroy$.complete();
|
1478
|
+
}
|
1479
|
+
transform(date) {
|
1480
|
+
var _a, _b;
|
1481
|
+
if (!date) {
|
1482
|
+
return '';
|
1483
|
+
}
|
1484
|
+
try {
|
1485
|
+
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);
|
1486
|
+
}
|
1487
|
+
catch (error) {
|
1488
|
+
return new Date(date).toString();
|
1489
|
+
}
|
1490
|
+
}
|
1491
|
+
}
|
1492
|
+
DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
1493
|
+
DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, name: "vlDate" });
|
1494
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, decorators: [{
|
1495
|
+
type: Pipe,
|
1496
|
+
args: [{
|
1497
|
+
name: 'vlDate',
|
1498
|
+
}]
|
1499
|
+
}] });
|
1500
|
+
|
1501
|
+
class NumberPipe {
|
1502
|
+
constructor() {
|
1503
|
+
var _a;
|
1504
|
+
this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
|
1505
|
+
this.destroy$ = new Subject();
|
1506
|
+
}
|
1507
|
+
ngOnDestroy() {
|
1508
|
+
this.destroy$.next();
|
1509
|
+
this.destroy$.complete();
|
1510
|
+
}
|
1511
|
+
transform(price) {
|
1512
|
+
var _a, _b, _c;
|
1513
|
+
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);
|
1514
|
+
}
|
1515
|
+
}
|
1516
|
+
NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
1517
|
+
NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, name: "vlNumber" });
|
1518
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, decorators: [{
|
1519
|
+
type: Pipe,
|
1520
|
+
args: [{
|
1521
|
+
name: 'vlNumber',
|
1522
|
+
}]
|
1523
|
+
}] });
|
1524
|
+
|
1525
|
+
class PricePipe {
|
1526
|
+
constructor() {
|
1527
|
+
var _a;
|
1528
|
+
this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
|
1529
|
+
this.destroy$ = new Subject();
|
1530
|
+
}
|
1531
|
+
ngOnDestroy() {
|
1532
|
+
this.destroy$.next();
|
1533
|
+
this.destroy$.complete();
|
1534
|
+
}
|
1535
|
+
transform(price) {
|
1536
|
+
var _a, _b, _c, _d;
|
1537
|
+
if (price == null || price === '') {
|
1538
|
+
return '';
|
1539
|
+
}
|
1540
|
+
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)}`;
|
1541
|
+
}
|
1542
|
+
}
|
1543
|
+
PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
1544
|
+
PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, name: "vlPrice" });
|
1545
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, decorators: [{
|
1546
|
+
type: Pipe,
|
1547
|
+
args: [{
|
1548
|
+
name: 'vlPrice',
|
1549
|
+
}]
|
1550
|
+
}] });
|
1551
|
+
|
1552
|
+
class SdkPipesModule {
|
1553
|
+
}
|
1554
|
+
SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1555
|
+
SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, declarations: [NumberPipe, PricePipe, DatePipe], exports: [NumberPipe, PricePipe, DatePipe] });
|
1556
|
+
SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule });
|
1557
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, decorators: [{
|
1558
|
+
type: NgModule,
|
1559
|
+
args: [{
|
1560
|
+
declarations: [NumberPipe, PricePipe, DatePipe],
|
1561
|
+
exports: [NumberPipe, PricePipe, DatePipe],
|
1238
1562
|
}]
|
1239
1563
|
}] });
|
1240
1564
|
|
@@ -1242,5 +1566,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
1242
1566
|
* Generated bundle index. Do not edit.
|
1243
1567
|
*/
|
1244
1568
|
|
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 };
|
1569
|
+
export { CalendarDirective, ConfigurationRuntimeService, ConfigurationService, 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
1570
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|