@veloceapps/sdk 7.0.2-4 → 7.0.2-41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. package/cms/cms.actions.d.ts +30 -1
  2. package/cms/components/element-children/element-children.component.d.ts +3 -1
  3. package/cms/components/element-tools-panel/element-tools-panel.component.d.ts +14 -0
  4. package/cms/components/preview/preview.component.d.ts +4 -4
  5. package/cms/components/preview/preview.module.d.ts +2 -1
  6. package/cms/components/preview/preview.types.d.ts +4 -0
  7. package/cms/index.d.ts +1 -0
  8. package/cms/injection-tokens.d.ts +1 -3
  9. package/cms/modules/runtime/index.d.ts +1 -0
  10. package/cms/modules/runtime/services/compilation.service.d.ts +2 -1
  11. package/cms/modules/runtime/services/runtime-editor.service.d.ts +6 -4
  12. package/cms/modules/runtime/services/runtime.service.d.ts +5 -1
  13. package/cms/modules/runtime/types/runtime.actions.d.ts +5 -2
  14. package/cms/plugins/element-hover.plugin.d.ts +32 -0
  15. package/cms/plugins/page.plugin.d.ts +15 -0
  16. package/cms/plugins/script.plugin.d.ts +0 -3
  17. package/cms/types/common.types.d.ts +11 -1
  18. package/cms/types/index.d.ts +2 -0
  19. package/cms/types/layouts.types.d.ts +30 -2
  20. package/cms/types/pages.types.d.ts +1 -0
  21. package/cms/utils/elements-resolver.d.ts +5 -1
  22. package/cms/utils/script.utils.d.ts +2 -0
  23. package/cms/vendor-map.d.ts +12 -6
  24. package/core/core.module.d.ts +2 -0
  25. package/core/directives/directives.module.d.ts +7 -0
  26. package/core/directives/index.d.ts +2 -0
  27. package/core/directives/primeng-calendar.directive.d.ts +14 -0
  28. package/core/index.d.ts +2 -0
  29. package/core/modules/configuration/services/configuration.service.d.ts +3 -3
  30. package/core/pipes/date.pipe.d.ts +12 -0
  31. package/core/pipes/index.d.ts +4 -0
  32. package/core/pipes/number.pipe.d.ts +10 -0
  33. package/core/pipes/pipes.module.d.ts +9 -0
  34. package/core/pipes/price.pipe.d.ts +10 -0
  35. package/core/services/index.d.ts +1 -0
  36. package/core/services/runtime-settings.service.d.ts +21 -0
  37. package/core/types/formatting-settings.types.d.ts +11 -0
  38. package/core/types/index.d.ts +1 -0
  39. package/core/types/ui-definition.types.d.ts +8 -2
  40. package/core/utils/line-item.utils.d.ts +7 -2
  41. package/core/utils/line-item.worker.d.ts +2 -2
  42. package/esm2020/cms/cms.actions.mjs +42 -2
  43. package/esm2020/cms/cms.elements.mjs +16 -4
  44. package/esm2020/cms/cms.layouts.mjs +73 -13
  45. package/esm2020/cms/components/element-children/element-children.component.mjs +11 -6
  46. package/esm2020/cms/components/element-drop-handle/element-drop-handle.component.mjs +2 -2
  47. package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +35 -0
  48. package/esm2020/cms/components/preview/preview.component.mjs +17 -15
  49. package/esm2020/cms/components/preview/preview.module.mjs +22 -4
  50. package/esm2020/cms/components/preview/preview.types.mjs +1 -1
  51. package/esm2020/cms/index.mjs +2 -1
  52. package/esm2020/cms/injection-tokens.mjs +1 -2
  53. package/esm2020/cms/modules/runtime/index.mjs +2 -1
  54. package/esm2020/cms/modules/runtime/services/compilation.service.mjs +5 -3
  55. package/esm2020/cms/modules/runtime/services/runtime-editor.service.mjs +5 -3
  56. package/esm2020/cms/modules/runtime/services/runtime.service.mjs +41 -6
  57. package/esm2020/cms/modules/runtime/types/runtime.actions.mjs +1 -1
  58. package/esm2020/cms/plugins/element-hover.plugin.mjs +112 -0
  59. package/esm2020/cms/plugins/page.plugin.mjs +37 -0
  60. package/esm2020/cms/plugins/region.plugin.mjs +3 -2
  61. package/esm2020/cms/plugins/script.plugin.mjs +6 -40
  62. package/esm2020/cms/services/integration.state.mjs +3 -6
  63. package/esm2020/cms/services/io-provider.service.mjs +7 -5
  64. package/esm2020/cms/types/common.types.mjs +1 -1
  65. package/esm2020/cms/types/index.mjs +3 -1
  66. package/esm2020/cms/types/layouts.types.mjs +70 -1
  67. package/esm2020/cms/types/pages.types.mjs +2 -0
  68. package/esm2020/cms/utils/elements-resolver.mjs +22 -8
  69. package/esm2020/cms/utils/script.utils.mjs +42 -0
  70. package/esm2020/cms/vendor-map.mjs +5 -3
  71. package/esm2020/core/core.module.mjs +33 -4
  72. package/esm2020/core/directives/directives.module.mjs +16 -0
  73. package/esm2020/core/directives/index.mjs +3 -0
  74. package/esm2020/core/directives/primeng-calendar.directive.mjs +41 -0
  75. package/esm2020/core/index.mjs +3 -1
  76. package/esm2020/core/modules/configuration/configuration.module.mjs +2 -2
  77. package/esm2020/core/modules/configuration/helpers.mjs +3 -6
  78. package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +2 -1
  79. package/esm2020/core/modules/configuration/services/configuration.service.mjs +6 -5
  80. package/esm2020/core/pipes/date.pipe.mjs +38 -0
  81. package/esm2020/core/pipes/index.mjs +5 -0
  82. package/esm2020/core/pipes/number.pipe.mjs +27 -0
  83. package/esm2020/core/pipes/pipes.module.mjs +18 -0
  84. package/esm2020/core/pipes/price.pipe.mjs +30 -0
  85. package/esm2020/core/services/index.mjs +2 -1
  86. package/esm2020/core/services/runtime-settings.service.mjs +88 -0
  87. package/esm2020/core/types/formatting-settings.types.mjs +3 -0
  88. package/esm2020/core/types/index.mjs +2 -1
  89. package/esm2020/core/types/ui-definition.types.mjs +1 -1
  90. package/esm2020/core/utils/line-item.utils.mjs +38 -16
  91. package/esm2020/core/utils/line-item.worker.mjs +5 -5
  92. package/esm2020/src/components/header/header.component.mjs +39 -33
  93. package/esm2020/src/components/header/header.module.mjs +7 -3
  94. package/esm2020/src/components/header/metrics/metrics.component.mjs +9 -7
  95. package/esm2020/src/components/header/metrics/metrics.module.mjs +7 -3
  96. package/esm2020/src/flow-routing.module.mjs +1 -1
  97. package/esm2020/src/guards/context.guard.mjs +11 -8
  98. package/fesm2015/veloceapps-sdk-cms.mjs +728 -373
  99. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  100. package/fesm2015/veloceapps-sdk-core.mjs +317 -33
  101. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  102. package/fesm2015/veloceapps-sdk.mjs +70 -52
  103. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  104. package/fesm2020/veloceapps-sdk-cms.mjs +777 -355
  105. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  106. package/fesm2020/veloceapps-sdk-core.mjs +310 -33
  107. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  108. package/fesm2020/veloceapps-sdk.mjs +68 -51
  109. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  110. package/package.json +1 -1
  111. package/src/components/header/header.component.d.ts +2 -3
  112. package/src/components/header/header.module.d.ts +2 -1
  113. package/src/components/header/metrics/metrics.component.d.ts +4 -2
  114. package/src/components/header/metrics/metrics.module.d.ts +2 -1
  115. package/src/guards/context.guard.d.ts +3 -2
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, NgModule } from '@angular/core';
3
- import { UUID, ConfigurationContext, RuntimeModel, ConfigurationContextMode, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils } from '@veloceapps/core';
2
+ import { InjectionToken, Injectable, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
3
+ import { UUID, ConfigurationContext, RuntimeModel, ConfigurationContextMode, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, getSupportedDateFormats, DEFAULT_DECIMALS_COUNT, parseJsonSafely, formatNumber } 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';
@@ -10,16 +10,17 @@ import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@vel
10
10
  import * as i5 from 'primeng/api';
11
11
  import * as i6 from 'primeng/dynamicdialog';
12
12
  import moment from 'moment';
13
+ import { NgControl } from '@angular/forms';
14
+ import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
13
15
 
14
16
  const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
15
17
  var _a, _b, _c;
16
18
  const id = UUID.UUID();
17
- const lineItem = Object.assign({ id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b['displayName']) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (context.offeringId
18
- ? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
19
- : {}));
20
- return lineItem;
19
+ return Object.assign({ id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b['displayName']) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (uiDefinitionProperties.offeringId ? { offeringId: uiDefinitionProperties.offeringId } : {}));
21
20
  };
