@veloceapps/sdk 8.0.0-117 → 8.0.0-119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cms/vendor-map.d.ts +2 -1
- 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 +20 -0
- package/core/services/flow-state.service.d.ts +3 -2
- package/core/services/index.d.ts +1 -0
- package/esm2020/cms/vendor-map.mjs +3 -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 +52 -0
- package/esm2020/core/services/flow-state.service.mjs +4 -1
- package/esm2020/core/services/index.mjs +2 -1
- package/fesm2015/veloceapps-sdk-cms.mjs +2 -1
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +132 -56
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +2 -1
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +88 -14
- 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!');
|
|
@@ -842,6 +874,9 @@ class FlowStateService {
|
|
|
842
874
|
? this._hasStatefulUnsavedChanges
|
|
843
875
|
: this.quoteDraftService.hasUnsavedChanges;
|
|
844
876
|
}
|
|
877
|
+
get stateId() {
|
|
878
|
+
return this.stateId$.value;
|
|
879
|
+
}
|
|
845
880
|
isInitialized$() {
|
|
846
881
|
return combineLatest([this.stateId$, this.quoteDraftService.isInitialized$]).pipe(map$1(values => values.some(Boolean)));
|
|
847
882
|
}
|
|
@@ -1762,6 +1797,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1762
1797
|
type: Injectable
|
|
1763
1798
|
}], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
|
|
1764
1799
|
|
|
1800
|
+
class FlowConfigurationModule {
|
|
1801
|
+
}
|
|
1802
|
+
FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1803
|
+
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule });
|
|
1804
|
+
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService] });
|
|
1805
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, decorators: [{
|
|
1806
|
+
type: NgModule,
|
|
1807
|
+
args: [{
|
|
1808
|
+
imports: [],
|
|
1809
|
+
providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
|
|
1810
|
+
}]
|
|
1811
|
+
}] });
|
|
1812
|
+
|
|
1813
|
+
class FlowStateConfigurationService {
|
|
1814
|
+
constructor(flowStateService, flowInfoService, configurationService, flowConfigurationService, flowStateApiService) {
|
|
1815
|
+
this.flowStateService = flowStateService;
|
|
1816
|
+
this.flowInfoService = flowInfoService;
|
|
1817
|
+
this.configurationService = configurationService;
|
|
1818
|
+
this.flowConfigurationService = flowConfigurationService;
|
|
1819
|
+
this.flowStateApiService = flowStateApiService;
|
|
1820
|
+
this.configurationStateId$ = new BehaviorSubject(null);
|
|
1821
|
+
}
|
|
1822
|
+
get configurationStateId() {
|
|
1823
|
+
return this.configurationStateId$.value;
|
|
1824
|
+
}
|
|
1825
|
+
addToCart$(props) {
|
|
1826
|
+
const stateful = this.flowInfoService.flow?.properties.stateful;
|
|
1827
|
+
if (stateful) {
|
|
1828
|
+
const stateId = this.flowStateService.stateId;
|
|
1829
|
+
if (!stateId) {
|
|
1830
|
+
return of();
|
|
1831
|
+
}
|
|
1832
|
+
const lineItem = generateConfigurationLineItem(props, props.qty);
|
|
1833
|
+
return this.flowStateApiService.newConfiguration(stateId, { lineItem }).pipe(tap$1(r => this.configurationStateId$.next(r.stateId)), switchMap(() => {
|
|
1834
|
+
if (!this.configurationStateId) {
|
|
1835
|
+
return of();
|
|
1836
|
+
}
|
|
1837
|
+
return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), tap$1(() => this.configurationStateId$.next(null)), map$1(noop));
|
|
1838
|
+
}));
|
|
1839
|
+
}
|
|
1840
|
+
else {
|
|
1841
|
+
return this.flowConfigurationService.addToCart$(props).pipe(map$1(noop));
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
FlowStateConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, deps: [{ token: FlowStateService }, { token: FlowInfoService }, { token: ConfigurationService }, { token: FlowConfigurationService }, { token: i1.FlowStateApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1846
|
+
FlowStateConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, providedIn: 'root' });
|
|
1847
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, decorators: [{
|
|
1848
|
+
type: Injectable,
|
|
1849
|
+
args: [{ providedIn: 'root' }]
|
|
1850
|
+
}], ctorParameters: function () { return [{ type: FlowStateService }, { type: FlowInfoService }, { type: ConfigurationService }, { type: FlowConfigurationService }, { type: i1.FlowStateApiService }]; } });
|
|
1851
|
+
|
|
1765
1852
|
function calculateMetricByMethod(lineItems, metric, method) {
|
|
1766
1853
|
const items = getLineItemsByMethod(lineItems, method);
|
|
1767
1854
|
return items.reduce((acc, li) => {
|
|
@@ -2169,19 +2256,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2169
2256
|
type: Injectable
|
|
2170
2257
|
}], ctorParameters: function () { return [{ type: i1.StatefulConfigurationApiService }, { type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type: i6.ToastService }]; } });
|
|
2171
2258
|
|
|
2172
|
-
class FlowConfigurationModule {
|
|
2173
|
-
}
|
|
2174
|
-
FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2175
|
-
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule });
|
|
2176
|
-
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService] });
|
|
2177
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, decorators: [{
|
|
2178
|
-
type: NgModule,
|
|
2179
|
-
args: [{
|
|
2180
|
-
imports: [],
|
|
2181
|
-
providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
|
|
2182
|
-
}]
|
|
2183
|
-
}] });
|
|
2184
|
-
|
|
2185
2259
|
class ConfigurationModule {
|
|
2186
2260
|
}
|
|
2187
2261
|
ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -2410,5 +2484,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2410
2484
|
* Generated bundle index. Do not edit.
|
|
2411
2485
|
*/
|
|
2412
2486
|
|
|
2413
|
-
export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationState, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowInfoService, 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 };
|
|
2414
2488
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|