@veloceapps/sdk 8.0.0-194 → 8.0.0-196

Sign up to get free protection for your applications and to get access to all the features.
@@ -1183,6 +1183,9 @@ class RuntimeSettingsService {
1183
1183
  if (iso) {
1184
1184
  const symbol = this.getCurrencySymbol('en-US', iso);
1185
1185
  this.currencySettings$.next({ iso, symbol });
1186
+ if (this.formattingSettings) {
1187
+ this.formattingSettings.currencySymbol = symbol;
1188
+ }
1186
1189
  }
1187
1190
  }
1188
1191
  getFormattingSettings() {
@@ -2038,11 +2041,15 @@ class ConfigurationStateService {
2038
2041
  this.isInitialized$ = new BehaviorSubject(false);
2039
2042
  this.canceledConfiguration$ = new Subject();
2040
2043
  this.NOT_INITIALIZED = Symbol();
2044
+ this.EXECUTION_BUFFER_TIME = 100;
2041
2045
  this.executedFunctions = {};
2042
2046
  this.stateId = null;
2043
2047
  this.ownerId = '';
2044
2048
  this.subscriptions = {};
2045
2049
  this.configurationStore = {};
2050
+ this.statefulExecutionInProgress$ = new BehaviorSubject(false);
2051
+ this.statefulRequestStream$ = new Subject();
2052
+ this.statefulExecutionRequest$ = this.initBufferedRequest$();
2046
2053
  }
2047
2054
  init$() {
2048
2055
  let request$;
@@ -2272,14 +2279,34 @@ class ConfigurationStateService {
2272
2279
  return throwError(() => error);
2273
2280
  }));
2274
2281
  }
2275
- executeStateful$(request) {
2276
- if (!this.flowStateService.stateId || !this.stateId) {
2277
- return of();
2278
- }
2279
- return this.flowStateApiService.executeConfiguration(this.flowStateService.stateId, this.stateId, request).pipe(tap$1(response => {
2280
- this.stateId = response.stateId;
2282
+ initBufferedRequest$() {
2283
+ return this.statefulRequestStream$.pipe(buffer(this.statefulRequestStream$.pipe(debounceTime(this.EXECUTION_BUFFER_TIME))), switchMap(requests => {
2284
+ if (!this.flowStateService.stateId || !this.stateId) {
2285
+ throw 'Stateful session is not initialized';
2286
+ }
2287
+ // merge buffered requests
2288
+ const request = {
2289
+ actions: requests.flatMap(({ actions }) => actions).filter(isDefined),
2290
+ selectors: requests
2291
+ .map(({ selectors }) => selectors)
2292
+ .filter(isDefined)
2293
+ .reduce((acc, selectorsMap) => Object.assign(acc, selectorsMap), {}),
2294
+ };
2295
+ this.statefulExecutionInProgress$.next(true);
2296
+ return this.flowStateApiService.executeConfiguration(this.flowStateService.stateId, this.stateId, request);
2297
+ }), tap$1(({ stateId }) => (this.stateId = stateId)), share(), tap$1(() => this.statefulExecutionInProgress$.next(false)), catchError(e => {
2298
+ this.statefulExecutionInProgress$.next(false);
2299
+ return throwError(() => e);
2281
2300
  }));
2282
2301
  }
2302
+ executeStateful$(request) {
2303
+ return this.statefulExecutionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap(() =>
2304
+ // make sure stream switches to statefulExecutionRequest$ before pushing an execution request
2305
+ combineLatest([
2306
+ this.statefulExecutionRequest$,
2307
+ of(undefined).pipe(tap$1(() => this.statefulRequestStream$.next(request))),
2308
+ ])), map$1(([response]) => response), take$1(1));
2309
+ }
2283
2310
  executeActionScript(request, processor) {
2284
2311
  const { actions } = this.configurationRuntimeService.runtimeContext?.uiDefinitionContainer ?? {};
2285
2312
  const configurationProcessor = actions?.find(action => action.apiName === processor.apiName);