22
21
 
22
+ const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
23
+
23
24
  var RuntimeMode;
24
25
  (function (RuntimeMode) {
25
26
  RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
@@ -158,7 +159,7 @@ class ConfigurationRuntimeService {
158
159
  runtimeMode: RuntimeMode.TEST,
159
160
  };
160
161
  this.contextService.update({
161
- properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: modelId, RuntimeMode: ConfigurationContextMode.TEST, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: this.uiDefinitionProperties.priceList, standalone: 'true' }), uiDefinitionExternals),
162
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: modelId, RuntimeMode: ConfigurationContextMode.TEST, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: this.uiDefinitionProperties.priceList, offeringId: this.uiDefinitionProperties.offeringId, standalone: 'true' }), uiDefinitionExternals),
162
163
  });
163
164
  this._isInitialized = true;
164
165
  }));
@@ -243,15 +244,22 @@ const removeLineItem = (lineItem, idToRemove) => {
243
244
  })
244
245
  .filter(r => !!r) });
245
246
  };
246
- const replaceLineItem = (lineItem, replaceTo) => {
247
+ const replaceLineItem = (lineItem, replaceTo, skipCardinalityCalculation = false) => {
247
248
  if (lineItem.id === replaceTo.id) {
248
- return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
249
+ if (!skipCardinalityCalculation) {
250
+ return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
251
+ }
252
+ else {
253
+ return Object.assign({}, replaceTo);
254
+ }
249
255
  }
250
- return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo)) });
256
+ return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo, skipCardinalityCalculation)) });
251
257
  };
