@veloceapps/sdk 10.0.0-0 → 10.0.0-10
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/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/services/flow-state.service.mjs +23 -5
- 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 +31 -4
- 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 +31 -4
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/package.json +1 -1
@@ -478,7 +478,8 @@ class FlowStateService {
|
|
478
478
|
this.EXECUTION_BUFFER_TIME = 100;
|
479
479
|
this.executedFunctions = {};
|
480
480
|
this.stateId$ = new BehaviorSubject(null);
|
481
|
-
this.
|
481
|
+
this.initialStatefulData = {};
|
482
|
+
this.trackedStatefulChangesMap = new Map();
|
482
483
|
this.processors = {};
|
483
484
|
this.subscriptions = {};
|
484
485
|
this.flowStore = {};
|
@@ -561,7 +562,7 @@ class FlowStateService {
|
|
561
562
|
}
|
562
563
|
get hasUnsavedChanges() {
|
563
564
|
return this.getFlowSafe().properties.stateful
|
564
|
-
? this.
|
565
|
+
? Array.from(this.trackedStatefulChangesMap.values()).some(Boolean)
|
565
566
|
: this.quoteDraftService.hasUnsavedChanges;
|
566
567
|
}
|
567
568
|
get stateId() {
|
@@ -625,6 +626,9 @@ class FlowStateService {
|
|
625
626
|
data$: new BehaviorSubject(this.NOT_INITIALIZED),
|
626
627
|
};
|
627
628
|
this.subscriptions[requestId] = subscription;
|
629
|
+
if (options?.trackedChanges) {
|
630
|
+
this.trackedStatefulChangesMap.set(requestId, false);
|
631
|
+
}
|
628
632
|
if (!options?.cold) {
|
629
633
|
this.executeRequest$(request).subscribe();
|
630
634
|
}
|
@@ -638,7 +642,11 @@ class FlowStateService {
|
|
638
642
|
save$() {
|
639
643
|
if (this.getFlowSafe().properties.stateful) {
|
640
644
|
if (this.stateId$.value) {
|
641
|
-
return this.flowStateApiService.save(this.stateId$.value)
|
645
|
+
return this.flowStateApiService.save(this.stateId$.value).pipe(tap$1(() => {
|
646
|
+
Array.from(this.trackedStatefulChangesMap.keys()).forEach(key => {
|
647
|
+
this.trackedStatefulChangesMap.set(key, false);
|
648
|
+
});
|
649
|
+
}));
|
642
650
|
}
|
643
651
|
}
|
644
652
|
else {
|
@@ -715,6 +723,7 @@ class FlowStateService {
|
|
715
723
|
}
|
716
724
|
const subscription$ = this.subscriptions[requestId]?.data$;
|
717
725
|
if (subscription$ && subscription$.value !== selectorResult) {
|
726
|
+
this.checkStatefulChanges(requestId, selectorResult);
|
718
727
|
subscription$.next(selectorResult);
|
719
728
|
}
|
720
729
|
});
|
@@ -954,6 +963,15 @@ class FlowStateService {
|
|
954
963
|
});
|
955
964
|
return request;
|
956
965
|
}
|
966
|
+
checkStatefulChanges(requestId, selectorResult) {
|
967
|
+
if (this.trackedStatefulChangesMap.has(requestId)) {
|
968
|
+
if (!this.initialStatefulData[requestId]) {
|
969
|
+
this.initialStatefulData[requestId] = selectorResult;
|
970
|
+
}
|
971
|
+
const hasChanges = !isEqual(this.initialStatefulData[requestId], selectorResult);
|
972
|
+
this.trackedStatefulChangesMap.set(requestId, hasChanges);
|
973
|
+
}
|
974
|
+
}
|
957
975
|
}
|
958
976
|
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 });
|
959
977
|
FlowStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService });
|
@@ -2071,6 +2089,7 @@ class ConfigurationStateService {
|
|
2071
2089
|
this.configurationStore = {};
|
2072
2090
|
this.executionInProgress$ = new BehaviorSubject(false);
|
2073
2091
|
this.statefulRequestStream$ = new Subject();
|
2092
|
+
this.statelessExecutionRequest$ = null;
|
2074
2093
|
this.statefulExecutionRequest$ = this.initBufferedRequest$();
|
2075
2094
|
}
|
2076
2095
|
get isExecutionInProgress$() {
|
@@ -2117,7 +2136,15 @@ class ConfigurationStateService {
|
|
2117
2136
|
actions: [{ name: actionName, inputData }],
|
2118
2137
|
};
|
2119
2138
|
const request = this.execToRequest(exec);
|
2120
|
-
|
2139
|
+
const executionRequest$ = this.executeRequest$(request);
|
2140
|
+
if (this.isStatefulConfiguration) {
|
2141
|
+
return executionRequest$;
|
2142
|
+
}
|
2143
|
+
// prevent parallel configuration requests in stateless mode
|
2144
|
+
if (!this.statelessExecutionRequest$) {
|
2145
|
+
this.statelessExecutionRequest$ = executionRequest$.pipe(shareReplay$1(), take$1(1), finalize(() => (this.statelessExecutionRequest$ = null)));
|
2146
|
+
}
|
2147
|
+
return this.statelessExecutionRequest$;
|
2121
2148
|
}
|
2122
2149
|
select$(selectorName, inputData = {}) {
|
2123
2150
|
const requestId = UUID.UUID();
|