@veloceapps/sdk 8.0.0-118 → 8.0.0-119
Sign up to get free protection for your applications and to get access to all the features.
- package/core/modules/configuration/helpers.d.ts +2 -1
- package/core/modules/configuration/types/configuration.types.d.ts +4 -0
- package/core/services/context.service.d.ts +1 -0
- package/core/services/flow-state-configuration.service.d.ts +2 -2
- package/esm2020/core/modules/configuration/helpers.mjs +21 -1
- package/esm2020/core/modules/configuration/types/configuration.types.mjs +1 -1
- package/esm2020/core/services/context.service.mjs +13 -1
- package/esm2020/core/services/flow-state-configuration.service.mjs +5 -6
- package/fesm2015/veloceapps-sdk-core.mjs +37 -5
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +36 -5
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/package.json +1 -1
@@ -67,6 +67,26 @@ const getGuidedSellingConfigurationRequest = (data, context) => {
|
|
67
67
|
},
|
68
68
|
};
|
69
69
|
};
|
70
|
+
const generateConfigurationLineItem = (props, qty = 1) => {
|
71
|
+
const id = UUID.UUID();
|
72
|
+
const attributes = Object.entries(props.attributesMap ?? {}).map(([name, value]) => ({
|
73
|
+
name,
|
74
|
+
value,
|
75
|
+
cfgStatus: 'User',
|
76
|
+
}));
|
77
|
+
const lineItems = [];
|
78
|
+
return {
|
79
|
+
id,
|
80
|
+
type: props.product.typeName ?? '',
|
81
|
+
cfgStatus: 'Default',
|
82
|
+
actionCode: 'ADD',
|
83
|
+
qty,
|
84
|
+
attributes,
|
85
|
+
lineItems,
|
86
|
+
productName: props.product.name,
|
87
|
+
productId: props.product.id ?? '',
|
88
|
+
};
|
89
|
+
};
|
70
90
|
|
71
91
|
class ContextService {
|
72
92
|
constructor(contextApiService) {
|
@@ -82,6 +102,18 @@ class ContextService {
|
|
82
102
|
get mode() {
|
83
103
|
return this.resolve().properties.mode;
|
84
104
|
}
|
105
|
+
get isEditMode$() {
|
106
|
+
return this.resolve$().pipe(map(() => {
|
107
|
+
const context = this.resolve();
|
108
|
+
if (context.mode === ConfigurationContextMode.ACCOUNT) {
|
109
|
+
return true;
|
110
|
+
}
|
111
|
+
if (context.mode === ConfigurationContextMode.QUOTE) {
|
112
|
+
return context.properties.Status === 'Draft';
|
113
|
+
}
|
114
|
+
return false;
|
115
|
+
}));
|
116
|
+
}
|
85
117
|
resolve() {
|
86
118
|
if (!this.context.value) {
|
87
119
|
throw new Error('Context is not initialized yet!');
|
@@ -1797,13 +1829,12 @@ class FlowStateConfigurationService {
|
|
1797
1829
|
if (!stateId) {
|
1798
1830
|
return of();
|
1799
1831
|
}
|
1800
|
-
|
1801
|
-
|
1802
|
-
.pipe(tap$1(r => this.configurationStateId$.next(r.stateId)))), switchMap(() => {
|
1832
|
+
const lineItem = generateConfigurationLineItem(props, props.qty);
|
1833
|
+
return this.flowStateApiService.newConfiguration(stateId, { lineItem }).pipe(tap$1(r => this.configurationStateId$.next(r.stateId)), switchMap(() => {
|
1803
1834
|
if (!this.configurationStateId) {
|
1804
1835
|
return of();
|
1805
1836
|
}
|
1806
|
-
return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), map$1(noop));
|
1837
|
+
return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), tap$1(() => this.configurationStateId$.next(null)), map$1(noop));
|
1807
1838
|
}));
|
1808
1839
|
}
|
1809
1840
|
else {
|
@@ -2453,5 +2484,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2453
2484
|
* Generated bundle index. Do not edit.
|
2454
2485
|
*/
|
2455
2486
|
|
2456
|
-
export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationState, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowInfoService, FlowStateConfigurationService, FlowStateService, FlowUpdateService, IntegrationState, 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 };
|
2487
|
+
export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationState, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowInfoService, FlowStateConfigurationService, FlowStateService, FlowUpdateService, IntegrationState, LineItemWorker, MetricsCalculationService, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, filterOutTechnicalAttributes, findLineItem, findLineItemWithComparator, generateConfigurationLineItem, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getGuidedSellingConfigurationRequest, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, isTechnicalAttribute, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
2457
2488
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|