@veloceapps/sdk 7.0.2-4 → 7.0.2-41
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 +30 -1
- 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 +4 -4
- package/cms/components/preview/preview.module.d.ts +2 -1
- package/cms/components/preview/preview.types.d.ts +4 -0
- package/cms/index.d.ts +1 -0
- package/cms/injection-tokens.d.ts +1 -3
- package/cms/modules/runtime/index.d.ts +1 -0
- package/cms/modules/runtime/services/compilation.service.d.ts +2 -1
- package/cms/modules/runtime/services/runtime-editor.service.d.ts +6 -4
- package/cms/modules/runtime/services/runtime.service.d.ts +5 -1
- package/cms/modules/runtime/types/runtime.actions.d.ts +5 -2
- package/cms/plugins/element-hover.plugin.d.ts +32 -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/layouts.types.d.ts +30 -2
- package/cms/types/pages.types.d.ts +1 -0
- package/cms/utils/elements-resolver.d.ts +5 -1
- package/cms/utils/script.utils.d.ts +2 -0
- package/cms/vendor-map.d.ts +12 -6
- 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/services/configuration.service.d.ts +3 -3
- 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/ui-definition.types.d.ts +8 -2
- package/core/utils/line-item.utils.d.ts +7 -2
- package/core/utils/line-item.worker.d.ts +2 -2
- package/esm2020/cms/cms.actions.mjs +42 -2
- 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 +17 -15
- package/esm2020/cms/components/preview/preview.module.mjs +22 -4
- package/esm2020/cms/components/preview/preview.types.mjs +1 -1
- package/esm2020/cms/index.mjs +2 -1
- package/esm2020/cms/injection-tokens.mjs +1 -2
- 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 +112 -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/layouts.types.mjs +70 -1
- package/esm2020/cms/types/pages.types.mjs +2 -0
- package/esm2020/cms/utils/elements-resolver.mjs +22 -8
- package/esm2020/cms/utils/script.utils.mjs +42 -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 +3 -6
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +2 -1
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +6 -5
- 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/ui-definition.types.mjs +1 -1
- package/esm2020/core/utils/line-item.utils.mjs +38 -16
- package/esm2020/core/utils/line-item.worker.mjs +5 -5
- package/esm2020/src/components/header/header.component.mjs +39 -33
- package/esm2020/src/components/header/header.module.mjs +7 -3
- package/esm2020/src/components/header/metrics/metrics.component.mjs +9 -7
- package/esm2020/src/components/header/metrics/metrics.module.mjs +7 -3
- package/esm2020/src/flow-routing.module.mjs +1 -1
- package/esm2020/src/guards/context.guard.mjs +11 -8
- package/fesm2015/veloceapps-sdk-cms.mjs +728 -373
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +317 -33
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +70 -52
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +777 -355
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +310 -33
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +68 -51
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/header/header.component.d.ts +2 -3
- package/src/components/header/header.module.d.ts +2 -1
- package/src/components/header/metrics/metrics.component.d.ts +4 -2
- package/src/components/header/metrics/metrics.module.d.ts +2 -1
- package/src/guards/context.guard.d.ts +3 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, NgModule } from '@angular/core';
|
|
3
|
-
import { UUID, ConfigurationContext, RuntimeModel, ConfigurationContextMode, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils } from '@veloceapps/core';
|
|
2
|
+
import { Injectable, InjectionToken, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
|
|
3
|
+
import { UUID, ConfigurationContext, RuntimeModel, ConfigurationContextMode, 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 * as i1 from '@veloceapps/api';
|
|
5
5
|
import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
|
|
6
6
|
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';
|
|
@@ -10,10 +10,13 @@ import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@vel
|
|
|
10
10
|
import * as i5 from 'primeng/api';
|
|
11
11
|
import * as i6 from 'primeng/dynamicdialog';
|
|
12
12
|
import moment from 'moment';
|
|
13
|
+
import { NgControl } from '@angular/forms';
|
|
14
|
+
import 'primeng/calendar';
|
|
15
|
+
import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
|
|
13
16
|
|
|
14
17
|
const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
|
|
15
18
|
const id = UUID.UUID();
|
|
16
|
-
|
|
19
|
+
return {
|
|
17
20
|
id,
|
|
18
21
|
type: uiDefinitionProperties.rootType ?? '',
|
|
19
22
|
cfgStatus: 'Default',
|
|
@@ -21,11 +24,8 @@ const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
|
|
|
21
24
|
qty,
|
|
22
25
|
productName: context.properties?.['displayName'] || context.productName,
|
|
23
26
|
productId: context.productId ?? '',
|
|
24
|
-
...(
|
|
25
|
-
? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
|
|
26
|
-
: {}),
|
|
27
|
+
...(uiDefinitionProperties.offeringId ? { offeringId: uiDefinitionProperties.offeringId } : {}),
|
|
27
28
|
};
|
|
28
|
-
return lineItem;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
class ContextService {
|
|
@@ -84,6 +84,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
84
84
|
args: [{ providedIn: 'root' }]
|
|
85
85
|
}], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
|
|
86
86
|
|
|
87
|
+
const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
|
|
88
|
+
|
|
87
89
|
var RuntimeMode;
|
|
88
90
|
(function (RuntimeMode) {
|
|
89
91
|
RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
|
|
@@ -180,6 +182,7 @@ class ConfigurationRuntimeService {
|
|
|
180
182
|
PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
|
|
181
183
|
StartDate: new Date().toISOString().substring(0, 10),
|
|
182
184
|
PriceListId: this.uiDefinitionProperties.priceList,
|
|
185
|
+
offeringId: this.uiDefinitionProperties.offeringId,
|
|
183
186
|
standalone: 'true',
|
|
184
187
|
...uiDefinitionExternals,
|
|
185
188
|
},
|
|
@@ -503,18 +506,25 @@ const removeLineItem = (lineItem, idToRemove) => {
|
|
|
503
506
|
.filter(r => !!r),
|
|
504
507
|
};
|
|
505
508
|
};
|
|
506
|
-
const replaceLineItem = (lineItem, replaceTo) => {
|
|
509
|
+
const replaceLineItem = (lineItem, replaceTo, skipCardinalityCalculation = false) => {
|
|
507
510
|
if (lineItem.id === replaceTo.id) {
|
|
508
|
-
|
|
511
|
+
if (!skipCardinalityCalculation) {
|
|
512
|
+
return { ...recalculateCardinalityVariables(lineItem, replaceTo) };
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
return { ...replaceTo };
|
|
516
|
+
}
|
|
509
517
|
}
|
|
510
518
|
return {
|
|
511
519
|
...lineItem,
|
|
512
|
-
lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo)),
|
|
520
|
+
lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo, skipCardinalityCalculation)),
|
|
513
521
|
};
|
|
514
522
|
};
|
|
515
523
|
const calculateCardinalityVariables = (lineItems) => {
|
|
516
524
|
const cardVars = new Map();
|
|
517
|
-
lineItems
|
|
525
|
+
lineItems
|
|
526
|
+
.filter(({ port, type }) => !!port && !!type)
|
|
527
|
+
.forEach(li => {
|
|
518
528
|
const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
|
|
519
529
|
cardVars.set(cardinalityVariableName, (cardVars.get(cardinalityVariableName) ?? 0) + li.qty);
|
|
520
530
|
});
|
|
@@ -554,13 +564,13 @@ const upsertAttributes = (originalAttributes, attributesToUpsert) => {
|
|
|
554
564
|
];
|
|
555
565
|
}, originalAttributes);
|
|
556
566
|
};
|
|
557
|
-
const patchAttributes = (rootLineItem, id, attrs) => {
|
|
567
|
+
const patchAttributes = (rootLineItem, id, attrs, skipCardinalityCalculation = false) => {
|
|
558
568
|
const lineItem = findLineItem(id, [rootLineItem]);
|
|
559
569
|
if (!lineItem) {
|
|
560
570
|
return rootLineItem;
|
|
561
571
|
}
|
|
562
572
|
const attributes = upsertAttributes(lineItem.attributes, attrs);
|
|
563
|
-
return replaceLineItem(rootLineItem, { ...lineItem, attributes });
|
|
573
|
+
return replaceLineItem(rootLineItem, { ...lineItem, attributes }, skipCardinalityCalculation);
|
|
564
574
|
};
|
|
565
575
|
const getAttributeValue = (attributes, name) => attributes.find(attr => attr.name === name)?.value;
|
|
566
576
|
const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
|
|
@@ -588,19 +598,31 @@ const getRecommendedPrices = (portDomain, type) => {
|
|
|
588
598
|
};
|
|
589
599
|
const generateModifiedAssetsMap = (lineItems) => {
|
|
590
600
|
return lineItems.reduce((acc, li) => {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
}
|
|
601
|
+
const isModified = isLineItemModified(li);
|
|
602
|
+
if (!isModified) {
|
|
603
|
+
return acc;
|
|
604
|
+
}
|
|
605
|
+
const target = getOriginParent(lineItems, li);
|
|
606
|
+
const id = target?.assetId ?? target?.openOrderLineItemId;
|
|
607
|
+
if (id) {
|
|
608
|
+
acc[id] = true;
|
|
600
609
|
}
|
|
601
610
|
return acc;
|
|
602
611
|
}, {});
|
|
603
612
|
};
|
|
613
|
+
const getOriginParent = (lineItems, currentLineItem) => {
|
|
614
|
+
let target = currentLineItem;
|
|
615
|
+
while (target && target.rampInstanceId) {
|
|
616
|
+
target = lineItems.find(sub => sub.id === currentLineItem.rampInstanceId);
|
|
617
|
+
}
|
|
618
|
+
return target;
|
|
619
|
+
};
|
|
620
|
+
const isLineItemModified = (lineItem) => {
|
|
621
|
+
if (lineItem.actionCode === 'EXIST' && lineItem.status === 'PENDING') {
|
|
622
|
+
return false;
|
|
623
|
+
}
|
|
624
|
+
return lineItem.actionCode !== 'EXIST';
|
|
625
|
+
};
|
|
604
626
|
const multiplyLineItems = (lineItem, qty, split) => {
|
|
605
627
|
if (split) {
|
|
606
628
|
const unifyIds = (lineItem) => ({
|
|
@@ -619,18 +641,24 @@ const multiplyLineItems = (lineItem, qty, split) => {
|
|
|
619
641
|
];
|
|
620
642
|
}
|
|
621
643
|
};
|
|
644
|
+
const filterOutTechnicalAttributes = (attributes) => {
|
|
645
|
+
return attributes.filter(({ name }) => !name.startsWith('#') && !name.startsWith('$'));
|
|
646
|
+
};
|
|
622
647
|
|
|
623
648
|
var lineItem_utils = /*#__PURE__*/Object.freeze({
|
|
624
649
|
__proto__: null,
|
|
625
650
|
calculateCardinalityVariables: calculateCardinalityVariables,
|
|
651
|
+
filterOutTechnicalAttributes: filterOutTechnicalAttributes,
|
|
626
652
|
findLineItem: findLineItem,
|
|
627
653
|
findLineItemWithComparator: findLineItemWithComparator,
|
|
628
654
|
generateLineItem: generateLineItem,
|
|
629
655
|
generateModifiedAssetsMap: generateModifiedAssetsMap,
|
|
630
656
|
getAttributeValue: getAttributeValue,
|
|
631
657
|
getAttributes: getAttributes,
|
|
658
|
+
getOriginParent: getOriginParent,
|
|
632
659
|
getRecommendedPrices: getRecommendedPrices,
|
|
633
660
|
insertLineItem: insertLineItem,
|
|
661
|
+
isLineItemModified: isLineItemModified,
|
|
634
662
|
mapAttributes: mapAttributes,
|
|
635
663
|
multiplyLineItems: multiplyLineItems,
|
|
636
664
|
patchAttributes: patchAttributes,
|
|
@@ -650,11 +678,11 @@ class LineItemWorker {
|
|
|
650
678
|
remove(id) {
|
|
651
679
|
return new LineItemWorker(removeLineItem(this.li, id));
|
|
652
680
|
}
|
|
653
|
-
replace(toReplace) {
|
|
654
|
-
return new LineItemWorker(replaceLineItem(this.li, toReplace));
|
|
681
|
+
replace(toReplace, skipCardinalityCalculation = false) {
|
|
682
|
+
return new LineItemWorker(replaceLineItem(this.li, toReplace, skipCardinalityCalculation));
|
|
655
683
|
}
|
|
656
|
-
patchAttribute(attrs, id) {
|
|
657
|
-
return new LineItemWorker(patchAttributes(this.li, id ?? this.li.id, attrs));
|
|
684
|
+
patchAttribute(attrs, id, skipCardinalityCalculation = false) {
|
|
685
|
+
return new LineItemWorker(patchAttributes(this.li, id ?? this.li.id, attrs, skipCardinalityCalculation));
|
|
658
686
|
}
|
|
659
687
|
}
|
|
660
688
|
|
|
@@ -680,11 +708,12 @@ class ConfigurationService {
|
|
|
680
708
|
this.charges.next({});
|
|
681
709
|
this.pricePlans.next({});
|
|
682
710
|
}
|
|
683
|
-
patch$(lineItem) {
|
|
711
|
+
patch$(lineItem, options) {
|
|
684
712
|
if (!this.lineItem.value) {
|
|
685
713
|
return throwError(() => new Error(`Source LineItem not found`));
|
|
686
714
|
}
|
|
687
|
-
|
|
715
|
+
const skipCardinalityCalculation = options?.skipCardinalityCalculation || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
|
|
716
|
+
this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
|
|
688
717
|
return this.configure().pipe(catchError(error => {
|
|
689
718
|
console.error(error);
|
|
690
719
|
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
|
@@ -699,8 +728,8 @@ class ConfigurationService {
|
|
|
699
728
|
}
|
|
700
729
|
}));
|
|
701
730
|
}
|
|
702
|
-
patch(lineItem) {
|
|
703
|
-
this.patch$(lineItem).subscribe();
|
|
731
|
+
patch(lineItem, options) {
|
|
732
|
+
this.patch$(lineItem, options).subscribe();
|
|
704
733
|
}
|
|
705
734
|
setConfigurableRamp(lineItem) {
|
|
706
735
|
this.configurableRamp = lineItem;
|
|
@@ -1268,16 +1297,264 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
1268
1297
|
args: [{ providedIn: 'root' }]
|
|
1269
1298
|
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
|
1270
1299
|
|
|
1300
|
+
class RuntimeSettingsService {
|
|
1301
|
+
constructor(configurationSettingsApiService) {
|
|
1302
|
+
this.configurationSettingsApiService = configurationSettingsApiService;
|
|
1303
|
+
this.configurationSettings$ = new BehaviorSubject({});
|
|
1304
|
+
this.currencySettings$ = new BehaviorSubject({
|
|
1305
|
+
iso: DEFAULT_CURRENCY_ISO_CODE,
|
|
1306
|
+
symbol: DEFAULT_CURRENCY_SYMBOL,
|
|
1307
|
+
});
|
|
1308
|
+
this.getCurrencySymbol = (locale, currency) => {
|
|
1309
|
+
return (0)
|
|
1310
|
+
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
|
1311
|
+
.replace(/\d/g, '')
|
|
1312
|
+
.trim();
|
|
1313
|
+
};
|
|
1314
|
+
}
|
|
1315
|
+
create() {
|
|
1316
|
+
return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
|
|
1317
|
+
this.configurationSettings$.next(configurationSettings);
|
|
1318
|
+
this.formattingSettings = this.getFormattingSettings();
|
|
1319
|
+
}), map$2(() => undefined));
|
|
1320
|
+
}
|
|
1321
|
+
initCurrency(iso) {
|
|
1322
|
+
if (iso) {
|
|
1323
|
+
const symbol = this.getCurrencySymbol('en-US', iso);
|
|
1324
|
+
this.currencySettings$.next({ iso, symbol });
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
getFormattingSettings() {
|
|
1328
|
+
if (this.formattingSettings) {
|
|
1329
|
+
return this.formattingSettings;
|
|
1330
|
+
}
|
|
1331
|
+
const shoppingCartSettings = this.getConfigurationSettings()['shopping-cart']?.reduce((acc, setting) => {
|
|
1332
|
+
return { ...acc, [setting.id]: setting.properties };
|
|
1333
|
+
}, {});
|
|
1334
|
+
const currencySettings = this.getCurrencySettings();
|
|
1335
|
+
const dateFormat = (validateDateFormat(shoppingCartSettings?.DATE_FORMAT ?? '') && shoppingCartSettings?.DATE_FORMAT) ||
|
|
1336
|
+
DEFAULT_DATE_FORMAT;
|
|
1337
|
+
const decimalSeparator = shoppingCartSettings?.DECIMAL_SEPARATOR ?? DEFAULT_DECIMAL_SEPARATOR;
|
|
1338
|
+
const thousandsSeparator = shoppingCartSettings?.THOUSANDS_SEPARATOR ?? DEFAULT_THOUSANDS_SEPARATOR;
|
|
1339
|
+
return {
|
|
1340
|
+
currencySymbol: currencySettings.symbol,
|
|
1341
|
+
dateFormats: getSupportedDateFormats(dateFormat),
|
|
1342
|
+
decimalSeparator: (['.', ','].includes(decimalSeparator) && decimalSeparator) || DEFAULT_DECIMAL_SEPARATOR,
|
|
1343
|
+
decimalsCount: (!isNaN(Number(shoppingCartSettings?.PRICE_SCALE)) && Number(shoppingCartSettings?.PRICE_SCALE)) ||
|
|
1344
|
+
DEFAULT_DECIMALS_COUNT,
|
|
1345
|
+
thousandsSeparator: ['.', ',', ''].includes(thousandsSeparator)
|
|
1346
|
+
? thousandsSeparator
|
|
1347
|
+
: DEFAULT_THOUSANDS_SEPARATOR,
|
|
1348
|
+
};
|
|
1349
|
+
}
|
|
1350
|
+
getConfigurationSettings() {
|
|
1351
|
+
return this.configurationSettings$.value;
|
|
1352
|
+
}
|
|
1353
|
+
getCurrencySettings() {
|
|
1354
|
+
return this.currencySettings$.value;
|
|
1355
|
+
}
|
|
1356
|
+
parseConfigurationSettings(settings) {
|
|
1357
|
+
return settings.reduce((acc, setting) => {
|
|
1358
|
+
switch (setting.key) {
|
|
1359
|
+
case 'shopping-cart':
|
|
1360
|
+
acc['shopping-cart'] = parseJsonSafely(setting.value, []);
|
|
1361
|
+
break;
|
|
1362
|
+
case 'navigation':
|
|
1363
|
+
acc.navigation = parseJsonSafely(setting.value, {});
|
|
1364
|
+
break;
|
|
1365
|
+
case 'flows':
|
|
1366
|
+
acc.flows = parseJsonSafely(setting.value, []);
|
|
1367
|
+
break;
|
|
1368
|
+
default:
|
|
1369
|
+
acc[setting.key] = setting.value;
|
|
1370
|
+
}
|
|
1371
|
+
return acc;
|
|
1372
|
+
}, {});
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1376
|
+
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
|
|
1377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
|
1378
|
+
type: Injectable,
|
|
1379
|
+
args: [{ providedIn: 'root' }]
|
|
1380
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
|
1381
|
+
|
|
1382
|
+
const DEFAULT_FORMATTING_SETTINGS = {
|
|
1383
|
+
currencySymbol: DEFAULT_CURRENCY_SYMBOL,
|
|
1384
|
+
decimalsCount: DEFAULT_DECIMALS_COUNT,
|
|
1385
|
+
dateFormats: getSupportedDateFormats(DEFAULT_DATE_FORMAT),
|
|
1386
|
+
decimalSeparator: DEFAULT_DECIMAL_SEPARATOR,
|
|
1387
|
+
thousandsSeparator: DEFAULT_THOUSANDS_SEPARATOR,
|
|
1388
|
+
};
|
|
1271
1389
|
class SdkCoreModule {
|
|
1272
1390
|
}
|
|
1273
1391
|
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1274
1392
|
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
|
1275
|
-
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
|
1393
|
+
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
|
1394
|
+
ContextService,
|
|
1395
|
+
QuoteDraftService,
|
|
1396
|
+
ProductImagesService,
|
|
1397
|
+
MetricsCalculationService,
|
|
1398
|
+
RuntimeSettingsService,
|
|
1399
|
+
{
|
|
1400
|
+
provide: FORMATTING_SETTINGS_TOKEN,
|
|
1401
|
+
useExisting: RuntimeSettingsService,
|
|
1402
|
+
},
|
|
1403
|
+
], imports: [ConfigurationModule, FlowConfigurationModule] });
|
|
1276
1404
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
|
|
1277
1405
|
type: NgModule,
|
|
1278
1406
|
args: [{
|
|
1279
1407
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
|
1280
|
-
providers: [
|
|
1408
|
+
providers: [
|
|
1409
|
+
ContextService,
|
|
1410
|
+
QuoteDraftService,
|
|
1411
|
+
ProductImagesService,
|
|
1412
|
+
MetricsCalculationService,
|
|
1413
|
+
RuntimeSettingsService,
|
|
1414
|
+
{
|
|
1415
|
+
provide: FORMATTING_SETTINGS_TOKEN,
|
|
1416
|
+
useExisting: RuntimeSettingsService,
|
|
1417
|
+
},
|
|
1418
|
+
],
|
|
1419
|
+
}]
|
|
1420
|
+
}] });
|
|
1421
|
+
|
|
1422
|
+
class CalendarDirective {
|
|
1423
|
+
constructor() {
|
|
1424
|
+
this.ngControl = inject(NgControl, { host: true, optional: true });
|
|
1425
|
+
this.formattingSettings = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })?.getFormattingSettings();
|
|
1426
|
+
this.destroy$ = new Subject();
|
|
1427
|
+
}
|
|
1428
|
+
set vlCalendar(calendar) {
|
|
1429
|
+
this.calendar = calendar;
|
|
1430
|
+
}
|
|
1431
|
+
ngOnDestroy() {
|
|
1432
|
+
this.destroy$.next();
|
|
1433
|
+
this.destroy$.complete();
|
|
1434
|
+
}
|
|
1435
|
+
ngOnInit() {
|
|
1436
|
+
if (this.calendar) {
|
|
1437
|
+
this.calendar.dateFormat = this.formattingSettings?.dateFormats.primengFormat ?? DEFAULT_DATE_FORMAT;
|
|
1438
|
+
if (this.ngControl && this.ngControl.control) {
|
|
1439
|
+
const control = this.ngControl.control;
|
|
1440
|
+
control.setValue(control.value, { emitEvent: false });
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1446
|
+
CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: CalendarDirective, selector: "[vlCalendar]", inputs: { vlCalendar: "vlCalendar" }, ngImport: i0 });
|
|
1447
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, decorators: [{
|
|
1448
|
+
type: Directive,
|
|
1449
|
+
args: [{
|
|
1450
|
+
selector: '[vlCalendar]',
|
|
1451
|
+
}]
|
|
1452
|
+
}], propDecorators: { vlCalendar: [{
|
|
1453
|
+
type: Input
|
|
1454
|
+
}] } });
|
|
1455
|
+
|
|
1456
|
+
class SdkDirectivesModule {
|
|
1457
|
+
}
|
|
1458
|
+
SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1459
|
+
SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, declarations: [CalendarDirective], exports: [CalendarDirective] });
|
|
1460
|
+
SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule });
|
|
1461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, decorators: [{
|
|
1462
|
+
type: NgModule,
|
|
1463
|
+
args: [{
|
|
1464
|
+
declarations: [CalendarDirective],
|
|
1465
|
+
exports: [CalendarDirective],
|
|
1466
|
+
}]
|
|
1467
|
+
}] });
|
|
1468
|
+
|
|
1469
|
+
class DatePipe {
|
|
1470
|
+
constructor() {
|
|
1471
|
+
this.locale = inject(LOCALE_ID);
|
|
1472
|
+
this.defaultOptions = inject(DATE_PIPE_DEFAULT_OPTIONS, { optional: true });
|
|
1473
|
+
this.formattingSettings = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })?.getFormattingSettings();
|
|
1474
|
+
this.destroy$ = new Subject();
|
|
1475
|
+
}
|
|
1476
|
+
ngOnDestroy() {
|
|
1477
|
+
this.destroy$.next();
|
|
1478
|
+
this.destroy$.complete();
|
|
1479
|
+
}
|
|
1480
|
+
transform(date) {
|
|
1481
|
+
if (!date) {
|
|
1482
|
+
return '';
|
|
1483
|
+
}
|
|
1484
|
+
try {
|
|
1485
|
+
return formatDate(date, this.formattingSettings?.dateFormats.datePipeFormat || DEFAULT_DATE_FORMAT, this.locale, this.defaultOptions?.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
|
+
this.formattingSettings = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })?.getFormattingSettings();
|
|
1504
|
+
this.destroy$ = new Subject();
|
|
1505
|
+
}
|
|
1506
|
+
ngOnDestroy() {
|
|
1507
|
+
this.destroy$.next();
|
|
1508
|
+
this.destroy$.complete();
|
|
1509
|
+
}
|
|
1510
|
+
transform(price) {
|
|
1511
|
+
return formatNumber(price, this.formattingSettings?.thousandsSeparator, this.formattingSettings?.decimalSeparator, this.formattingSettings?.decimalsCount);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1515
|
+
NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, name: "vlNumber" });
|
|
1516
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, decorators: [{
|
|
1517
|
+
type: Pipe,
|
|
1518
|
+
args: [{
|
|
1519
|
+
name: 'vlNumber',
|
|
1520
|
+
}]
|
|
1521
|
+
}] });
|
|
1522
|
+
|
|
1523
|
+
class PricePipe {
|
|
1524
|
+
constructor() {
|
|
1525
|
+
this.formattingSettings = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })?.getFormattingSettings();
|
|
1526
|
+
this.destroy$ = new Subject();
|
|
1527
|
+
}
|
|
1528
|
+
ngOnDestroy() {
|
|
1529
|
+
this.destroy$.next();
|
|
1530
|
+
this.destroy$.complete();
|
|
1531
|
+
}
|
|
1532
|
+
transform(price) {
|
|
1533
|
+
if (price == null || price === '') {
|
|
1534
|
+
return '';
|
|
1535
|
+
}
|
|
1536
|
+
return `${this.formattingSettings?.currencySymbol || DEFAULT_CURRENCY_SYMBOL}${formatNumber(price, this.formattingSettings?.thousandsSeparator, this.formattingSettings?.decimalSeparator, this.formattingSettings?.decimalsCount)}`;
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1540
|
+
PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, name: "vlPrice" });
|
|
1541
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, decorators: [{
|
|
1542
|
+
type: Pipe,
|
|
1543
|
+
args: [{
|
|
1544
|
+
name: 'vlPrice',
|
|
1545
|
+
}]
|
|
1546
|
+
}] });
|
|
1547
|
+
|
|
1548
|
+
class SdkPipesModule {
|
|
1549
|
+
}
|
|
1550
|
+
SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1551
|
+
SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, declarations: [NumberPipe, PricePipe, DatePipe], exports: [NumberPipe, PricePipe, DatePipe] });
|
|
1552
|
+
SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule });
|
|
1553
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, decorators: [{
|
|
1554
|
+
type: NgModule,
|
|
1555
|
+
args: [{
|
|
1556
|
+
declarations: [NumberPipe, PricePipe, DatePipe],
|
|
1557
|
+
exports: [NumberPipe, PricePipe, DatePipe],
|
|
1281
1558
|
}]
|
|
1282
1559
|
}] });
|
|
1283
1560
|
|
|
@@ -1285,5 +1562,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
1285
1562
|
* Generated bundle index. Do not edit.
|
|
1286
1563
|
*/
|
|
1287
1564
|
|
|
1288
|
-
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, getRecommendedPrices, insertLineItem, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
|
1565
|
+
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, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
|
1289
1566
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|