@veloceapps/sdk 10.0.0-2 → 10.0.0-21
Sign up to get free protection for your applications and to get access to all the features.
- package/cms/modules/runtime/services/runtime.service.d.ts +3 -1
- package/cms/utils/index.d.ts +1 -0
- package/cms/utils/inject.d.ts +1 -0
- package/cms/utils/ui-definition.utils.d.ts +1 -0
- package/cms/vendor-map.d.ts +1 -0
- package/core/modules/configuration/services/configuration-state.service.d.ts +1 -0
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +4 -1
- package/core/services/flow-state.service.d.ts +3 -1
- package/core/types/flow-state.types.d.ts +1 -0
- package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +3 -2
- package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +3 -3
- package/esm2020/cms/modules/runtime/services/runtime.service.mjs +3 -1
- package/esm2020/cms/utils/index.mjs +2 -1
- package/esm2020/cms/utils/inject.mjs +27 -0
- package/esm2020/cms/utils/ui-definition.utils.mjs +13 -1
- package/esm2020/cms/vendor-map.mjs +3 -1
- package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +13 -4
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +16 -5
- package/esm2020/core/services/flow-state.service.mjs +27 -9
- package/esm2020/core/types/flow-state.types.mjs +1 -1
- package/fesm2015/veloceapps-sdk-cms.mjs +43 -4
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +49 -12
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +42 -3
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +48 -12
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/package.json +1 -1
@@ -441,7 +441,8 @@ class FlowStateService {
|
|
441
441
|
this.EXECUTION_BUFFER_TIME = 100;
|
442
442
|
this.executedFunctions = {};
|
443
443
|
this.stateId$ = new BehaviorSubject(null);
|
444
|
-
this.
|
444
|
+
this.initialStatefulData = {};
|
445
|
+
this.trackedStatefulChangesMap = new Map();
|
445
446
|
this.processors = {};
|
446
447
|
this.subscriptions = {};
|
447
448
|
this.flowStore = {};
|
@@ -524,7 +525,7 @@ class FlowStateService {
|
|
524
525
|
}
|
525
526
|
get hasUnsavedChanges() {
|
526
527
|
return this.getFlowSafe().properties.stateful
|
527
|
-
? this.
|
528
|
+
? Array.from(this.trackedStatefulChangesMap.values()).some(Boolean)
|
528
529
|
: this.quoteDraftService.hasUnsavedChanges;
|
529
530
|
}
|
530
531
|
get stateId() {
|
@@ -589,6 +590,9 @@ class FlowStateService {
|
|
589
590
|
data$: new BehaviorSubject(this.NOT_INITIALIZED),
|
590
591
|
};
|
591
592
|
this.subscriptions[requestId] = subscription;
|
593
|
+
if (options === null || options === void 0 ? void 0 : options.trackedChanges) {
|
594
|
+
this.trackedStatefulChangesMap.set(requestId, false);
|
595
|
+
}
|
592
596
|
if (!(options === null || options === void 0 ? void 0 : options.cold)) {
|
593
597
|
this.executeRequest$(request).subscribe();
|
594
598
|
}
|
@@ -603,14 +607,18 @@ class FlowStateService {
|
|
603
607
|
save$() {
|
604
608
|
if (this.getFlowSafe().properties.stateful) {
|
605
609
|
if (this.stateId$.value) {
|
606
|
-
return this.flowStateApiService.save(this.stateId$.value)
|
610
|
+
return this.flowStateApiService.save(this.stateId$.value).pipe(tap$1(() => {
|
611
|
+
Array.from(this.trackedStatefulChangesMap.keys()).forEach(key => {
|
612
|
+
this.trackedStatefulChangesMap.set(key, false);
|
613
|
+
});
|
614
|
+
}));
|
607
615
|
}
|
608
616
|
}
|
609
617
|
else {
|
610
618
|
const quoteDraft = this.quoteDraftService.quoteDraft;
|
611
619
|
if (quoteDraft) {
|
612
|
-
return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap$1(({
|
613
|
-
this.contextService.update({ properties: {
|
620
|
+
return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap$1(({ versionId }) => {
|
621
|
+
this.contextService.update({ properties: { VELOCPQ__VersionId__c: versionId } });
|
614
622
|
}));
|
615
623
|
}
|
616
624
|
}
|
@@ -625,8 +633,8 @@ class FlowStateService {
|
|
625
633
|
else {
|
626
634
|
const quoteDraft = this.quoteDraftService.quoteDraft;
|
627
635
|
if (quoteDraft) {
|
628
|
-
return this.quoteApiService.submitQuote(quoteDraft).pipe(tap$1(({
|
629
|
-
this.contextService.update({ properties: {
|
636
|
+
return this.quoteApiService.submitQuote(quoteDraft).pipe(tap$1(({ versionId }) => {
|
637
|
+
this.contextService.update({ properties: { VELOCPQ__VersionId__c: versionId } });
|
630
638
|
}));
|
631
639
|
}
|
632
640
|
}
|
@@ -684,6 +692,7 @@ class FlowStateService {
|
|
684
692
|
}
|
685
693
|
const subscription$ = (_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$;
|
686
694
|
if (subscription$ && subscription$.value !== selectorResult) {
|
695
|
+
this.checkStatefulChanges(requestId, selectorResult);
|
687
696
|
subscription$.next(selectorResult);
|
688
697
|
}
|
689
698
|
});
|
@@ -936,6 +945,15 @@ class FlowStateService {
|
|
936
945
|
});
|
937
946
|
return request;
|
938
947
|
}
|
948
|
+
checkStatefulChanges(requestId, selectorResult) {
|
949
|
+
if (this.trackedStatefulChangesMap.has(requestId)) {
|
950
|
+
if (!this.initialStatefulData[requestId]) {
|
951
|
+
this.initialStatefulData[requestId] = selectorResult;
|
952
|
+
}
|
953
|
+
const hasChanges = !isEqual(this.initialStatefulData[requestId], selectorResult);
|
954
|
+
this.trackedStatefulChangesMap.set(requestId, hasChanges);
|
955
|
+
}
|
956
|
+
}
|
939
957
|
}
|
940
958
|
FlowStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, deps: [{ token: ContextService }, { token: QuoteDraftService }, { token: FlowInfoService }, { token: FlowConfigurationService }, { token: i1.ConfigurationProcessorsApiService }, { token: i1.FlowStateApiService }, { token: i1.QuoteApiService }, { token: i6.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
941
959
|
FlowStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService });
|
@@ -1640,17 +1658,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1640
1658
|
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6$1.DialogService }, { type: RuntimeSettingsService }]; } });
|
1641
1659
|
|
1642
1660
|
class FlowConfigurationService {
|
1643
|
-
constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
|
1661
|
+
constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService, flowInfoService) {
|
1644
1662
|
this.proceduresApiService = proceduresApiService;
|
1645
1663
|
this.contextService = contextService;
|
1646
1664
|
this.quoteDraftService = quoteDraftService;
|
1647
1665
|
this.updateService = updateService;
|
1648
1666
|
this.configurationService = configurationService;
|
1667
|
+
this.flowInfoService = flowInfoService;
|
1649
1668
|
this.updatedSubj$ = new Subject();
|
1650
1669
|
this.updated$ = this.updatedSubj$.asObservable();
|
1651
1670
|
}
|
1652
1671
|
calculate$(quoteDraft) {
|
1653
|
-
return this.
|
1672
|
+
return this.extendedApply$(quoteDraft).pipe(tap$1(result => {
|
1654
1673
|
// sort the result current state based on the quote draft initial state
|
1655
1674
|
const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
|
1656
1675
|
result.currentState = result.currentState
|
@@ -1775,12 +1794,21 @@ class FlowConfigurationService {
|
|
1775
1794
|
}));
|
1776
1795
|
};
|
1777
1796
|
}
|
1797
|
+
extendedApply$(quoteDraft) {
|
1798
|
+
var _a;
|
1799
|
+
const request = Object.assign({}, quoteDraft);
|
1800
|
+
const procedureName = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.procedureName;
|
1801
|
+
if (procedureName) {
|
1802
|
+
request.procedureName = procedureName;
|
1803
|
+
}
|
1804
|
+
return this.proceduresApiService.apply$(request);
|
1805
|
+
}
|
1778
1806
|
}
|
1779
|
-
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 });
|
1807
|
+
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 }, { token: FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1780
1808
|
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
|
1781
1809
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
|
1782
1810
|
type: Injectable
|
1783
|
-
}], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
|
1811
|
+
}], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }, { type: FlowInfoService }]; } });
|
1784
1812
|
|
1785
1813
|
class FlowConfigurationModule {
|
1786
1814
|
}
|
@@ -2042,6 +2070,7 @@ class ConfigurationStateService {
|
|
2042
2070
|
this.configurationStore = {};
|
2043
2071
|
this.executionInProgress$ = new BehaviorSubject(false);
|
2044
2072
|
this.statefulRequestStream$ = new Subject();
|
2073
|
+
this.statelessExecutionRequest$ = null;
|
2045
2074
|
this.statefulExecutionRequest$ = this.initBufferedRequest$();
|
2046
2075
|
}
|
2047
2076
|
get isExecutionInProgress$() {
|
@@ -2089,7 +2118,15 @@ class ConfigurationStateService {
|
|
2089
2118
|
actions: [{ name: actionName, inputData }],
|
2090
2119
|
};
|
2091
2120
|
const request = this.execToRequest(exec);
|
2092
|
-
|
2121
|
+
const executionRequest$ = this.executeRequest$(request);
|
2122
|
+
if (this.isStatefulConfiguration) {
|
2123
|
+
return executionRequest$;
|
2124
|
+
}
|
2125
|
+
// prevent parallel configuration requests in stateless mode
|
2126
|
+
if (!this.statelessExecutionRequest$) {
|
2127
|
+
this.statelessExecutionRequest$ = executionRequest$.pipe(shareReplay$1(), take$1(1), finalize(() => (this.statelessExecutionRequest$ = null)));
|
2128
|
+
}
|
2129
|
+
return this.statelessExecutionRequest$;
|
2093
2130
|
}
|
2094
2131
|
select$(selectorName, inputData = {}) {
|
2095
2132
|
const requestId = UUID.UUID();
|