@veloceapps/sdk 7.0.2-27 → 7.0.2-28
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.
- 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/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 +9 -6
- 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 +9 -6
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- 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 * as i1 from '@veloceapps/api';
|
|
5
5
|
import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
|
|
6
6
|
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';
|
|
@@ -1290,16 +1290,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
1290
1290
|
args: [{ providedIn: 'root' }]
|
|
1291
1291
|
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
|
1292
1292
|
|
|
1293
|
+
class RuntimeSettingsService {
|
|
1294
|
+
constructor(configurationSettingsApiService) {
|
|
1295
|
+
this.configurationSettingsApiService = configurationSettingsApiService;
|
|
1296
|
+
this.configurationSettings$ = new BehaviorSubject({});
|
|
1297
|
+
this.currencySettings$ = new BehaviorSubject({
|
|
1298
|
+
iso: 'USD',
|
|
1299
|
+
symbol: '$',
|
|
1300
|
+
});
|
|
1301
|
+
this.getCurrencySymbol = (locale, currency) => {
|
|
1302
|
+
return (0)
|
|
1303
|
+
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
|
1304
|
+
.replace(/\d/g, '')
|
|
1305
|
+
.trim();
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
create() {
|
|
1309
|
+
return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => this.configurationSettings$.next(configurationSettings)), map$2(() => undefined));
|
|
1310
|
+
}
|
|
1311
|
+
initCurrency(iso) {
|
|
1312
|
+
if (iso) {
|
|
1313
|
+
const symbol = this.getCurrencySymbol('en-US', iso);
|
|
1314
|
+
this.currencySettings$.next({ iso, symbol });
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
getConfigurationSettings() {
|
|
1318
|
+
return this.configurationSettings$.value;
|
|
1319
|
+
}
|
|
1320
|
+
getCurrencySettings() {
|
|
1321
|
+
return this.currencySettings$.value;
|
|
1322
|
+
}
|
|
1323
|
+
parseConfigurationSettings(settings) {
|
|
1324
|
+
return settings.reduce((acc, setting) => {
|
|
1325
|
+
switch (setting.key) {
|
|
1326
|
+
case 'shopping-cart':
|
|
1327
|
+
acc['shopping-cart'] = parseJsonSafely(setting.value, []);
|
|
1328
|
+
break;
|
|
1329
|
+
case 'navigation':
|
|
1330
|
+
acc.navigation = parseJsonSafely(setting.value, {});
|
|
1331
|
+
break;
|
|
1332
|
+
case 'flows':
|
|
1333
|
+
acc.flows = parseJsonSafely(setting.value, []);
|
|
1334
|
+
break;
|
|
1335
|
+
default:
|
|
1336
|
+
acc[setting.key] = setting.value;
|
|
1337
|
+
}
|
|
1338
|
+
return acc;
|
|
1339
|
+
}, {});
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1343
|
+
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
|
|
1344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
|
1345
|
+
type: Injectable,
|
|
1346
|
+
args: [{ providedIn: 'root' }]
|
|
1347
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
|
1348
|
+
|
|
1293
1349
|
class SdkCoreModule {
|
|
1294
1350
|
}
|
|
1295
1351
|
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1296
1352
|
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
|
1297
|
-
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
|
1353
|
+
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
|
1354
|
+
ContextService,
|
|
1355
|
+
QuoteDraftService,
|
|
1356
|
+
ProductImagesService,
|
|
1357
|
+
MetricsCalculationService,
|
|
1358
|
+
RuntimeSettingsService,
|
|
1359
|
+
], imports: [ConfigurationModule, FlowConfigurationModule] });
|
|
1298
1360
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
|
|
1299
1361
|
type: NgModule,
|
|
1300
1362
|
args: [{
|
|
1301
1363
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
|
1302
|
-
providers: [
|
|
1364
|
+
providers: [
|
|
1365
|
+
ContextService,
|
|
1366
|
+
QuoteDraftService,
|
|
1367
|
+
ProductImagesService,
|
|
1368
|
+
MetricsCalculationService,
|
|
1369
|
+
RuntimeSettingsService,
|
|
1370
|
+
],
|
|
1303
1371
|
}]
|
|
1304
1372
|
}] });
|
|
1305
1373
|
|
|
@@ -1307,5 +1375,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
1307
1375
|
* Generated bundle index. Do not edit.
|
|
1308
1376
|
*/
|
|
1309
1377
|
|
|
1310
|
-
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 };
|
|
1378
|
+
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 };
|
|
1311
1379
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|