252
258
  const calculateCardinalityVariables = (lineItems) => {
253
259
  const cardVars = new Map();
254
- lineItems.forEach(li => {
260
+ lineItems
261
+ .filter(({ port, type }) => !!port && !!type)
262
+ .forEach(li => {
255
263
  var _a;
256
264
  const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
257
265
  cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
@@ -289,13 +297,13 @@ const upsertAttributes = (originalAttributes, attributesToUpsert) => {
289
297
  ];
290
298
  }, originalAttributes);
291
299
  };
292
- const patchAttributes = (rootLineItem, id, attrs) => {
300
+ const patchAttributes = (rootLineItem, id, attrs, skipCardinalityCalculation = false) => {
293
301
  const lineItem = findLineItem(id, [rootLineItem]);
294
302
  if (!lineItem) {
295
303
  return rootLineItem;
296
304
  }
297
305
  const attributes = upsertAttributes(lineItem.attributes, attrs);
298
- return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }));
306
+ return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }), skipCardinalityCalculation);
299
307
  };
300
308
  const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
301
309
  const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
@@ -323,19 +331,31 @@ const getRecommendedPrices = (portDomain, type) => {
323
331
  const generateModifiedAssetsMap = (lineItems) => {
324
332
  return lineItems.reduce((acc, li) => {
325
333
  var _a;
326
- if (li.rampInstanceId && li.status !== 'EXIST') {
327
- let target = li;
328
- while (target && target.rampInstanceId) {
329
- target = lineItems.find(sub => sub.id === li.rampInstanceId);
330
- }
331
- const id = (_a = target === null || target === void 0 ? void 0 : target.assetId) !== null && _a !== void 0 ? _a : target === null || target === void 0 ? void 0 : target.openOrderLineItemId;
332
- if (id) {
333
- acc[id] = true;
334
- }
334
+ const isModified = isLineItemModified(li);
335
+ if (!isModified) {
336
+ return acc;
337
+ }
338
+ const target = getOriginParent(lineItems, li);
339
+ const id = (_a = target === null || target === void 0 ? void 0 : target.assetId) !== null && _a !== void 0 ? _a : target === null || target === void 0 ? void 0 : target.openOrderLineItemId;
340
+ if (id) {
341
+ acc[id] = true;
335
342
  }
336
343
  return acc;
337
344
  }, {});
338
345
  };
346
+ const getOriginParent = (lineItems, currentLineItem) => {
347
+ let target = currentLineItem;
348
+ while (target && target.rampInstanceId) {
349
+ target = lineItems.find(sub => sub.id === currentLineItem.rampInstanceId);
350
+ }
351
+ return target;
352
+ };
353
+ const isLineItemModified = (lineItem) => {
354
+ if (lineItem.actionCode === 'EXIST' && lineItem.status === 'PENDING') {
355
+ return false;
356
+ }
357
+ return lineItem.actionCode !== 'EXIST';
358
+ };
339
359
  const multiplyLineItems = (lineItem, qty, split) => {
340
360
  if (split) {
341
361
  const unifyIds = (lineItem) => (Object.assign(Object.assign({}, lineItem), { id: UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds) }));
@@ -347,18 +367,24 @@ const multiplyLineItems = (lineItem, qty, split) => {
347
367
  ];
348
368
  }
349
369
  };
370
+ const filterOutTechnicalAttributes = (attributes) => {
371
+ return attributes.filter(({ name }) => !name.startsWith('#') && !name.startsWith('$'));
372
+ };
350
373
 
351
374
  var lineItem_utils = /*#__PURE__*/Object.freeze({
352
375
  __proto__: null,
353
376
  calculateCardinalityVariables: calculateCardinalityVariables,
377
+ filterOutTechnicalAttributes: filterOutTechnicalAttributes,
354
378
  findLineItem: findLineItem,
355
379
  findLineItemWithComparator: findLineItemWithComparator,
356
380
  generateLineItem: generateLineItem,
357
381
  generateModifiedAssetsMap: generateModifiedAssetsMap,
358
382
  getAttributeValue: getAttributeValue,
359
383
  getAttributes: getAttributes,
384
+ getOriginParent: getOriginParent,
360
385
  getRecommendedPrices: getRecommendedPrices,
361
386
  insertLineItem: insertLineItem,
387
+ isLineItemModified: isLineItemModified,
362
388
  mapAttributes: mapAttributes,
363
389
  multiplyLineItems: multiplyLineItems,
364
390
  patchAttributes: patchAttributes,
@@ -378,11 +404,11 @@ class LineItemWorker {
378
404
  remove(id) {
379
405
  return new LineItemWorker(removeLineItem(this.li, id));
380
406
  }
381
- replace(toReplace) {
382
- return new LineItemWorker(replaceLineItem(this.li, toReplace));
407
+ replace(toReplace, skipCardinalityCalculation = false) {
408
+ return new LineItemWorker(replaceLineItem(this.li, toReplace, skipCardinalityCalculation));
383
409
  }
384
- patchAttribute(attrs, id) {
385
- return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
410
+ patchAttribute(attrs, id, skipCardinalityCalculation = false) {
411
+ return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs, skipCardinalityCalculation));
386
412
  }
387
413
  }
388
414
 
@@ -617,11 +643,12 @@ class ConfigurationService {
617
643
  this.charges.next({});
618
644
  this.pricePlans.next({});
619
645
  }
620
- patch$(lineItem) {
646
+ patch$(lineItem, options) {
621
647
  if (!this.lineItem.value) {
622
648
  return throwError(() => new Error(`Source LineItem not found`));
623
649
  }
624
- this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
650
+ const skipCardinalityCalculation = (options === null || options === void 0 ? void 0 : options.skipCardinalityCalculation) || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
651
+ this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
625
652
  return this.configure().pipe(catchError(error => {
626
653
  console.error(error);
627
654
  if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
@@ -636,8 +663,8 @@ class ConfigurationService {
636
663
  }
637
664
  }));
638
665
  }
639
- patch(lineItem) {
640
- this.patch$(lineItem).subscribe();
666
+ patch(lineItem, options) {
667
+ this.patch$(lineItem, options).subscribe();
641
668
  }
642
669
  setConfigurableRamp(lineItem) {
643
670
  this.configurableRamp = lineItem;
@@ -1211,16 +1238,273 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1211
1238
  args: [{ providedIn: 'root' }]
1212
1239
  }], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
1213
1240
 
1241
+ class RuntimeSettingsService {
1242
+ constructor(configurationSettingsApiService) {
1243
+ this.configurationSettingsApiService = configurationSettingsApiService;
1244
+ this.configurationSettings$ = new BehaviorSubject({});
1245
+ this.currencySettings$ = new BehaviorSubject({
1246
+ iso: DEFAULT_CURRENCY_ISO_CODE,
1247
+ symbol: DEFAULT_CURRENCY_SYMBOL,
1248
+ });
1249
+ this.getCurrencySymbol = (locale, currency) => {
1250
+ return (0)
1251
+ .toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
1252
+ .replace(/\d/g, '')
1253
+ .trim();
1254
+ };
1255
+ }
1256
+ create() {
1257
+ return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
1258
+ this.configurationSettings$.next(configurationSettings);
1259
+ this.formattingSettings = this.getFormattingSettings();
1260
+ }), map$2(() => undefined));
1261
+ }
1262
+ initCurrency(iso) {
1263
+ if (iso) {
1264
+ const symbol = this.getCurrencySymbol('en-US', iso);
1265
+ this.currencySettings$.next({ iso, symbol });
1266
+ }
1267
+ }
1268
+ getFormattingSettings() {
1269
+ var _a, _b, _c, _d;
1270
+ if (this.formattingSettings) {
1271
+ return this.formattingSettings;
1272
+ }
1273
+ const shoppingCartSettings = (_a = this.getConfigurationSettings()['shopping-cart']) === null || _a === void 0 ? void 0 : _a.reduce((acc, setting) => {
1274
+ return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
1275
+ }, {});
1276
+ const currencySettings = this.getCurrencySettings();
1277
+ 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)) ||
1278
+ DEFAULT_DATE_FORMAT;
1279
+ const decimalSeparator = (_c = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DECIMAL_SEPARATOR) !== null && _c !== void 0 ? _c : DEFAULT_DECIMAL_SEPARATOR;
1280
+ const thousandsSeparator = (_d = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.THOUSANDS_SEPARATOR) !== null && _d !== void 0 ? _d : DEFAULT_THOUSANDS_SEPARATOR;
1281
+ return {
1282
+ currencySymbol: currencySettings.symbol,
1283
+ dateFormats: getSupportedDateFormats(dateFormat),
1284
+ decimalSeparator: (['.', ','].includes(decimalSeparator) && decimalSeparator) || DEFAULT_DECIMAL_SEPARATOR,
1285
+ decimalsCount: (!isNaN(Number(shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE)) && Number(shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE)) ||
1286
+ DEFAULT_DECIMALS_COUNT,
1287
+ thousandsSeparator: ['.', ',', ''].includes(thousandsSeparator)
1288
+ ? thousandsSeparator
1289
+ : DEFAULT_THOUSANDS_SEPARATOR,
1290
+ };
1291
+ }
1292
+ getConfigurationSettings() {
1293
+ return this.configurationSettings$.value;
1294
+ }
1295
+ getCurrencySettings() {
1296
+ return this.currencySettings$.value;
1297
+ }
1298
+ parseConfigurationSettings(settings) {
1299
+ return settings.reduce((acc, setting) => {
1300
+ switch (setting.key) {
1301
+ case 'shopping-cart':
1302
+ acc['shopping-cart'] = parseJsonSafely(setting.value, []);
1303
+ break;
1304
+ case 'navigation':
1305
+ acc.navigation = parseJsonSafely(setting.value, {});
1306
+ break;
1307
+ case 'flows':
1308
+ acc.flows = parseJsonSafely(setting.value, []);
1309
+ break;
1310
+ default:
1311
+ acc[setting.key] = setting.value;
1312
+ }
1313
+ return acc;
1314
+ }, {});
1315
+ }
1316
+ }
1317
+ RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1318
+ RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
1319
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, decorators: [{
1320
+ type: Injectable,
1321
+ args: [{ providedIn: 'root' }]
1322
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
1323
+
1324
+ const DEFAULT_FORMATTING_SETTINGS = {
1325
+ currencySymbol: DEFAULT_CURRENCY_SYMBOL,
1326
+ decimalsCount: DEFAULT_DECIMALS_COUNT,
1327
+ dateFormats: getSupportedDateFormats(DEFAULT_DATE_FORMAT),
1328
+ decimalSeparator: DEFAULT_DECIMAL_SEPARATOR,
1329
+ thousandsSeparator: DEFAULT_THOUSANDS_SEPARATOR,
1330
+ };
1214
1331
  class SdkCoreModule {
1215
1332
  }
1216
1333
  SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1217
1334
  SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1218
- SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService], imports: [ConfigurationModule, FlowConfigurationModule] });
1335
+ SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
1336
+ ContextService,
1337
+ QuoteDraftService,
1338
+ ProductImagesService,
1339
+ MetricsCalculationService,
1340
+ RuntimeSettingsService,
1341
+ {
1342
+ provide: FORMATTING_SETTINGS_TOKEN,
1343
+ useExisting: RuntimeSettingsService,
1344
+ },
1345
+ ], imports: [ConfigurationModule, FlowConfigurationModule] });
1219
1346
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
1220
1347
  type: NgModule,
