@veloceapps/sdk 10.0.0-48 → 10.0.0-49

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.
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, InjectionToken, Optional, Inject, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
3
- import { UUID, ConfigurationContextMode, ConfigurationContext, UITemplateType, QuoteDraft, isDefined, ConfigurationProcessorTypes, EntityUtil, 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, ChargeGroupUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
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, ConfigurationMode, extractErrorDetails, ConfigurationTranslatorUtils, ChargeGroupUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
4
4
  import * as i1 from '@veloceapps/api';
5
5
  import { ApiModule } from '@veloceapps/api';
6
- 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';
7
- import { map, filter, tap, switchMap as switchMap$1, skip, take, shareReplay, catchError as catchError$1, finalize as finalize$1, first } from 'rxjs/operators';
8
- import { merge, isEqual, cloneDeep, assign, flatten, entries, sortBy, map as map$2, uniqBy, omit, transform } from 'lodash';
6
+ 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';
7
+ 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';
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 { HttpErrorResponse } from '@angular/common/http';
@@ -88,22 +88,128 @@ const generateConfigurationLineItem = (props, qty = 1) => {
88
88
  };
89
89
  };
90
90
 
91
+ class RuntimeSettingsService {
92
+ constructor(configurationSettingsApiService) {
93
+ this.configurationSettingsApiService = configurationSettingsApiService;
94
+ this.configurationSettings$ = new BehaviorSubject({});
95
+ this.currencySettings$ = new BehaviorSubject({
96
+ iso: DEFAULT_CURRENCY_ISO_CODE,
97
+ symbol: DEFAULT_CURRENCY_SYMBOL,
98
+ });
99
+ this.shoppingCartSettings$ = new BehaviorSubject([]);
100
+ this.getCurrencySymbol = (locale, currency) => {
101
+ return (0)
102
+ .toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
103
+ .replace(/\d/g, '')
104
+ .trim();
105
+ };
106
+ }
107
+ create() {
108
+ return this.configurationSettingsApiService.fetchSettings().pipe(map(settings => this.parseConfigurationSettings(settings)), tap(configurationSettings => {
109
+ this.configurationSettings$.next(configurationSettings);
110
+ this.addShoppingCartSettings(configurationSettings['shopping-cart'] ?? []);
111
+ this.formattingSettings = this.getFormattingSettings();
112
+ }), map(() => undefined));
113
+ }
114
+ initCurrency(iso) {
115
+ if (iso) {
116
+ const symbol = this.getCurrencySymbol('en-US', iso);
117
+ this.currencySettings$.next({ iso, symbol });
118
+ if (this.formattingSettings) {
119
+ this.formattingSettings.currencySymbol = symbol;
120
+ }
121
+ }
122
+ }
123
+ getFormattingSettings() {
124
+ if (this.formattingSettings) {
125
+ return this.formattingSettings;
126
+ }
127
+ const shoppingCartSettings = this.configurationSettings['shopping-cart']?.reduce((acc, setting) => {
128
+ return { ...acc, [setting.id]: setting.properties };
129
+ }, {});
130
+ const currencySettings = this.getCurrencySettings();
131
+ const dateFormat = (validateDateFormat(shoppingCartSettings?.DATE_FORMAT ?? '') && shoppingCartSettings?.DATE_FORMAT) ||
132
+ DEFAULT_DATE_FORMAT;
133
+ const decimalSeparator = shoppingCartSettings?.DECIMAL_SEPARATOR;
134
+ const thousandsSeparator = shoppingCartSettings?.THOUSANDS_SEPARATOR;
135
+ // the number of decimal places can be 0
136
+ const priceScale = shoppingCartSettings?.PRICE_SCALE;
137
+ const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
138
+ ? Number(priceScale)
139
+ : DEFAULT_DECIMALS_COUNT;
140
+ const actionCodeSettings = shoppingCartSettings?.STATUS_LABEL;
141
+ return {
142
+ currencySymbol: currencySettings.symbol,
143
+ dateFormats: getSupportedDateFormats(dateFormat),
144
+ decimalsCount,
145
+ decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
146
+ ? decimalSeparator
147
+ : DEFAULT_DECIMAL_SEPARATOR,
148
+ // thousands separator can be a blank value, so it can also be null
149
+ thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
150
+ ? thousandsSeparator || ''
151
+ : DEFAULT_THOUSANDS_SEPARATOR,
152
+ actionCodeLabels: actionCodeSettings?.length
153
+ ? actionCodeSettings.reduce((result, setting) => ({ ...result, [setting.status_label]: setting.custom_label }), {})
154
+ : DEFAULT_ACTION_CODE_LABELS,
155
+ };
156
+ }
157
+ get configurationSettings() {
158
+ return this.configurationSettings$.value;
159
+ }
160
+ getShoppingCartSettings() {
161
+ return this.shoppingCartSettings$.value;
162
+ }
163
+ getCurrencySettings() {
164
+ return this.currencySettings$.value;
165
+ }
166
+ parseConfigurationSettings(settings) {
167
+ return settings.reduce((acc, setting) => {
168
+ switch (setting.key) {
169
+ case 'shopping-cart':
170
+ acc['shopping-cart'] = parseJsonSafely(setting.value, []);
171
+ break;
172
+ case 'navigation':
173
+ acc.navigation = parseJsonSafely(setting.value, {});
174
+ break;
175
+ case 'flows':
176
+ acc.flows = parseJsonSafely(setting.value, []);
177
+ break;
178
+ default:
179
+ acc[setting.key] = setting.value;
180
+ }
181
+ return acc;
182
+ }, {});
183
+ }
184
+ addShoppingCartSettings(settings) {
185
+ // uniqBy removes items with the biggest index
186
+ const newSettings = uniqBy([...settings, ...this.shoppingCartSettings$.value], 'id');
187
+ this.shoppingCartSettings$.next(newSettings);
188
+ }
189
+ }
190
+ RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
191
+ RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService });
192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, decorators: [{
193
+ type: Injectable
194
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
195
+
91
196
  class ContextService {
92
- constructor(contextApiService) {
197
+ constructor(contextApiService, runtimeSettingsService) {
93
198
  this.contextApiService = contextApiService;
199
+ this.runtimeSettingsService = runtimeSettingsService;
94
200
  this.context = new BehaviorSubject(null);
95
201
  }
96
202
  get isInitialized() {
97
203
  return Boolean(this.context.value);
98
204
  }
99
205
  get isInitialized$() {
100
- return this.context.pipe(map(Boolean));
206
+ return this.context.pipe(map$1(Boolean));
101
207
  }
102
208
  get mode() {
103
209
  return this.resolve().properties['#mode'];
104
210
  }
105
211
  get isEditMode$() {
106
- return this.resolve$().pipe(map(() => this.isEditMode));
212
+ return this.resolve$().pipe(map$1(() => this.isEditMode));
107
213
  }
108
214
  get isEditMode() {
109
215
  const context = this.resolve();
@@ -125,10 +231,16 @@ class ContextService {
125
231
  return this.context.pipe(filter((ctx) => Boolean(ctx)));
126
232
  }
127
233
  create(headerId, mode) {
128
- return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
234
+ const configurationSettings = this.runtimeSettingsService.configurationSettings;
235
+ const skipContextRequest = configurationSettings['SKIP_CONTEXT_REQUEST'] === 'true';
236
+ let contextRequest$ = this.contextApiService.getContext(headerId, mode);
237
+ if (skipContextRequest) {
238
+ contextRequest$ = of({});
239
+ }
240
+ return contextRequest$.pipe(tap$1(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map$1(() => this.resolve()));
129
241
  }
130
242
  initTestMode() {
131
- return this.create('TestId', ConfigurationContextMode.TEST).pipe(map(context => {
243
+ return this.create('TestId', ConfigurationContextMode.TEST).pipe(map$1(context => {
132
244
  return this.update({
133
245
  properties: {
134
246
  ...context.properties,
@@ -165,11 +277,11 @@ class ContextService {
165
277
  this.context.next(null);
166
278
  }
167
279
  }
168
- ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
280
+ 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 });
169
281
  ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService });
170
282
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, decorators: [{
171
283
  type: Injectable
172
- }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
284
+ }], ctorParameters: function () { return [{ type: i1.ContextApiService }, { type: RuntimeSettingsService }]; } });
173
285
 
174
286
  const FLOW_CUSTOMIZATION = new InjectionToken('FLOW_CUSTOMIZATION');
175
287
 
@@ -206,9 +318,10 @@ class FlowInfoService {
206
318
  get isStateful() {
207
319
  return !!this.flow?.properties.stateful;
208
320
  }
209
- constructor(flowsApiService, templatesApiService, customizationService) {
321
+ constructor(flowsApiService, templatesApiService, runtimeSettingsService, customizationService) {
210
322
  this.flowsApiService = flowsApiService;
211
323
  this.templatesApiService = templatesApiService;
324
+ this.runtimeSettingsService = runtimeSettingsService;
212
325
  this.customizationService = customizationService;
213
326
  this.templates = {};
214
327
  this.defaultTemplates = {
@@ -218,10 +331,20 @@ class FlowInfoService {
218
331
  this.flow$ = this.flowSubj$.asObservable();
219
332
  }
220
333
  init$(flowId, routeQueryParams) {
221
- return this.flowsApiService.getFlow(flowId).pipe(switchMap(flow => this.initFlowTemplates$(flow).pipe(map$1(() => flow))), tap$1(flow => {
334
+ const flows = this.runtimeSettingsService.configurationSettings['flows'];
335
+ const flow = flows?.find(({ id }) => id === flowId);
336
+ if (!flow) {
337
+ return of(undefined);
338
+ }
339
+ const isLegacy = !!flow && flow?.properties.stateful == null;
340
+ let flowTemplates$ = of(undefined);
341
+ if (!isLegacy) {
342
+ flowTemplates$ = this.initFlowTemplates$(flow).pipe(map(() => undefined));
343
+ }
344
+ return flowTemplates$.pipe(tap(() => {
222
345
  this.params = { ...routeQueryParams, ...flow.properties.queryParams };
223
346
  this.flowSubj$.next(flow);
224
- }), map$1(noop), catchError(e => {
347
+ }), map(noop), catchError(e => {
225
348
  this.flowSubj$.next(null);
226
349
  return throwError(() => e);
227
350
  }));
@@ -235,7 +358,7 @@ class FlowInfoService {
235
358
  return forkJoin([
236
359
  this.templatesApiService.fetchTemplates$(),
237
360
  this.customizationService?.getTemplates?.() ?? of([]),
238
- ]).pipe(map$1(([templates, localTemplates]) => {
361
+ ]).pipe(map(([templates, localTemplates]) => {
239
362
  Object.entries({ ...this.defaultTemplates, ...flow.properties.templates }).forEach(([key, name]) => {
240
363
  const type = this.remapTemplateName(key);
241
364
  if (type) {
@@ -272,11 +395,11 @@ class FlowInfoService {
272
395
  return undefined;
273
396
  }
274
397
  }
275
- 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 });
398
+ 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 });
276
399
  FlowInfoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService });
277
400
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, decorators: [{
278
401
  type: Injectable
279
- }], ctorParameters: function () { return [{ type: i1.FlowsApiService }, { type: i1.UITemplatesApiService }, { type: undefined, decorators: [{
402
+ }], ctorParameters: function () { return [{ type: i1.FlowsApiService }, { type: i1.UITemplatesApiService }, { type: RuntimeSettingsService }, { type: undefined, decorators: [{
280
403
  type: Optional
281
404
  }, {
282
405
  type: Inject,
@@ -305,13 +428,13 @@ class QuoteDraftService {
305
428
  }
306
429
  }
307
430
  get hasProducts$() {
308
- return this.quoteSubj$.pipe(map(() => this.hasProducts));
431
+ return this.quoteSubj$.pipe(map$1(() => this.hasProducts));
309
432
  }
310
433
  get hasProducts() {
311
434
  return Boolean(this.quoteSubj$.value?.currentState.length);
312
435
  }
313
436
  get hasAssets$() {
314
- return this.assetsSubj$.pipe(map(() => this.hasAssets));
437
+ return this.assetsSubj$.pipe(map$1(() => this.hasAssets));
315
438
  }
316
439
  get hasAssets() {
317
440
  return Boolean(this.assetsSubj$.value?.currentState.length);
@@ -319,11 +442,12 @@ class QuoteDraftService {
319
442
  get assetsState() {
320
443
  return this.assetsSubj$.value;
321
444
  }
322
- constructor(context, flowInfoService, accountApiService, quoteApiService) {
445
+ constructor(context, flowInfoService, accountApiService, quoteApiService, runtimeSettingsService) {
323
446
  this.context = context;
324
447
  this.flowInfoService = flowInfoService;
325
448
  this.accountApiService = accountApiService;
326
449
  this.quoteApiService = quoteApiService;
450
+ this.runtimeSettingsService = runtimeSettingsService;
327
451
  this.quoteSubj$ = new BehaviorSubject(null);
328
452
  this.assetsSubj$ = new BehaviorSubject(null);
329
453
  this.resetSubj$ = new BehaviorSubject(true);
@@ -332,7 +456,7 @@ class QuoteDraftService {
332
456
  this._hasUnsavedChanges = false;
333
457
  this.reset$ = this.resetSubj$.asObservable();
334
458
  this.isInitializedSubj$
335
- .pipe(filter(isInitialized => isInitialized), switchMap$1(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
459
+ .pipe(filter(isInitialized => isInitialized), switchMap(() => this.quoteSubj$.asObservable()), skip(1), tap$1(quote => this.markAsUpdated(quote)))
336
460
  .subscribe();
337
461
  }
338
462
  reset() {
@@ -345,21 +469,30 @@ class QuoteDraftService {
345
469
  init(headerId, params) {
346
470
  const ctx = this.context.resolve();
347
471
  const isAccountMode = this.context.mode === ConfigurationContextMode.ACCOUNT;
348
- const accountId = isAccountMode ? headerId : ctx.properties.AccountId;
349
- return zip(accountId ? this.accountApiService.getAssetsState(accountId, params) : of(null), isAccountMode
472
+ const accountId = isAccountMode ? headerId : ctx.properties?.AccountId;
473
+ const configurationSettings = this.runtimeSettingsService.configurationSettings;
474
+ const skipAssetsQuery = configurationSettings['SKIP_ASSETS_QUERY'] === 'true';
475
+ let assetRequest$ = of(null);
476
+ if (accountId && !skipAssetsQuery) {
477
+ assetRequest$ = this.accountApiService.getAssetsState(accountId, params);
478
+ }
479
+ return zip(assetRequest$, isAccountMode
350
480
  ? of(QuoteDraft.emptyQuote(ConfigurationContextMode.ACCOUNT))
351
- : this.quoteApiService.getQuoteState(headerId, params)).pipe(tap(([assets, quote]) => {
481
+ : this.quoteApiService.getQuoteState(headerId, params)).pipe(tap$1(([assets, quote]) => {
352
482
  if (assets) {
353
483
  this.assetsSubj$.next(assets);
354
484
  }
485
+ let context;
355
486
  this.quoteSubj$.next(quote);
356
487
  if (assets && isAccountMode) {
357
- this.context.update(assets.context);
488
+ context = assets.context;
358
489
  }
359
490
  else {
360
- this.context.update(quote.context);
491
+ context = quote.context;
361
492
  }
362
- }), map(() => noop()), take(1));
493
+ this.context.update(context);
494
+ this.runtimeSettingsService.initCurrency(context.properties['CurrencyIsoCode']);
495
+ }), map$1(() => noop()), take(1));
363
496
  }
364
497
  finalizeInit() {
365
498
  this.isInitialized = true;
@@ -408,7 +541,7 @@ class QuoteDraftService {
408
541
  this.assetsSubj$.next(assetsState);
409
542
  }
410
543
  get quoteDraft$() {
411
- return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
544
+ return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map$1(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
412
545
  }
413
546
  get quoteDraft() {
414
547
  const quote = this.quoteSubj$.value;
@@ -421,7 +554,7 @@ class QuoteDraftService {
421
554
  };
422
555
  }
423
556
  get currentState$() {
424
- return this.quoteDraft$.pipe(map(quote => quote.currentState));
557
+ return this.quoteDraft$.pipe(map$1(quote => quote.currentState));
425
558
  }
426
559
  get currentState() {
427
560
  return this.quoteDraft?.currentState ?? [];
@@ -430,13 +563,13 @@ class QuoteDraftService {
430
563
  return this.flowInfoService.flow?.properties.standalone ?? false;
431
564
  }
432
565
  get isStandalone$() {
433
- return this.flowInfoService.flow$.pipe(map(() => this.isStandalone));
566
+ return this.flowInfoService.flow$.pipe(map$1(() => this.isStandalone));
434
567
  }
435
568
  getInitialCurrentState() {
436
569
  return this.initialCurrentState;
437
570
  }
438
571
  isEditMode$() {
439
- return this.context.resolve$().pipe(map(() => this.isEditMode()));
572
+ return this.context.resolve$().pipe(map$1(() => this.isEditMode()));
440
573
  }
441
574
  isEditMode() {
442
575
  const context = this.context.resolve();
@@ -457,11 +590,11 @@ class QuoteDraftService {
457
590
  }
458
591
  }
459
592
  }
460
- 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 });
593
+ 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 });
461
594
  QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService });
462
595
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, decorators: [{
463
596
  type: Injectable
464
- }], ctorParameters: function () { return [{ type: ContextService }, { type: FlowInfoService }, { type: i1.AccountApiService }, { type: i1.QuoteApiService }]; } });
597
+ }], ctorParameters: function () { return [{ type: ContextService }, { type: FlowInfoService }, { type: i1.AccountApiService }, { type: i1.QuoteApiService }, { type: RuntimeSettingsService }]; } });
465
598
 
466
599
  class FlowStateService {
467
600
  constructor(contextService, quoteDraftService, flowInfoService, flowConfiguration, processorsApiService, flowStateApiService, quoteApiService, toastService, customizationService) {
@@ -492,55 +625,59 @@ class FlowStateService {
492
625
  all subscriptions get their updates according to updated QuoteDraft
493
626
  */
494
627
  this.isInitialized$()
495
- .pipe(filter$1(Boolean), filter$1(() => !this.getFlowSafe().properties.stateful), switchMap(() => this.flowConfiguration.updated$), switchMap(() => this.executeRequest$({}, true)))
628
+ .pipe(filter$1(Boolean), filter$1(() => !this.getFlowSafe().properties.stateful), switchMap$1(() => this.flowConfiguration.updated$), switchMap$1(() => this.executeRequest$({}, true)))
496
629
  .subscribe();
497
- this.charges$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
630
+ this.charges$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap$1(() => {
498
631
  if (this.flowInfoService.isLegacy) {
499
- return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.charges));
632
+ return this.quoteDraftService.quoteDraft$.pipe(map(quoteDraft => quoteDraft.charges));
500
633
  }
501
634
  else {
502
635
  return this.subscribe$(UITemplateType.FLOW_ENGINE, 'CHARGES', null, {
503
636
  cold: true,
504
- }).pipe(map$1(response => (response.success ? response.result : {})));
637
+ }).pipe(map(response => (response.success ? response.result : {})));
505
638
  }
506
639
  }), shareReplay$1(1));
507
640
  this.charges$.subscribe();
508
- this.pricePlans$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
641
+ this.pricePlans$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap$1(() => {
509
642
  if (this.flowInfoService.isLegacy) {
510
- return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.pricePlans));
643
+ return this.quoteDraftService.quoteDraft$.pipe(map(quoteDraft => quoteDraft.pricePlans));
511
644
  }
512
645
  else {
513
646
  return this.subscribe$(UITemplateType.FLOW_ENGINE, 'PRICE_PLANS', null, {
514
647
  cold: true,
515
- }).pipe(map$1(response => (response.success ? response.result : {})));
648
+ }).pipe(map(response => (response.success ? response.result : {})));
516
649
  }
517
650
  }), shareReplay$1(1));
518
651
  this.pricePlans$.subscribe();
519
- this.activeMetrics$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
652
+ this.activeMetrics$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap$1(() => {
520
653
  if (this.flowInfoService.isLegacy) {
521
- return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.activeMetrics));
654
+ return this.quoteDraftService.quoteDraft$.pipe(map(quoteDraft => quoteDraft.activeMetrics));
522
655
  }
523
656
  else {
524
657
  return this.subscribe$(UITemplateType.FLOW_ENGINE, 'ACTIVE_METRICS', null, {
525
658
  cold: true,
526
- }).pipe(map$1(response => (response.success ? response.result : [])));
659
+ }).pipe(map(response => (response.success ? response.result : [])));
527
660
  }
528
661
  }), shareReplay$1(1));
529
662
  this.activeMetrics$.subscribe();
530
- this.isPriceListLocked$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
663
+ this.isPriceListLocked$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap$1(() => {
531
664
  if (this.flowInfoService.isLegacy) {
532
665
  return of(false);
533
666
  }
534
667
  else {
535
668
  return this.subscribe$(UITemplateType.FLOW_ENGINE, 'IS_PRICE_LIST_LOCKED', null, {
536
669
  cold: true,
537
- }).pipe(map$1(response => (response.success ? response.result : false)));
670
+ }).pipe(map(response => (response.success ? response.result : false)));
538
671
  }
539
672
  }), shareReplay$1(1));
540
673
  this.isPriceListLocked$.subscribe();
541
674
  }
542
675
  init$() {
543
- return this.initProcessors$().pipe(switchMap(() => {
676
+ let processors$ = this.initProcessors$();
677
+ if (this.flowInfoService.isLegacy) {
678
+ processors$ = of(undefined);
679
+ }
680
+ return processors$.pipe(switchMap$1(() => {
544
681
  if (this.getFlowSafe().properties.stateful) {
545
682
  return this.initStateful$();
546
683
  }
@@ -572,14 +709,14 @@ class FlowStateService {
572
709
  return this.executionInProgress$.asObservable();
573
710
  }
574
711
  isInitialized$() {
575
- return combineLatest([this.stateId$, this.quoteDraftService.isInitialized$]).pipe(map$1(values => values.some(Boolean)));
712
+ return combineLatest([this.stateId$, this.quoteDraftService.isInitialized$]).pipe(map(values => values.some(Boolean)));
576
713
  }
577
714
  isInitialized() {
578
715
  return Boolean(this.stateId$.value) || this.quoteDraftService.isInitialized;
579
716
  }
580
717
  execute$(scope, exec) {
581
718
  const request = this.execToRequest(scope, exec);
582
- return this.executeRequest$(request).pipe(map$1(result => {
719
+ return this.executeRequest$(request).pipe(map(result => {
583
720
  // Keep only requested results
584
721
  const actualSelectors = Object.entries(result.selectors).reduce((trunk, [requestId, result]) => {
585
722
  if (exec.selectors?.[requestId]) {
@@ -591,11 +728,14 @@ class FlowStateService {
591
728
  }));
592
729
  }
593
730
  dispatch$(scope, action, inputData) {
731
+ if (this.flowInfoService.isLegacy) {
732
+ return of(undefined);
733
+ }
594
734
  const exec = {
595
735
  actions: [{ name: action, inputData }],
596
736
  };
597
737
  const request = this.execToRequest(scope, exec);
598
- return this.executeRequest$(request).pipe(map$1(noop));
738
+ return this.executeRequest$(request).pipe(map(noop));
599
739
  }
600
740
  select$(scope, selectorName, inputData) {
601
741
  const requestId = this.generateRequestId(scope, selectorName, inputData);
@@ -607,9 +747,15 @@ class FlowStateService {
607
747
  },
608
748
  },
609
749
  });
610
- return this.executeRequest$(request).pipe(map$1(response => response.selectors[requestId]));
750
+ return this.executeRequest$(request).pipe(map(response => response.selectors[requestId]));
611
751
  }
612
752
  subscribe$(scope, selectorName, inputData, options) {
753
+ if (this.flowInfoService.isLegacy) {
754
+ return of({
755
+ success: false,
756
+ errorMessage: '',
757
+ });
758
+ }
613
759
  const requestId = this.generateRequestId(scope, selectorName, inputData);
614
760
  let subscription = this.subscriptions[requestId];
615
761
  if (!subscription) {
@@ -633,7 +779,7 @@ class FlowStateService {
633
779
  this.executeRequest$(request).subscribe();
634
780
  }
635
781
  }
636
- return subscription.data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map$1(data => data), finalize(() => {
782
+ return subscription.data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map(data => data), finalize(() => {
637
783
  if (!this.subscriptions[requestId]?.data$.observed) {
638
784
  delete this.subscriptions[requestId];
639
785
  }
@@ -642,7 +788,7 @@ class FlowStateService {
642
788
  save$() {
643
789
  if (this.getFlowSafe().properties.stateful) {
644
790
  if (this.stateId$.value) {
645
- return this.flowStateApiService.save(this.stateId$.value).pipe(tap$1(() => {
791
+ return this.flowStateApiService.save(this.stateId$.value).pipe(tap(() => {
646
792
  Array.from(this.trackedStatefulChangesMap.keys()).forEach(key => {
647
793
  this.trackedStatefulChangesMap.set(key, false);
648
794
  });
@@ -652,7 +798,7 @@ class FlowStateService {
652
798
  else {
653
799
  const quoteDraft = this.quoteDraftService.quoteDraft;
654
800
  if (quoteDraft) {
655
- return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap$1(({ versionId }) => {
801
+ return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap(({ versionId }) => {
656
802
  this.contextService.update({ properties: { VELOCPQ__VersionId__c: versionId } });
657
803
  }));
658
804
  }
@@ -668,7 +814,7 @@ class FlowStateService {
668
814
  else {
669
815
  const quoteDraft = this.quoteDraftService.quoteDraft;
670
816
  if (quoteDraft) {
671
- return this.quoteApiService.submitQuote(quoteDraft).pipe(tap$1(({ versionId }) => {
817
+ return this.quoteApiService.submitQuote(quoteDraft).pipe(tap(({ versionId }) => {
672
818
  this.contextService.update({ properties: { VELOCPQ__VersionId__c: versionId } });
673
819
  }));
674
820
  }
@@ -714,7 +860,7 @@ class FlowStateService {
714
860
  const execution$ = this.getFlowSafe().properties.stateful
715
861
  ? this.executeStateful$(fullRequest)
716
862
  : this.executeStateless$(fullRequest);
717
- return execution$.pipe(tap$1(result => this.handleSelectorsResponse(result.selectors)));
863
+ return execution$.pipe(tap(result => this.handleSelectorsResponse(result.selectors)));
718
864
  }
719
865
  handleSelectorsResponse(selectors) {
720
866
  Object.entries(selectors).forEach(([requestId, selectorResult]) => {
@@ -731,7 +877,7 @@ class FlowStateService {
731
877
  initStateful$() {
732
878
  // Subscriptions
733
879
  this.subscribe$(UITemplateType.FLOW_ENGINE, 'CONTEXT', null, { cold: true })
734
- .pipe(tap$1(response => {
880
+ .pipe(tap(response => {
735
881
  if (response.success) {
736
882
  this.contextService.update(response.result);
737
883
  }
@@ -753,13 +899,13 @@ class FlowStateService {
753
899
  selectors: { ...selectors, ...request.selectors },
754
900
  actions: request.actions,
755
901
  })
756
- .pipe(map$1(({ stateId, selectors }) => {
902
+ .pipe(map(({ stateId, selectors }) => {
757
903
  this.handleSelectorsResponse(selectors);
758
904
  this.stateId$.next(stateId);
759
905
  }));
760
906
  }
761
907
  initBufferedRequest$() {
762
- return this.statefulRequestStream$.pipe(buffer(this.statefulRequestStream$.pipe(debounceTime(this.EXECUTION_BUFFER_TIME))), switchMap(requests => {
908
+ return this.statefulRequestStream$.pipe(buffer(this.statefulRequestStream$.pipe(debounceTime(this.EXECUTION_BUFFER_TIME))), switchMap$1(requests => {
763
909
  if (!this.stateId$.value) {
764
910
  throw 'Stateful session is not initialized';
765
911
  }
@@ -773,32 +919,32 @@ class FlowStateService {
773
919
  };
774
920
  this.executionInProgress$.next(true);
775
921
  return this.flowStateApiService.execute(this.stateId$.value, request);
776
- }), tap$1(({ stateId }) => this.stateId$.next(stateId)), share(), tap$1(() => this.executionInProgress$.next(false)), catchError(e => {
922
+ }), tap(({ stateId }) => this.stateId$.next(stateId)), share(), tap(() => this.executionInProgress$.next(false)), catchError(e => {
777
923
  this.executionInProgress$.next(false);
778
924
  return throwError(() => e);
779
925
  }));
780
926
  }
781
927
  executeStateful$(request) {
782
- return this.executionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap(() =>
928
+ return this.executionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap$1(() =>
783
929
  // make sure stream switches to statefulExecutionRequest$ before pushing an execution request
784
930
  combineLatest([
785
931
  this.statefulExecutionRequest$,
786
- of(undefined).pipe(tap$1(() => this.statefulRequestStream$.next(request))),
787
- ])), map$1(([response]) => response), take$1(1));
932
+ of(undefined).pipe(tap(() => this.statefulRequestStream$.next(request))),
933
+ ])), map(([response]) => response), take$1(1));
788
934
  }
789
935
  initStateless$() {
790
936
  const { headerId } = this.contextService.resolve();
791
- return this.quoteDraftService.init(headerId, this.flowInfoService.params ?? {}).pipe(tap$1(() => {
937
+ return this.quoteDraftService.init(headerId, this.flowInfoService.params ?? {}).pipe(tap(() => {
792
938
  const assets = this.quoteDraftService.assetsState;
793
939
  if (assets) {
794
940
  this.flowStore = { ...this.flowStore, assets };
795
941
  }
796
- }), switchMap(() => {
942
+ }), switchMap$1(() => {
797
943
  if (this.flowInfoService.isLegacy) {
798
944
  return of(null);
799
945
  }
800
946
  return this.executeRequest$(this.getDefaultExecutionRequestDTO());
801
- }), switchMap(() => this.calculate$()), tap$1(() => this.quoteDraftService.finalizeInit()), map$1(noop));
947
+ }), switchMap$1(() => this.calculate$()), tap(() => this.quoteDraftService.finalizeInit()), map(noop));
802
948
  }
803
949
  calculate$() {
804
950
  const flowState = this.quoteDraftService.quoteDraft;
@@ -821,7 +967,7 @@ class FlowStateService {
821
967
  }
822
968
  executeStateless$(request) {
823
969
  this.executionInProgress$.next(true);
824
- return of(undefined).pipe(tap$1(() => this.executeStatelessActions(request)), switchMap(() => {
970
+ return of(undefined).pipe(tap(() => this.executeStatelessActions(request)), switchMap$1(() => {
825
971
  /*
826
972
  Skip price calculation in case
827
973
  1. No actions in the request
@@ -833,7 +979,7 @@ class FlowStateService {
833
979
  else {
834
980
  return this.calculate$();
835
981
  }
836
- }), map$1(() => this.executeStatelessSelectors(request)), tap$1(() => this.executionInProgress$.next(false)), catchError(e => {
982
+ }), map(() => this.executeStatelessSelectors(request)), tap(() => this.executionInProgress$.next(false)), catchError(e => {
837
983
  this.executionInProgress$.next(false);
838
984
  return throwError(() => e);
839
985
  }));
@@ -896,7 +1042,7 @@ class FlowStateService {
896
1042
  return;
897
1043
  }
898
1044
  const localProcessors$ = this.customizationService?.getTemplateConfigurationProcessors?.(template.name) ?? of(null);
899
- return localProcessors$.pipe(switchMap(processors => processors ? of(processors) : this.processorsApiService.fetchConfigurationProcessors$(template.id)), tap$1(processors => {
1045
+ return localProcessors$.pipe(switchMap$1(processors => processors ? of(processors) : this.processorsApiService.fetchConfigurationProcessors$(template.id)), tap(processors => {
900
1046
  const processorsMap = processors.reduce((acc, p) => {
901
1047
  acc[p.apiName] = p;
902
1048
  return acc;
@@ -908,7 +1054,7 @@ class FlowStateService {
908
1054
  if (!owners$.length) {
909
1055
  return of(undefined);
910
1056
  }
911
- return forkJoin(owners$).pipe(map$1(noop));
1057
+ return forkJoin(owners$).pipe(map(noop));
912
1058
  }
913
1059
  executeActionScript(request, executable) {
914
1060
  const configurationProcessor = this.processors[executable.ownerId]?.[executable.apiName];
@@ -1191,111 +1337,6 @@ var lineItem_utils = /*#__PURE__*/Object.freeze({
1191
1337
  upsertAttributes: upsertAttributes
1192
1338
  });
1193
1339
 
1194
- class RuntimeSettingsService {
1195
- constructor(configurationSettingsApiService) {
1196
- this.configurationSettingsApiService = configurationSettingsApiService;
1197
- this.configurationSettings$ = new BehaviorSubject({});
1198
- this.currencySettings$ = new BehaviorSubject({
1199
- iso: DEFAULT_CURRENCY_ISO_CODE,
1200
- symbol: DEFAULT_CURRENCY_SYMBOL,
1201
- });
1202
- this.shoppingCartSettings$ = new BehaviorSubject([]);
1203
- this.getCurrencySymbol = (locale, currency) => {
1204
- return (0)
1205
- .toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
1206
- .replace(/\d/g, '')
1207
- .trim();
1208
- };
1209
- }
1210
- create() {
1211
- return this.configurationSettingsApiService.fetchSettings().pipe(map$1(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
1212
- this.configurationSettings$.next(configurationSettings);
1213
- this.addShoppingCartSettings(configurationSettings['shopping-cart'] ?? []);
1214
- this.formattingSettings = this.getFormattingSettings();
1215
- }), map$1(() => undefined));
1216
- }
1217
- initCurrency(iso) {
1218
- if (iso) {
1219
- const symbol = this.getCurrencySymbol('en-US', iso);
1220
- this.currencySettings$.next({ iso, symbol });
1221
- if (this.formattingSettings) {
1222
- this.formattingSettings.currencySymbol = symbol;
1223
- }
1224
- }
1225
- }
1226
- getFormattingSettings() {
1227
- if (this.formattingSettings) {
1228
- return this.formattingSettings;
1229
- }
1230
- const shoppingCartSettings = this.getConfigurationSettings()['shopping-cart']?.reduce((acc, setting) => {
1231
- return { ...acc, [setting.id]: setting.properties };
1232
- }, {});
1233
- const currencySettings = this.getCurrencySettings();
1234
- const dateFormat = (validateDateFormat(shoppingCartSettings?.DATE_FORMAT ?? '') && shoppingCartSettings?.DATE_FORMAT) ||
1235
- DEFAULT_DATE_FORMAT;
1236
- const decimalSeparator = shoppingCartSettings?.DECIMAL_SEPARATOR;
1237
- const thousandsSeparator = shoppingCartSettings?.THOUSANDS_SEPARATOR;
1238
- // the number of decimal places can be 0
1239
- const priceScale = shoppingCartSettings?.PRICE_SCALE;
1240
- const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
1241
- ? Number(priceScale)
1242
- : DEFAULT_DECIMALS_COUNT;
1243
- const actionCodeSettings = shoppingCartSettings?.STATUS_LABEL;
1244
- return {
1245
- currencySymbol: currencySettings.symbol,
1246
- dateFormats: getSupportedDateFormats(dateFormat),
1247
- decimalsCount,
1248
- decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
1249
- ? decimalSeparator
1250
- : DEFAULT_DECIMAL_SEPARATOR,
1251
- // thousands separator can be a blank value, so it can also be null
1252
- thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
1253
- ? thousandsSeparator || ''
1254
- : DEFAULT_THOUSANDS_SEPARATOR,
1255
- actionCodeLabels: actionCodeSettings?.length
1256
- ? actionCodeSettings.reduce((result, setting) => ({ ...result, [setting.status_label]: setting.custom_label }), {})
1257
- : DEFAULT_ACTION_CODE_LABELS,
1258
- };
1259
- }
1260
- getConfigurationSettings() {
1261
- return this.configurationSettings$.value;
1262
- }
1263
- getShoppingCartSettings() {
1264
- return this.shoppingCartSettings$.value;
1265
- }
1266
- getCurrencySettings() {
1267
- return this.currencySettings$.value;
1268
- }
1269
- parseConfigurationSettings(settings) {
1270
- return settings.reduce((acc, setting) => {
1271
- switch (setting.key) {
1272
- case 'shopping-cart':
1273
- acc['shopping-cart'] = parseJsonSafely(setting.value, []);
1274
- break;
1275
- case 'navigation':
1276
- acc.navigation = parseJsonSafely(setting.value, {});
1277
- break;
1278
- case 'flows':
1279
- acc.flows = parseJsonSafely(setting.value, []);
1280
- break;
1281
- default:
1282
- acc[setting.key] = setting.value;
1283
- }
1284
- return acc;
1285
- }, {});
1286
- }
1287
- addShoppingCartSettings(settings) {
1288
- // uniqBy removes items with the biggest index
1289
- const newSettings = uniqBy([...settings, ...this.shoppingCartSettings$.value], 'id');
1290
- this.shoppingCartSettings$.next(newSettings);
1291
- }
1292
- }
1293
- RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1294
- RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService });
1295
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, decorators: [{
1296
- type: Injectable
1297
- }], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
1298
-
1299
1340
  class LineItemWorker {
1300
1341
  constructor(src) {
1301
1342
  this.li = { ...src };
@@ -1361,7 +1402,7 @@ class ConfigurationService {
1361
1402
  const prevState = this.configurationState.value;
1362
1403
  this.configurationState.next(prevState ? { ...prevState } : null);
1363
1404
  return throwError(() => error);
1364
- }), tap(() => {
1405
+ }), tap$1(() => {
1365
1406
  if (!this.hasUnsavedChanges) {
1366
1407
  this.hasUnsavedChanges = true;
1367
1408
  }
@@ -1374,7 +1415,7 @@ class ConfigurationService {
1374
1415
  this.configurableRamp = lineItem;
1375
1416
  }
1376
1417
  get() {
1377
- return this.configurationState.pipe(map(state => state?.lineItem), shareReplay$1());
1418
+ return this.configurationState.pipe(map$1(state => state?.lineItem), shareReplay$1());
1378
1419
  }
1379
1420
  getSnapshot() {
1380
1421
  return this.configurationState.value?.lineItem ? { ...this.configurationState.value?.lineItem } : undefined;
@@ -1409,19 +1450,19 @@ class ConfigurationService {
1409
1450
  return this.contextService.resolve$();
1410
1451
  }
1411
1452
  get charges$() {
1412
- return this.configurationState.pipe(map(state => state?.charges ?? {}));
1453
+ return this.configurationState.pipe(map$1(state => state?.charges ?? {}));
1413
1454
  }
1414
1455
  get chargesSnapshot() {
1415
1456
  return this.configurationState.value?.charges ?? {};
1416
1457
  }
1417
1458
  get pricePlans$() {
1418
- return this.configurationState.pipe(map(state => state?.pricePlans ?? {}));
1459
+ return this.configurationState.pipe(map$1(state => state?.pricePlans ?? {}));
1419
1460
  }
1420
1461
  get pricePlansSnapshot() {
1421
1462
  return this.configurationState.value?.pricePlans ?? {};
1422
1463
  }
1423
1464
  get procedureContext$() {
1424
- return this.configurationState.pipe(map(state => state?.procedureContext ?? {}));
1465
+ return this.configurationState.pipe(map$1(state => state?.procedureContext ?? {}));
1425
1466
  }
1426
1467
  get procedureContextSnapshot() {
1427
1468
  return this.configurationState.value?.procedureContext ?? {};
@@ -1435,7 +1476,7 @@ class ConfigurationService {
1435
1476
  const uiDefinitionProperties = this.getUIDefinitionProperties();
1436
1477
  const mainPricingEnabled = runtimeContext.properties?.PricingEnabled;
1437
1478
  const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
1438
- const customPriceApi = this.runtimeSettings.getConfigurationSettings()['CUSTOM_PRICE_API'];
1479
+ const customPriceApi = this.runtimeSettings.configurationSettings['CUSTOM_PRICE_API'];
1439
1480
  this.isLoadingSubj$.next(true);
1440
1481
  const configure$ = pricingEnabled && customPriceApi
1441
1482
  ? this.configurationApiService.customConfigurePrice({ url: customPriceApi, configurationRequest, runtimeModel })
@@ -1444,7 +1485,7 @@ class ConfigurationService {
1444
1485
  runtimeModel,
1445
1486
  pricingEnabled,
1446
1487
  });
1447
- return configure$.pipe(tap(result => {
1488
+ return configure$.pipe(tap$1(result => {
1448
1489
  this.contextService.update(result.context);
1449
1490
  this.configurationState.next(result);
1450
1491
  this.previousConfigurationState.next(cloneDeep(result));
@@ -1452,7 +1493,7 @@ class ConfigurationService {
1452
1493
  this.showInactiveProductsConfirmation();
1453
1494
  }
1454
1495
  this.configurableRamp = result.lineItem;
1455
- }), map(({ lineItem }) => lineItem), catchError$1(error => throwError(() => {
1496
+ }), map$1(({ lineItem }) => lineItem), catchError$1(error => throwError(() => {
1456
1497
  const resetState = this.previousConfigurationState.value;
1457
1498
  if (resetState) {
1458
1499
  this.previousConfigurationState.next(cloneDeep(resetState));
@@ -1467,7 +1508,7 @@ class ConfigurationService {
1467
1508
  configureExternal$(props) {
1468
1509
  return this.runtimeService
1469
1510
  .init({ productId: props.productId, defaultQty: props.qty, attributesMap: props.attributesMap })
1470
- .pipe(switchMap$1(() => this.configure()), first(), catchError$1(error => {
1511
+ .pipe(switchMap(() => this.configure()), first(), catchError$1(error => {
1471
1512
  this.messageService.add({ severity: ToastType.error, summary: error });
1472
1513
  throw error;
1473
1514
  }), finalize$1(() => this.reset()));
@@ -1704,14 +1745,14 @@ class FlowConfigurationService {
1704
1745
  this.updated$ = this.updatedSubj$.asObservable();
1705
1746
  }
1706
1747
  calculate$(quoteDraft) {
1707
- return this.extendedApply$(quoteDraft).pipe(tap$1(result => {
1748
+ return this.extendedApply$(quoteDraft).pipe(tap(result => {
1708
1749
  // sort the result current state based on the quote draft initial state
1709
1750
  const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
1710
1751
  result.currentState = result.currentState
1711
1752
  .slice()
1712
1753
  .sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
1713
1754
  this.quoteDraftService.updateQuoteDraft(result);
1714
- }), map$1(noop));
1755
+ }), map(noop));
1715
1756
  }
1716
1757
  calculate(quoteDraft) {
1717
1758
  this.calculate$(quoteDraft).subscribe();
@@ -1721,11 +1762,11 @@ class FlowConfigurationService {
1721
1762
  if (!quoteDraft) {
1722
1763
  return of(null);
1723
1764
  }
1724
- return of([]).pipe(map$1(() => {
1765
+ return of([]).pipe(map(() => {
1725
1766
  const updatedState = cloneDeep(quoteDraft.currentState);
1726
1767
  this.updateService.update(updatedState, updates, quoteDraft.charges);
1727
1768
  return updatedState;
1728
- }), switchMap(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1769
+ }), switchMap$1(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map(() => this.quoteDraftService.quoteDraft), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1729
1770
  }
1730
1771
  update(updates) {
1731
1772
  this.update$(updates).subscribe();
@@ -1742,9 +1783,9 @@ class FlowConfigurationService {
1742
1783
  }
1743
1784
  const updatedState = cloneDeep(currentState);
1744
1785
  updatedState.splice(currentLineItemIndex, 1, initialLineItem);
1745
- return of([]).pipe(tap$1(() => {
1786
+ return of([]).pipe(tap(() => {
1746
1787
  this.quoteDraftService.setCurrentLineItemState(updatedState);
1747
- }), switchMap(() => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1788
+ }), switchMap$1(() => this.calculate$({ ...quoteDraft, currentState: updatedState })), map(() => this.quoteDraftService.quoteDraft), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1748
1789
  }
1749
1790
  revert(lineItemId) {
1750
1791
  this.revert$(lineItemId).subscribe();
@@ -1755,7 +1796,7 @@ class FlowConfigurationService {
1755
1796
  if (!quoteDraft) {
1756
1797
  return of(null);
1757
1798
  }
1758
- return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1799
+ return of([]).pipe(map(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap$1(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map(() => this.quoteDraftService.quoteDraft), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1759
1800
  }
1760
1801
  delete(ids) {
1761
1802
  this.delete$(ids).subscribe();
@@ -1766,34 +1807,34 @@ class FlowConfigurationService {
1766
1807
  return of(null);
1767
1808
  }
1768
1809
  const updatedState = [...quoteDraft.currentState, term];
1769
- return of([]).pipe(switchMap(() => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1810
+ return of([]).pipe(switchMap$1(() => this.calculate$({ ...quoteDraft, currentState: updatedState })), map(() => this.quoteDraftService.quoteDraft), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1770
1811
  }
1771
1812
  addToCart$(props) {
1772
1813
  const quoteDraft = this.quoteDraftService.quoteDraft;
1773
1814
  if (!quoteDraft) {
1774
1815
  return of(null);
1775
1816
  }
1776
- return this.configurationService.configureExternal$(props).pipe(map$1(lineItem => {
1817
+ return this.configurationService.configureExternal$(props).pipe(map(lineItem => {
1777
1818
  const model = this.configurationService.getRuntimeModel();
1778
1819
  const split = model?.types.find(type => type.name === lineItem.type)?.split ?? false;
1779
1820
  const lineItems = multiplyLineItems(lineItem, props.qty ?? 1, split);
1780
1821
  return [...quoteDraft.currentState, ...lineItems];
1781
- }), switchMap(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1822
+ }), switchMap$1(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map(() => this.quoteDraftService.quoteDraft), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1782
1823
  }
1783
1824
  get() {
1784
- return this.quoteDraftService.quoteDraft$.pipe(map$1(() => this.quoteDraftService.currentState), shareReplay$1());
1825
+ return this.quoteDraftService.quoteDraft$.pipe(map(() => this.quoteDraftService.currentState), shareReplay$1());
1785
1826
  }
1786
1827
  getSnapshot() {
1787
1828
  return this.quoteDraftService?.currentState.slice() ?? [];
1788
1829
  }
1789
1830
  get charges$() {
1790
- return this.quoteDraftService.quoteDraft$.pipe(map$1(({ charges }) => charges));
1831
+ return this.quoteDraftService.quoteDraft$.pipe(map(({ charges }) => charges));
1791
1832
  }
1792
1833
  get pricePlans$() {
1793
- return this.quoteDraftService.quoteDraft$.pipe(map$1(({ pricePlans }) => pricePlans));
1834
+ return this.quoteDraftService.quoteDraft$.pipe(map(({ pricePlans }) => pricePlans));
1794
1835
  }
1795
1836
  get activeMetrics$() {
1796
- return this.quoteDraftService.quoteDraft$.pipe(map$1(({ activeMetrics }) => activeMetrics));
1837
+ return this.quoteDraftService.quoteDraft$.pipe(map(({ activeMetrics }) => activeMetrics));
1797
1838
  }
1798
1839
  get chargesSnapshot() {
1799
1840
  return this.quoteDraftService.quoteDraft?.charges ?? {};
@@ -1873,18 +1914,18 @@ class FlowStateConfigurationService {
1873
1914
  }
1874
1915
  else {
1875
1916
  const lineItem = generateConfigurationLineItem(props, props.qty);
1876
- request$ = this.flowStateApiService.newConfiguration(stateId, { lineItem }).pipe(tap$1(r => this.configurationStateId$.next(r.stateId)), switchMap(() => {
1917
+ request$ = this.flowStateApiService.newConfiguration(stateId, { lineItem }).pipe(tap(r => this.configurationStateId$.next(r.stateId)), switchMap$1(() => {
1877
1918
  if (!this.configurationStateId) {
1878
1919
  return of();
1879
1920
  }
1880
- return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(tap$1(() => this.configurationStateId$.next(null)), map$1(noop));
1921
+ return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(tap(() => this.configurationStateId$.next(null)), map(noop));
1881
1922
  }));
1882
1923
  }
1883
1924
  }
1884
1925
  else {
1885
- request$ = this.flowConfigurationService.addToCart$(props).pipe(map$1(noop));
1926
+ request$ = this.flowConfigurationService.addToCart$(props).pipe(map(noop));
1886
1927
  }
1887
- return request$.pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), map$1(noop));
1928
+ return request$.pipe(switchMap$1(() => this.flowStateService.executeRequest$({}, true)), map(noop));
1888
1929
  }
1889
1930
  }
1890
1931
  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 });
@@ -1911,7 +1952,7 @@ class IntegrationState {
1911
1952
  this.action$.next(action);
1912
1953
  }
1913
1954
  listen$(actionType) {
1914
- return this.action$.pipe(filter$1(action => action.type === actionType), map$1(action => action.payload));
1955
+ return this.action$.pipe(filter$1(action => action.type === actionType), map(action => action.payload));
1915
1956
  }
1916
1957
  listenAll$() {
1917
1958
  return this.action$.asObservable();
@@ -1936,12 +1977,12 @@ class ProductImagesService {
1936
1977
  this.imagesMap$.next({ ...this.imagesMap$.value, [productId]: '' });
1937
1978
  this.fetchProductImage(productId);
1938
1979
  }
1939
- return this.imagesMap$.pipe(map$1(imagesMap => imagesMap[productId] ?? null), distinctUntilChanged());
1980
+ return this.imagesMap$.pipe(map(imagesMap => imagesMap[productId] ?? null), distinctUntilChanged());
1940
1981
  }
1941
1982
  fetchProductImage(productId) {
1942
1983
  this.productApiService
1943
1984
  .fetchImage$(productId)
1944
- .pipe(map$1(file => URL.createObjectURL(file)), catchError(() => of('')), tap$1(url => this.imagesMap$.next({ ...this.imagesMap$.value, [productId]: url })))
1985
+ .pipe(map(file => URL.createObjectURL(file)), catchError(() => of('')), tap(url => this.imagesMap$.next({ ...this.imagesMap$.value, [productId]: url })))
1945
1986
  .subscribe();
1946
1987
  }
1947
1988
  }
@@ -1956,7 +1997,7 @@ class RuntimeContextService {
1956
1997
  this.configurationApiService = configurationApiService;
1957
1998
  }
1958
1999
  getRuntimeContext(productId, offeringId) {
1959
- return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
2000
+ return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map$1(runtimeData => {
1960
2001
  const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
1961
2002
  const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
1962
2003
  const { productName, properties } = Array.from(runtimeModel.components.values()).find(c => c.productId === productId) ?? {};
@@ -2007,7 +2048,7 @@ class ConfigurationRuntimeService {
2007
2048
  return combineLatest([
2008
2049
  this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
2009
2050
  this.contextService.initTestMode(),
2010
- ]).pipe(first(), map(([runtimeData, context]) => {
2051
+ ]).pipe(first(), map$1(([runtimeData, context]) => {
2011
2052
  this.contextService.update({
2012
2053
  properties: {
2013
2054
  ...this.runtimeContext?.properties,
@@ -2026,12 +2067,12 @@ class ConfigurationRuntimeService {
2026
2067
  uiDefinitionContainer,
2027
2068
  };
2028
2069
  return this._runtimeContext;
2029
- }), tap(() => (this._isInitialized = true)));
2070
+ }), tap$1(() => (this._isInitialized = true)));
2030
2071
  }
2031
2072
  init(props) {
2032
2073
  this.initializationProps = props;
2033
2074
  const context = this.contextService.resolve();
2034
- return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
2075
+ return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap$1(runtimeContext => {
2035
2076
  this.uiDefinitionProperties = runtimeContext.uiDefinitionContainer?.source.properties ?? {};
2036
2077
  const { PriceListId } = context.properties ?? {};
2037
2078
  const mergeContext = {
@@ -2053,7 +2094,7 @@ class ConfigurationRuntimeService {
2053
2094
  });
2054
2095
  }
2055
2096
  return this._runtimeContext;
2056
- }), tap(() => (this._isInitialized = true)));
2097
+ }), tap$1(() => (this._isInitialized = true)));
2057
2098
  }
2058
2099
  overrideUIDefinition(uiDefinitionContainer) {
2059
2100
  if (!this._runtimeContext) {
@@ -2140,7 +2181,7 @@ class ConfigurationStateService {
2140
2181
  }
2141
2182
  execute$(exec) {
2142
2183
  const request = this.execToRequest(exec);
2143
- return this.executeRequest$(request).pipe(map$1(result => {
2184
+ return this.executeRequest$(request).pipe(map(result => {
2144
2185
  // Keep only requested results
2145
2186
  const actualSelectors = Object.entries(result.selectors).reduce((trunk, [requestId, result]) => {
2146
2187
  if (exec.selectors?.[requestId]) {
@@ -2176,7 +2217,7 @@ class ConfigurationStateService {
2176
2217
  },
2177
2218
  },
2178
2219
  });
2179
- return this.executeRequest$(request).pipe(map$1(response => response.selectors[requestId]));
2220
+ return this.executeRequest$(request).pipe(map(response => response.selectors[requestId]));
2180
2221
  }
2181
2222
  subscribe$(selectorName, inputData = {}, options) {
2182
2223
  const requestId = UUID.UUID();
@@ -2199,7 +2240,7 @@ class ConfigurationStateService {
2199
2240
  this.executeRequest$(request).subscribe();
2200
2241
  }
2201
2242
  }
2202
- return subscription.data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map$1(data => data), distinctUntilChanged(), finalize(() => {
2243
+ return subscription.data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map(data => data), distinctUntilChanged(), finalize(() => {
2203
2244
  if (!this.subscriptions[requestId]?.data$.observed) {
2204
2245
  delete this.subscriptions[requestId];
2205
2246
  }
@@ -2210,7 +2251,7 @@ class ConfigurationStateService {
2210
2251
  if (this.isStatefulConfiguration) {
2211
2252
  return this.flowStateApiService
2212
2253
  .saveConfiguration(this.flowStateService.stateId ?? '', this.stateId ?? '')
2213
- .pipe(switchMap(r => this.flowStateService.executeRequest$({}, true).pipe(map$1(() => r))));
2254
+ .pipe(switchMap$1(r => this.flowStateService.executeRequest$({}, true).pipe(map(() => r))));
2214
2255
  }
2215
2256
  else {
2216
2257
  if (!flow) {
@@ -2247,7 +2288,7 @@ class ConfigurationStateService {
2247
2288
  }
2248
2289
  return this.flowConfigurationService
2249
2290
  .calculate$({ ...quoteDraft, currentState, initialState })
2250
- .pipe(map$1(() => ({ quoteId: '' })));
2291
+ .pipe(map(() => ({ quoteId: '' })));
2251
2292
  }
2252
2293
  }
2253
2294
  }
@@ -2290,13 +2331,13 @@ class ConfigurationStateService {
2290
2331
  selectorsOverride: container?.selectors?.map(processor => ({ ...processor, ownerId: this.ownerId })),
2291
2332
  });
2292
2333
  }
2293
- return request$.pipe(map$1(r => {
2334
+ return request$.pipe(map(r => {
2294
2335
  this.stateId = r.stateId;
2295
2336
  return undefined;
2296
2337
  }));
2297
2338
  }
2298
2339
  initStateless$() {
2299
- return this.configurationService.configure().pipe(map$1(() => undefined));
2340
+ return this.configurationService.configure().pipe(map(() => undefined));
2300
2341
  }
2301
2342
  execToRequest(exec) {
2302
2343
  return {
@@ -2337,11 +2378,11 @@ class ConfigurationStateService {
2337
2378
  else {
2338
2379
  execution$ = this.executeStateless$(fullRequest);
2339
2380
  }
2340
- return execution$.pipe(tap$1(result => this.handleSelectorsResponse(result.selectors)));
2381
+ return execution$.pipe(tap(result => this.handleSelectorsResponse(result.selectors)));
2341
2382
  }
2342
2383
  executeStateless$(request) {
2343
2384
  this.executionInProgress$.next(true);
2344
- return of(undefined).pipe(switchMap(() => {
2385
+ return of(undefined).pipe(switchMap$1(() => {
2345
2386
  // Apply actions and execute configuration/price call
2346
2387
  // No need to run configuration if no actions in the request
2347
2388
  if (!request.actions?.length) {
@@ -2353,14 +2394,14 @@ class ConfigurationStateService {
2353
2394
  });
2354
2395
  configurationRequest = ConfigurationTranslatorUtils.lightenConfigurationRequest(configurationRequest);
2355
2396
  return this.configurationService.configureRequest$(configurationRequest);
2356
- }), map$1(() => {
2397
+ }), map(() => {
2357
2398
  // Run selectors and apply them to the state
2358
2399
  const configurationState = this.configurationService.stateSnapshot;
2359
2400
  if (!configurationState) {
2360
2401
  return { stateId: '', selectors: {} };
2361
2402
  }
2362
2403
  return this.runStatelessSelectors(request, configurationState);
2363
- }), tap$1(() => this.executionInProgress$.next(false)), catchError(error => {
2404
+ }), tap(() => this.executionInProgress$.next(false)), catchError(error => {
2364
2405
  const configurationState = this.configurationService.previousStateSnapshot;
2365
2406
  if (configurationState) {
2366
2407
  const selectorsResult = this.runStatelessSelectors(request, configurationState);
@@ -2374,7 +2415,7 @@ class ConfigurationStateService {
2374
2415
  }));
2375
2416
  }
2376
2417
  initBufferedRequest$() {
2377
- return this.statefulRequestStream$.pipe(buffer(this.statefulRequestStream$.pipe(debounceTime(this.EXECUTION_BUFFER_TIME))), switchMap(requests => {
2418
+ return this.statefulRequestStream$.pipe(buffer(this.statefulRequestStream$.pipe(debounceTime(this.EXECUTION_BUFFER_TIME))), switchMap$1(requests => {
2378
2419
  if (!this.flowStateService.stateId || !this.stateId) {
2379
2420
  throw 'Stateful session is not initialized';
2380
2421
  }
@@ -2388,18 +2429,18 @@ class ConfigurationStateService {
2388
2429
  };
2389
2430
  this.executionInProgress$.next(true);
2390
2431
  return this.flowStateApiService.executeConfiguration(this.flowStateService.stateId, this.stateId, request);
2391
- }), tap$1(({ stateId }) => (this.stateId = stateId)), share(), tap$1(() => this.executionInProgress$.next(false)), catchError(e => {
2432
+ }), tap(({ stateId }) => (this.stateId = stateId)), share(), tap(() => this.executionInProgress$.next(false)), catchError(e => {
2392
2433
  this.executionInProgress$.next(false);
2393
2434
  return throwError(() => e);
2394
2435
  }));
2395
2436
  }
2396
2437
  executeStateful$(request) {
2397
- return this.executionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap(() =>
2438
+ return this.executionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap$1(() =>
2398
2439
  // make sure stream switches to statefulExecutionRequest$ before pushing an execution request
2399
2440
  combineLatest([
2400
2441
  this.statefulExecutionRequest$,
2401
- of(undefined).pipe(tap$1(() => this.statefulRequestStream$.next(request))),
2402
- ])), map$1(([response]) => response), take$1(1));
2442
+ of(undefined).pipe(tap(() => this.statefulRequestStream$.next(request))),
2443
+ ])), map(([response]) => response), take$1(1));
2403
2444
  }
2404
2445
  executeActionScript(request, processor) {
2405
2446
  const { actions } = this.configurationRuntimeService.runtimeContext?.uiDefinitionContainer ?? {};