@veloceapps/sdk 8.0.0-9 → 8.0.0-90
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +0 -1
- package/cms/utils/element.utils.d.ts +1 -0
- package/cms/vendor-map.d.ts +7 -2
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +1 -1
- package/core/modules/configuration/services/configuration.service.d.ts +6 -1
- package/core/modules/flow-configuration/types/update.types.d.ts +1 -1
- package/core/pipes/action-code.pipe.d.ts +8 -0
- package/core/pipes/date.pipe.d.ts +2 -1
- package/core/pipes/index.d.ts +1 -0
- package/core/pipes/pipes.module.d.ts +2 -1
- package/core/services/context.service.d.ts +2 -0
- package/core/services/runtime-settings.service.d.ts +4 -1
- package/core/types/formatting-settings.types.d.ts +2 -0
- package/core/types/index.d.ts +1 -0
- package/core/types/pipe.types.d.ts +1 -0
- package/esm2020/cms/components/element-children/element-children.component.mjs +3 -3
- package/esm2020/cms/components/element-children/element-children.module.mjs +4 -4
- package/esm2020/cms/components/element-drop-handle/element-drop-handle.component.mjs +3 -3
- package/esm2020/cms/components/element-drop-handle/element-drop-handle.module.mjs +4 -4
- package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +3 -3
- package/esm2020/cms/components/element-renderer/element-renderer.module.mjs +4 -4
- package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +5 -5
- package/esm2020/cms/components/plugin.component.mjs +3 -3
- package/esm2020/cms/components/preview/preview.component.mjs +3 -3
- package/esm2020/cms/components/preview/preview.module.mjs +4 -4
- package/esm2020/cms/directives/custom-template.directive.mjs +7 -7
- package/esm2020/cms/launcher.module.mjs +4 -4
- package/esm2020/cms/modules/federated/federated-host.directive.mjs +3 -3
- package/esm2020/cms/modules/federated/federated.component.mjs +3 -3
- package/esm2020/cms/modules/federated/federated.module.mjs +4 -4
- package/esm2020/cms/modules/migrations/migrations.module.mjs +4 -4
- package/esm2020/cms/modules/migrations/services/migrations.service.mjs +3 -3
- package/esm2020/cms/modules/runtime/runtime.module.mjs +4 -4
- package/esm2020/cms/modules/runtime/services/compilation.service.mjs +3 -3
- package/esm2020/cms/modules/runtime/services/runtime-editor.service.mjs +3 -3
- package/esm2020/cms/modules/runtime/services/runtime.service.mjs +3 -3
- package/esm2020/cms/plugins/configuration.plugin.mjs +3 -3
- package/esm2020/cms/plugins/element-hover.plugin.mjs +3 -3
- package/esm2020/cms/plugins/io.plugin.mjs +8 -7
- package/esm2020/cms/plugins/page.plugin.mjs +3 -3
- package/esm2020/cms/plugins/region.plugin.mjs +3 -3
- package/esm2020/cms/plugins/script.plugin.mjs +3 -3
- package/esm2020/cms/services/element-context.service.mjs +3 -3
- package/esm2020/cms/services/integration.state.mjs +3 -3
- package/esm2020/cms/services/io-provider.service.mjs +3 -3
- package/esm2020/cms/services/resources.service.mjs +3 -3
- package/esm2020/cms/services/templates.service.mjs +3 -3
- package/esm2020/cms/utils/element.utils.mjs +10 -3
- package/esm2020/cms/utils/elements-resolver.mjs +2 -2
- package/esm2020/cms/vendor-map.mjs +8 -3
- package/esm2020/core/core.module.mjs +8 -17
- package/esm2020/core/directives/directives.module.mjs +4 -4
- package/esm2020/core/directives/primeng-calendar.directive.mjs +3 -3
- package/esm2020/core/modules/configuration/configuration.module.mjs +4 -4
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +11 -14
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +28 -9
- package/esm2020/core/modules/configuration/services/configuration.state.mjs +3 -3
- package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +9 -9
- package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +4 -4
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +3 -3
- package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +7 -14
- package/esm2020/core/modules/flow-configuration/types/update.types.mjs +1 -1
- package/esm2020/core/pipes/action-code.pipe.mjs +20 -0
- package/esm2020/core/pipes/date.pipe.mjs +13 -7
- package/esm2020/core/pipes/index.mjs +2 -1
- package/esm2020/core/pipes/number.pipe.mjs +3 -3
- package/esm2020/core/pipes/pipes.module.mjs +8 -7
- package/esm2020/core/pipes/price.pipe.mjs +3 -3
- package/esm2020/core/services/context.service.mjs +20 -5
- package/esm2020/core/services/metric-calculation/metric-calculation.service.mjs +3 -3
- package/esm2020/core/services/product-images.service.mjs +3 -3
- package/esm2020/core/services/quote-draft.service.mjs +5 -4
- package/esm2020/core/services/runtime-settings.service.mjs +20 -5
- package/esm2020/core/types/formatting-settings.types.mjs +1 -1
- package/esm2020/core/types/index.mjs +2 -1
- package/esm2020/core/types/pipe.types.mjs +2 -0
- package/esm2020/src/components/dialog/dialog.component.mjs +3 -3
- package/esm2020/src/components/dialog/dialog.module.mjs +4 -4
- package/esm2020/src/components/doc-gen/doc-gen.component.mjs +13 -14
- package/esm2020/src/components/doc-gen/doc-gen.module.mjs +4 -4
- package/esm2020/src/components/guided-selling/guided-selling.component.mjs +13 -14
- package/esm2020/src/components/guided-selling/guided-selling.module.mjs +4 -4
- package/esm2020/src/components/header/cart-overlay/cart-preview.component.mjs +3 -3
- package/esm2020/src/components/header/cart-overlay/cart-preview.module.mjs +4 -4
- package/esm2020/src/components/header/header.component.mjs +4 -4
- package/esm2020/src/components/header/header.module.mjs +4 -4
- package/esm2020/src/components/header/metrics/metrics.component.mjs +4 -4
- package/esm2020/src/components/header/metrics/metrics.module.mjs +4 -4
- package/esm2020/src/flow-routing.module.mjs +66 -75
- package/esm2020/src/flow.component.mjs +16 -10
- package/esm2020/src/flow.module.mjs +4 -4
- package/esm2020/src/guards/context.guard.mjs +4 -4
- package/esm2020/src/guards/flow.guard.mjs +23 -0
- package/esm2020/src/guards/product-unload.guard.mjs +7 -4
- package/esm2020/src/guards/root.guard.mjs +17 -13
- package/esm2020/src/pages/assets/assets.component.mjs +12 -12
- package/esm2020/src/pages/assets/assets.module.mjs +4 -4
- package/esm2020/src/pages/catalog/catalog.component.mjs +12 -12
- package/esm2020/src/pages/catalog/catalog.module.mjs +4 -4
- package/esm2020/src/pages/debug/debug.component.mjs +12 -16
- package/esm2020/src/pages/debug/debug.module.mjs +4 -4
- package/esm2020/src/pages/empty-account/empty-account.component.mjs +3 -3
- package/esm2020/src/pages/empty-account/empty-account.module.mjs +4 -4
- package/esm2020/src/pages/product/product.component.mjs +5 -6
- package/esm2020/src/pages/product/product.module.mjs +4 -4
- package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +3 -3
- package/esm2020/src/pages/record-not-found/record-not-found.module.mjs +4 -4
- package/esm2020/src/pages/remote/remote.component.mjs +8 -9
- package/esm2020/src/pages/remote/remote.module.mjs +4 -4
- package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +12 -12
- package/esm2020/src/pages/shopping-cart/shopping-cart.module.mjs +4 -4
- package/esm2020/src/resolvers/flow.resolver.mjs +17 -11
- package/esm2020/src/resolvers/quote.resolver.mjs +12 -8
- package/esm2020/src/services/doc-gen.service.mjs +3 -3
- package/esm2020/src/services/flow-dialog.service.mjs +3 -3
- package/esm2020/src/services/flow-router.service.mjs +5 -5
- package/esm2020/src/services/flow.service.mjs +34 -11
- package/esm2020/src/services/guided-selling.service.mjs +3 -3
- package/esm2020/src/utils/flow.utils.mjs +6 -2
- package/fesm2015/veloceapps-sdk-cms.mjs +129 -116
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +1064 -1011
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +605 -695
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +128 -115
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +589 -538
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +606 -697
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +3 -11
- package/src/components/doc-gen/doc-gen.component.d.ts +4 -5
- package/src/components/guided-selling/guided-selling.component.d.ts +5 -6
- package/src/flow-routing.module.d.ts +6 -7
- package/src/flow.component.d.ts +3 -2
- package/src/guards/context.guard.d.ts +4 -4
- package/src/guards/flow.guard.d.ts +2 -0
- package/src/guards/product-unload.guard.d.ts +2 -2
- package/src/guards/root.guard.d.ts +0 -1
- package/src/pages/assets/assets.component.d.ts +3 -3
- package/src/pages/catalog/catalog.component.d.ts +3 -3
- package/src/pages/debug/debug.component.d.ts +5 -8
- package/src/pages/shopping-cart/shopping-cart.component.d.ts +3 -3
- package/src/resolvers/flow.resolver.d.ts +3 -1
- package/src/resolvers/quote.resolver.d.ts +3 -1
- package/src/services/flow.service.d.ts +11 -2
- package/esm2020/runtime/components/component-preview/component-preview.component.mjs +0 -125
- package/esm2020/runtime/components/index.mjs +0 -5
- package/esm2020/runtime/components/section-renderer/section-renderer.component.mjs +0 -67
- package/esm2020/runtime/components/ui-runtime/runtime.component.mjs +0 -440
- package/esm2020/runtime/components/ui-runtime-preview/runtime-preview.component.mjs +0 -108
- package/esm2020/runtime/execution/components/children-placeholder/children-placeholder.component.mjs +0 -60
- package/esm2020/runtime/execution/components/context-provider/context-provider.component.mjs +0 -39
- package/esm2020/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.mjs +0 -67
- package/esm2020/runtime/execution/components/federated/federated.component.mjs +0 -74
- package/esm2020/runtime/execution/components/velo-attribute/velo-attribute.component.mjs +0 -60
- package/esm2020/runtime/execution/components/velo-multiselect/velo-multiselect.component.mjs +0 -130
- package/esm2020/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.mjs +0 -72
- package/esm2020/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.mjs +0 -97
- package/esm2020/runtime/execution/components/velo-port-radio/velo-port-radio.component.mjs +0 -142
- package/esm2020/runtime/execution/components/velo-type/velo-type.component.mjs +0 -119
- package/esm2020/runtime/execution/directives/section-script.directive.mjs +0 -247
- package/esm2020/runtime/execution/directives/sf-query.directive.mjs +0 -35
- package/esm2020/runtime/execution/directives/velo-attribute.directive.mjs +0 -88
- package/esm2020/runtime/execution/directives/velo-port.directive.mjs +0 -376
- package/esm2020/runtime/execution/directives/vl-approval.directive.mjs +0 -23
- package/esm2020/runtime/execution/directives/vl-document-attachments.directive.mjs +0 -36
- package/esm2020/runtime/execution/directives/vl-document-templates.directive.mjs +0 -60
- package/esm2020/runtime/execution/directives/vl-quote.directive.mjs +0 -42
- package/esm2020/runtime/execution/directives/vl-ramp.directive.mjs +0 -55
- package/esm2020/runtime/execution/runtime-execution.module.mjs +0 -133
- package/esm2020/runtime/execution/utils/federated.util.mjs +0 -32
- package/esm2020/runtime/index.mjs +0 -5
- package/esm2020/runtime/runtime.module.mjs +0 -74
- package/esm2020/runtime/services/cart.service.mjs +0 -29
- package/esm2020/runtime/services/collapsible-state.service.mjs +0 -34
- package/esm2020/runtime/services/configuration.service.mjs +0 -119
- package/esm2020/runtime/services/current-state.service.mjs +0 -17
- package/esm2020/runtime/services/form-scope.service.mjs +0 -30
- package/esm2020/runtime/services/index.mjs +0 -4
- package/esm2020/runtime/services/product-model-cache.service.mjs +0 -31
- package/esm2020/runtime/services/runtime-context.service.mjs +0 -60
- package/esm2020/runtime/services/runtime-form.service.mjs +0 -219
- package/esm2020/runtime/services/runtime.service.mjs +0 -115
- package/esm2020/runtime/services/section-helper.service.mjs +0 -27
- package/esm2020/runtime/services/section-scope.service.mjs +0 -36
- package/esm2020/runtime/services/section-store.service.mjs +0 -22
- package/esm2020/runtime/services/section.service.mjs +0 -117
- package/esm2020/runtime/types/bound-data.types.mjs +0 -7
- package/esm2020/runtime/types/index.mjs +0 -3
- package/esm2020/runtime/types/quote-states.types.mjs +0 -2
- package/esm2020/runtime/types/runtime.types.mjs +0 -2
- package/esm2020/runtime/types/script-registry.types.mjs +0 -51
- package/esm2020/runtime/utils/line-item.util.mjs +0 -270
- package/esm2020/runtime/utils/section.utils.mjs +0 -26
- package/esm2020/runtime/utils/sections-binder.helper.mjs +0 -105
- package/esm2020/runtime/veloceapps-sdk-runtime.mjs +0 -5
- package/esm2020/src/pages/legacy-product/legacy-product.component.mjs +0 -137
- package/esm2020/src/pages/legacy-product/legacy-product.module.mjs +0 -19
- package/fesm2015/veloceapps-sdk-runtime.mjs +0 -3770
- package/fesm2015/veloceapps-sdk-runtime.mjs.map +0 -1
- package/fesm2020/veloceapps-sdk-runtime.mjs +0 -3767
- package/fesm2020/veloceapps-sdk-runtime.mjs.map +0 -1
- package/runtime/README.md +0 -5
- package/runtime/components/component-preview/component-preview.component.d.ts +0 -27
- package/runtime/components/index.d.ts +0 -4
- package/runtime/components/section-renderer/section-renderer.component.d.ts +0 -25
- package/runtime/components/ui-runtime/runtime.component.d.ts +0 -53
- package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +0 -27
- package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +0 -30
- package/runtime/execution/components/context-provider/context-provider.component.d.ts +0 -14
- package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +0 -25
- package/runtime/execution/components/federated/federated.component.d.ts +0 -36
- package/runtime/execution/components/velo-attribute/velo-attribute.component.d.ts +0 -19
- package/runtime/execution/components/velo-multiselect/velo-multiselect.component.d.ts +0 -35
- package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +0 -22
- package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +0 -22
- package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +0 -28
- package/runtime/execution/components/velo-type/velo-type.component.d.ts +0 -31
- package/runtime/execution/directives/section-script.directive.d.ts +0 -59
- package/runtime/execution/directives/sf-query.directive.d.ts +0 -15
- package/runtime/execution/directives/velo-attribute.directive.d.ts +0 -26
- package/runtime/execution/directives/velo-port.directive.d.ts +0 -74
- package/runtime/execution/directives/vl-approval.directive.d.ts +0 -10
- package/runtime/execution/directives/vl-document-attachments.directive.d.ts +0 -15
- package/runtime/execution/directives/vl-document-templates.directive.d.ts +0 -33
- package/runtime/execution/directives/vl-quote.directive.d.ts +0 -14
- package/runtime/execution/directives/vl-ramp.directive.d.ts +0 -15
- package/runtime/execution/runtime-execution.module.d.ts +0 -25
- package/runtime/execution/utils/federated.util.d.ts +0 -6
- package/runtime/index.d.ts +0 -4
- package/runtime/runtime.module.d.ts +0 -16
- package/runtime/services/cart.service.d.ts +0 -15
- package/runtime/services/collapsible-state.service.d.ts +0 -15
- package/runtime/services/configuration.service.d.ts +0 -20
- package/runtime/services/current-state.service.d.ts +0 -8
- package/runtime/services/form-scope.service.d.ts +0 -20
- package/runtime/services/index.d.ts +0 -3
- package/runtime/services/product-model-cache.service.d.ts +0 -14
- package/runtime/services/runtime-context.service.d.ts +0 -16
- package/runtime/services/runtime-form.service.d.ts +0 -24
- package/runtime/services/runtime.service.d.ts +0 -44
- package/runtime/services/section-helper.service.d.ts +0 -8
- package/runtime/services/section-scope.service.d.ts +0 -14
- package/runtime/services/section-store.service.d.ts +0 -11
- package/runtime/services/section.service.d.ts +0 -30
- package/runtime/types/bound-data.types.d.ts +0 -13
- package/runtime/types/index.d.ts +0 -2
- package/runtime/types/quote-states.types.d.ts +0 -6
- package/runtime/types/runtime.types.d.ts +0 -19
- package/runtime/types/script-registry.types.d.ts +0 -13
- package/runtime/utils/line-item.util.d.ts +0 -34
- package/runtime/utils/section.utils.d.ts +0 -2
- package/runtime/utils/sections-binder.helper.d.ts +0 -16
- package/src/pages/legacy-product/legacy-product.component.d.ts +0 -37
- package/src/pages/legacy-product/legacy-product.module.d.ts +0 -9
@@ -1,11 +1,11 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
2
|
import { Injectable, InjectionToken, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
|
3
|
-
import { UUID, ConfigurationContextMode, ConfigurationContext,
|
3
|
+
import { UUID, ConfigurationContextMode, ConfigurationContext, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, DEFAULT_ACTION_CODE_LABELS, parseJsonSafely, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, EntityUtil, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
|
4
4
|
import * as i1 from '@veloceapps/api';
|
5
5
|
import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
|
6
|
-
import { BehaviorSubject,
|
7
|
-
import { filter, tap,
|
8
|
-
import { merge, isEqual, flatten, sortBy, map as map$1, transform, omit, cloneDeep, uniq } from 'lodash';
|
6
|
+
import { BehaviorSubject, zip, noop, combineLatest, map as map$2, tap as tap$1, throwError, shareReplay as shareReplay$1, of, switchMap as switchMap$1, catchError as catchError$1, Subject, take as take$1, distinctUntilChanged } from 'rxjs';
|
7
|
+
import { map, filter, tap, switchMap, skip, take, shareReplay, catchError, finalize, first } from 'rxjs/operators';
|
8
|
+
import { merge, isEqual, flatten, sortBy, map as map$1, uniqBy, transform, omit, cloneDeep, uniq } from 'lodash';
|
9
9
|
import { HttpErrorResponse } from '@angular/common/http';
|
10
10
|
import * as i4 from '@veloceapps/components';
|
11
11
|
import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
|
@@ -71,6 +71,9 @@ class ContextService {
|
|
71
71
|
get isInitialized() {
|
72
72
|
return Boolean(this.context.value);
|
73
73
|
}
|
74
|
+
get isInitialized$() {
|
75
|
+
return this.context.pipe(map(Boolean));
|
76
|
+
}
|
74
77
|
get mode() {
|
75
78
|
return this.resolve().properties.mode;
|
76
79
|
}
|
@@ -86,6 +89,18 @@ class ContextService {
|
|
86
89
|
create(headerId, mode) {
|
87
90
|
return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
|
88
91
|
}
|
92
|
+
initTestMode() {
|
93
|
+
return this.create('TestId', ConfigurationContextMode.TEST).pipe(map(context => {
|
94
|
+
return this.update({
|
95
|
+
properties: {
|
96
|
+
...context.properties,
|
97
|
+
RuntimeMode: ConfigurationContextMode.TEST,
|
98
|
+
StartDate: new Date().toISOString().substring(0, 10),
|
99
|
+
standalone: 'true',
|
100
|
+
},
|
101
|
+
});
|
102
|
+
}));
|
103
|
+
}
|
89
104
|
update(partialContext) {
|
90
105
|
const originalContext = this.resolve();
|
91
106
|
const updatedContext = {
|
@@ -112,172 +127,13 @@ class ContextService {
|
|
112
127
|
this.context.next(null);
|
113
128
|
}
|
114
129
|
}
|
115
|
-
ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
116
|
-
ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
117
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
130
|
+
ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
131
|
+
ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, providedIn: 'root' });
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, decorators: [{
|
118
133
|
type: Injectable,
|
119
134
|
args: [{ providedIn: 'root' }]
|
120
135
|
}], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
|
121
136
|
|
122
|
-
const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
|
123
|
-
|
124
|
-
var RuntimeMode;
|
125
|
-
(function (RuntimeMode) {
|
126
|
-
RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
|
127
|
-
RuntimeMode[RuntimeMode["PROD"] = 1] = "PROD";
|
128
|
-
})(RuntimeMode || (RuntimeMode = {}));
|
129
|
-
var RuntimeOperation;
|
130
|
-
(function (RuntimeOperation) {
|
131
|
-
RuntimeOperation["INIT"] = "INIT";
|
132
|
-
RuntimeOperation["UPDATE"] = "UPDATE";
|
133
|
-
})(RuntimeOperation || (RuntimeOperation = {}));
|
134
|
-
var RuntimeStep;
|
135
|
-
(function (RuntimeStep) {
|
136
|
-
RuntimeStep["START"] = "START";
|
137
|
-
RuntimeStep["UPDATE"] = "UPDATE";
|
138
|
-
})(RuntimeStep || (RuntimeStep = {}));
|
139
|
-
|
140
|
-
const UI_DEFINITION_VERSION = 3;
|
141
|
-
|
142
|
-
class RuntimeContextService {
|
143
|
-
constructor(configurationApiService) {
|
144
|
-
this.configurationApiService = configurationApiService;
|
145
|
-
}
|
146
|
-
getRuntimeContext(productId, offeringId) {
|
147
|
-
return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
|
148
|
-
const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
|
149
|
-
const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
|
150
|
-
const { productName, properties } = Array.from(runtimeModel.components.values()).find(c => c.productId === productId) ?? {};
|
151
|
-
const uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
152
|
-
return {
|
153
|
-
modelId: runtimeData.modelId,
|
154
|
-
uiDefinitionContainer: uiDefinitionContainer,
|
155
|
-
runtimeModel: runtimeModel,
|
156
|
-
runtimeMode: RuntimeMode.PROD,
|
157
|
-
productId: productId,
|
158
|
-
productType: properties?.['displayName'] || productName,
|
159
|
-
offeringId: offeringId,
|
160
|
-
properties: {
|
161
|
-
PricingEnabled: uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
|
162
|
-
PriceListId: uiDefinitionProperties.priceList,
|
163
|
-
},
|
164
|
-
};
|
165
|
-
}));
|
166
|
-
}
|
167
|
-
getUIDefinitionContainer(runtimeData) {
|
168
|
-
const containers = runtimeData.uiDefinitions.filter(container => !isLegacyUIDefinition(container.source));
|
169
|
-
return containers.find(container => container.source.primary) ?? containers[0];
|
170
|
-
}
|
171
|
-
}
|
172
|
-
RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
173
|
-
RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService });
|
174
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService, decorators: [{
|
175
|
-
type: Injectable
|
176
|
-
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
|
177
|
-
|
178
|
-
class ConfigurationRuntimeService {
|
179
|
-
constructor(apiService, contextService, runtimeContextService) {
|
180
|
-
this.apiService = apiService;
|
181
|
-
this.contextService = contextService;
|
182
|
-
this.runtimeContextService = runtimeContextService;
|
183
|
-
this._isInitialized = false;
|
184
|
-
this.uiDefinitionProperties = {};
|
185
|
-
}
|
186
|
-
reset() {
|
187
|
-
this._isInitialized = false;
|
188
|
-
this._runtimeContext = undefined;
|
189
|
-
this.initializationProps = undefined;
|
190
|
-
this.uiDefinitionProperties = {};
|
191
|
-
}
|
192
|
-
initTestMode(uiDefinitionContainer) {
|
193
|
-
this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
194
|
-
const uiDefinitionExternals = uiDefinitionContainer.source.externals ?? {};
|
195
|
-
return combineLatest([
|
196
|
-
this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
|
197
|
-
this.contextService.create('TestId', ConfigurationContextMode.TEST),
|
198
|
-
]).pipe(first(), map(([runtimeData, context]) => {
|
199
|
-
this.contextService.update({
|
200
|
-
properties: {
|
201
|
-
...this.runtimeContext?.properties,
|
202
|
-
...context.properties,
|
203
|
-
ModelId: uiDefinitionContainer.modelId,
|
204
|
-
RuntimeMode: ConfigurationContextMode.TEST,
|
205
|
-
PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
|
206
|
-
StartDate: new Date().toISOString().substring(0, 10),
|
207
|
-
PriceListId: this.uiDefinitionProperties.priceList,
|
208
|
-
offeringId: this.uiDefinitionProperties.offeringId,
|
209
|
-
standalone: 'true',
|
210
|
-
...uiDefinitionExternals,
|
211
|
-
},
|
212
|
-
});
|
213
|
-
this._runtimeContext = {
|
214
|
-
modelId: uiDefinitionContainer.modelId,
|
215
|
-
runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
|
216
|
-
runtimeMode: RuntimeMode.TEST,
|
217
|
-
uiDefinitionContainer,
|
218
|
-
};
|
219
|
-
return this._runtimeContext;
|
220
|
-
}), tap(() => (this._isInitialized = true)));
|
221
|
-
}
|
222
|
-
init(props) {
|
223
|
-
this.initializationProps = props;
|
224
|
-
const context = this.contextService.resolve();
|
225
|
-
return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
|
226
|
-
this.uiDefinitionProperties = getUIDefinitionProperties(runtimeContext.uiDefinitionContainer);
|
227
|
-
const { PriceListId } = context.properties ?? {};
|
228
|
-
const mergeContext = {
|
229
|
-
...runtimeContext,
|
230
|
-
properties: {
|
231
|
-
...runtimeContext.properties,
|
232
|
-
...context.properties,
|
233
|
-
PricingEnabled: PriceListId ? 'true' : 'false',
|
234
|
-
},
|
235
|
-
};
|
236
|
-
this.id15to18('AccountId', mergeContext.properties);
|
237
|
-
this._runtimeContext = mergeContext;
|
238
|
-
if (context.properties && this._runtimeContext.properties?.StartDate) {
|
239
|
-
this.contextService.update({
|
240
|
-
properties: {
|
241
|
-
...this._runtimeContext.properties,
|
242
|
-
...context.properties,
|
243
|
-
},
|
244
|
-
});
|
245
|
-
}
|
246
|
-
return this._runtimeContext;
|
247
|
-
}), tap(() => (this._isInitialized = true)));
|
248
|
-
}
|
249
|
-
overrideUIDefinition(uiDefinitionContainer) {
|
250
|
-
if (!this._runtimeContext) {
|
251
|
-
return;
|
252
|
-
}
|
253
|
-
this._runtimeContext.uiDefinitionContainer = uiDefinitionContainer;
|
254
|
-
this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
255
|
-
}
|
256
|
-
id15to18(propertyName, source) {
|
257
|
-
if (!source) {
|
258
|
-
return;
|
259
|
-
}
|
260
|
-
const value = source[propertyName];
|
261
|
-
if (typeof value === 'string' && value.length === 15) {
|
262
|
-
source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
|
263
|
-
}
|
264
|
-
}
|
265
|
-
get isInitialized() {
|
266
|
-
return this._isInitialized;
|
267
|
-
}
|
268
|
-
get runtimeModel() {
|
269
|
-
return this.runtimeContext?.runtimeModel;
|
270
|
-
}
|
271
|
-
get runtimeContext() {
|
272
|
-
return this._runtimeContext;
|
273
|
-
}
|
274
|
-
}
|
275
|
-
ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
|
276
|
-
ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationRuntimeService });
|
277
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
|
278
|
-
type: Injectable
|
279
|
-
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
|
280
|
-
|
281
137
|
class QuoteDraftService {
|
282
138
|
get isInitialized() {
|
283
139
|
return this.isInitializedSubj$.getValue();
|
@@ -323,6 +179,7 @@ class QuoteDraftService {
|
|
323
179
|
reset() {
|
324
180
|
this.resetSubj$.next(true);
|
325
181
|
this.quoteSubj$.next(null);
|
182
|
+
this.isInitialized = false;
|
326
183
|
this.hasUnsavedChanges = false;
|
327
184
|
}
|
328
185
|
init(quoteId, params) {
|
@@ -493,9 +350,9 @@ class QuoteDraftService {
|
|
493
350
|
}
|
494
351
|
}
|
495
352
|
}
|
496
|
-
QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
497
|
-
QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
498
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
353
|
+
QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
354
|
+
QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, providedIn: 'root' });
|
355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, decorators: [{
|
499
356
|
type: Injectable,
|
500
357
|
args: [{ providedIn: 'root' }]
|
501
358
|
}], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }]; } });
|
@@ -708,58 +565,183 @@ var lineItem_utils = /*#__PURE__*/Object.freeze({
|
|
708
565
|
upsertAttributes: upsertAttributes
|
709
566
|
});
|
710
567
|
|
711
|
-
class
|
712
|
-
constructor(
|
713
|
-
this.
|
568
|
+
class RuntimeSettingsService {
|
569
|
+
constructor(configurationSettingsApiService) {
|
570
|
+
this.configurationSettingsApiService = configurationSettingsApiService;
|
571
|
+
this.configurationSettings$ = new BehaviorSubject({});
|
572
|
+
this.currencySettings$ = new BehaviorSubject({
|
573
|
+
iso: DEFAULT_CURRENCY_ISO_CODE,
|
574
|
+
symbol: DEFAULT_CURRENCY_SYMBOL,
|
575
|
+
});
|
576
|
+
this.shoppingCartSettings$ = new BehaviorSubject([]);
|
577
|
+
this.getCurrencySymbol = (locale, currency) => {
|
578
|
+
return (0)
|
579
|
+
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
580
|
+
.replace(/\d/g, '')
|
581
|
+
.trim();
|
582
|
+
};
|
714
583
|
}
|
715
|
-
|
716
|
-
return
|
584
|
+
create() {
|
585
|
+
return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
|
586
|
+
this.configurationSettings$.next(configurationSettings);
|
587
|
+
this.addShoppingCartSettings(configurationSettings['shopping-cart'] ?? []);
|
588
|
+
this.formattingSettings = this.getFormattingSettings();
|
589
|
+
}), map$2(() => undefined));
|
717
590
|
}
|
718
|
-
|
719
|
-
|
591
|
+
initCurrency(iso) {
|
592
|
+
if (iso) {
|
593
|
+
const symbol = this.getCurrencySymbol('en-US', iso);
|
594
|
+
this.currencySettings$.next({ iso, symbol });
|
595
|
+
}
|
720
596
|
}
|
721
|
-
|
722
|
-
|
597
|
+
getFormattingSettings() {
|
598
|
+
if (this.formattingSettings) {
|
599
|
+
return this.formattingSettings;
|
600
|
+
}
|
601
|
+
const shoppingCartSettings = this.getConfigurationSettings()['shopping-cart']?.reduce((acc, setting) => {
|
602
|
+
return { ...acc, [setting.id]: setting.properties };
|
603
|
+
}, {});
|
604
|
+
const currencySettings = this.getCurrencySettings();
|
605
|
+
const dateFormat = (validateDateFormat(shoppingCartSettings?.DATE_FORMAT ?? '') && shoppingCartSettings?.DATE_FORMAT) ||
|
606
|
+
DEFAULT_DATE_FORMAT;
|
607
|
+
const decimalSeparator = shoppingCartSettings?.DECIMAL_SEPARATOR;
|
608
|
+
const thousandsSeparator = shoppingCartSettings?.THOUSANDS_SEPARATOR;
|
609
|
+
// the number of decimal places can be 0
|
610
|
+
const priceScale = shoppingCartSettings?.PRICE_SCALE;
|
611
|
+
const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
|
612
|
+
? Number(priceScale)
|
613
|
+
: DEFAULT_DECIMALS_COUNT;
|
614
|
+
const actionCodeSettings = shoppingCartSettings?.STATUS_LABEL;
|
615
|
+
return {
|
616
|
+
currencySymbol: currencySettings.symbol,
|
617
|
+
dateFormats: getSupportedDateFormats(dateFormat),
|
618
|
+
decimalsCount,
|
619
|
+
decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
|
620
|
+
? decimalSeparator
|
621
|
+
: DEFAULT_DECIMAL_SEPARATOR,
|
622
|
+
// thousands separator can be a blank value, so it can also be null
|
623
|
+
thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
|
624
|
+
? thousandsSeparator || ''
|
625
|
+
: DEFAULT_THOUSANDS_SEPARATOR,
|
626
|
+
actionCodeLabels: actionCodeSettings?.length
|
627
|
+
? actionCodeSettings.reduce((result, setting) => ({ ...result, [setting.status_label]: setting.custom_label }), {})
|
628
|
+
: DEFAULT_ACTION_CODE_LABELS,
|
629
|
+
};
|
723
630
|
}
|
724
|
-
|
725
|
-
return
|
631
|
+
getConfigurationSettings() {
|
632
|
+
return this.configurationSettings$.value;
|
726
633
|
}
|
727
|
-
|
728
|
-
|
729
|
-
class ConfigurationService {
|
730
|
-
constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
|
731
|
-
this.quoteDraftService = quoteDraftService;
|
732
|
-
this.runtimeService = runtimeService;
|
733
|
-
this.contextService = contextService;
|
734
|
-
this.configurationApiService = configurationApiService;
|
735
|
-
this.messageService = messageService;
|
736
|
-
this.dialogService = dialogService;
|
737
|
-
this.mode = ConfigurationMode.SEARCH;
|
738
|
-
this.lineItem = new BehaviorSubject(undefined);
|
739
|
-
this.charges = new BehaviorSubject({});
|
740
|
-
this.pricePlans = new BehaviorSubject({});
|
741
|
-
this.isLoadingSubj$ = new BehaviorSubject(false);
|
742
|
-
this.isLoading$ = this.isLoadingSubj$.asObservable();
|
743
|
-
this.hasUnsavedChanges = false;
|
634
|
+
getShoppingCartSettings() {
|
635
|
+
return this.shoppingCartSettings$.value;
|
744
636
|
}
|
745
|
-
|
746
|
-
this.
|
747
|
-
this.runtimeService.reset();
|
748
|
-
this.configurableRamp = undefined;
|
749
|
-
this.lineItem.next(undefined);
|
750
|
-
this.charges.next({});
|
751
|
-
this.pricePlans.next({});
|
637
|
+
getCurrencySettings() {
|
638
|
+
return this.currencySettings$.value;
|
752
639
|
}
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
640
|
+
parseConfigurationSettings(settings) {
|
641
|
+
return settings.reduce((acc, setting) => {
|
642
|
+
switch (setting.key) {
|
643
|
+
case 'shopping-cart':
|
644
|
+
acc['shopping-cart'] = parseJsonSafely(setting.value, []);
|
645
|
+
break;
|
646
|
+
case 'navigation':
|
647
|
+
acc.navigation = parseJsonSafely(setting.value, {});
|
648
|
+
break;
|
649
|
+
case 'flows':
|
650
|
+
acc.flows = parseJsonSafely(setting.value, []);
|
651
|
+
break;
|
652
|
+
default:
|
653
|
+
acc[setting.key] = setting.value;
|
654
|
+
}
|
655
|
+
return acc;
|
656
|
+
}, {});
|
657
|
+
}
|
658
|
+
addShoppingCartSettings(settings) {
|
659
|
+
// uniqBy removes items with the biggest index
|
660
|
+
const newSettings = uniqBy([...settings, ...this.shoppingCartSettings$.value], 'id');
|
661
|
+
this.shoppingCartSettings$.next(newSettings);
|
662
|
+
}
|
663
|
+
}
|
664
|
+
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
665
|
+
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
|
666
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
667
|
+
type: Injectable,
|
668
|
+
args: [{ providedIn: 'root' }]
|
669
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
670
|
+
|
671
|
+
const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
|
672
|
+
|
673
|
+
var RuntimeMode;
|
674
|
+
(function (RuntimeMode) {
|
675
|
+
RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
|
676
|
+
RuntimeMode[RuntimeMode["PROD"] = 1] = "PROD";
|
677
|
+
})(RuntimeMode || (RuntimeMode = {}));
|
678
|
+
var RuntimeOperation;
|
679
|
+
(function (RuntimeOperation) {
|
680
|
+
RuntimeOperation["INIT"] = "INIT";
|
681
|
+
RuntimeOperation["UPDATE"] = "UPDATE";
|
682
|
+
})(RuntimeOperation || (RuntimeOperation = {}));
|
683
|
+
var RuntimeStep;
|
684
|
+
(function (RuntimeStep) {
|
685
|
+
RuntimeStep["START"] = "START";
|
686
|
+
RuntimeStep["UPDATE"] = "UPDATE";
|
687
|
+
})(RuntimeStep || (RuntimeStep = {}));
|
688
|
+
|
689
|
+
const UI_DEFINITION_VERSION = 3;
|
690
|
+
|
691
|
+
class LineItemWorker {
|
692
|
+
constructor(src) {
|
693
|
+
this.li = { ...src };
|
694
|
+
}
|
695
|
+
insert(parentId, toInsert) {
|
696
|
+
return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
|
697
|
+
}
|
698
|
+
remove(id) {
|
699
|
+
return new LineItemWorker(removeLineItem(this.li, id));
|
700
|
+
}
|
701
|
+
replace(toReplace, skipCardinalityCalculation = false) {
|
702
|
+
return new LineItemWorker(replaceLineItem(this.li, toReplace, skipCardinalityCalculation));
|
703
|
+
}
|
704
|
+
patchAttribute(attrs, id, skipCardinalityCalculation = false) {
|
705
|
+
return new LineItemWorker(patchAttributes(this.li, id ?? this.li.id, attrs, skipCardinalityCalculation));
|
706
|
+
}
|
707
|
+
}
|
708
|
+
|
709
|
+
class ConfigurationService {
|
710
|
+
constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService, runtimeSettings) {
|
711
|
+
this.quoteDraftService = quoteDraftService;
|
712
|
+
this.runtimeService = runtimeService;
|
713
|
+
this.contextService = contextService;
|
714
|
+
this.configurationApiService = configurationApiService;
|
715
|
+
this.messageService = messageService;
|
716
|
+
this.dialogService = dialogService;
|
717
|
+
this.runtimeSettings = runtimeSettings;
|
718
|
+
this.mode = ConfigurationMode.SEARCH;
|
719
|
+
this.lineItem = new BehaviorSubject(undefined);
|
720
|
+
this.charges = new BehaviorSubject({});
|
721
|
+
this.pricePlans = new BehaviorSubject({});
|
722
|
+
this.procedureContext = new BehaviorSubject({});
|
723
|
+
this.isLoadingSubj$ = new BehaviorSubject(false);
|
724
|
+
this.isLoading$ = this.isLoadingSubj$.asObservable();
|
725
|
+
this.hasUnsavedChanges = false;
|
726
|
+
}
|
727
|
+
reset() {
|
728
|
+
this.hasUnsavedChanges = false;
|
729
|
+
this.runtimeService.reset();
|
730
|
+
this.configurableRamp = undefined;
|
731
|
+
this.lineItem.next(undefined);
|
732
|
+
this.charges.next({});
|
733
|
+
this.pricePlans.next({});
|
734
|
+
}
|
735
|
+
patch$(lineItem, options) {
|
736
|
+
if (!this.lineItem.value) {
|
737
|
+
return throwError(() => new Error(`Source LineItem not found`));
|
738
|
+
}
|
739
|
+
const skipCardinalityCalculation = options?.skipCardinalityCalculation || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
|
740
|
+
this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
|
741
|
+
return this.configure().pipe(catchError(error => {
|
742
|
+
console.error(error);
|
743
|
+
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
744
|
+
this.messageService.add({ severity: 'error', summary: error });
|
763
745
|
}
|
764
746
|
// bounce back if configuration call has failed
|
765
747
|
this.lineItem.next(this.lineItem.value ? { ...this.lineItem.value } : undefined);
|
@@ -814,6 +796,12 @@ class ConfigurationService {
|
|
814
796
|
get pricePlansSnapshot() {
|
815
797
|
return this.pricePlans.value;
|
816
798
|
}
|
799
|
+
get procedureContext$() {
|
800
|
+
return this.procedureContext.asObservable();
|
801
|
+
}
|
802
|
+
get procedureContextSnapshot() {
|
803
|
+
return this.procedureContext.value;
|
804
|
+
}
|
817
805
|
configure() {
|
818
806
|
return this.configureRequest$(this.generateRequest());
|
819
807
|
}
|
@@ -823,11 +811,20 @@ class ConfigurationService {
|
|
823
811
|
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
824
812
|
const mainPricingEnabled = runtimeContext.properties?.PricingEnabled;
|
825
813
|
const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
|
814
|
+
const customPriceApi = this.runtimeSettings.getConfigurationSettings()['CUSTOM_PRICE_API'];
|
826
815
|
this.isLoadingSubj$.next(true);
|
827
|
-
|
816
|
+
const configure$ = pricingEnabled && customPriceApi
|
817
|
+
? this.configurationApiService.customConfigurePrice({ url: customPriceApi, configurationRequest, runtimeModel })
|
818
|
+
: this.configurationApiService.configureLineItem({
|
819
|
+
configurationRequest,
|
820
|
+
runtimeModel,
|
821
|
+
pricingEnabled,
|
822
|
+
});
|
823
|
+
return configure$.pipe(tap(({ lineItem, context, charges, pricePlans, deletedLineItems, procedureContext }) => {
|
828
824
|
this.contextService.update(context ?? {});
|
829
825
|
this.charges.next(charges ?? {});
|
830
826
|
this.pricePlans.next(pricePlans ?? {});
|
827
|
+
this.procedureContext.next(procedureContext ?? {});
|
831
828
|
if (lineItem) {
|
832
829
|
this.lineItem.next(lineItem);
|
833
830
|
}
|
@@ -884,7 +881,7 @@ class ConfigurationService {
|
|
884
881
|
}
|
885
882
|
getUIDefinitionProperties() {
|
886
883
|
return {
|
887
|
-
...
|
884
|
+
...(this.getRuntimeContext().uiDefinitionContainer?.source.properties ?? {}),
|
888
885
|
...(this.runtimeService.uiDefinitionProperties ?? {}),
|
889
886
|
};
|
890
887
|
}
|
@@ -920,140 +917,11 @@ class ConfigurationService {
|
|
920
917
|
return this.quoteDraftService.quoteDraft?.initialState.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
|
921
918
|
}
|
922
919
|
}
|
923
|
-
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
924
|
-
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
925
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
926
|
-
type: Injectable
|
927
|
-
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6.DialogService }]; } });
|
928
|
-
|
929
|
-
class ConfigurationState {
|
930
|
-
constructor(statefulConfigurationApiService, runtimeService, configurationService, toastService) {
|
931
|
-
this.statefulConfigurationApiService = statefulConfigurationApiService;
|
932
|
-
this.runtimeService = runtimeService;
|
933
|
-
this.configurationService = configurationService;
|
934
|
-
this.toastService = toastService;
|
935
|
-
this.stateSubj$ = new BehaviorSubject({});
|
936
|
-
this.state$ = this.stateSubj$.asObservable();
|
937
|
-
this.stateId = null;
|
938
|
-
}
|
939
|
-
init$() {
|
940
|
-
return this.configurationService.configure().pipe(switchMap$1(() => {
|
941
|
-
if (!this.isStatefulConfiguration) {
|
942
|
-
return of(undefined);
|
943
|
-
}
|
944
|
-
const { actions, selectors } = this.runtimeService.runtimeContext?.uiDefinitionContainer ?? {};
|
945
|
-
return this.statefulConfigurationApiService.init({
|
946
|
-
request: this.configurationService.generateRequest(),
|
947
|
-
actions: actions?.map(action => ({ name: action.apiName, script: action.script })),
|
948
|
-
selectors: selectors?.map(selector => ({ name: selector.apiName, script: selector.script })),
|
949
|
-
});
|
950
|
-
}), tap$1(stateId => (this.stateId = stateId || null)), map$2(() => undefined));
|
951
|
-
}
|
952
|
-
cleanup() {
|
953
|
-
this.stateId = null;
|
954
|
-
this.configurationService.reset();
|
955
|
-
this.stateSubj$.next({});
|
956
|
-
}
|
957
|
-
execute$(req) {
|
958
|
-
if (this.isStatefulConfiguration) {
|
959
|
-
return this.executeStateful$(req);
|
960
|
-
}
|
961
|
-
else {
|
962
|
-
return this.executeStateless$(req);
|
963
|
-
}
|
964
|
-
}
|
965
|
-
dispatch$(actionName, inputData) {
|
966
|
-
return this.execute$({ actions: [{ name: actionName, inputData }] });
|
967
|
-
}
|
968
|
-
select$(selectorName, inputData) {
|
969
|
-
const requestId = UUID.UUID();
|
970
|
-
return this.execute$({
|
971
|
-
selectors: {
|
972
|
-
[requestId]: {
|
973
|
-
name: selectorName,
|
974
|
-
inputData,
|
975
|
-
},
|
976
|
-
},
|
977
|
-
}).pipe(map$2(() => this.stateSubj$.value[requestId]), tap$1(() => this.stateSubj$.next(omit(this.stateSubj$.value, requestId))));
|
978
|
-
}
|
979
|
-
get isStatefulConfiguration() {
|
980
|
-
return this.runtimeService.uiDefinitionProperties.statefulConfigurationEnabled ?? false;
|
981
|
-
}
|
982
|
-
executeStateless$(request) {
|
983
|
-
return of(undefined).pipe(switchMap$1(() => {
|
984
|
-
// Apply actions and execute configuration/price call
|
985
|
-
// No need to run configuration if no actions in the request
|
986
|
-
if (!request.actions?.length) {
|
987
|
-
return of(undefined);
|
988
|
-
}
|
989
|
-
let configurationRequest = this.configurationService.generateRequest();
|
990
|
-
request.actions.forEach(action => {
|
991
|
-
configurationRequest = this.executeActionScript(configurationRequest, action) ?? configurationRequest;
|
992
|
-
});
|
993
|
-
return this.configurationService.configureRequest$(configurationRequest);
|
994
|
-
}), tap$1(() => {
|
995
|
-
if (!request.selectors) {
|
996
|
-
return;
|
997
|
-
}
|
998
|
-
// Run selectors and apply them to the state
|
999
|
-
const finalConfigurationRequest = this.configurationService.generateRequest();
|
1000
|
-
const selectorsResult = EntityUtil.entries(request.selectors).reduce((trunk, [key, selector]) => {
|
1001
|
-
trunk[key] = this.executeSelectorScript(finalConfigurationRequest, selector);
|
1002
|
-
return trunk;
|
1003
|
-
}, {});
|
1004
|
-
this.stateSubj$.next({
|
1005
|
-
...this.stateSubj$.value,
|
1006
|
-
...selectorsResult,
|
1007
|
-
});
|
1008
|
-
}), map$2(() => undefined));
|
1009
|
-
}
|
1010
|
-
executeStateful$(request) {
|
1011
|
-
if (!this.stateId) {
|
1012
|
-
return of(undefined);
|
1013
|
-
}
|
1014
|
-
return this.statefulConfigurationApiService.execute(this.stateId, request).pipe(tap$1(response => {
|
1015
|
-
this.stateId = response.stateId;
|
1016
|
-
const updatedState = this.stateSubj$.value;
|
1017
|
-
EntityUtil.entries(response.selectors).forEach(([key, value]) => {
|
1018
|
-
if (!value.success) {
|
1019
|
-
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
1020
|
-
this.toastService.add({ summary: value.errorMessage, severity: ToastType.error });
|
1021
|
-
}
|
1022
|
-
return;
|
1023
|
-
}
|
1024
|
-
updatedState[key] = value.result;
|
1025
|
-
});
|
1026
|
-
this.stateSubj$.next(updatedState);
|
1027
|
-
}), map$2(() => undefined));
|
1028
|
-
}
|
1029
|
-
executeActionScript(request, processor) {
|
1030
|
-
const { actions } = this.runtimeService.runtimeContext?.uiDefinitionContainer ?? {};
|
1031
|
-
const script = actions?.find(action => action.apiName === processor.name)?.script;
|
1032
|
-
if (!script) {
|
1033
|
-
return null;
|
1034
|
-
}
|
1035
|
-
return this.executeProcessorScript(request, script, processor.inputData);
|
1036
|
-
}
|
1037
|
-
executeSelectorScript(request, processor) {
|
1038
|
-
const { selectors } = this.runtimeService.runtimeContext?.uiDefinitionContainer ?? {};
|
1039
|
-
const script = selectors?.find(selector => selector.apiName === processor.name)?.script;
|
1040
|
-
if (!script) {
|
1041
|
-
return null;
|
1042
|
-
}
|
1043
|
-
return this.executeProcessorScript(request, script, processor.inputData);
|
1044
|
-
}
|
1045
|
-
executeProcessorScript(request, script, inputData) {
|
1046
|
-
return new Function(`${script}\nreturn transform;`)()({
|
1047
|
-
request,
|
1048
|
-
inputData: inputData,
|
1049
|
-
});
|
1050
|
-
}
|
1051
|
-
}
|
1052
|
-
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 });
|
1053
|
-
ConfigurationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationState });
|
1054
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationState, decorators: [{
|
920
|
+
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i5.MessageService }, { token: i6.DialogService }, { token: RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
921
|
+
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService });
|
922
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, decorators: [{
|
1055
923
|
type: Injectable
|
1056
|
-
}], ctorParameters: function () { return [{ type:
|
924
|
+
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6.DialogService }, { type: RuntimeSettingsService }]; } });
|
1057
925
|
|
1058
926
|
function extractMetadata(uiDefinition) {
|
1059
927
|
return omit(uiDefinition, [
|
@@ -1135,6 +1003,7 @@ class FlowUpdateService {
|
|
1135
1003
|
}
|
1136
1004
|
break;
|
1137
1005
|
case 'LIST_PRICE_ADJUSTMENT':
|
1006
|
+
case 'MARGIN_ADJUSTMENT':
|
1138
1007
|
{
|
1139
1008
|
const charge = lineItem.chargeItems.find(charge => (charges || {})[charge.chargeId]?.main);
|
1140
1009
|
if (charge) {
|
@@ -1142,19 +1011,11 @@ class FlowUpdateService {
|
|
1142
1011
|
}
|
1143
1012
|
}
|
1144
1013
|
break;
|
1145
|
-
case '
|
1014
|
+
case 'COST_ADJUSTMENT':
|
1146
1015
|
{
|
1147
1016
|
const charge = lineItem.chargeItems.find(charge => (charges || {})[charge.chargeId]?.main);
|
1148
1017
|
if (charge) {
|
1149
|
-
charge.
|
1150
|
-
}
|
1151
|
-
}
|
1152
|
-
break;
|
1153
|
-
case 'MARGIN_PERCENT':
|
1154
|
-
{
|
1155
|
-
const charge = lineItem.chargeItems.find(charge => (charges || {})[charge.chargeId]?.main);
|
1156
|
-
if (charge) {
|
1157
|
-
charge.marginPercent = update.newValue;
|
1018
|
+
charge.costAdjustment = update.newValue;
|
1158
1019
|
}
|
1159
1020
|
}
|
1160
1021
|
break;
|
@@ -1196,9 +1057,9 @@ class FlowUpdateService {
|
|
1196
1057
|
return true;
|
1197
1058
|
}
|
1198
1059
|
}
|
1199
|
-
FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1200
|
-
FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
1201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1060
|
+
FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1061
|
+
FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService });
|
1062
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService, decorators: [{
|
1202
1063
|
type: Injectable
|
1203
1064
|
}] });
|
1204
1065
|
|
@@ -1331,63 +1192,21 @@ class FlowConfigurationService {
|
|
1331
1192
|
};
|
1332
1193
|
}
|
1333
1194
|
}
|
1334
|
-
FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1335
|
-
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
1336
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1195
|
+
FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1196
|
+
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
|
1197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
|
1337
1198
|
type: Injectable
|
1338
1199
|
}], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
|
1339
1200
|
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
|
1350
|
-
}]
|
1351
|
-
}] });
|
1352
|
-
|
1353
|
-
class ConfigurationModule {
|
1354
|
-
}
|
1355
|
-
ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1356
|
-
ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
|
1357
|
-
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, providers: [
|
1358
|
-
ContextApiService,
|
1359
|
-
ProductModelApiService,
|
1360
|
-
ConfigurationApiService,
|
1361
|
-
ConfigurationRuntimeService,
|
1362
|
-
RuntimeContextService,
|
1363
|
-
ConfigurationService,
|
1364
|
-
ConfigurationState,
|
1365
|
-
], imports: [ConfirmationDialogModule] });
|
1366
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, decorators: [{
|
1367
|
-
type: NgModule,
|
1368
|
-
args: [{
|
1369
|
-
imports: [ConfirmationDialogModule],
|
1370
|
-
providers: [
|
1371
|
-
ContextApiService,
|
1372
|
-
ProductModelApiService,
|
1373
|
-
ConfigurationApiService,
|
1374
|
-
ConfigurationRuntimeService,
|
1375
|
-
RuntimeContextService,
|
1376
|
-
ConfigurationService,
|
1377
|
-
ConfigurationState,
|
1378
|
-
],
|
1379
|
-
}]
|
1380
|
-
}] });
|
1381
|
-
|
1382
|
-
function calculateMetricByMethod(lineItems, metric, method) {
|
1383
|
-
const items = getLineItemsByMethod(lineItems, method);
|
1384
|
-
return items.reduce((acc, li) => {
|
1385
|
-
let value = li.reduce((accProduct, item) => accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0), 0);
|
1386
|
-
if (method === 'avg' && li.length > 0) {
|
1387
|
-
value /= li.length;
|
1388
|
-
}
|
1389
|
-
return acc + value;
|
1390
|
-
}, 0);
|
1201
|
+
function calculateMetricByMethod(lineItems, metric, method) {
|
1202
|
+
const items = getLineItemsByMethod(lineItems, method);
|
1203
|
+
return items.reduce((acc, li) => {
|
1204
|
+
let value = li.reduce((accProduct, item) => accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0), 0);
|
1205
|
+
if (method === 'avg' && li.length > 0) {
|
1206
|
+
value /= li.length;
|
1207
|
+
}
|
1208
|
+
return acc + value;
|
1209
|
+
}, 0);
|
1391
1210
|
}
|
1392
1211
|
function getLineItemsByMethod(lineItems, method) {
|
1393
1212
|
switch (method) {
|
@@ -1488,9 +1307,9 @@ class MetricsCalculationService {
|
|
1488
1307
|
return this.activeMetricRules.find(metricRule => metricRule.metrics.find(metric => metric.totalName === name));
|
1489
1308
|
}
|
1490
1309
|
}
|
1491
|
-
MetricsCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1492
|
-
MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
1493
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1310
|
+
MetricsCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: FlowConfigurationService }, { token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1311
|
+
MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, providedIn: 'root' });
|
1312
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, decorators: [{
|
1494
1313
|
type: Injectable,
|
1495
1314
|
args: [{ providedIn: 'root' }]
|
1496
1315
|
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: FlowConfigurationService }, { type: i1.ConfigurationSettingsApiService }]; } });
|
@@ -1514,101 +1333,319 @@ class ProductImagesService {
|
|
1514
1333
|
.subscribe();
|
1515
1334
|
}
|
1516
1335
|
}
|
1517
|
-
ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1518
|
-
ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.
|
1519
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1336
|
+
ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1337
|
+
ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, providedIn: 'root' });
|
1338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, decorators: [{
|
1520
1339
|
type: Injectable,
|
1521
1340
|
args: [{ providedIn: 'root' }]
|
1522
1341
|
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
1523
1342
|
|
1524
|
-
class
|
1525
|
-
constructor(
|
1526
|
-
this.
|
1527
|
-
this.configurationSettings$ = new BehaviorSubject({});
|
1528
|
-
this.currencySettings$ = new BehaviorSubject({
|
1529
|
-
iso: DEFAULT_CURRENCY_ISO_CODE,
|
1530
|
-
symbol: DEFAULT_CURRENCY_SYMBOL,
|
1531
|
-
});
|
1532
|
-
this.getCurrencySymbol = (locale, currency) => {
|
1533
|
-
return (0)
|
1534
|
-
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
1535
|
-
.replace(/\d/g, '')
|
1536
|
-
.trim();
|
1537
|
-
};
|
1343
|
+
class RuntimeContextService {
|
1344
|
+
constructor(configurationApiService) {
|
1345
|
+
this.configurationApiService = configurationApiService;
|
1538
1346
|
}
|
1539
|
-
|
1540
|
-
return this.
|
1541
|
-
this.
|
1542
|
-
|
1543
|
-
|
1347
|
+
getRuntimeContext(productId, offeringId) {
|
1348
|
+
return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
|
1349
|
+
const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
|
1350
|
+
const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
|
1351
|
+
const { productName, properties } = Array.from(runtimeModel.components.values()).find(c => c.productId === productId) ?? {};
|
1352
|
+
const uiDefinitionProperties = uiDefinitionContainer?.source.properties;
|
1353
|
+
return {
|
1354
|
+
modelId: runtimeData.modelId,
|
1355
|
+
uiDefinitionContainer: uiDefinitionContainer,
|
1356
|
+
runtimeModel: runtimeModel,
|
1357
|
+
runtimeMode: RuntimeMode.PROD,
|
1358
|
+
productId: productId,
|
1359
|
+
productType: properties?.['displayName'] || productName,
|
1360
|
+
offeringId: offeringId,
|
1361
|
+
properties: {
|
1362
|
+
PricingEnabled: uiDefinitionProperties?.pricingEnabled ? 'true' : 'false',
|
1363
|
+
PriceListId: uiDefinitionProperties?.priceList,
|
1364
|
+
},
|
1365
|
+
};
|
1366
|
+
}));
|
1544
1367
|
}
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1368
|
+
getUIDefinitionContainer(runtimeData) {
|
1369
|
+
const containers = runtimeData.uiDefinitions.filter(container => isNotLegacyUIDefinition(container.source));
|
1370
|
+
return containers.find(container => container.source.primary) ?? containers[0];
|
1371
|
+
}
|
1372
|
+
}
|
1373
|
+
RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1374
|
+
RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService });
|
1375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService, decorators: [{
|
1376
|
+
type: Injectable
|
1377
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
|
1378
|
+
|
1379
|
+
class ConfigurationRuntimeService {
|
1380
|
+
constructor(apiService, contextService, runtimeContextService) {
|
1381
|
+
this.apiService = apiService;
|
1382
|
+
this.contextService = contextService;
|
1383
|
+
this.runtimeContextService = runtimeContextService;
|
1384
|
+
this._isInitialized = false;
|
1385
|
+
this.uiDefinitionProperties = {};
|
1386
|
+
}
|
1387
|
+
reset() {
|
1388
|
+
this._isInitialized = false;
|
1389
|
+
this._runtimeContext = undefined;
|
1390
|
+
this.initializationProps = undefined;
|
1391
|
+
this.uiDefinitionProperties = {};
|
1392
|
+
}
|
1393
|
+
initTestMode(uiDefinitionContainer) {
|
1394
|
+
this.uiDefinitionProperties = uiDefinitionContainer.source.properties ?? {};
|
1395
|
+
const uiDefinitionExternals = uiDefinitionContainer.source.externals ?? {};
|
1396
|
+
return combineLatest([
|
1397
|
+
this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
|
1398
|
+
this.contextService.initTestMode(),
|
1399
|
+
]).pipe(first(), map(([runtimeData, context]) => {
|
1400
|
+
this.contextService.update({
|
1401
|
+
properties: {
|
1402
|
+
...this.runtimeContext?.properties,
|
1403
|
+
...context.properties,
|
1404
|
+
ModelId: uiDefinitionContainer.modelId,
|
1405
|
+
PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
|
1406
|
+
PriceListId: this.uiDefinitionProperties.priceList,
|
1407
|
+
offeringId: this.uiDefinitionProperties.offeringId,
|
1408
|
+
...uiDefinitionExternals,
|
1409
|
+
},
|
1410
|
+
});
|
1411
|
+
this._runtimeContext = {
|
1412
|
+
modelId: uiDefinitionContainer.modelId,
|
1413
|
+
runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
|
1414
|
+
runtimeMode: RuntimeMode.TEST,
|
1415
|
+
uiDefinitionContainer,
|
1416
|
+
};
|
1417
|
+
return this._runtimeContext;
|
1418
|
+
}), tap(() => (this._isInitialized = true)));
|
1419
|
+
}
|
1420
|
+
init(props) {
|
1421
|
+
this.initializationProps = props;
|
1422
|
+
const context = this.contextService.resolve();
|
1423
|
+
return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
|
1424
|
+
this.uiDefinitionProperties = runtimeContext.uiDefinitionContainer?.source.properties ?? {};
|
1425
|
+
const { PriceListId } = context.properties ?? {};
|
1426
|
+
const mergeContext = {
|
1427
|
+
...runtimeContext,
|
1428
|
+
properties: {
|
1429
|
+
...runtimeContext.properties,
|
1430
|
+
...context.properties,
|
1431
|
+
PricingEnabled: PriceListId ? 'true' : 'false',
|
1432
|
+
},
|
1433
|
+
};
|
1434
|
+
this.id15to18('AccountId', mergeContext.properties);
|
1435
|
+
this._runtimeContext = mergeContext;
|
1436
|
+
if (context.properties && this._runtimeContext.properties?.StartDate) {
|
1437
|
+
this.contextService.update({
|
1438
|
+
properties: {
|
1439
|
+
...this._runtimeContext.properties,
|
1440
|
+
...context.properties,
|
1441
|
+
},
|
1442
|
+
});
|
1443
|
+
}
|
1444
|
+
return this._runtimeContext;
|
1445
|
+
}), tap(() => (this._isInitialized = true)));
|
1446
|
+
}
|
1447
|
+
overrideUIDefinition(uiDefinitionContainer) {
|
1448
|
+
if (!this._runtimeContext) {
|
1449
|
+
return;
|
1549
1450
|
}
|
1451
|
+
this._runtimeContext.uiDefinitionContainer = uiDefinitionContainer;
|
1452
|
+
this.uiDefinitionProperties = uiDefinitionContainer.source.properties ?? {};
|
1550
1453
|
}
|
1551
|
-
|
1552
|
-
if (
|
1553
|
-
return
|
1454
|
+
id15to18(propertyName, source) {
|
1455
|
+
if (!source) {
|
1456
|
+
return;
|
1457
|
+
}
|
1458
|
+
const value = source[propertyName];
|
1459
|
+
if (typeof value === 'string' && value.length === 15) {
|
1460
|
+
source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
|
1554
1461
|
}
|
1555
|
-
const shoppingCartSettings = this.getConfigurationSettings()['shopping-cart']?.reduce((acc, setting) => {
|
1556
|
-
return { ...acc, [setting.id]: setting.properties };
|
1557
|
-
}, {});
|
1558
|
-
const currencySettings = this.getCurrencySettings();
|
1559
|
-
const dateFormat = (validateDateFormat(shoppingCartSettings?.DATE_FORMAT ?? '') && shoppingCartSettings?.DATE_FORMAT) ||
|
1560
|
-
DEFAULT_DATE_FORMAT;
|
1561
|
-
const decimalSeparator = shoppingCartSettings?.DECIMAL_SEPARATOR;
|
1562
|
-
const thousandsSeparator = shoppingCartSettings?.THOUSANDS_SEPARATOR;
|
1563
|
-
// the number of decimal places can be 0
|
1564
|
-
const priceScale = shoppingCartSettings?.PRICE_SCALE;
|
1565
|
-
const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
|
1566
|
-
? Number(priceScale)
|
1567
|
-
: DEFAULT_DECIMALS_COUNT;
|
1568
|
-
return {
|
1569
|
-
currencySymbol: currencySettings.symbol,
|
1570
|
-
dateFormats: getSupportedDateFormats(dateFormat),
|
1571
|
-
decimalsCount,
|
1572
|
-
decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
|
1573
|
-
? decimalSeparator
|
1574
|
-
: DEFAULT_DECIMAL_SEPARATOR,
|
1575
|
-
// thousands separator can be a blank value, so it can also be null
|
1576
|
-
thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
|
1577
|
-
? thousandsSeparator || ''
|
1578
|
-
: DEFAULT_THOUSANDS_SEPARATOR,
|
1579
|
-
};
|
1580
1462
|
}
|
1581
|
-
|
1582
|
-
return this.
|
1463
|
+
get isInitialized() {
|
1464
|
+
return this._isInitialized;
|
1583
1465
|
}
|
1584
|
-
|
1585
|
-
return this.
|
1466
|
+
get runtimeModel() {
|
1467
|
+
return this.runtimeContext?.runtimeModel;
|
1586
1468
|
}
|
1587
|
-
|
1588
|
-
return
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1469
|
+
get runtimeContext() {
|
1470
|
+
return this._runtimeContext;
|
1471
|
+
}
|
1472
|
+
}
|
1473
|
+
ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1474
|
+
ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService });
|
1475
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
|
1476
|
+
type: Injectable
|
1477
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
|
1478
|
+
|
1479
|
+
class ConfigurationState {
|
1480
|
+
constructor(statefulConfigurationApiService, runtimeService, configurationService, toastService) {
|
1481
|
+
this.statefulConfigurationApiService = statefulConfigurationApiService;
|
1482
|
+
this.runtimeService = runtimeService;
|
1483
|
+
this.configurationService = configurationService;
|
1484
|
+
this.toastService = toastService;
|
1485
|
+
this.stateSubj$ = new BehaviorSubject({});
|
1486
|
+
this.state$ = this.stateSubj$.asObservable();
|
1487
|
+
this.stateId = null;
|
1488
|
+
}
|
1489
|
+
init$() {
|
1490
|
+
return this.configurationService.configure().pipe(switchMap$1(() => {
|
1491
|
+
if (!this.isStatefulConfiguration) {
|
1492
|
+
return of(undefined);
|
1601
1493
|
}
|
1602
|
-
|
1603
|
-
|
1494
|
+
const { actions, selectors } = this.runtimeService.runtimeContext?.uiDefinitionContainer ?? {};
|
1495
|
+
return this.statefulConfigurationApiService.init({
|
1496
|
+
request: this.configurationService.generateRequest(),
|
1497
|
+
actions: actions?.map(action => ({ name: action.apiName, script: action.script })),
|
1498
|
+
selectors: selectors?.map(selector => ({ name: selector.apiName, script: selector.script })),
|
1499
|
+
});
|
1500
|
+
}), tap$1(stateId => (this.stateId = stateId || null)), map$2(() => undefined));
|
1501
|
+
}
|
1502
|
+
cleanup() {
|
1503
|
+
this.stateId = null;
|
1504
|
+
this.configurationService.reset();
|
1505
|
+
this.stateSubj$.next({});
|
1506
|
+
}
|
1507
|
+
execute$(req) {
|
1508
|
+
if (this.isStatefulConfiguration) {
|
1509
|
+
return this.executeStateful$(req);
|
1510
|
+
}
|
1511
|
+
else {
|
1512
|
+
return this.executeStateless$(req);
|
1513
|
+
}
|
1514
|
+
}
|
1515
|
+
dispatch$(actionName, inputData) {
|
1516
|
+
return this.execute$({ actions: [{ name: actionName, inputData }] });
|
1517
|
+
}
|
1518
|
+
select$(selectorName, inputData) {
|
1519
|
+
const requestId = UUID.UUID();
|
1520
|
+
return this.execute$({
|
1521
|
+
selectors: {
|
1522
|
+
[requestId]: {
|
1523
|
+
name: selectorName,
|
1524
|
+
inputData,
|
1525
|
+
},
|
1526
|
+
},
|
1527
|
+
}).pipe(map$2(() => this.stateSubj$.value[requestId]), tap$1(() => this.stateSubj$.next(omit(this.stateSubj$.value, requestId))));
|
1528
|
+
}
|
1529
|
+
get isStatefulConfiguration() {
|
1530
|
+
return this.runtimeService.uiDefinitionProperties.statefulConfigurationEnabled ?? false;
|
1531
|
+
}
|
1532
|
+
executeStateless$(request) {
|
1533
|
+
return of(undefined).pipe(switchMap$1(() => {
|
1534
|
+
// Apply actions and execute configuration/price call
|
1535
|
+
// No need to run configuration if no actions in the request
|
1536
|
+
if (!request.actions?.length) {
|
1537
|
+
return of(undefined);
|
1538
|
+
}
|
1539
|
+
let configurationRequest = this.configurationService.generateRequest();
|
1540
|
+
request.actions.forEach(action => {
|
1541
|
+
configurationRequest = this.executeActionScript(configurationRequest, action) ?? configurationRequest;
|
1542
|
+
});
|
1543
|
+
return this.configurationService.configureRequest$(configurationRequest);
|
1544
|
+
}), tap$1(() => {
|
1545
|
+
if (!request.selectors) {
|
1546
|
+
return;
|
1547
|
+
}
|
1548
|
+
// Run selectors and apply them to the state
|
1549
|
+
const finalConfigurationRequest = this.configurationService.generateRequest();
|
1550
|
+
const selectorsResult = EntityUtil.entries(request.selectors).reduce((trunk, [key, selector]) => {
|
1551
|
+
trunk[key] = this.executeSelectorScript(finalConfigurationRequest, selector);
|
1552
|
+
return trunk;
|
1553
|
+
}, {});
|
1554
|
+
this.stateSubj$.next({
|
1555
|
+
...this.stateSubj$.value,
|
1556
|
+
...selectorsResult,
|
1557
|
+
});
|
1558
|
+
}), map$2(() => undefined));
|
1559
|
+
}
|
1560
|
+
executeStateful$(request) {
|
1561
|
+
if (!this.stateId) {
|
1562
|
+
return of(undefined);
|
1563
|
+
}
|
1564
|
+
return this.statefulConfigurationApiService.execute(this.stateId, request).pipe(tap$1(response => {
|
1565
|
+
this.stateId = response.stateId;
|
1566
|
+
const updatedState = this.stateSubj$.value;
|
1567
|
+
EntityUtil.entries(response.selectors).forEach(([key, value]) => {
|
1568
|
+
if (!value.success) {
|
1569
|
+
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
1570
|
+
this.toastService.add({ summary: value.errorMessage, severity: ToastType.error });
|
1571
|
+
}
|
1572
|
+
return;
|
1573
|
+
}
|
1574
|
+
updatedState[key] = value.result;
|
1575
|
+
});
|
1576
|
+
this.stateSubj$.next(updatedState);
|
1577
|
+
}), map$2(() => undefined));
|
1578
|
+
}
|
1579
|
+
executeActionScript(request, processor) {
|
1580
|
+
const { actions } = this.runtimeService.runtimeContext?.uiDefinitionContainer ?? {};
|
1581
|
+
const script = actions?.find(action => action.apiName === processor.name)?.script;
|
1582
|
+
if (!script) {
|
1583
|
+
return null;
|
1584
|
+
}
|
1585
|
+
return this.executeProcessorScript(request, script, processor.inputData);
|
1586
|
+
}
|
1587
|
+
executeSelectorScript(request, processor) {
|
1588
|
+
const { selectors } = this.runtimeService.runtimeContext?.uiDefinitionContainer ?? {};
|
1589
|
+
const script = selectors?.find(selector => selector.apiName === processor.name)?.script;
|
1590
|
+
if (!script) {
|
1591
|
+
return null;
|
1592
|
+
}
|
1593
|
+
return this.executeProcessorScript(request, script, processor.inputData);
|
1594
|
+
}
|
1595
|
+
executeProcessorScript(request, script, inputData) {
|
1596
|
+
return new Function(`${script}\nreturn transform;`)()({
|
1597
|
+
request,
|
1598
|
+
inputData: inputData,
|
1599
|
+
});
|
1604
1600
|
}
|
1605
1601
|
}
|
1606
|
-
|
1607
|
-
|
1608
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1609
|
-
type: Injectable
|
1610
|
-
|
1611
|
-
|
1602
|
+
ConfigurationState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationState, deps: [{ token: i1.StatefulConfigurationApiService }, { token: ConfigurationRuntimeService }, { token: ConfigurationService }, { token: i4.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1603
|
+
ConfigurationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationState });
|
1604
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationState, decorators: [{
|
1605
|
+
type: Injectable
|
1606
|
+
}], ctorParameters: function () { return [{ type: i1.StatefulConfigurationApiService }, { type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type: i4.ToastService }]; } });
|
1607
|
+
|
1608
|
+
class FlowConfigurationModule {
|
1609
|
+
}
|
1610
|
+
FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1611
|
+
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule });
|
1612
|
+
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService] });
|
1613
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, decorators: [{
|
1614
|
+
type: NgModule,
|
1615
|
+
args: [{
|
1616
|
+
imports: [],
|
1617
|
+
providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
|
1618
|
+
}]
|
1619
|
+
}] });
|
1620
|
+
|
1621
|
+
class ConfigurationModule {
|
1622
|
+
}
|
1623
|
+
ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1624
|
+
ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
|
1625
|
+
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [
|
1626
|
+
ContextApiService,
|
1627
|
+
ProductModelApiService,
|
1628
|
+
ConfigurationApiService,
|
1629
|
+
ConfigurationRuntimeService,
|
1630
|
+
RuntimeContextService,
|
1631
|
+
ConfigurationService,
|
1632
|
+
ConfigurationState,
|
1633
|
+
], imports: [ConfirmationDialogModule] });
|
1634
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, decorators: [{
|
1635
|
+
type: NgModule,
|
1636
|
+
args: [{
|
1637
|
+
imports: [ConfirmationDialogModule],
|
1638
|
+
providers: [
|
1639
|
+
ContextApiService,
|
1640
|
+
ProductModelApiService,
|
1641
|
+
ConfigurationApiService,
|
1642
|
+
ConfigurationRuntimeService,
|
1643
|
+
RuntimeContextService,
|
1644
|
+
ConfigurationService,
|
1645
|
+
ConfigurationState,
|
1646
|
+
],
|
1647
|
+
}]
|
1648
|
+
}] });
|
1612
1649
|
|
1613
1650
|
const DEFAULT_FORMATTING_SETTINGS = {
|
1614
1651
|
currencySymbol: DEFAULT_CURRENCY_SYMBOL,
|
@@ -1616,32 +1653,23 @@ const DEFAULT_FORMATTING_SETTINGS = {
|
|
1616
1653
|
dateFormats: getSupportedDateFormats(DEFAULT_DATE_FORMAT),
|
1617
1654
|
decimalSeparator: DEFAULT_DECIMAL_SEPARATOR,
|
1618
1655
|
thousandsSeparator: DEFAULT_THOUSANDS_SEPARATOR,
|
1656
|
+
actionCodeLabels: DEFAULT_ACTION_CODE_LABELS,
|
1619
1657
|
};
|
1620
1658
|
class SdkCoreModule {
|
1621
1659
|
}
|
1622
|
-
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1623
|
-
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.
|
1624
|
-
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.
|
1625
|
-
ContextService,
|
1626
|
-
QuoteDraftService,
|
1627
|
-
ProductImagesService,
|
1628
|
-
MetricsCalculationService,
|
1629
|
-
RuntimeSettingsService,
|
1660
|
+
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1661
|
+
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
1662
|
+
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, providers: [
|
1630
1663
|
{
|
1631
1664
|
provide: FORMATTING_SETTINGS_TOKEN,
|
1632
1665
|
useExisting: RuntimeSettingsService,
|
1633
1666
|
},
|
1634
1667
|
], imports: [ConfigurationModule, FlowConfigurationModule] });
|
1635
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, decorators: [{
|
1636
1669
|
type: NgModule,
|
1637
1670
|
args: [{
|
1638
1671
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
1639
1672
|
providers: [
|
1640
|
-
ContextService,
|
1641
|
-
QuoteDraftService,
|
1642
|
-
ProductImagesService,
|
1643
|
-
MetricsCalculationService,
|
1644
|
-
RuntimeSettingsService,
|
1645
1673
|
{
|
1646
1674
|
provide: FORMATTING_SETTINGS_TOKEN,
|
1647
1675
|
useExisting: RuntimeSettingsService,
|
@@ -1673,9 +1701,9 @@ class CalendarDirective {
|
|
1673
1701
|
}
|
1674
1702
|
}
|
1675
1703
|
}
|
1676
|
-
CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1677
|
-
CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
1678
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1704
|
+
CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
1705
|
+
CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: CalendarDirective, selector: "[vlCalendar]", inputs: { vlCalendar: "vlCalendar" }, ngImport: i0 });
|
1706
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CalendarDirective, decorators: [{
|
1679
1707
|
type: Directive,
|
1680
1708
|
args: [{
|
1681
1709
|
selector: '[vlCalendar]',
|
@@ -1686,10 +1714,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
1686
1714
|
|
1687
1715
|
class SdkDirectivesModule {
|
1688
1716
|
}
|
1689
|
-
SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1690
|
-
SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.
|
1691
|
-
SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.
|
1692
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1717
|
+
SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1718
|
+
SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule, declarations: [CalendarDirective], exports: [CalendarDirective] });
|
1719
|
+
SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule });
|
1720
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkDirectivesModule, decorators: [{
|
1693
1721
|
type: NgModule,
|
1694
1722
|
args: [{
|
1695
1723
|
declarations: [CalendarDirective],
|
@@ -1708,21 +1736,27 @@ class DatePipe {
|
|
1708
1736
|
this.destroy$.next();
|
1709
1737
|
this.destroy$.complete();
|
1710
1738
|
}
|
1711
|
-
transform(date) {
|
1739
|
+
transform(date, type = 'date') {
|
1712
1740
|
if (!date) {
|
1713
1741
|
return '';
|
1714
1742
|
}
|
1743
|
+
const dateFormat = this.formattingSettings?.dateFormats.datePipeFormat || DEFAULT_DATE_FORMAT;
|
1744
|
+
const formatMap = {
|
1745
|
+
date: dateFormat,
|
1746
|
+
time: DEFAULT_TIME_FORMAT,
|
1747
|
+
datetime: `${dateFormat} ${DEFAULT_TIME_FORMAT}`,
|
1748
|
+
};
|
1715
1749
|
try {
|
1716
|
-
return formatDate(date,
|
1750
|
+
return formatDate(date, formatMap[type], this.locale, this.defaultOptions?.timezone);
|
1717
1751
|
}
|
1718
1752
|
catch (error) {
|
1719
1753
|
return new Date(date).toString();
|
1720
1754
|
}
|
1721
1755
|
}
|
1722
1756
|
}
|
1723
|
-
DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1724
|
-
DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.
|
1725
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1757
|
+
DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
1758
|
+
DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DatePipe, name: "vlDate" });
|
1759
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DatePipe, decorators: [{
|
1726
1760
|
type: Pipe,
|
1727
1761
|
args: [{
|
1728
1762
|
name: 'vlDate',
|
@@ -1742,9 +1776,9 @@ class NumberPipe {
|
|
1742
1776
|
return formatNumber(price, this.formattingSettings?.thousandsSeparator, this.formattingSettings?.decimalSeparator, this.formattingSettings?.decimalsCount);
|
1743
1777
|
}
|
1744
1778
|
}
|
1745
|
-
NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1746
|
-
NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.
|
1747
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1779
|
+
NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
1780
|
+
NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NumberPipe, name: "vlNumber" });
|
1781
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NumberPipe, decorators: [{
|
1748
1782
|
type: Pipe,
|
1749
1783
|
args: [{
|
1750
1784
|
name: 'vlNumber',
|
@@ -1767,25 +1801,42 @@ class PricePipe {
|
|
1767
1801
|
return `${this.formattingSettings?.currencySymbol || DEFAULT_CURRENCY_SYMBOL}${formatNumber(price, this.formattingSettings?.thousandsSeparator, this.formattingSettings?.decimalSeparator, this.formattingSettings?.decimalsCount)}`;
|
1768
1802
|
}
|
1769
1803
|
}
|
1770
|
-
PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1771
|
-
PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.
|
1772
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1804
|
+
PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PricePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
1805
|
+
PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: PricePipe, name: "vlPrice" });
|
1806
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PricePipe, decorators: [{
|
1773
1807
|
type: Pipe,
|
1774
1808
|
args: [{
|
1775
1809
|
name: 'vlPrice',
|
1776
1810
|
}]
|
1777
1811
|
}] });
|
1778
1812
|
|
1813
|
+
class ActionCodePipe {
|
1814
|
+
constructor() {
|
1815
|
+
this.formattingSettings = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })?.getFormattingSettings();
|
1816
|
+
}
|
1817
|
+
transform(actionCode) {
|
1818
|
+
return this.formattingSettings?.actionCodeLabels[actionCode] ?? actionCode;
|
1819
|
+
}
|
1820
|
+
}
|
1821
|
+
ActionCodePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ActionCodePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
1822
|
+
ActionCodePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ActionCodePipe, name: "vlActionCode" });
|
1823
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ActionCodePipe, decorators: [{
|
1824
|
+
type: Pipe,
|
1825
|
+
args: [{
|
1826
|
+
name: 'vlActionCode',
|
1827
|
+
}]
|
1828
|
+
}] });
|
1829
|
+
|
1779
1830
|
class SdkPipesModule {
|
1780
1831
|
}
|
1781
|
-
SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
1782
|
-
SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.
|
1783
|
-
SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.
|
1784
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
1832
|
+
SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1833
|
+
SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule, declarations: [NumberPipe, PricePipe, DatePipe, ActionCodePipe], exports: [NumberPipe, PricePipe, DatePipe, ActionCodePipe] });
|
1834
|
+
SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule });
|
1835
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkPipesModule, decorators: [{
|
1785
1836
|
type: NgModule,
|
1786
1837
|
args: [{
|
1787
|
-
declarations: [NumberPipe, PricePipe, DatePipe],
|
1788
|
-
exports: [NumberPipe, PricePipe, DatePipe],
|
1838
|
+
declarations: [NumberPipe, PricePipe, DatePipe, ActionCodePipe],
|
1839
|
+
exports: [NumberPipe, PricePipe, DatePipe, ActionCodePipe],
|
1789
1840
|
}]
|
1790
1841
|
}] });
|
1791
1842
|
|
@@ -1793,5 +1844,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
1793
1844
|
* Generated bundle index. Do not edit.
|
1794
1845
|
*/
|
1795
1846
|
|
1796
|
-
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 };
|
1847
|
+
export { ActionCodePipe, 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 };
|
1797
1848
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|