@veloceapps/sdk 7.0.2-71 → 7.0.2-73
Sign up to get free protection for your applications and to get access to all the features.
- package/cms/components/preview/preview.component.d.ts +6 -9
- package/cms/components/preview/preview.types.d.ts +5 -0
- package/cms/services/resources.service.d.ts +9 -0
- package/cms/vendor-map.d.ts +2 -1
- package/core/modules/configuration/index.d.ts +1 -0
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +4 -3
- package/core/modules/configuration/services/configuration.service.d.ts +6 -4
- package/core/modules/configuration/services/configuration.state.d.ts +30 -0
- package/core/modules/configuration/services/runtime-context.service.d.ts +1 -1
- package/core/types/runtime.types.d.ts +2 -2
- package/esm2020/cms/components/preview/preview.component.mjs +17 -37
- package/esm2020/cms/components/preview/preview.types.mjs +1 -1
- package/esm2020/cms/services/resources.service.mjs +19 -1
- package/esm2020/cms/vendor-map.mjs +3 -2
- package/esm2020/core/modules/configuration/configuration.module.mjs +4 -1
- package/esm2020/core/modules/configuration/index.mjs +2 -1
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +27 -19
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +41 -29
- package/esm2020/core/modules/configuration/services/configuration.state.mjs +142 -0
- package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +10 -11
- package/esm2020/core/services/quote-draft.service.mjs +1 -1
- package/esm2020/core/types/runtime.types.mjs +1 -1
- package/esm2020/src/components/doc-gen/doc-gen.component.mjs +1 -1
- package/esm2020/src/components/guided-selling/guided-selling.component.mjs +1 -1
- package/esm2020/src/pages/assets/assets.component.mjs +1 -1
- package/esm2020/src/pages/catalog/catalog.component.mjs +1 -1
- package/esm2020/src/pages/legacy-product/legacy-product.component.mjs +4 -4
- package/esm2020/src/pages/product/product.component.mjs +50 -66
- package/esm2020/src/pages/remote/remote.component.mjs +19 -19
- package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +1 -1
- package/esm2020/src/types/flow-customization.types.mjs +1 -1
- package/fesm2015/veloceapps-sdk-cms.mjs +44 -43
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +214 -59
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +67 -80
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +42 -43
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +206 -55
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +64 -76
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/pages/product/product.component.d.ts +10 -21
- package/src/pages/remote/remote.component.d.ts +3 -4
- package/src/types/flow-customization.types.d.ts +3 -3
@@ -1,12 +1,13 @@
|
|
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, RuntimeModel, isLegacyUIDefinition, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, getSupportedDateFormats, DEFAULT_DECIMALS_COUNT, parseJsonSafely, formatNumber } from '@veloceapps/core';
|
3
|
+
import { UUID, ConfigurationContextMode, ConfigurationContext, RuntimeModel, getUIDefinitionProperties, isLegacyUIDefinition, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, EntityUtil, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_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
|
-
import { BehaviorSubject, combineLatest, zip, noop, throwError, shareReplay as shareReplay$1,
|
6
|
+
import { BehaviorSubject, combineLatest, zip, noop, throwError, shareReplay as shareReplay$1, switchMap as switchMap$1, of, tap as tap$1, map as map$2, catchError as catchError$1, Subject, take as take$1, distinctUntilChanged } from 'rxjs';
|
7
7
|
import { filter, tap, map, first, switchMap, skip, take, shareReplay, catchError, finalize } from 'rxjs/operators';
|
8
8
|
import { merge, isEqual, flatten, sortBy, map as map$1, transform, omit, cloneDeep, uniq } from 'lodash';
|
9
9
|
import { HttpErrorResponse } from '@angular/common/http';
|
10
|
+
import * as i4 from '@veloceapps/components';
|
10
11
|
import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
|
11
12
|
import * as i5 from 'primeng/api';
|
12
13
|
import * as i6 from 'primeng/dynamicdialog';
|
@@ -144,29 +145,28 @@ class RuntimeContextService {
|
|
144
145
|
}
|
145
146
|
getRuntimeContext(productId, offeringId) {
|
146
147
|
return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
|
147
|
-
const
|
148
|
+
const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
|
148
149
|
const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
|
149
150
|
const { productName, properties } = Array.from(runtimeModel.components.values()).find(c => c.productId === productId) ?? {};
|
151
|
+
const uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
150
152
|
return {
|
151
153
|
modelId: runtimeData.modelId,
|
152
|
-
|
154
|
+
uiDefinitionContainer: uiDefinitionContainer,
|
153
155
|
runtimeModel: runtimeModel,
|
154
156
|
runtimeMode: RuntimeMode.PROD,
|
155
157
|
productId: productId,
|
156
158
|
productType: properties?.['displayName'] || productName,
|
157
159
|
offeringId: offeringId,
|
158
160
|
properties: {
|
159
|
-
PricingEnabled:
|
160
|
-
PriceListId:
|
161
|
+
PricingEnabled: uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
|
162
|
+
PriceListId: uiDefinitionProperties.priceList,
|
161
163
|
},
|
162
164
|
};
|
163
165
|
}));
|
164
166
|
}
|
165
|
-
|
166
|
-
const
|
167
|
-
|
168
|
-
.filter((uiDefinition) => !isLegacyUIDefinition(uiDefinition));
|
169
|
-
return uiDefinitions.find(uiDef => uiDef.primary) ?? uiDefinitions[0];
|
167
|
+
getUIDefinitionContainer(runtimeData) {
|
168
|
+
const containers = runtimeData.uiDefinitions.filter(container => !isLegacyUIDefinition(container.source));
|
169
|
+
return containers.find(container => container.source.primary) ?? containers[0];
|
170
170
|
}
|
171
171
|
}
|
172
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 });
|
@@ -189,23 +189,18 @@ class ConfigurationRuntimeService {
|
|
189
189
|
this.initializationProps = undefined;
|
190
190
|
this.uiDefinitionProperties = {};
|
191
191
|
}
|
192
|
-
initTestMode(
|
193
|
-
this.uiDefinitionProperties =
|
194
|
-
const uiDefinitionExternals =
|
192
|
+
initTestMode(uiDefinitionContainer) {
|
193
|
+
this.uiDefinitionProperties = getUIDefinitionProperties(uiDefinitionContainer);
|
194
|
+
const uiDefinitionExternals = uiDefinitionContainer.source.externals ?? {};
|
195
195
|
return combineLatest([
|
196
|
-
this.apiService.getRuntimeDataByModelId(modelId),
|
196
|
+
this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
|
197
197
|
this.contextService.create('TestId', ConfigurationContextMode.TEST),
|
198
|
-
]).pipe(first(),
|
199
|
-
this._runtimeContext = {
|
200
|
-
modelId: modelId,
|
201
|
-
runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
|
202
|
-
runtimeMode: RuntimeMode.TEST,
|
203
|
-
};
|
198
|
+
]).pipe(first(), map(([runtimeData, context]) => {
|
204
199
|
this.contextService.update({
|
205
200
|
properties: {
|
206
201
|
...this.runtimeContext?.properties,
|
207
202
|
...context.properties,
|
208
|
-
ModelId: modelId,
|
203
|
+
ModelId: uiDefinitionContainer.modelId,
|
209
204
|
RuntimeMode: ConfigurationContextMode.TEST,
|
210
205
|
PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
|
211
206
|
StartDate: new Date().toISOString().substring(0, 10),
|
@@ -215,14 +210,20 @@ class ConfigurationRuntimeService {
|
|
215
210
|
...uiDefinitionExternals,
|
216
211
|
},
|
217
212
|
});
|
218
|
-
this.
|
219
|
-
|
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)));
|
220
221
|
}
|
221
222
|
init(props) {
|
222
223
|
this.initializationProps = props;
|
223
224
|
const context = this.contextService.resolve();
|
224
225
|
return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
|
225
|
-
this.uiDefinitionProperties = runtimeContext.
|
226
|
+
this.uiDefinitionProperties = getUIDefinitionProperties(runtimeContext.uiDefinitionContainer);
|
226
227
|
const { PriceListId } = context.properties ?? {};
|
227
228
|
const mergeContext = {
|
228
229
|
...runtimeContext,
|
@@ -242,8 +243,15 @@ class ConfigurationRuntimeService {
|
|
242
243
|
},
|
243
244
|
});
|
244
245
|
}
|
245
|
-
this.
|
246
|
-
}));
|
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);
|
247
255
|
}
|
248
256
|
id15to18(propertyName, source) {
|
249
257
|
if (!source) {
|
@@ -773,10 +781,18 @@ class ConfigurationService {
|
|
773
781
|
return this.lineItem.value ? { ...this.lineItem.value } : undefined;
|
774
782
|
}
|
775
783
|
getRuntimeModel() {
|
776
|
-
|
784
|
+
const runtimeModel = this.runtimeService.runtimeModel;
|
785
|
+
if (!runtimeModel) {
|
786
|
+
throw new Error('Runtime model not initialized');
|
787
|
+
}
|
788
|
+
return runtimeModel;
|
777
789
|
}
|
778
790
|
getRuntimeContext() {
|
779
|
-
|
791
|
+
const runtimeContext = this.runtimeService.runtimeContext;
|
792
|
+
if (!runtimeContext) {
|
793
|
+
throw new Error('Runtime context not initialized');
|
794
|
+
}
|
795
|
+
return runtimeContext;
|
780
796
|
}
|
781
797
|
get contextSnapshot() {
|
782
798
|
return this.contextService.resolve();
|
@@ -797,40 +813,26 @@ class ConfigurationService {
|
|
797
813
|
return this.pricePlans.value;
|
798
814
|
}
|
799
815
|
configure() {
|
816
|
+
return this.configureRequest$(this.generateRequest());
|
817
|
+
}
|
818
|
+
configureRequest$(configurationRequest) {
|
800
819
|
const runtimeContext = this.getRuntimeContext();
|
801
820
|
const runtimeModel = this.getRuntimeModel();
|
802
|
-
|
803
|
-
return throwError(() => new Error('Runtime context/model not initialized'));
|
804
|
-
}
|
805
|
-
const uiDefinitionProperties = {
|
806
|
-
...(runtimeContext.uiDefinition?.properties ?? {}),
|
807
|
-
...(this.runtimeService.uiDefinitionProperties ?? {}),
|
808
|
-
};
|
809
|
-
let lineItem = this.configurableRamp;
|
810
|
-
if (!lineItem) {
|
811
|
-
const { initializationProps } = this.runtimeService ?? {};
|
812
|
-
lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps?.defaultQty);
|
813
|
-
// Set default attributes
|
814
|
-
if (initializationProps?.attributesMap) {
|
815
|
-
const attributes = transform(initializationProps?.attributesMap, (acc, value, name) => acc.push({ name, value }), []);
|
816
|
-
lineItem = new LineItemWorker(lineItem).patchAttribute(attributes).li;
|
817
|
-
}
|
818
|
-
}
|
819
|
-
const configurationRequest = this.createRequest(lineItem);
|
821
|
+
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
820
822
|
const mainPricingEnabled = runtimeContext.properties?.PricingEnabled;
|
821
823
|
const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
|
822
|
-
return this.configurationApiService
|
823
|
-
.configureLineItem({ configurationRequest, runtimeModel, pricingEnabled })
|
824
|
-
.pipe(map(({ lineItem, context, charges, pricePlans, deletedLineItems }) => {
|
824
|
+
return this.configurationApiService.configureLineItem({ configurationRequest, runtimeModel, pricingEnabled }).pipe(tap(({ lineItem, context, charges, pricePlans, deletedLineItems }) => {
|
825
825
|
this.contextService.update(context ?? {});
|
826
826
|
this.charges.next(charges ?? {});
|
827
827
|
this.pricePlans.next(pricePlans ?? {});
|
828
|
+
if (lineItem) {
|
829
|
+
this.lineItem.next(lineItem);
|
830
|
+
}
|
828
831
|
if (deletedLineItems?.length) {
|
829
832
|
this.showInactiveProductsConfirmation();
|
830
833
|
}
|
831
|
-
|
832
|
-
}))
|
833
|
-
.pipe(tap(lineItem => lineItem && this.lineItem.next(lineItem)), catchError(error => throwError(() => new Error(error.error?.message || error.message || JSON.stringify(error)))));
|
834
|
+
this.configurableRamp = lineItem;
|
835
|
+
}), map(({ lineItem }) => lineItem), catchError(error => throwError(() => new Error(error.error?.message || error.message || JSON.stringify(error)))));
|
834
836
|
}
|
835
837
|
configureExternal$(props) {
|
836
838
|
return this.runtimeService
|
@@ -852,7 +854,19 @@ class ConfigurationService {
|
|
852
854
|
throw error;
|
853
855
|
}));
|
854
856
|
}
|
855
|
-
|
857
|
+
generateRequest() {
|
858
|
+
const runtimeContext = this.getRuntimeContext();
|
859
|
+
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
860
|
+
let lineItem = this.configurableRamp;
|
861
|
+
if (!lineItem) {
|
862
|
+
const { initializationProps } = this.runtimeService ?? {};
|
863
|
+
lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps?.defaultQty);
|
864
|
+
// Set default attributes
|
865
|
+
if (initializationProps?.attributesMap) {
|
866
|
+
const attributes = transform(initializationProps?.attributesMap, (acc, value, name) => acc.push({ name, value }), []);
|
867
|
+
lineItem = new LineItemWorker(lineItem).patchAttribute(attributes).li;
|
868
|
+
}
|
869
|
+
}
|
856
870
|
let request = {
|
857
871
|
lineItem,
|
858
872
|
mode: this.mode,
|
@@ -865,6 +879,12 @@ class ConfigurationService {
|
|
865
879
|
request = ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
|
866
880
|
return request;
|
867
881
|
}
|
882
|
+
getUIDefinitionProperties() {
|
883
|
+
return {
|
884
|
+
...getUIDefinitionProperties(this.getRuntimeContext().uiDefinitionContainer),
|
885
|
+
...(this.runtimeService.uiDefinitionProperties ?? {}),
|
886
|
+
};
|
887
|
+
}
|
868
888
|
showInactiveProductsConfirmation() {
|
869
889
|
const confirmationConfig = {
|
870
890
|
title: ' ',
|
@@ -903,6 +923,135 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
903
923
|
type: Injectable
|
904
924
|
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6.DialogService }]; } });
|
905
925
|
|
926
|
+
class ConfigurationState {
|
927
|
+
constructor(statefulConfigurationApiService, runtimeService, configurationService, toastService) {
|
928
|
+
this.statefulConfigurationApiService = statefulConfigurationApiService;
|
929
|
+
this.runtimeService = runtimeService;
|
930
|
+
this.configurationService = configurationService;
|
931
|
+
this.toastService = toastService;
|
932
|
+
this.stateSubj$ = new BehaviorSubject({});
|
933
|
+
this.state$ = this.stateSubj$.asObservable();
|
934
|
+
this.stateId = null;
|
935
|
+
}
|
936
|
+
init$() {
|
937
|
+
return this.configurationService.configure().pipe(switchMap$1(() => {
|
938
|
+
if (!this.isStatefulConfiguration) {
|
939
|
+
return of(undefined);
|
940
|
+
}
|
941
|
+
const { actions, selectors } = this.runtimeService.runtimeContext?.uiDefinitionContainer ?? {};
|
942
|
+
return this.statefulConfigurationApiService.init({
|
943
|
+
request: this.configurationService.generateRequest(),
|
944
|
+
actions: actions?.map(action => ({ name: action.apiName, script: action.script })),
|
945
|
+
selectors: selectors?.map(selector => ({ name: selector.apiName, script: selector.script })),
|
946
|
+
});
|
947
|
+
}), tap$1(stateId => (this.stateId = stateId || null)), map$2(() => undefined));
|
948
|
+
}
|
949
|
+
cleanup() {
|
950
|
+
this.stateId = null;
|
951
|
+
this.configurationService.reset();
|
952
|
+
this.stateSubj$.next({});
|
953
|
+
}
|
954
|
+
execute$(req) {
|
955
|
+
if (this.isStatefulConfiguration) {
|
956
|
+
return this.executeStateful$(req);
|
957
|
+
}
|
958
|
+
else {
|
959
|
+
return this.executeStateless$(req);
|
960
|
+
}
|
961
|
+
}
|
962
|
+
dispatch$(actionName, inputData) {
|
963
|
+
return this.execute$({ actions: [{ name: actionName, inputData }] });
|
964
|
+
}
|
965
|
+
select$(selectorName, inputData) {
|
966
|
+
const requestId = UUID.UUID();
|
967
|
+
return this.execute$({
|
968
|
+
selectors: {
|
969
|
+
[requestId]: {
|
970
|
+
name: selectorName,
|
971
|
+
inputData,
|
972
|
+
},
|
973
|
+
},
|
974
|
+
}).pipe(map$2(() => this.stateSubj$.value[requestId]), tap$1(() => this.stateSubj$.next(omit(this.stateSubj$.value, requestId))));
|
975
|
+
}
|
976
|
+
get isStatefulConfiguration() {
|
977
|
+
return this.runtimeService.uiDefinitionProperties.statefulConfigurationEnabled ?? false;
|
978
|
+
}
|
979
|
+
executeStateless$(request) {
|
980
|
+
return of(undefined).pipe(switchMap$1(() => {
|
981
|
+
// Apply actions and execute configuration/price call
|
982
|
+
// No need to run configuration if no actions in the request
|
983
|
+
if (!request.actions?.length) {
|
984
|
+
return of(undefined);
|
985
|
+
}
|
986
|
+
let configurationRequest = this.configurationService.generateRequest();
|
987
|
+
request.actions.forEach(action => {
|
988
|
+
configurationRequest = this.executeActionScript(configurationRequest, action) ?? configurationRequest;
|
989
|
+
});
|
990
|
+
return this.configurationService.configureRequest$(configurationRequest);
|
991
|
+
}), tap$1(() => {
|
992
|
+
if (!request.selectors) {
|
993
|
+
return;
|
994
|
+
}
|
995
|
+
// Run selectors and apply them to the state
|
996
|
+
const finalConfigurationRequest = this.configurationService.generateRequest();
|
997
|
+
const selectorsResult = EntityUtil.entries(request.selectors).reduce((trunk, [key, selector]) => {
|
998
|
+
trunk[key] = this.executeSelectorScript(finalConfigurationRequest, selector);
|
999
|
+
return trunk;
|
1000
|
+
}, {});
|
1001
|
+
this.stateSubj$.next({
|
1002
|
+
...this.stateSubj$.value,
|
1003
|
+
...selectorsResult,
|
1004
|
+
});
|
1005
|
+
}), map$2(() => undefined));
|
1006
|
+
}
|
1007
|
+
executeStateful$(request) {
|
1008
|
+
if (!this.stateId) {
|
1009
|
+
return of(undefined);
|
1010
|
+
}
|
1011
|
+
return this.statefulConfigurationApiService.execute(this.stateId, request).pipe(tap$1(response => {
|
1012
|
+
this.stateId = response.stateId;
|
1013
|
+
const updatedState = this.stateSubj$.value;
|
1014
|
+
EntityUtil.entries(response.selectors).forEach(([key, value]) => {
|
1015
|
+
if (!value.success) {
|
1016
|
+
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
1017
|
+
this.toastService.add({ summary: value.errorMessage, severity: ToastType.error });
|
1018
|
+
}
|
1019
|
+
return;
|
1020
|
+
}
|
1021
|
+
updatedState[key] = value.result;
|
1022
|
+
});
|
1023
|
+
this.stateSubj$.next(updatedState);
|
1024
|
+
}), map$2(() => undefined));
|
1025
|
+
}
|
1026
|
+
executeActionScript(request, processor) {
|
1027
|
+
const { actions } = this.runtimeService.runtimeContext?.uiDefinitionContainer ?? {};
|
1028
|
+
const script = actions?.find(action => action.apiName === processor.name)?.script;
|
1029
|
+
if (!script) {
|
1030
|
+
return null;
|
1031
|
+
}
|
1032
|
+
return this.executeProcessorScript(request, script, processor.inputData);
|
1033
|
+
}
|
1034
|
+
executeSelectorScript(request, processor) {
|
1035
|
+
const { selectors } = this.runtimeService.runtimeContext?.uiDefinitionContainer ?? {};
|
1036
|
+
const script = selectors?.find(selector => selector.apiName === processor.name)?.script;
|
1037
|
+
if (!script) {
|
1038
|
+
return null;
|
1039
|
+
}
|
1040
|
+
return this.executeProcessorScript(request, script, processor.inputData);
|
1041
|
+
}
|
1042
|
+
executeProcessorScript(request, script, inputData) {
|
1043
|
+
return new Function(`${script}\nreturn transform;`)()({
|
1044
|
+
request,
|
1045
|
+
inputData: inputData,
|
1046
|
+
});
|
1047
|
+
}
|
1048
|
+
}
|
1049
|
+
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 });
|
1050
|
+
ConfigurationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationState });
|
1051
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationState, decorators: [{
|
1052
|
+
type: Injectable
|
1053
|
+
}], ctorParameters: function () { return [{ type: i1.StatefulConfigurationApiService }, { type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type: i4.ToastService }]; } });
|
1054
|
+
|
906
1055
|
function extractMetadata(uiDefinition) {
|
907
1056
|
return omit(uiDefinition, [
|
908
1057
|
'children',
|
@@ -1193,6 +1342,7 @@ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
|
|
1193
1342
|
ConfigurationRuntimeService,
|
1194
1343
|
RuntimeContextService,
|
1195
1344
|
ConfigurationService,
|
1345
|
+
ConfigurationState,
|
1196
1346
|
], imports: [ConfirmationDialogModule] });
|
1197
1347
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, decorators: [{
|
1198
1348
|
type: NgModule,
|
@@ -1205,6 +1355,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
1205
1355
|
ConfigurationRuntimeService,
|
1206
1356
|
RuntimeContextService,
|
1207
1357
|
ConfigurationService,
|
1358
|
+
ConfigurationState,
|
1208
1359
|
],
|
1209
1360
|
}]
|
1210
1361
|
}] });
|
@@ -1616,5 +1767,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
1616
1767
|
* Generated bundle index. Do not edit.
|
1617
1768
|
*/
|
1618
1769
|
|
1619
|
-
export { CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, filterOutTechnicalAttributes, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getGuidedSellingConfigurationRequest, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, isTechnicalAttribute, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
1770
|
+
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 };
|
1620
1771
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|