@veloceapps/sdk 8.0.0-114 → 8.0.0-116

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.
@@ -999,13 +999,15 @@ class FlowStateService {
999
999
  .map(({ request }) => request.selectors)
1000
1000
  .filter(isDefined)
1001
1001
  .reduce((trunk, selectors) => ({ ...trunk, ...selectors }), {});
1002
+ const request = this.getDefaultExecutionRequestDTO();
1002
1003
  return this.flowStateApiService
1003
1004
  .init({
1004
1005
  quoteId: this.contextService.resolve().headerId,
1005
1006
  params: this.flowInfoService.params ?? {},
1006
1007
  actionsOverride: processors?.filter(processor => processor.type === ConfigurationProcessorTypes.ACTION),
1007
1008
  selectorsOverride: processors?.filter(processor => processor.type === ConfigurationProcessorTypes.SELECTOR),
1008
- selectors,
1009
+ selectors: { ...selectors, ...request.selectors },
1010
+ actions: request.actions,
1009
1011
  })
1010
1012
  .pipe(map$1(({ stateId, selectors }) => {
1011
1013
  this.handleSelectorsResponse(selectors);
@@ -1024,9 +1026,7 @@ class FlowStateService {
1024
1026
  }
1025
1027
  initStateless$() {
1026
1028
  const { headerId } = this.contextService.resolve();
1027
- const stateInit$ = this.quoteDraftService
1028
- .init(headerId, this.flowInfoService.params ?? {})
1029
- .pipe(switchMap(() => this.calculate$()));
1029
+ const stateInit$ = this.quoteDraftService.init(headerId, this.flowInfoService.params ?? {}).pipe(switchMap(() => this.executeRequest$(this.getDefaultExecutionRequestDTO())), switchMap(() => this.calculate$()));
1030
1030
  return stateInit$.pipe(tap$1(() => this.quoteDraftService.finalizeInit()), map$1(noop));
1031
1031
  }
1032
1032
  calculate$() {
@@ -1088,10 +1088,6 @@ class FlowStateService {
1088
1088
  initProcessors$() {
1089
1089
  const hasOverrides = Boolean(this.customizationService?.getTemplateConfigurationProcessors);
1090
1090
  const flow = this.getFlowSafe();
1091
- if (flow.properties.stateful == null) {
1092
- // Skip initialization for Stateless flow (legacy)
1093
- return of(undefined);
1094
- }
1095
1091
  if (flow.properties.stateful && !hasOverrides) {
1096
1092
  // Skip initialization as backend will take processors from SF
1097
1093
  return of(undefined);
@@ -1141,6 +1137,19 @@ class FlowStateService {
1141
1137
  const inputDataHash = UUID.hex(JSON.stringify(inputData) || '').slice(0, 8);
1142
1138
  return `${scope}/${selectorName}/${inputDataHash}`;
1143
1139
  }
1140
+ getDefaultExecutionRequestDTO() {
1141
+ const request = {
1142
+ actions: [],
1143
+ selectors: {},
1144
+ };
1145
+ const ownerId = this.getOwnerIdByScope(UITemplateType.FLOW_ENGINE);
1146
+ request.actions?.push({
1147
+ apiName: 'INITIALIZE_STATE',
1148
+ ownerId,
1149
+ inputData: {},
1150
+ });
1151
+ return request;
1152
+ }
1144
1153
  }
1145
1154
  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 });
1146
1155
  FlowStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, providedIn: 'root' });