@veloceapps/sdk 8.0.0-73 → 8.0.0-74
Sign up to get free protection for your applications and to get access to all the features.
- package/core/services/runtime-settings.service.d.ts +4 -1
- package/esm2020/core/services/runtime-settings.service.mjs +12 -1
- package/fesm2015/veloceapps-sdk-core.mjs +12 -1
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +11 -1
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/package.json +1 -1
@@ -5,7 +5,7 @@ import * as i1 from '@veloceapps/api';
|
|
5
5
|
import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
|
6
6
|
import { BehaviorSubject, zip, noop, combineLatest, map as map$2, tap as tap$1, throwError, shareReplay as shareReplay$1, of, switchMap as switchMap$1, catchError as catchError$1, Subject, take as take$1, distinctUntilChanged } from 'rxjs';
|
7
7
|
import { filter, tap, map, switchMap, skip, take, shareReplay, catchError, finalize, first } from 'rxjs/operators';
|
8
|
-
import { merge, isEqual, flatten, sortBy, map as map$1, transform, omit, cloneDeep, uniq } from 'lodash';
|
8
|
+
import { merge, isEqual, flatten, sortBy, map as map$1, uniqBy, transform, omit, cloneDeep, uniq } from 'lodash';
|
9
9
|
import { HttpErrorResponse } from '@angular/common/http';
|
10
10
|
import * as i4 from '@veloceapps/components';
|
11
11
|
import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
|
@@ -569,6 +569,7 @@ class RuntimeSettingsService {
|
|
569
569
|
iso: DEFAULT_CURRENCY_ISO_CODE,
|
570
570
|
symbol: DEFAULT_CURRENCY_SYMBOL,
|
571
571
|
});
|
572
|
+
this.shoppingCartSettings$ = new BehaviorSubject([]);
|
572
573
|
this.getCurrencySymbol = (locale, currency) => {
|
573
574
|
return (0)
|
574
575
|
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
@@ -579,6 +580,7 @@ class RuntimeSettingsService {
|
|
579
580
|
create() {
|
580
581
|
return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
|
581
582
|
this.configurationSettings$.next(configurationSettings);
|
583
|
+
this.addShoppingCartSettings(configurationSettings['shopping-cart'] ?? []);
|
582
584
|
this.formattingSettings = this.getFormattingSettings();
|
583
585
|
}), map$2(() => undefined));
|
584
586
|
}
|
@@ -625,6 +627,9 @@ class RuntimeSettingsService {
|
|
625
627
|
getConfigurationSettings() {
|
626
628
|
return this.configurationSettings$.value;
|
627
629
|
}
|
630
|
+
getShoppingCartSettings() {
|
631
|
+
return this.shoppingCartSettings$.value;
|
632
|
+
}
|
628
633
|
getCurrencySettings() {
|
629
634
|
return this.currencySettings$.value;
|
630
635
|
}
|
@@ -646,6 +651,11 @@ class RuntimeSettingsService {
|
|
646
651
|
return acc;
|
647
652
|
}, {});
|
648
653
|
}
|
654
|
+
addShoppingCartSettings(settings) {
|
655
|
+
// uniqBy removes items with the biggest index
|
656
|
+
const newSettings = uniqBy([...settings, ...this.shoppingCartSettings$.value], 'id');
|
657
|
+
this.shoppingCartSettings$.next(newSettings);
|
658
|
+
}
|
649
659
|
}
|
650
660
|
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
651
661
|
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
|