@veloceapps/sdk 10.0.0-4 → 10.0.0-41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/cms/modules/runtime/services/runtime.service.d.ts +3 -1
  2. package/cms/utils/index.d.ts +1 -0
  3. package/cms/utils/inject.d.ts +1 -0
  4. package/cms/utils/ui-definition.utils.d.ts +1 -0
  5. package/cms/vendor-map.d.ts +1 -0
  6. package/core/modules/configuration/services/configuration-state.service.d.ts +1 -0
  7. package/core/services/context.service.d.ts +3 -1
  8. package/core/services/flow-info.service.d.ts +4 -2
  9. package/core/services/quote-draft.service.d.ts +3 -1
  10. package/core/services/runtime-settings.service.d.ts +1 -1
  11. package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +3 -2
  12. package/esm2020/cms/modules/runtime/services/runtime.service.mjs +3 -1
  13. package/esm2020/cms/utils/index.mjs +2 -1
  14. package/esm2020/cms/utils/inject.mjs +27 -0
  15. package/esm2020/cms/utils/ui-definition.utils.mjs +13 -1
  16. package/esm2020/cms/vendor-map.mjs +3 -1
  17. package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +13 -4
  18. package/esm2020/core/modules/configuration/services/configuration.service.mjs +2 -2
  19. package/esm2020/core/services/context.service.mjs +15 -6
  20. package/esm2020/core/services/flow-info.service.mjs +19 -6
  21. package/esm2020/core/services/flow-state.service.mjs +19 -6
  22. package/esm2020/core/services/quote-draft.service.mjs +21 -9
  23. package/esm2020/core/services/runtime-settings.service.mjs +3 -3
  24. package/esm2020/src/guards/context.guard.mjs +4 -6
  25. package/esm2020/src/guards/flow.guard.mjs +5 -4
  26. package/fesm2015/veloceapps-sdk-cms.mjs +41 -2
  27. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  28. package/fesm2015/veloceapps-sdk-core.mjs +281 -230
  29. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  30. package/fesm2015/veloceapps-sdk.mjs +6 -7
  31. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  32. package/fesm2020/veloceapps-sdk-cms.mjs +40 -1
  33. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  34. package/fesm2020/veloceapps-sdk-core.mjs +278 -228
  35. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  36. package/fesm2020/veloceapps-sdk.mjs +6 -7
  37. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  38. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Injectable, Optional, Inject, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