1221
1348
  args: [{
1222
1349
  imports: [ConfigurationModule, FlowConfigurationModule],
1223
- providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService],
1350
+ providers: [
1351
+ ContextService,
1352
+ QuoteDraftService,
1353
+ ProductImagesService,
1354
+ MetricsCalculationService,
1355
+ RuntimeSettingsService,
1356
+ {
1357
+ provide: FORMATTING_SETTINGS_TOKEN,
1358
+ useExisting: RuntimeSettingsService,
1359
+ },
1360
+ ],
1361
+ }]
1362
+ }] });
1363
+
1364
+ class CalendarDirective {
1365
+ constructor() {
1366
+ var _a;
1367
+ this.ngControl = inject(NgControl, { host: true, optional: true });
1368
+ this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
1369
+ this.destroy$ = new Subject();
1370
+ }
1371
+ set vlCalendar(calendar) {
1372
+ this.calendar = calendar;
1373
+ }
1374
+ ngOnDestroy() {
1375
+ this.destroy$.next();
1376
+ this.destroy$.complete();
1377
+ }
1378
+ ngOnInit() {
1379
+ var _a, _b;
1380
+ if (this.calendar) {
1381
+ this.calendar.dateFormat = (_b = (_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.dateFormats.primengFormat) !== null && _b !== void 0 ? _b : DEFAULT_DATE_FORMAT;
1382
+ if (this.ngControl && this.ngControl.control) {
1383
+ const control = this.ngControl.control;
1384
+ control.setValue(control.value, { emitEvent: false });
1385
+ }
1386
+ }
1387
+ }
1388
+ }
1389
+ CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1390
+ CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: CalendarDirective, selector: "[vlCalendar]", inputs: { vlCalendar: "vlCalendar" }, ngImport: i0 });
1391
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, decorators: [{
1392
+ type: Directive,
1393
+ args: [{
1394
+ selector: '[vlCalendar]',
1395
+ }]
1396
+ }], propDecorators: { vlCalendar: [{
1397
+ type: Input
1398
+ }] } });
1399
+
1400
+ class SdkDirectivesModule {
1401
+ }
1402
+ SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1403
+ SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, declarations: [CalendarDirective], exports: [CalendarDirective] });
1404
+ SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule });
1405
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, decorators: [{
1406
+ type: NgModule,
1407
+ args: [{
1408
+ declarations: [CalendarDirective],
1409
+ exports: [CalendarDirective],
1410
+ }]
1411
+ }] });
1412
+
1413
+ class DatePipe {
1414
+ constructor() {
1415
+ var _a;
1416
+ this.locale = inject(LOCALE_ID);
1417
+ this.defaultOptions = inject(DATE_PIPE_DEFAULT_OPTIONS, { optional: true });
1418
+ this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
1419
+ this.destroy$ = new Subject();
1420
+ }
1421
+ ngOnDestroy() {
1422
+ this.destroy$.next();
1423
+ this.destroy$.complete();
1424
+ }
1425
+ transform(date) {
1426
+ var _a, _b;
1427
+ if (!date) {
1428
+ return '';
1429
+ }
1430
+ try {
1431
+ return formatDate(date, ((_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.dateFormats.datePipeFormat) || DEFAULT_DATE_FORMAT, this.locale, (_b = this.defaultOptions) === null || _b === void 0 ? void 0 : _b.timezone);
1432
+ }
1433
+ catch (error) {
1434
+ return new Date(date).toString();
1435
+ }
1436
+ }
1437
+ }
1438
+ DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1439
+ DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, name: "vlDate" });
1440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, decorators: [{
1441
+ type: Pipe,
1442
+ args: [{
1443
+ name: 'vlDate',
1444
+ }]
1445
+ }] });
1446
+
1447
+ class NumberPipe {
1448
+ constructor() {
1449
+ var _a;
1450
+ this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
1451
+ this.destroy$ = new Subject();
1452
+ }
1453
+ ngOnDestroy() {
1454
+ this.destroy$.next();
1455
+ this.destroy$.complete();
1456
+ }
1457
+ transform(price) {
1458
+ var _a, _b, _c;
1459
+ return formatNumber(price, (_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.thousandsSeparator, (_b = this.formattingSettings) === null || _b === void 0 ? void 0 : _b.decimalSeparator, (_c = this.formattingSettings) === null || _c === void 0 ? void 0 : _c.decimalsCount);
1460
+ }
1461
+ }
1462
+ NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1463
+ NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, name: "vlNumber" });
1464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, decorators: [{
1465
+ type: Pipe,
1466
+ args: [{
1467
+ name: 'vlNumber',
1468
+ }]
1469
+ }] });
1470
+
1471
+ class PricePipe {
1472
+ constructor() {
1473
+ var _a;
1474
+ this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
1475
+ this.destroy$ = new Subject();
1476
+ }
1477
+ ngOnDestroy() {
1478
+ this.destroy$.next();
1479
+ this.destroy$.complete();
1480
+ }
1481
+ transform(price) {
1482
+ var _a, _b, _c, _d;
1483
+ if (price == null || price === '') {
1484
+ return '';
1485
+ }
1486
+ return `${((_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.currencySymbol) || DEFAULT_CURRENCY_SYMBOL}${formatNumber(price, (_b = this.formattingSettings) === null || _b === void 0 ? void 0 : _b.thousandsSeparator, (_c = this.formattingSettings) === null || _c === void 0 ? void 0 : _c.decimalSeparator, (_d = this.formattingSettings) === null || _d === void 0 ? void 0 : _d.decimalsCount)}`;
1487
+ }
1488
+ }
1489
+ PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1490
+ PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, name: "vlPrice" });
1491
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, decorators: [{
1492
+ type: Pipe,
1493
+ args: [{
1494
+ name: 'vlPrice',
1495
+ }]
1496
+ }] });
1497
+
1498
+ class SdkPipesModule {
1499
+ }
1500
+ SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1501
+ SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, declarations: [NumberPipe, PricePipe, DatePipe], exports: [NumberPipe, PricePipe, DatePipe] });
1502
+ SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule });
1503
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, decorators: [{
1504
+ type: NgModule,
1505
+ args: [{
1506
+ declarations: [NumberPipe, PricePipe, DatePipe],
1507
+ exports: [NumberPipe, PricePipe, DatePipe],
1224
1508
  }]
1225
1509
  }] });
1226
1510
 
@@ -1228,5 +1512,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1228
1512
  * Generated bundle index. Do not edit.
1229
1513
  */
1230
1514
 
1231
- 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, getRecommendedPrices, insertLineItem, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
1515
+ export { CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, filterOutTechnicalAttributes, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
1232
1516
  //# sourceMappingURL=veloceapps-sdk-core.mjs.map