@veloceapps/sdk 10.0.0-2 → 10.0.0-20
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 +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 +35 -8
- 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 +35 -8
- 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 });
|
@@ -2042,6 +2060,7 @@ class ConfigurationStateService {
|
|
2042
2060
|
this.configurationStore = {};
|
2043
2061
|
this.executionInProgress$ = new BehaviorSubject(false);
|
2044
2062
|
this.statefulRequestStream$ = new Subject();
|
2063
|
+
this.statelessExecutionRequest$ = null;
|
2045
2064
|
this.statefulExecutionRequest$ = this.initBufferedRequest$();
|
2046
2065
|
}
|
2047
2066
|
get isExecutionInProgress$() {
|
@@ -2089,7 +2108,15 @@ class ConfigurationStateService {
|
|
2089
2108
|
actions: [{ name: actionName, inputData }],
|
2090
2109
|
};
|
2091
2110
|
const request = this.execToRequest(exec);
|
2092
|
-
|
2111
|
+
const executionRequest$ = this.executeRequest$(request);
|
2112
|
+
if (this.isStatefulConfiguration) {
|
2113
|
+
return executionRequest$;
|
2114
|
+
}
|
2115
|
+
// prevent parallel configuration requests in stateless mode
|
2116
|
+
if (!this.statelessExecutionRequest$) {
|
2117
|
+
this.statelessExecutionRequest$ = executionRequest$.pipe(shareReplay$1(), take$1(1), finalize(() => (this.statelessExecutionRequest$ = null)));
|
2118
|
+
}
|
2119
|
+
return this.statelessExecutionRequest$;
|
2093
2120
|
}
|
2094
2121
|
select$(selectorName, inputData = {}) {
|
2095
2122
|
const requestId = UUID.UUID();
|