@veloceapps/sdk 7.0.2-27 → 7.0.2-29
Sign up to get free protection for your applications and to get access to all the features.
- package/cms/vendor-map.d.ts +2 -1
- package/core/services/index.d.ts +1 -0
- package/core/services/runtime-settings.service.d.ts +18 -0
- package/esm2020/cms/vendor-map.mjs +3 -2
- package/esm2020/core/core.module.mjs +16 -4
- package/esm2020/core/services/index.mjs +2 -1
- package/esm2020/core/services/runtime-settings.service.mjs +62 -0
- package/esm2020/src/components/header/metrics/metrics.component.mjs +9 -7
- package/esm2020/src/guards/context.guard.mjs +11 -8
- package/fesm2015/veloceapps-sdk-cms.mjs +3 -2
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +72 -4
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +16 -11
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +2 -1
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +72 -4
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +16 -11
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/header/metrics/metrics.component.d.ts +4 -2
- package/src/guards/context.guard.d.ts +3 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
2
|
import { Injectable, NgModule } from '@angular/core';
|
3
|
-
import { UUID, ConfigurationContext, RuntimeModel, ConfigurationContextMode, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils } from '@veloceapps/core';
|
3
|
+
import { UUID, ConfigurationContext, RuntimeModel, ConfigurationContextMode, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils, parseJsonSafely } from '@veloceapps/core';
|
4
4
|
import { BehaviorSubject, combineLatest, zip, noop, throwError, shareReplay as shareReplay$1, tap as tap$1, map as map$2, of, switchMap as switchMap$1, catchError as catchError$1, Subject, take as take$1, distinctUntilChanged } from 'rxjs';
|
5
5
|
import { filter, tap, map, first, switchMap, skip, take, shareReplay, catchError, finalize } from 'rxjs/operators';
|
6
6
|
import * as i1 from '@veloceapps/api';
|
@@ -1233,16 +1233,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
1233
1233
|
args: [{ providedIn: 'root' }]
|
1234
1234
|
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
1235
1235
|
|
1236
|
+
class RuntimeSettingsService {
|
1237
|
+
constructor(configurationSettingsApiService) {
|
1238
|
+
this.configurationSettingsApiService = configurationSettingsApiService;
|
1239
|
+
this.configurationSettings$ = new BehaviorSubject({});
|
1240
|
+
this.currencySettings$ = new BehaviorSubject({
|
1241
|
+
iso: 'USD',
|
1242
|
+
symbol: '$',
|
1243
|
+
});
|
1244
|
+
this.getCurrencySymbol = (locale, currency) => {
|
1245
|
+
return (0)
|
1246
|
+
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
1247
|
+
.replace(/\d/g, '')
|
1248
|
+
.trim();
|
1249
|
+
};
|
1250
|
+
}
|
1251
|
+
create() {
|
1252
|
+
return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => this.configurationSettings$.next(configurationSettings)), map$2(() => undefined));
|
1253
|
+
}
|
1254
|
+
initCurrency(iso) {
|
1255
|
+
if (iso) {
|
1256
|
+
const symbol = this.getCurrencySymbol('en-US', iso);
|
1257
|
+
this.currencySettings$.next({ iso, symbol });
|
1258
|
+
}
|
1259
|
+
}
|
1260
|
+
getConfigurationSettings() {
|
1261
|
+
return this.configurationSettings$.value;
|
1262
|
+
}
|
1263
|
+
getCurrencySettings() {
|
1264
|
+
return this.currencySettings$.value;
|
1265
|
+
}
|
1266
|
+
parseConfigurationSettings(settings) {
|
1267
|
+
return settings.reduce((acc, setting) => {
|
1268
|
+
switch (setting.key) {
|
1269
|
+
case 'shopping-cart':
|
1270
|
+
acc['shopping-cart'] = parseJsonSafely(setting.value, []);
|
1271
|
+
break;
|
1272
|
+
case 'navigation':
|
1273
|
+
acc.navigation = parseJsonSafely(setting.value, {});
|
1274
|
+
break;
|
1275
|
+
case 'flows':
|
1276
|
+
acc.flows = parseJsonSafely(setting.value, []);
|
1277
|
+
break;
|
1278
|
+
default:
|
1279
|
+
acc[setting.key] = setting.value;
|
1280
|
+
}
|
1281
|
+
return acc;
|
1282
|
+
}, {});
|
1283
|
+
}
|
1284
|
+
}
|
1285
|
+
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1286
|
+
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
|
1287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
1288
|
+
type: Injectable,
|
1289
|
+
args: [{ providedIn: 'root' }]
|
1290
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
1291
|
+
|
1236
1292
|
class SdkCoreModule {
|
1237
1293
|
}
|
1238
1294
|
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1239
1295
|
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
1240
|
-
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
1296
|
+
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
1297
|
+
ContextService,
|
1298
|
+
QuoteDraftService,
|
1299
|
+
ProductImagesService,
|
1300
|
+
MetricsCalculationService,
|
1301
|
+
RuntimeSettingsService,
|
1302
|
+
], imports: [ConfigurationModule, FlowConfigurationModule] });
|
1241
1303
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
|
1242
1304
|
type: NgModule,
|
1243
1305
|
args: [{
|
1244
1306
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
1245
|
-
providers: [
|
1307
|
+
providers: [
|
1308
|
+
ContextService,
|
1309
|
+
QuoteDraftService,
|
1310
|
+
ProductImagesService,
|
1311
|
+
MetricsCalculationService,
|
1312
|
+
RuntimeSettingsService,
|
1313
|
+
],
|
1246
1314
|
}]
|
1247
1315
|
}] });
|
1248
1316
|
|
@@ -1250,5 +1318,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
1250
1318
|
* Generated bundle index. Do not edit.
|
1251
1319
|
*/
|
1252
1320
|
|
1253
|
-
export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeStep, SdkCoreModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
1321
|
+
export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
1254
1322
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|