3
- import { UUID, ConfigurationContextMode, ConfigurationContext, UITemplateType, QuoteDraft, isDefined, ConfigurationProcessorTypes, EntityUtil, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, DEFAULT_ACTION_CODE_LABELS, parseJsonSafely, ConfigurationMode, extractErrorDetails, ConfigurationTranslatorUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
4
- import { BehaviorSubject, switchMap, map as map$1, tap as tap$1, noop, catchError, throwError, forkJoin, of, zip, combineLatest, Subject, filter as filter$1, shareReplay as shareReplay$1, finalize, takeUntil, buffer, debounceTime, share, take as take$1, distinctUntilChanged } from 'rxjs';
5
- import { map, filter, tap, switchMap as switchMap$1, skip, take, shareReplay, catchError as catchError$1, finalize as finalize$1, first } from 'rxjs/operators';
3
+ import { UUID, ConfigurationContextMode, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, DEFAULT_ACTION_CODE_LABELS, parseJsonSafely, ConfigurationContext, UITemplateType, QuoteDraft, isDefined, ConfigurationProcessorTypes, EntityUtil, ChargeGroupUtils, ConfigurationMode, extractErrorDetails, ConfigurationTranslatorUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
4
+ import { BehaviorSubject, map, tap, of, noop, catchError, throwError, forkJoin, zip, combineLatest, Subject, filter as filter$1, switchMap as switchMap$1, shareReplay as shareReplay$1, finalize, takeUntil, buffer, debounceTime, share, take as take$1, distinctUntilChanged } from 'rxjs';
5
+ import { map as map$1, filter, tap as tap$1, switchMap, skip, take, shareReplay, catchError as catchError$1, finalize as finalize$1, first } from 'rxjs/operators';
6
6
  import * as i1 from '@veloceapps/api';
7
7
  import { ApiModule } from '@veloceapps/api';
8
- import { merge, isEqual, cloneDeep, assign, flatten, entries, sortBy, map as map$2, omit, uniqBy, transform } from 'lodash';
8
+ import { uniqBy, merge, isEqual, cloneDeep, assign, flatten, entries, sortBy, map as map$2, omit, transform } from 'lodash';
9
9
  import * as i6 from '@veloceapps/components';
10
10
  import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
11
11
  import moment from 'moment';
@@ -92,22 +92,130 @@ var RuntimeStep;
92
92
 
93
93
  const UI_DEFINITION_VERSION = 3;
94
94
 
95
+ class RuntimeSettingsService {
96
+ constructor(configurationSettingsApiService) {
97
+ this.configurationSettingsApiService = configurationSettingsApiService;
98
+ this.configurationSettings$ = new BehaviorSubject({});
99
+ this.currencySettings$ = new BehaviorSubject({
100
+ iso: DEFAULT_CURRENCY_ISO_CODE,
101
+ symbol: DEFAULT_CURRENCY_SYMBOL,
102
+ });
103
+ this.shoppingCartSettings$ = new BehaviorSubject([]);
104
+ this.getCurrencySymbol = (locale, currency) => {
105
+ return (0)
106
+ .toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
107
+ .replace(/\d/g, '')
108
+ .trim();
109
+ };
110
+ }
111
+ create() {
112
+ return this.configurationSettingsApiService.fetchSettings().pipe(map(settings => this.parseConfigurationSettings(settings)), tap(configurationSettings => {
113
+ var _a;
114
+ this.configurationSettings$.next(configurationSettings);
115
+ this.addShoppingCartSettings((_a = configurationSettings['shopping-cart']) !== null && _a !== void 0 ? _a : []);
116
+ this.formattingSettings = this.getFormattingSettings();
117
+ }), map(() => undefined));
118
+ }
119
+ initCurrency(iso) {
120
+ if (iso) {
121
+ const symbol = this.getCurrencySymbol('en-US', iso);
122
+ this.currencySettings$.next({ iso, symbol });
123
+ if (this.formattingSettings) {
124
+ this.formattingSettings.currencySymbol = symbol;
125
+ }
126
+ }
127
+ }
128
+ getFormattingSettings() {
129
+ var _a, _b;
130
+ if (this.formattingSettings) {
131
+ return this.formattingSettings;
132
+ }
133
+ const shoppingCartSettings = (_a = this.configurationSettings['shopping-cart']) === null || _a === void 0 ? void 0 : _a.reduce((acc, setting) => {
134
+ return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
135
+ }, {});
136
+ const currencySettings = this.getCurrencySettings();
137
+ const dateFormat = (validateDateFormat((_b = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT) !== null && _b !== void 0 ? _b : '') && (shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT)) ||
138
+ DEFAULT_DATE_FORMAT;
139
+ const decimalSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DECIMAL_SEPARATOR;
140
+ const thousandsSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.THOUSANDS_SEPARATOR;
141
+ // the number of decimal places can be 0
142
+ const priceScale = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE;
143
+ const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
144
+ ? Number(priceScale)
145
+ : DEFAULT_DECIMALS_COUNT;
146
+ const actionCodeSettings = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.STATUS_LABEL;
147
+ return {
148
+ currencySymbol: currencySettings.symbol,
149
+ dateFormats: getSupportedDateFormats(dateFormat),
150
+ decimalsCount,
151
+ decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
152
+ ? decimalSeparator
153
+ : DEFAULT_DECIMAL_SEPARATOR,
154
+ // thousands separator can be a blank value, so it can also be null
155
+ thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
156
+ ? thousandsSeparator || ''
157
+ : DEFAULT_THOUSANDS_SEPARATOR,
158
+ actionCodeLabels: (actionCodeSettings === null || actionCodeSettings === void 0 ? void 0 : actionCodeSettings.length)
159
+ ? actionCodeSettings.reduce((result, setting) => (Object.assign(Object.assign({}, result), { [setting.status_label]: setting.custom_label })), {})
160
+ : DEFAULT_ACTION_CODE_LABELS,
161
+ };
162
+ }
163
+ get configurationSettings() {
164
+ return this.configurationSettings$.value;
165
+ }
166
+ getShoppingCartSettings() {
167
+ return this.shoppingCartSettings$.value;
168
+ }
169
+ getCurrencySettings() {
170
+ return this.currencySettings$.value;
171
+ }
172
+ parseConfigurationSettings(settings) {
173
+ return settings.reduce((acc, setting) => {
174
+ switch (setting.key) {
175
+ case 'shopping-cart':
176
+ acc['shopping-cart'] = parseJsonSafely(setting.value, []);
177
+ break;
178
+ case 'navigation':
179
+ acc.navigation = parseJsonSafely(setting.value, {});
180
+ break;
181
+ case 'flows':
182
+ acc.flows = parseJsonSafely(setting.value, []);
183
+ break;
184
+ default:
185
+ acc[setting.key] = setting.value;
186
+ }
187
+ return acc;
188
+ }, {});
189
+ }
190
+ addShoppingCartSettings(settings) {
191
+ // uniqBy removes items with the biggest index
192
+ const newSettings = uniqBy([...settings, ...this.shoppingCartSettings$.value], 'id');
193
+ this.shoppingCartSettings$.next(newSettings);
194
+ }
195
+ }
196
+ RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
197
+ RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService });
198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, decorators: [{
199
+ type: Injectable
200
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
201
+
95
202
  class ContextService {
96
- constructor(contextApiService) {
203
+ constructor(contextApiService, runtimeSettingsService) {
97
204
  this.contextApiService = contextApiService;
205
+ this.runtimeSettingsService = runtimeSettingsService;
98
206
  this.context = new BehaviorSubject(null);
99
207
  }
100
208
  get isInitialized() {
101
209
  return Boolean(this.context.value);
102
210
  }
103
211
  get isInitialized$() {
104
- return this.context.pipe(map(Boolean));
212
+ return this.context.pipe(map$1(Boolean));
105
213
  }
106
214
  get mode() {
107
215
  return this.resolve().properties['#mode'];
108
216
  }
109
217
  get isEditMode$() {
110
- return this.resolve$().pipe(map(() => this.isEditMode));
218
+ return this.resolve$().pipe(map$1(() => this.isEditMode));
111
219
  }
112
220
  get isEditMode() {
113
221
  const context = this.resolve();
@@ -129,10 +237,16 @@ class ContextService {
129
237
  return this.context.pipe(filter((ctx) => Boolean(ctx)));
130
238
  }
131
239
  create(headerId, mode) {
132
- return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
240
+ const configurationSettings = this.runtimeSettingsService.configurationSettings;
241
+ const skipContextRequest = configurationSettings['SKIP_CONTEXT_REQUEST'] === 'true';
242
+ let contextRequest$ = this.contextApiService.getContext(headerId, mode);
243
+ if (skipContextRequest) {
244
+ contextRequest$ = of({});
245
+ }
246
+ return contextRequest$.pipe(tap$1(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map$1(() => this.resolve()));
133
247
  }
134
248
  initTestMode() {
135
- return this.create('TestId', ConfigurationContextMode.TEST).pipe(map(context => {
249
+ return this.create('TestId', ConfigurationContextMode.TEST).pipe(map$1(context => {
136
250
  return this.update({
137
251
  properties: Object.assign(Object.assign({}, context.properties), { RuntimeMode: ConfigurationContextMode.TEST, StartDate: new Date().toISOString().substring(0, 10), standalone: 'true' }),
138
252
  });
@@ -154,11 +268,11 @@ class ContextService {
154
268
  this.context.next(null);
155
269
  }
156
270
  }
157
- ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
271
+ ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }, { token: RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
158
272
  ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService });
159
273
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, decorators: [{
160
274
  type: Injectable
161
- }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
275
+ }], ctorParameters: function () { return [{ type: i1.ContextApiService }, { type: RuntimeSettingsService }]; } });
162
276
 
163
277
  class FlowInfoService {
164
278
  get flow() {
@@ -175,9 +289,10 @@ class FlowInfoService {
175
289
  var _a;
176
290
  return !!((_a = this.flow) === null || _a === void 0 ? void 0 : _a.properties.stateful);
177
291
  }
178
- constructor(flowsApiService, templatesApiService, customizationService) {
292
+ constructor(flowsApiService, templatesApiService, runtimeSettingsService, customizationService) {
179
293
  this.flowsApiService = flowsApiService;
180
294
  this.templatesApiService = templatesApiService;
295
+ this.runtimeSettingsService = runtimeSettingsService;
181
296
  this.customizationService = customizationService;
182
297
  this.templates = {};
183
298
  this.defaultTemplates = {
@@ -187,10 +302,20 @@ class FlowInfoService {
187
302
  this.flow$ = this.flowSubj$.asObservable();
188
303
  }
189
304
  init$(flowId, routeQueryParams) {
190
- return this.flowsApiService.getFlow(flowId).pipe(switchMap(flow => this.initFlowTemplates$(flow).pipe(map$1(() => flow))), tap$1(flow => {
305
+ const flows = this.runtimeSettingsService.configurationSettings['flows'];
306
+ const flow = flows === null || flows === void 0 ? void 0 : flows.find(({ id }) => id === flowId);
307
+ if (!flow) {
308
+ return of(undefined);
309
+ }
310
+ const isLegacy = !!flow && (flow === null || flow === void 0 ? void 0 : flow.properties.stateful) == null;
311
+ let flowTemplates$ = of(undefined);
312
+ if (!isLegacy) {
313
+ flowTemplates$ = this.initFlowTemplates$(flow).pipe(map(() => undefined));
314
+ }
315
+ return flowTemplates$.pipe(tap(() => {
191
316
  this.params = Object.assign(Object.assign({}, routeQueryParams), flow.properties.queryParams);
192
317
  this.flowSubj$.next(flow);
193
- }), map$1(noop), catchError(e => {
318
+ }), map(noop), catchError(e => {
194
319
  this.flowSubj$.next(null);
195
320
  return throwError(() => e);
196
321
  }));
@@ -205,7 +330,7 @@ class FlowInfoService {
205
330
  return forkJoin([
206
331
  this.templatesApiService.fetchTemplates$(),
207
332
  (_c = (_b = (_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplates) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : of([]),
208
- ]).pipe(map$1(([templates, localTemplates]) => {
333
+ ]).pipe(map(([templates, localTemplates]) => {
209
334
  Object.entries(Object.assign(Object.assign({}, this.defaultTemplates), flow.properties.templates)).forEach(([key, name]) => {
210
335
  var _a;
211
336
  const type = this.remapTemplateName(key);
@@ -242,12 +367,12 @@ class FlowInfoService {
242
367
  return undefined;
243
368
  }
244
369
  }
245
- FlowInfoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, deps: [{ token: i1.FlowsApiService }, { token: i1.UITemplatesApiService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
370
+ FlowInfoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, deps: [{ token: i1.FlowsApiService }, { token: i1.UITemplatesApiService }, { token: RuntimeSettingsService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
246
371
  FlowInfoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService });
247
372
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, decorators: [{
248
373
  type: Injectable
249
374
  }], ctorParameters: function () {
250
- return [{ type: i1.FlowsApiService }, { type: i1.UITemplatesApiService }, { type: undefined, decorators: [{
375
+ return [{ type: i1.FlowsApiService }, { type: i1.UITemplatesApiService }, { type: RuntimeSettingsService }, { type: undefined, decorators: [{
251
376
  type: Optional
252
377
  }, {
253
378
  type: Inject,
@@ -278,14 +403,14 @@ class QuoteDraftService {
278
403
  }
279
404
  }
280
405
  get hasProducts$() {
281
- return this.quoteSubj$.pipe(map(() => this.hasProducts));
406
+ return this.quoteSubj$.pipe(map$1(() => this.hasProducts));
282
407
  }
283
408
  get hasProducts() {
284
409
  var _a;
285
410
  return Boolean((_a = this.quoteSubj$.value) === null || _a === void 0 ? void 0 : _a.currentState.length);
286
411
  }
287
412
  get hasAssets$() {
288
- return this.assetsSubj$.pipe(map(() => this.hasAssets));
413
+ return this.assetsSubj$.pipe(map$1(() => this.hasAssets));
289
414
  }
290
415
  get hasAssets() {
291
416
  var _a;
@@ -294,11 +419,12 @@ class QuoteDraftService {
294
419
  get assetsState() {
295
420
  return this.assetsSubj$.value;
296
421
  }
297
- constructor(context, flowInfoService, accountApiService, quoteApiService) {
422
+ constructor(context, flowInfoService, accountApiService, quoteApiService, runtimeSettingsService) {
298
423
  this.context = context;
299
424
  this.flowInfoService = flowInfoService;
300
425
  this.accountApiService = accountApiService;
301
426
  this.quoteApiService = quoteApiService;
427
+ this.runtimeSettingsService = runtimeSettingsService;
302
428
  this.quoteSubj$ = new BehaviorSubject(null);
303
429
  this.assetsSubj$ = new BehaviorSubject(null);
304
430
  this.resetSubj$ = new BehaviorSubject(true);
@@ -307,7 +433,7 @@ class QuoteDraftService {
307
433
  this._hasUnsavedChanges = false;
308
434
  this.reset$ = this.resetSubj$.asObservable();
309
435
  this.isInitializedSubj$
310
- .pipe(filter(isInitialized => isInitialized), switchMap$1(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
436
+ .pipe(filter(isInitialized => isInitialized), switchMap(() => this.quoteSubj$.asObservable()), skip(1), tap$1(quote => this.markAsUpdated(quote)))
311
437
  .subscribe();
312
438
  }
313
439
  reset() {
@@ -318,23 +444,33 @@ class QuoteDraftService {
318
444
  this.hasUnsavedChanges = false;
319
445
  }
320
446
  init(headerId, params) {
447
+ var _a;
321
448
  const ctx = this.context.resolve();
322
449
  const isAccountMode = this.context.mode === ConfigurationContextMode.ACCOUNT;
323
- const accountId = isAccountMode ? headerId : ctx.properties.AccountId;
324
- return zip(accountId ? this.accountApiService.getAssetsState(accountId, params) : of(null), isAccountMode
450
+ const accountId = isAccountMode ? headerId : (_a = ctx.properties) === null || _a === void 0 ? void 0 : _a.AccountId;
451
+ const configurationSettings = this.runtimeSettingsService.configurationSettings;
452
+ const skipAssetsQuery = configurationSettings['SKIP_ASSETS_QUERY'] === 'true';
453
+ let assetRequest$ = of(null);
454
+ if (accountId && !skipAssetsQuery) {
455
+ assetRequest$ = this.accountApiService.getAssetsState(accountId, params);
456
+ }
457
+ return zip(assetRequest$, isAccountMode
325
458
  ? of(QuoteDraft.emptyQuote(ConfigurationContextMode.ACCOUNT))
326
- : this.quoteApiService.getQuoteState(headerId, params)).pipe(tap(([assets, quote]) => {
459
+ : this.quoteApiService.getQuoteState(headerId, params)).pipe(tap$1(([assets, quote]) => {
327
460
  if (assets) {
328
461
  this.assetsSubj$.next(assets);
329
462
  }
463
+ let context;
330
464
  this.quoteSubj$.next(quote);
331
465
  if (assets && isAccountMode) {
332
- this.context.update(assets.context);
466
+ context = assets.context;
333
467
  }
334
468
  else {
335
- this.context.update(quote.context);
469
+ context = quote.context;
336
470
  }
337
- }), map(() => noop()), take(1));
471
+ this.context.update(context);
472
+ this.runtimeSettingsService.initCurrency(context.properties['CurrencyIsoCode']);
473
+ }), map$1(() => noop()), take(1));
338
474
  }
339
475
  finalizeInit() {
340
476
  this.isInitialized = true;
@@ -372,7 +508,7 @@ class QuoteDraftService {
372
508
  this.assetsSubj$.next(assetsState);
373
509
  }
374
510
  get quoteDraft$() {
375
- return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
511
+ return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map$1(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
376
512
  }
377
513
  get quoteDraft() {
378
514
  const quote = this.quoteSubj$.value;
@@ -382,7 +518,7 @@ class QuoteDraftService {
382
518
  return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
383
519
  }
384
520
  get currentState$() {
385
- return this.quoteDraft$.pipe(map(quote => quote.currentState));
521
+ return this.quoteDraft$.pipe(map$1(quote => quote.currentState));
386
522
  }
387
523
  get currentState() {
388
524
  var _a, _b;
@@ -393,13 +529,13 @@ class QuoteDraftService {
393
529
  return (_b = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.standalone) !== null && _b !== void 0 ? _b : false;
394
530
  }
395
531
  get isStandalone$() {
396
- return this.flowInfoService.flow$.pipe(map(() => this.isStandalone));
532
+ return this.flowInfoService.flow$.pipe(map$1(() => this.isStandalone));
397
533
  }
398
534
  getInitialCurrentState() {
399
535
  return this.initialCurrentState;
400
536
  }
401
537
  isEditMode$() {
402
- return this.context.resolve$().pipe(map(() => this.isEditMode()));
538
+ return this.context.resolve$().pipe(map$1(() => this.isEditMode()));
403
539
  }
404
540
  isEditMode() {
405
541
  const context = this.context.resolve();
@@ -420,11 +556,11 @@ class QuoteDraftService {
420
556
  }
421
557
  }
422
558
  }
423
- QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: FlowInfoService }, { token: i1.AccountApiService }, { token: i1.QuoteApiService }], target: i0.ɵɵFactoryTarget.Injectable });
559
+ QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: FlowInfoService }, { token: i1.AccountApiService }, { token: i1.QuoteApiService }, { token: RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
424
560
  QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService });
425
561
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, decorators: [{
426
562
  type: Injectable
427
- }], ctorParameters: function () { return [{ type: ContextService }, { type: FlowInfoService }, { type: i1.AccountApiService }, { type: i1.QuoteApiService }]; } });
563
+ }], ctorParameters: function () { return [{ type: ContextService }, { type: FlowInfoService }, { type: i1.AccountApiService }, { type: i1.QuoteApiService }, { type: RuntimeSettingsService }]; } });
428
564
 
429
565
  class FlowStateService {
430
566
  constructor(contextService, quoteDraftService, flowInfoService, flowConfiguration, processorsApiService, flowStateApiService, quoteApiService, toastService, customizationService) {
@@ -455,55 +591,59 @@ class FlowStateService {
455
591
  all subscriptions get their updates according to updated QuoteDraft
456
592
  */
457
593
  this.isInitialized$()
458
- .pipe(filter$1(Boolean), filter$1(() => !this.getFlowSafe().properties.stateful), switchMap(() => this.flowConfiguration.updated$), switchMap(() => this.executeRequest$({}, true)))
594
+ .pipe(filter$1(Boolean), filter$1(() => !this.getFlowSafe().properties.stateful), switchMap$1(() => this.flowConfiguration.updated$), switchMap$1(() => this.executeRequest$({}, true)))
459
595
  .subscribe();
460
- this.charges$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
596
+ this.charges$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap$1(() => {
461
597
  if (this.flowInfoService.isLegacy) {
462
- return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.charges));
598
+ return this.quoteDraftService.quoteDraft$.pipe(map(quoteDraft => quoteDraft.charges));
463
599
  }
464
600
  else {
465
601
  return this.subscribe$(UITemplateType.FLOW_ENGINE, 'CHARGES', null, {
466
602
  cold: true,
467
- }).pipe(map$1(response => (response.success ? response.result : {})));
603
+ }).pipe(map(response => (response.success ? response.result : {})));
468
604
  }
469
605
  }), shareReplay$1(1));
470
606
  this.charges$.subscribe();
471
- this.pricePlans$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
607
+ this.pricePlans$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap$1(() => {
472
608
  if (this.flowInfoService.isLegacy) {
473
- return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.pricePlans));
609
+ return this.quoteDraftService.quoteDraft$.pipe(map(quoteDraft => quoteDraft.pricePlans));
474
610
  }
475
611
  else {
476
612
  return this.subscribe$(UITemplateType.FLOW_ENGINE, 'PRICE_PLANS', null, {
477
613
  cold: true,
478
- }).pipe(map$1(response => (response.success ? response.result : {})));
614
+ }).pipe(map(response => (response.success ? response.result : {})));
479
615
  }
480
616
  }), shareReplay$1(1));
481
617
  this.pricePlans$.subscribe();
482
- this.activeMetrics$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
618
+ this.activeMetrics$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap$1(() => {
483
619
  if (this.flowInfoService.isLegacy) {
484
- return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.activeMetrics));
620
+ return this.quoteDraftService.quoteDraft$.pipe(map(quoteDraft => quoteDraft.activeMetrics));
485
621
  }
486
622
  else {
487
623
  return this.subscribe$(UITemplateType.FLOW_ENGINE, 'ACTIVE_METRICS', null, {
488
624
  cold: true,
489
- }).pipe(map$1(response => (response.success ? response.result : [])));
625
+ }).pipe(map(response => (response.success ? response.result : [])));
490
626
  }
491
627
  }), shareReplay$1(1));
492
628
  this.activeMetrics$.subscribe();
493
- this.isPriceListLocked$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
629
+ this.isPriceListLocked$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap$1(() => {
494
630
  if (this.flowInfoService.isLegacy) {
495
631
  return of(false);
496
632
  }
497
633
  else {
498
634
  return this.subscribe$(UITemplateType.FLOW_ENGINE, 'IS_PRICE_LIST_LOCKED', null, {
499
635
  cold: true,
500
- }).pipe(map$1(response => (response.success ? response.result : false)));
636
+ }).pipe(map(response => (response.success ? response.result : false)));
501
637
  }
502
638
  }), shareReplay$1(1));
503
639
  this.isPriceListLocked$.subscribe();
504
640
  }
505
641
  init$() {
506
- return this.initProcessors$().pipe(switchMap(() => {
642
+ let processors$ = this.initProcessors$();
643
+ if (this.flowInfoService.isLegacy) {
644
+ processors$ = of(undefined);
645
+ }
646
+ return processors$.pipe(switchMap$1(() => {
507
647
  if (this.getFlowSafe().properties.stateful) {
508
648
  return this.initStateful$();
509
649
  }
@@ -535,14 +675,14 @@ class FlowStateService {
535
675
  return this.executionInProgress$.asObservable();
536
676
  }
537
677
  isInitialized$() {
538
- return combineLatest([this.stateId$, this.quoteDraftService.isInitialized$]).pipe(map$1(values => values.some(Boolean)));
678
+ return combineLatest([this.stateId$, this.quoteDraftService.isInitialized$]).pipe(map(values => values.some(Boolean)));
539
679
  }
540
680
  isInitialized() {
541
681
  return Boolean(this.stateId$.value) || this.quoteDraftService.isInitialized;
542
682
  }
543
683
  execute$(scope, exec) {
544
684
  const request = this.execToRequest(scope, exec);
545
- return this.executeRequest$(request).pipe(map$1(result => {
685
+ return this.executeRequest$(request).pipe(map(result => {
546
686
  // Keep only requested results
547
687
  const actualSelectors = Object.entries(result.selectors).reduce((trunk, [requestId, result]) => {
548
688
  var _a;
@@ -555,11 +695,14 @@ class FlowStateService {
555
695
  }));
556
696
  }
557
697
  dispatch$(scope, action, inputData) {
698
+ if (this.flowInfoService.isLegacy) {
699
+ return of(undefined);
700
+ }
558
701
  const exec = {
559
702
  actions: [{ name: action, inputData }],
560
703
  };
561
704
  const request = this.execToRequest(scope, exec);
562
- return this.executeRequest$(request).pipe(map$1(noop));
705
+ return this.executeRequest$(request).pipe(map(noop));
563
706
  }
564
707
  select$(scope, selectorName, inputData) {
565
708
  const requestId = this.generateRequestId(scope, selectorName, inputData);
@@ -571,9 +714,15 @@ class FlowStateService {
571
714
  },
572
715
  },
573
716
  });
574
- return this.executeRequest$(request).pipe(map$1(response => response.selectors[requestId]));
717
+ return this.executeRequest$(request).pipe(map(response => response.selectors[requestId]));
575
718
  }
576
719
  subscribe$(scope, selectorName, inputData, options) {
720
+ if (this.flowInfoService.isLegacy) {
721
+ return of({
722
+ success: false,
723
+ errorMessage: '',
724
+ });
725
+ }
577
726
  const requestId = this.generateRequestId(scope, selectorName, inputData);
578
727
  let subscription = this.subscriptions[requestId];
579
728
  if (!subscription) {
@@ -597,7 +746,7 @@ class FlowStateService {
597
746
  this.executeRequest$(request).subscribe();
598
747
  }
599
748
  }
600
- return subscription.data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map$1(data => data), finalize(() => {
749
+ return subscription.data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map(data => data), finalize(() => {
601
750
  var _a;
602
751
  if (!((_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$.observed)) {
603
752
  delete this.subscriptions[requestId];
@@ -607,7 +756,7 @@ class FlowStateService {
607
756
  save$() {
608
757
  if (this.getFlowSafe().properties.stateful) {
609
758
  if (this.stateId$.value) {
610
- return this.flowStateApiService.save(this.stateId$.value).pipe(tap$1(() => {
759
+ return this.flowStateApiService.save(this.stateId$.value).pipe(tap(() => {
611
760
  Array.from(this.trackedStatefulChangesMap.keys()).forEach(key => {
612
761
  this.trackedStatefulChangesMap.set(key, false);
613
762
  });
@@ -617,8 +766,8 @@ class FlowStateService {
617
766
  else {
618
767
  const quoteDraft = this.quoteDraftService.quoteDraft;
619
768
  if (quoteDraft) {
620
- return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap$1(({ configurationId }) => {
621
- this.contextService.update({ properties: { ConfigurationId: configurationId } });
769
+ return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap(({ versionId }) => {
770
+ this.contextService.update({ properties: { ConfigurationId: versionId } });
622
771
  }));
623
772
  }
624
773
  }
@@ -633,8 +782,8 @@ class FlowStateService {
633
782
  else {
634
783
  const quoteDraft = this.quoteDraftService.quoteDraft;
635
784
  if (quoteDraft) {
636
- return this.quoteApiService.submitQuote(quoteDraft).pipe(tap$1(({ configurationId }) => {
637
- this.contextService.update({ properties: { ConfigurationId: configurationId } });
785
+ return this.quoteApiService.submitQuote(quoteDraft).pipe(tap(({ versionId }) => {
786
+ this.contextService.update({ properties: { ConfigurationId: versionId } });
638
787
  }));
639
788
  }
640
789
  }
@@ -682,7 +831,7 @@ class FlowStateService {
682
831
  const execution$ = this.getFlowSafe().properties.stateful
683
832
  ? this.executeStateful$(fullRequest)
684
833
  : this.executeStateless$(fullRequest);
685
- return execution$.pipe(tap$1(result => this.handleSelectorsResponse(result.selectors)));
834
+ return execution$.pipe(tap(result => this.handleSelectorsResponse(result.selectors)));
686
835
  }
687
836
  handleSelectorsResponse(selectors) {
688
837
  Object.entries(selectors).forEach(([requestId, selectorResult]) => {
@@ -701,7 +850,7 @@ class FlowStateService {
701
850
  var _a;
702
851
  // Subscriptions
703
852
  this.subscribe$(UITemplateType.FLOW_ENGINE, 'CONTEXT', null, { cold: true })
704
- .pipe(tap$1(response => {
853
+ .pipe(tap(response => {
705
854
  if (response.success) {
706
855
  this.contextService.update(response.result);
707
856
  }
@@ -723,13 +872,13 @@ class FlowStateService {
723
872
  selectors: Object.assign(Object.assign({}, selectors), request.selectors),
724
873
  actions: request.actions,
725
874
  })
726
- .pipe(map$1(({ stateId, selectors }) => {
875
+ .pipe(map(({ stateId, selectors }) => {
727
876
  this.handleSelectorsResponse(selectors);
728
877
  this.stateId$.next(stateId);
729
878
  }));
730
879
  }
731
880
  initBufferedRequest$() {
732
- return this.statefulRequestStream$.pipe(buffer(this.statefulRequestStream$.pipe(debounceTime(this.EXECUTION_BUFFER_TIME))), switchMap(requests => {
881
+ return this.statefulRequestStream$.pipe(buffer(this.statefulRequestStream$.pipe(debounceTime(this.EXECUTION_BUFFER_TIME))), switchMap$1(requests => {
733
882
  if (!this.stateId$.value) {
734
883
  throw 'Stateful session is not initialized';
735
884
  }
@@ -743,33 +892,33 @@ class FlowStateService {
743
892
  };
744
893
  this.executionInProgress$.next(true);
745
894
  return this.flowStateApiService.execute(this.stateId$.value, request);
746
- }), tap$1(({ stateId }) => this.stateId$.next(stateId)), share(), tap$1(() => this.executionInProgress$.next(false)), catchError(e => {
895
+ }), tap(({ stateId }) => this.stateId$.next(stateId)), share(), tap(() => this.executionInProgress$.next(false)), catchError(e => {
747
896
  this.executionInProgress$.next(false);
748
897
  return throwError(() => e);
749
898
  }));
750
899
  }
751
900
  executeStateful$(request) {
752
- return this.executionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap(() =>
901
+ return this.executionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap$1(() =>
753
902
  // make sure stream switches to statefulExecutionRequest$ before pushing an execution request
754
903
  combineLatest([
755
904
  this.statefulExecutionRequest$,
756
- of(undefined).pipe(tap$1(() => this.statefulRequestStream$.next(request))),
757
- ])), map$1(([response]) => response), take$1(1));
905
+ of(undefined).pipe(tap(() => this.statefulRequestStream$.next(request))),
906
+ ])), map(([response]) => response), take$1(1));
758
907
  }
759
908
  initStateless$() {
760
909
  var _a;
761
910
  const { headerId } = this.contextService.resolve();
762
- return this.quoteDraftService.init(headerId, (_a = this.flowInfoService.params) !== null && _a !== void 0 ? _a : {}).pipe(tap$1(() => {
911
+ return this.quoteDraftService.init(headerId, (_a = this.flowInfoService.params) !== null && _a !== void 0 ? _a : {}).pipe(tap(() => {
763
912
  const assets = this.quoteDraftService.assetsState;
764
913
  if (assets) {
765
914
  this.flowStore = Object.assign(Object.assign({}, this.flowStore), { assets });
766
915
  }
767
- }), switchMap(() => {
916
+ }), switchMap$1(() => {
768
917
  if (this.flowInfoService.isLegacy) {
769
918
  return of(null);
770
919
  }
771
920
  return this.executeRequest$(this.getDefaultExecutionRequestDTO());
772
- }), switchMap(() => this.calculate$()), tap$1(() => this.quoteDraftService.finalizeInit()), map$1(noop));
921
+ }), switchMap$1(() => this.calculate$()), tap(() => this.quoteDraftService.finalizeInit()), map(noop));
773
922
  }
774
923
  calculate$() {
775
924
  var _a;
@@ -793,7 +942,7 @@ class FlowStateService {
793
942
  }
794
943
  executeStateless$(request) {
795
944
  this.executionInProgress$.next(true);
796
- return of(undefined).pipe(tap$1(() => this.executeStatelessActions(request)), switchMap(() => {
945
+ return of(undefined).pipe(tap(() => this.executeStatelessActions(request)), switchMap$1(() => {
797
946
  var _a;
798
947
  /*
799
948
  Skip price calculation in case
@@ -806,7 +955,7 @@ class FlowStateService {
806
955
  else {
807
956
  return this.calculate$();
808
957
  }
809
- }), map$1(() => this.executeStatelessSelectors(request)), tap$1(() => this.executionInProgress$.next(false)), catchError(e => {
958
+ }), map(() => this.executeStatelessSelectors(request)), tap(() => this.executionInProgress$.next(false)), catchError(e => {
810
959
  this.executionInProgress$.next(false);
811
960
  return throwError(() => e);
812
961
  }));
@@ -874,7 +1023,7 @@ class FlowStateService {
874
1023
  return;
875
1024
  }
876
1025
  const localProcessors$ = (_c = (_b = (_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplateConfigurationProcessors) === null || _b === void 0 ? void 0 : _b.call(_a, template.name)) !== null && _c !== void 0 ? _c : of(null);
877
- return localProcessors$.pipe(switchMap(processors => processors ? of(processors) : this.processorsApiService.fetchConfigurationProcessors$(template.id)), tap$1(processors => {
1026
+ return localProcessors$.pipe(switchMap$1(processors => processors ? of(processors) : this.processorsApiService.fetchConfigurationProcessors$(template.id)), tap(processors => {
878
1027
  const processorsMap = processors.reduce((acc, p) => {
879
1028
  acc[p.apiName] = p;
880
1029
  return acc;
@@ -886,7 +1035,7 @@ class FlowStateService {
886
1035
  if (!owners$.length) {
887
1036
  return of(undefined);
888
1037
  }
889
- return forkJoin(owners$).pipe(map$1(noop));
1038
+ return forkJoin(owners$).pipe(map(noop));
890
1039
  }
891
1040
  executeActionScript(request, executable) {
892
1041
  var _a;
@@ -1316,113 +1465,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1316
1465
  type: Injectable
1317
1466
  }] });
1318
1467
 
1319
- class RuntimeSettingsService {
1320
- constructor(configurationSettingsApiService) {
1321
- this.configurationSettingsApiService = configurationSettingsApiService;
1322
- this.configurationSettings$ = new BehaviorSubject({});
1323
- this.currencySettings$ = new BehaviorSubject({
1324
- iso: DEFAULT_CURRENCY_ISO_CODE,
1325
- symbol: DEFAULT_CURRENCY_SYMBOL,
1326
- });
1327
- this.shoppingCartSettings$ = new BehaviorSubject([]);
1328
- this.getCurrencySymbol = (locale, currency) => {
1329
- return (0)
1330
- .toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
1331
- .replace(/\d/g, '')
1332
- .trim();
1333
- };
1334
- }
1335
- create() {
1336
- return this.configurationSettingsApiService.fetchSettings().pipe(map$1(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
1337
- var _a;
1338
- this.configurationSettings$.next(configurationSettings);
1339
- this.addShoppingCartSettings((_a = configurationSettings['shopping-cart']) !== null && _a !== void 0 ? _a : []);
1340
- this.formattingSettings = this.getFormattingSettings();
1341
- }), map$1(() => undefined));
1342
- }
1343
- initCurrency(iso) {
1344
- if (iso) {
1345
- const symbol = this.getCurrencySymbol('en-US', iso);
1346
- this.currencySettings$.next({ iso, symbol });
1347
- if (this.formattingSettings) {
1348
- this.formattingSettings.currencySymbol = symbol;
1349
- }
1350
- }
1351
- }
1352
- getFormattingSettings() {
1353
- var _a, _b;
1354
- if (this.formattingSettings) {
1355
- return this.formattingSettings;
1356
- }
1357
- const shoppingCartSettings = (_a = this.getConfigurationSettings()['shopping-cart']) === null || _a === void 0 ? void 0 : _a.reduce((acc, setting) => {
1358
- return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
1359
- }, {});
1360
- const currencySettings = this.getCurrencySettings();
1361
- const dateFormat = (validateDateFormat((_b = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT) !== null && _b !== void 0 ? _b : '') && (shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT)) ||
1362
- DEFAULT_DATE_FORMAT;
1363
- const decimalSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DECIMAL_SEPARATOR;
1364
- const thousandsSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.THOUSANDS_SEPARATOR;
1365
- // the number of decimal places can be 0
1366
- const priceScale = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE;
1367
- const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
1368
- ? Number(priceScale)
1369
- : DEFAULT_DECIMALS_COUNT;
1370
- const actionCodeSettings = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.STATUS_LABEL;
1371
- return {
1372
- currencySymbol: currencySettings.symbol,
1373
- dateFormats: getSupportedDateFormats(dateFormat),
1374
- decimalsCount,
1375
- decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
1376
- ? decimalSeparator
1377
- : DEFAULT_DECIMAL_SEPARATOR,
1378
- // thousands separator can be a blank value, so it can also be null
1379
- thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
1380
- ? thousandsSeparator || ''
1381
- : DEFAULT_THOUSANDS_SEPARATOR,
1382
- actionCodeLabels: (actionCodeSettings === null || actionCodeSettings === void 0 ? void 0 : actionCodeSettings.length)
1383
- ? actionCodeSettings.reduce((result, setting) => (Object.assign(Object.assign({}, result), { [setting.status_label]: setting.custom_label })), {})
1384
- : DEFAULT_ACTION_CODE_LABELS,
1385
- };
1386
- }
1387
- getConfigurationSettings() {
1388
- return this.configurationSettings$.value;
1389
- }
1390
- getShoppingCartSettings() {
1391
- return this.shoppingCartSettings$.value;
1392
- }
1393
- getCurrencySettings() {
1394
- return this.currencySettings$.value;
1395
- }
1396
- parseConfigurationSettings(settings) {
1397
- return settings.reduce((acc, setting) => {
1398
- switch (setting.key) {
1399
- case 'shopping-cart':
1400
- acc['shopping-cart'] = parseJsonSafely(setting.value, []);
1401
- break;
1402
- case 'navigation':
1403
- acc.navigation = parseJsonSafely(setting.value, {});
1404
- break;
1405
- case 'flows':
1406
- acc.flows = parseJsonSafely(setting.value, []);
1407
- break;
1408
- default:
1409
- acc[setting.key] = setting.value;
1410
- }
1411
- return acc;
1412
- }, {});
1413
- }
1414
- addShoppingCartSettings(settings) {
1415
- // uniqBy removes items with the biggest index
1416
- const newSettings = uniqBy([...settings, ...this.shoppingCartSettings$.value], 'id');
1417
- this.shoppingCartSettings$.next(newSettings);
1418
- }
1419
- }
1420
- RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1421
- RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService });
1422
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, decorators: [{
1423
- type: Injectable
1424
- }], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
1425
-
1426
1468
  class ConfigurationService {
1427
1469
  constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService, runtimeSettings) {
1428
1470
  this.quoteDraftService = quoteDraftService;
@@ -1460,7 +1502,7 @@ class ConfigurationService {
1460
1502
  const prevState = this.configurationState.value;
1461
1503
  this.configurationState.next(prevState ? Object.assign({}, prevState) : null);
1462
1504
  return throwError(() => error);
1463
- }), tap(() => {
1505
+ }), tap$1(() => {
1464
1506
  if (!this.hasUnsavedChanges) {
1465
1507
  this.hasUnsavedChanges = true;
1466
1508
  }
@@ -1473,7 +1515,7 @@ class ConfigurationService {
1473
1515
  this.configurableRamp = lineItem;
1474
1516
  }
1475
1517
  get() {
1476
- return this.configurationState.pipe(map(state => state === null || state === void 0 ? void 0 : state.lineItem), shareReplay$1());
1518
+ return this.configurationState.pipe(map$1(state => state === null || state === void 0 ? void 0 : state.lineItem), shareReplay$1());
1477
1519
  }
1478
1520
  getSnapshot() {
1479
1521
  var _a, _b;
@@ -1506,21 +1548,21 @@ class ConfigurationService {
1506
1548
  return this.contextService.resolve$();
1507
1549
  }
1508
1550
  get charges$() {
1509
- return this.configurationState.pipe(map(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.charges) !== null && _a !== void 0 ? _a : {}; }));
1551
+ return this.configurationState.pipe(map$1(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.charges) !== null && _a !== void 0 ? _a : {}; }));
1510
1552
  }
1511
1553
  get chargesSnapshot() {
1512
1554
  var _a, _b;
1513
1555
  return (_b = (_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.charges) !== null && _b !== void 0 ? _b : {};
1514
1556
  }
1515
1557
  get pricePlans$() {
1516
- return this.configurationState.pipe(map(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.pricePlans) !== null && _a !== void 0 ? _a : {}; }));
1558
+ return this.configurationState.pipe(map$1(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.pricePlans) !== null && _a !== void 0 ? _a : {}; }));
1517
1559
  }
1518
1560
  get pricePlansSnapshot() {
1519
1561
  var _a, _b;
1520
1562
  return (_b = (_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.pricePlans) !== null && _b !== void 0 ? _b : {};
1521
1563
  }
1522
1564
  get procedureContext$() {
1523
- return this.configurationState.pipe(map(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.procedureContext) !== null && _a !== void 0 ? _a : {}; }));
1565
+ return this.configurationState.pipe(map$1(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.procedureContext) !== null && _a !== void 0 ? _a : {}; }));
1524
1566
  }
1525
1567
  get procedureContextSnapshot() {
1526
1568
  var _a, _b;
@@ -1536,7 +1578,7 @@ class ConfigurationService {
1536
1578
  const uiDefinitionProperties = this.getUIDefinitionProperties();
1537
1579
  const mainPricingEnabled = (_a = runtimeContext.properties) === null || _a === void 0 ? void 0 : _a.PricingEnabled;
1538
1580
  const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
1539
- const customPriceApi = this.runtimeSettings.getConfigurationSettings()['CUSTOM_PRICE_API'];
1581
+ const customPriceApi = this.runtimeSettings.configurationSettings['CUSTOM_PRICE_API'];
1540
1582
  this.isLoadingSubj$.next(true);
1541
1583
  const configure$ = pricingEnabled && customPriceApi
1542
1584
  ? this.configurationApiService.customConfigurePrice({ url: customPriceApi, configurationRequest, runtimeModel })
@@ -1545,7 +1587,7 @@ class ConfigurationService {
1545
1587
  runtimeModel,
1546
1588
  pricingEnabled,
1547
1589
  });
1548
- return configure$.pipe(tap(result => {
1590
+ return configure$.pipe(tap$1(result => {
1549
1591
  var _a;
1550
1592
  this.contextService.update(result.context);
1551
1593
  this.configurationState.next(result);
@@ -1553,7 +1595,7 @@ class ConfigurationService {
1553
1595
  this.showInactiveProductsConfirmation();
1554
1596
  }
1555
1597
  this.configurableRamp = result.lineItem;
1556
- }), map(({ lineItem }) => lineItem), catchError$1(error => throwError(() => {
1598
+ }), map$1(({ lineItem }) => lineItem), catchError$1(error => throwError(() => {
1557
1599
  if (error.error) {
1558
1600
  return extractErrorDetails(error.error).join('. ');
1559
1601
  }
@@ -1563,7 +1605,7 @@ class ConfigurationService {
1563
1605
  configureExternal$(props) {
1564
1606
  return this.runtimeService
1565
1607
  .init({ productId: props.productId, defaultQty: props.qty, attributesMap: props.attributesMap })
1566
- .pipe(switchMap$1(() => this.configure()), first(), catchError$1(error => {
1608
+ .pipe(switchMap(() => this.configure()), first(), catchError$1(error => {
1567
1609
  this.messageService.add({ severity: ToastType.error, summary: error });
1568
1610
  throw error;
1569
1611
  }), finalize$1(() => this.reset()));
@@ -1668,14 +1710,14 @@ class FlowConfigurationService {
1668
1710
  this.updated$ = this.updatedSubj$.asObservable();
1669
1711
  }
1670
1712
  calculate$(quoteDraft) {
1671
- return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
1713
+ return this.proceduresApiService.apply$(quoteDraft).pipe(tap(result => {
1672
1714
  // sort the result current state based on the quote draft initial state
1673
1715
  const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
1674
1716
  result.currentState = result.currentState
1675
1717
  .slice()
1676
1718
  .sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
1677
1719
  this.quoteDraftService.updateQuoteDraft(result);
1678
- }), map$1(noop));
1720
+ }), map(noop));
1679
1721
  }
1680
1722
  calculate(quoteDraft) {
1681
1723
  this.calculate$(quoteDraft).subscribe();
@@ -1685,11 +1727,11 @@ class FlowConfigurationService {
1685
1727
  if (!quoteDraft) {
1686
1728
  return of(null);
1687
1729
  }
1688
- return of([]).pipe(map$1(() => {
1730
+ return of([]).pipe(map(() => {
1689
1731
  const updatedState = cloneDeep(quoteDraft.currentState);
1690
1732
  this.updateService.update(updatedState, updates, quoteDraft.charges);
1691
1733
  return updatedState;
1692
- }), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1734
+ }), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map(() => this.quoteDraftService.quoteDraft), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1693
1735
  }
1694
1736
  update(updates) {
1695
1737
  this.update$(updates).subscribe();
@@ -1706,9 +1748,9 @@ class FlowConfigurationService {
1706
1748
  }
1707
1749
  const updatedState = cloneDeep(currentState);
1708
1750
  updatedState.splice(currentLineItemIndex, 1, initialLineItem);
1709
- return of([]).pipe(tap$1(() => {
1751
+ return of([]).pipe(tap(() => {
1710
1752
  this.quoteDraftService.setCurrentLineItemState(updatedState);
1711
- }), switchMap(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1753
+ }), switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map(() => this.quoteDraftService.quoteDraft), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1712
1754
  }
1713
1755
  revert(lineItemId) {
1714
1756
  this.revert$(lineItemId).subscribe();
@@ -1719,7 +1761,7 @@ class FlowConfigurationService {
1719
1761
  if (!quoteDraft) {
1720
1762
  return of(null);
1721
1763
  }
1722
- return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1764
+ return of([]).pipe(map(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map(() => this.quoteDraftService.quoteDraft), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1723
1765
  }
1724
1766
  delete(ids) {
1725
1767
  this.delete$(ids).subscribe();
@@ -1730,36 +1772,36 @@ class FlowConfigurationService {
1730
1772
  return of(null);
1731
1773
  }
1732
1774
  const updatedState = [...quoteDraft.currentState, term];
1733
- return of([]).pipe(switchMap(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1775
+ return of([]).pipe(switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map(() => this.quoteDraftService.quoteDraft), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1734
1776
  }
1735
1777
  addToCart$(props) {
1736
1778
  const quoteDraft = this.quoteDraftService.quoteDraft;
1737
1779
  if (!quoteDraft) {
1738
1780
  return of(null);
1739
1781
  }
1740
- return this.configurationService.configureExternal$(props).pipe(map$1(lineItem => {
1782
+ return this.configurationService.configureExternal$(props).pipe(map(lineItem => {
1741
1783
  var _a, _b, _c;
1742
1784
  const model = this.configurationService.getRuntimeModel();
1743
1785
  const split = (_b = (_a = model === null || model === void 0 ? void 0 : model.types.find(type => type.name === lineItem.type)) === null || _a === void 0 ? void 0 : _a.split) !== null && _b !== void 0 ? _b : false;
1744
1786
  const lineItems = multiplyLineItems(lineItem, (_c = props.qty) !== null && _c !== void 0 ? _c : 1, split);
1745
1787
  return [...quoteDraft.currentState, ...lineItems];
1746
- }), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1788
+ }), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map(() => this.quoteDraftService.quoteDraft), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1747
1789
  }
1748
1790
  get() {
1749
- return this.quoteDraftService.quoteDraft$.pipe(map$1(() => this.quoteDraftService.currentState), shareReplay$1());
1791
+ return this.quoteDraftService.quoteDraft$.pipe(map(() => this.quoteDraftService.currentState), shareReplay$1());
1750
1792
  }
1751
1793
  getSnapshot() {
1752
1794
  var _a, _b;
1753
1795
  return (_b = (_a = this.quoteDraftService) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
1754
1796
  }
1755
1797
  get charges$() {
1756
- return this.quoteDraftService.quoteDraft$.pipe(map$1(({ charges }) => charges));
1798
+ return this.quoteDraftService.quoteDraft$.pipe(map(({ charges }) => charges));
1757
1799
  }
1758
1800
  get pricePlans$() {
1759
- return this.quoteDraftService.quoteDraft$.pipe(map$1(({ pricePlans }) => pricePlans));
1801
+ return this.quoteDraftService.quoteDraft$.pipe(map(({ pricePlans }) => pricePlans));
1760
1802
  }
1761
1803
  get activeMetrics$() {
1762
- return this.quoteDraftService.quoteDraft$.pipe(map$1(({ activeMetrics }) => activeMetrics));
1804
+ return this.quoteDraftService.quoteDraft$.pipe(map(({ activeMetrics }) => activeMetrics));
1763
1805
  }
1764
1806
  get chargesSnapshot() {
1765
1807
  var _a, _b;
@@ -1835,18 +1877,18 @@ class FlowStateConfigurationService {
1835
1877
  }
1836
1878
  else {
1837
1879
  const lineItem = generateConfigurationLineItem(props, props.qty);
1838
- request$ = this.flowStateApiService.newConfiguration(stateId, { lineItem }).pipe(tap$1(r => this.configurationStateId$.next(r.stateId)), switchMap(() => {
1880
+ request$ = this.flowStateApiService.newConfiguration(stateId, { lineItem }).pipe(tap(r => this.configurationStateId$.next(r.stateId)), switchMap$1(() => {
1839
1881
  if (!this.configurationStateId) {
1840
1882
  return of();
1841
1883
  }
1842
- return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(tap$1(() => this.configurationStateId$.next(null)), map$1(noop));
1884
+ return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(tap(() => this.configurationStateId$.next(null)), map(noop));
1843
1885
  }));
1844
1886
  }
1845
1887
  }
1846
1888
  else {
1847
- request$ = this.flowConfigurationService.addToCart$(props).pipe(map$1(noop));
1889
+ request$ = this.flowConfigurationService.addToCart$(props).pipe(map(noop));
1848
1890
  }
1849
- return request$.pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), map$1(noop));
1891
+ return request$.pipe(switchMap$1(() => this.flowStateService.executeRequest$({}, true)), map(noop));
1850
1892
  }
1851
1893
  }
1852
1894
  FlowStateConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, deps: [{ token: FlowInfoService }, { token: FlowConfigurationService }, { token: i1.FlowStateApiService }, { token: FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -1873,7 +1915,7 @@ class IntegrationState {
1873
1915
  this.action$.next(action);
1874
1916
  }
1875
1917
  listen$(actionType) {
1876
- return this.action$.pipe(filter$1(action => action.type === actionType), map$1(action => action.payload));
1918
+ return this.action$.pipe(filter$1(action => action.type === actionType), map(action => action.payload));
1877
1919
  }
1878
1920
  listenAll$() {
1879
1921
  return this.action$.asObservable();
@@ -1898,12 +1940,12 @@ class ProductImagesService {
1898
1940
  this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: '' }));
1899
1941
  this.fetchProductImage(productId);
1900
1942
  }
1901
- return this.imagesMap$.pipe(map$1(imagesMap => { var _a; return (_a = imagesMap[productId]) !== null && _a !== void 0 ? _a : null; }), distinctUntilChanged());
1943
+ return this.imagesMap$.pipe(map(imagesMap => { var _a; return (_a = imagesMap[productId]) !== null && _a !== void 0 ? _a : null; }), distinctUntilChanged());
1902
1944
  }
1903
1945
  fetchProductImage(productId) {
1904
1946
  this.productApiService
1905
1947
  .fetchImage$(productId)
1906
- .pipe(map$1(file => URL.createObjectURL(file)), catchError(() => of('')), tap$1(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
1948
+ .pipe(map(file => URL.createObjectURL(file)), catchError(() => of('')), tap(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
1907
1949
  .subscribe();
1908
1950
  }
1909
1951
  }
@@ -1918,7 +1960,7 @@ class RuntimeContextService {
1918
1960
  this.configurationApiService = configurationApiService;
1919
1961
  }
1920
1962
  getRuntimeContext(productId, offeringId) {
1921
- return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
1963
+ return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map$1(runtimeData => {
1922
1964
  var _a;
1923
1965
  const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
1924
1966
  const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
@@ -1972,7 +2014,7 @@ class ConfigurationRuntimeService {
1972
2014
  return combineLatest([
1973
2015
  this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
1974
2016
  this.contextService.initTestMode(),
1975
- ]).pipe(first(), map(([runtimeData, context]) => {
2017
+ ]).pipe(first(), map$1(([runtimeData, context]) => {
1976
2018
  var _a;
1977
2019
  this.contextService.update({
1978
2020
  properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: uiDefinitionContainer.modelId, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', PriceListId: this.uiDefinitionProperties.priceList, offeringId: this.uiDefinitionProperties.offeringId }), uiDefinitionExternals),
@@ -1984,12 +2026,12 @@ class ConfigurationRuntimeService {
1984
2026
  uiDefinitionContainer,
1985
2027
  };
1986
2028
  return this._runtimeContext;
1987
- }), tap(() => (this._isInitialized = true)));
2029
+ }), tap$1(() => (this._isInitialized = true)));
1988
2030
  }
1989
2031
  init(props) {
1990
2032
  this.initializationProps = props;
1991
2033
  const context = this.contextService.resolve();
1992
- return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
2034
+ return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap$1(runtimeContext => {
1993
2035
  var _a, _b, _c, _d;
1994
2036
  this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.source.properties) !== null && _b !== void 0 ? _b : {};
1995
2037
  const { PriceListId } = (_c = context.properties) !== null && _c !== void 0 ? _c : {};
@@ -2002,7 +2044,7 @@ class ConfigurationRuntimeService {
2002
2044
  });
2003
2045
  }
2004
2046
  return this._runtimeContext;
2005
- }), tap(() => (this._isInitialized = true)));
2047
+ }), tap$1(() => (this._isInitialized = true)));
2006
2048
  }
2007
2049
  overrideUIDefinition(uiDefinitionContainer) {
2008
2050
  var _a;
@@ -2060,6 +2102,7 @@ class ConfigurationStateService {
2060
2102
  this.configurationStore = {};
2061
2103
  this.executionInProgress$ = new BehaviorSubject(false);
2062
2104
  this.statefulRequestStream$ = new Subject();
2105
+ this.statelessExecutionRequest$ = null;
2063
2106
  this.statefulExecutionRequest$ = this.initBufferedRequest$();
2064
2107
  }
2065
2108
  get isExecutionInProgress$() {
@@ -2090,7 +2133,7 @@ class ConfigurationStateService {
2090
2133
  }
2091
2134
  execute$(exec) {
2092
2135
  const request = this.execToRequest(exec);
2093
- return this.executeRequest$(request).pipe(map$1(result => {
2136
+ return this.executeRequest$(request).pipe(map(result => {
2094
2137
  // Keep only requested results
2095
2138
  const actualSelectors = Object.entries(result.selectors).reduce((trunk, [requestId, result]) => {
2096
2139
  var _a;
@@ -2107,7 +2150,15 @@ class ConfigurationStateService {
2107
2150
  actions: [{ name: actionName, inputData }],
2108
2151
  };
2109
2152
  const request = this.execToRequest(exec);
2110
- return this.executeRequest$(request);
2153
+ const executionRequest$ = this.executeRequest$(request);
2154
+ if (this.isStatefulConfiguration) {
2155
+ return executionRequest$;
2156
+ }
2157
+ // prevent parallel configuration requests in stateless mode
2158
+ if (!this.statelessExecutionRequest$) {
2159
+ this.statelessExecutionRequest$ = executionRequest$.pipe(shareReplay$1(), take$1(1), finalize(() => (this.statelessExecutionRequest$ = null)));
2160
+ }
2161
+ return this.statelessExecutionRequest$;
2111
2162
  }
2112
2163
  select$(selectorName, inputData = {}) {
2113
2164
  const requestId = UUID.UUID();
@@ -2119,7 +2170,7 @@ class ConfigurationStateService {
2119
2170
  },
2120
2171
  },
2121
2172
  });
2122
- return this.executeRequest$(request).pipe(map$1(response => response.selectors[requestId]));
2173
+ return this.executeRequest$(request).pipe(map(response => response.selectors[requestId]));
2123
2174
  }
2124
2175
  subscribe$(selectorName, inputData = {}, options) {
2125
2176
  const requestId = UUID.UUID();
@@ -2142,7 +2193,7 @@ class ConfigurationStateService {
2142
2193
  this.executeRequest$(request).subscribe();
2143
2194
  }
2144
2195
  }
2145
- return subscription.data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map$1(data => data), distinctUntilChanged(), finalize(() => {
2196
+ return subscription.data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map(data => data), distinctUntilChanged(), finalize(() => {
2146
2197
  var _a;
2147
2198
  if (!((_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$.observed)) {
2148
2199
  delete this.subscriptions[requestId];
@@ -2155,7 +2206,7 @@ class ConfigurationStateService {
2155
2206
  if (this.isStatefulConfiguration) {
2156
2207
  return this.flowStateApiService
2157
2208
  .saveConfiguration((_a = this.flowStateService.stateId) !== null && _a !== void 0 ? _a : '', (_b = this.stateId) !== null && _b !== void 0 ? _b : '')
2158
- .pipe(switchMap(r => this.flowStateService.executeRequest$({}, true).pipe(map$1(() => r))));
2209
+ .pipe(switchMap$1(r => this.flowStateService.executeRequest$({}, true).pipe(map(() => r))));
2159
2210
  }
2160
2211
  else {
2161
2212
  if (!flow) {
@@ -2192,7 +2243,7 @@ class ConfigurationStateService {
2192
2243
  }
2193
2244
  return this.flowConfigurationService
2194
2245
  .calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState, initialState }))
2195
- .pipe(map$1(() => ({ quoteId: '' })));
2246
+ .pipe(map(() => ({ quoteId: '' })));
2196
2247
  }
2197
2248
  }
2198
2249
  }
@@ -2238,13 +2289,13 @@ class ConfigurationStateService {
2238
2289
  selectorsOverride: (_k = container === null || container === void 0 ? void 0 : container.selectors) === null || _k === void 0 ? void 0 : _k.map(processor => (Object.assign(Object.assign({}, processor), { ownerId: this.ownerId }))),
2239
2290
  });
2240
2291
  }
2241
- return request$.pipe(map$1(r => {
2292
+ return request$.pipe(map(r => {
2242
2293
  this.stateId = r.stateId;
2243
2294
  return undefined;
2244
2295
  }));
2245
2296
  }
2246
2297
  initStateless$() {
2247
- return this.configurationService.configure().pipe(map$1(() => undefined));
2298
+ return this.configurationService.configure().pipe(map(() => undefined));
2248
2299
  }
2249
2300
  execToRequest(exec) {
2250
2301
  var _a;
@@ -2291,11 +2342,11 @@ class ConfigurationStateService {
2291
2342
  else {
2292
2343
  execution$ = this.executeStateless$(fullRequest);
2293
2344
  }
2294
- return execution$.pipe(tap$1(result => this.handleSelectorsResponse(result.selectors)));
2345
+ return execution$.pipe(tap(result => this.handleSelectorsResponse(result.selectors)));
2295
2346
  }
2296
2347
  executeStateless$(request) {
2297
2348
  this.executionInProgress$.next(true);
2298
- return of(undefined).pipe(switchMap(() => {
2349
+ return of(undefined).pipe(switchMap$1(() => {
2299
2350
  var _a;
2300
2351
  // Apply actions and execute configuration/price call
2301
2352
  // No need to run configuration if no actions in the request
@@ -2309,7 +2360,7 @@ class ConfigurationStateService {
2309
2360
  });
2310
2361
  configurationRequest = ConfigurationTranslatorUtils.lightenConfigurationRequest(configurationRequest);
2311
2362
  return this.configurationService.configureRequest$(configurationRequest);
2312
- }), map$1(() => {
2363
+ }), map(() => {
2313
2364
  var _a;
2314
2365
  // Run selectors and apply them to the state
2315
2366
  const configurationState = cloneDeep(this.configurationService.stateSnapshot);
@@ -2333,7 +2384,7 @@ class ConfigurationStateService {
2333
2384
  return result;
2334
2385
  }, { stateId: '', selectors: {} });
2335
2386
  return selectorsResult;
2336
- }), tap$1(() => this.executionInProgress$.next(false)), catchError(error => {
2387
+ }), tap(() => this.executionInProgress$.next(false)), catchError(error => {
2337
2388
  this.executionInProgress$.next(false);
2338
2389
  if (!this.configurationRuntimeService.uiDefinitionProperties.suppressToastMessages) {
2339
2390
  this.toastService.add({ severity: ToastType.error, summary: String(error) });
@@ -2342,7 +2393,7 @@ class ConfigurationStateService {
2342
2393
  }));
2343
2394
  }
2344
2395
  initBufferedRequest$() {
2345
- return this.statefulRequestStream$.pipe(buffer(this.statefulRequestStream$.pipe(debounceTime(this.EXECUTION_BUFFER_TIME))), switchMap(requests => {
2396
+ return this.statefulRequestStream$.pipe(buffer(this.statefulRequestStream$.pipe(debounceTime(this.EXECUTION_BUFFER_TIME))), switchMap$1(requests => {
2346
2397
  if (!this.flowStateService.stateId || !this.stateId) {
2347
2398
  throw 'Stateful session is not initialized';
2348
2399
  }
@@ -2356,18 +2407,18 @@ class ConfigurationStateService {
2356
2407
  };
2357
2408
  this.executionInProgress$.next(true);
2358
2409
  return this.flowStateApiService.executeConfiguration(this.flowStateService.stateId, this.stateId, request);
2359
- }), tap$1(({ stateId }) => (this.stateId = stateId)), share(), tap$1(() => this.executionInProgress$.next(false)), catchError(e => {
2410
+ }), tap(({ stateId }) => (this.stateId = stateId)), share(), tap(() => this.executionInProgress$.next(false)), catchError(e => {
2360
2411
  this.executionInProgress$.next(false);
2361
2412
  return throwError(() => e);
2362
2413
  }));
2363
2414
  }
2364
2415
  executeStateful$(request) {
2365
- return this.executionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap(() =>
2416
+ return this.executionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap$1(() =>
2366
2417
  // make sure stream switches to statefulExecutionRequest$ before pushing an execution request
2367
2418
  combineLatest([
2368
2419
  this.statefulExecutionRequest$,
2369
- of(undefined).pipe(tap$1(() => this.statefulRequestStream$.next(request))),
2370
- ])), map$1(([response]) => response), take$1(1));
2420
+ of(undefined).pipe(tap(() => this.statefulRequestStream$.next(request))),
2421
+ ])), map(([response]) => response), take$1(1));
2371
2422
  }
2372
2423
  executeActionScript(request, processor) {
2373
2424
  var _a, _b;