@veloceapps/sdk 7.0.2-6 → 7.0.2-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. package/cms/cms.actions.d.ts +30 -1
  2. package/cms/cms.default.d.ts +2 -2
  3. package/cms/components/element-children/element-children.component.d.ts +3 -1
  4. package/cms/components/element-tools-panel/element-tools-panel.component.d.ts +14 -0
  5. package/cms/components/preview/preview.component.d.ts +6 -5
  6. package/cms/components/preview/preview.module.d.ts +2 -1
  7. package/cms/components/preview/preview.types.d.ts +4 -0
  8. package/cms/definitions/index.d.ts +1 -0
  9. package/cms/definitions/ui-builder.definitions.d.ts +6 -0
  10. package/cms/index.d.ts +2 -0
  11. package/cms/injection-tokens.d.ts +2 -4
  12. package/cms/modules/migrations/services/migrations.service.d.ts +1 -1
  13. package/cms/modules/migrations/types/migrations.types.d.ts +1 -1
  14. package/cms/modules/runtime/index.d.ts +1 -0
  15. package/cms/modules/runtime/services/compilation.service.d.ts +3 -2
  16. package/cms/modules/runtime/services/runtime-editor.service.d.ts +6 -4
  17. package/cms/modules/runtime/services/runtime.service.d.ts +6 -2
  18. package/cms/modules/runtime/types/runtime.actions.d.ts +5 -2
  19. package/cms/plugins/element-hover.plugin.d.ts +33 -0
  20. package/cms/plugins/page.plugin.d.ts +15 -0
  21. package/cms/plugins/script.plugin.d.ts +0 -3
  22. package/cms/types/common.types.d.ts +11 -1
  23. package/cms/types/index.d.ts +2 -0
  24. package/cms/types/layouts.types.d.ts +30 -2
  25. package/cms/types/pages.types.d.ts +1 -0
  26. package/cms/utils/element.utils.d.ts +1 -1
  27. package/cms/utils/elements-resolver.d.ts +6 -2
  28. package/cms/utils/index.d.ts +1 -0
  29. package/cms/utils/script.utils.d.ts +2 -0
  30. package/cms/utils/ui-builder-layout.utils.d.ts +4 -0
  31. package/cms/vendor-map.d.ts +12 -8
  32. package/core/core.module.d.ts +2 -0
  33. package/core/directives/directives.module.d.ts +7 -0
  34. package/core/directives/index.d.ts +2 -0
  35. package/core/directives/primeng-calendar.directive.d.ts +14 -0
  36. package/core/index.d.ts +2 -0
  37. package/core/modules/configuration/helpers.d.ts +2 -2
  38. package/core/modules/configuration/services/configuration-runtime.service.d.ts +2 -2
  39. package/core/modules/configuration/services/configuration.service.d.ts +3 -3
  40. package/core/pipes/date.pipe.d.ts +12 -0
  41. package/core/pipes/index.d.ts +4 -0
  42. package/core/pipes/number.pipe.d.ts +10 -0
  43. package/core/pipes/pipes.module.d.ts +9 -0
  44. package/core/pipes/price.pipe.d.ts +10 -0
  45. package/core/services/index.d.ts +1 -0
  46. package/core/services/runtime-settings.service.d.ts +21 -0
  47. package/core/types/formatting-settings.types.d.ts +11 -0
  48. package/core/types/index.d.ts +1 -0
  49. package/core/types/runtime.types.d.ts +1 -2
  50. package/core/types/ui-definition.types.d.ts +0 -40
  51. package/core/utils/line-item.utils.d.ts +6 -3
  52. package/core/utils/line-item.worker.d.ts +2 -2
  53. package/core/utils/ui-definition.utils.d.ts +1 -1
  54. package/esm2020/cms/cms.actions.mjs +42 -2
  55. package/esm2020/cms/cms.default.mjs +1 -1
  56. package/esm2020/cms/cms.elements.mjs +16 -4
  57. package/esm2020/cms/cms.layouts.mjs +73 -13
  58. package/esm2020/cms/components/element-children/element-children.component.mjs +11 -6
  59. package/esm2020/cms/components/element-drop-handle/element-drop-handle.component.mjs +2 -2
  60. package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +35 -0
  61. package/esm2020/cms/components/preview/preview.component.mjs +18 -16
  62. package/esm2020/cms/components/preview/preview.module.mjs +22 -4
  63. package/esm2020/cms/components/preview/preview.types.mjs +1 -1
  64. package/esm2020/cms/definitions/index.mjs +2 -0
  65. package/esm2020/cms/definitions/ui-builder.definitions.mjs +18 -0
  66. package/esm2020/cms/index.mjs +3 -1
  67. package/esm2020/cms/injection-tokens.mjs +1 -2
  68. package/esm2020/cms/modules/migrations/migrations.mjs +10 -3
  69. package/esm2020/cms/modules/migrations/services/migrations.service.mjs +1 -1
  70. package/esm2020/cms/modules/migrations/types/migrations.types.mjs +1 -1
  71. package/esm2020/cms/modules/runtime/index.mjs +2 -1
  72. package/esm2020/cms/modules/runtime/services/compilation.service.mjs +5 -3
  73. package/esm2020/cms/modules/runtime/services/runtime-editor.service.mjs +5 -3
  74. package/esm2020/cms/modules/runtime/services/runtime.service.mjs +41 -6
  75. package/esm2020/cms/modules/runtime/types/runtime.actions.mjs +1 -1
  76. package/esm2020/cms/plugins/element-hover.plugin.mjs +121 -0
  77. package/esm2020/cms/plugins/page.plugin.mjs +37 -0
  78. package/esm2020/cms/plugins/region.plugin.mjs +3 -2
  79. package/esm2020/cms/plugins/script.plugin.mjs +6 -40
  80. package/esm2020/cms/services/integration.state.mjs +3 -6
  81. package/esm2020/cms/services/io-provider.service.mjs +7 -5
  82. package/esm2020/cms/types/common.types.mjs +1 -1
  83. package/esm2020/cms/types/index.mjs +3 -1
  84. package/esm2020/cms/types/layouts.types.mjs +70 -1
  85. package/esm2020/cms/types/pages.types.mjs +2 -0
  86. package/esm2020/cms/utils/element.utils.mjs +1 -1
  87. package/esm2020/cms/utils/elements-resolver.mjs +22 -8
  88. package/esm2020/cms/utils/index.mjs +2 -1
  89. package/esm2020/cms/utils/script.utils.mjs +42 -0
  90. package/esm2020/cms/utils/ui-builder-layout.utils.mjs +46 -0
  91. package/esm2020/cms/vendor-map.mjs +5 -3
  92. package/esm2020/core/core.module.mjs +33 -4
  93. package/esm2020/core/directives/directives.module.mjs +16 -0
  94. package/esm2020/core/directives/index.mjs +3 -0
  95. package/esm2020/core/directives/primeng-calendar.directive.mjs +41 -0
  96. package/esm2020/core/index.mjs +3 -1
  97. package/esm2020/core/modules/configuration/configuration.module.mjs +2 -2
  98. package/esm2020/core/modules/configuration/helpers.mjs +3 -6
  99. package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +3 -2
  100. package/esm2020/core/modules/configuration/services/configuration.service.mjs +6 -5
  101. package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +6 -12
  102. package/esm2020/core/pipes/date.pipe.mjs +38 -0
  103. package/esm2020/core/pipes/index.mjs +5 -0
  104. package/esm2020/core/pipes/number.pipe.mjs +27 -0
  105. package/esm2020/core/pipes/pipes.module.mjs +18 -0
  106. package/esm2020/core/pipes/price.pipe.mjs +30 -0
  107. package/esm2020/core/services/index.mjs +2 -1
  108. package/esm2020/core/services/runtime-settings.service.mjs +88 -0
  109. package/esm2020/core/types/formatting-settings.types.mjs +3 -0
  110. package/esm2020/core/types/index.mjs +2 -1
  111. package/esm2020/core/types/runtime.types.mjs +1 -1
  112. package/esm2020/core/types/ui-definition.types.mjs +1 -1
  113. package/esm2020/core/utils/line-item.utils.mjs +19 -9
  114. package/esm2020/core/utils/line-item.worker.mjs +5 -5
  115. package/esm2020/core/utils/ui-definition.utils.mjs +1 -1
  116. package/esm2020/runtime/components/ui-runtime-preview/runtime-preview.component.mjs +2 -2
  117. package/esm2020/runtime/services/runtime-context.service.mjs +8 -5
  118. package/esm2020/runtime/services/runtime.service.mjs +1 -1
  119. package/esm2020/runtime/types/runtime.types.mjs +1 -1
  120. package/esm2020/src/components/dialog/dialog.component.mjs +3 -3
  121. package/esm2020/src/components/doc-gen/doc-gen.component.mjs +2 -2
  122. package/esm2020/src/components/header/cart-overlay/cart-preview.component.mjs +5 -6
  123. package/esm2020/src/components/header/cart-overlay/cart-preview.module.mjs +7 -4
  124. package/esm2020/src/components/header/header.component.mjs +49 -41
  125. package/esm2020/src/components/header/header.module.mjs +7 -3
  126. package/esm2020/src/components/header/metrics/metrics.component.mjs +35 -7
  127. package/esm2020/src/components/header/metrics/metrics.module.mjs +7 -3
  128. package/esm2020/src/flow-routing.module.mjs +1 -1
  129. package/esm2020/src/guards/context.guard.mjs +11 -8
  130. package/esm2020/src/pages/assets/assets.component.mjs +2 -2
  131. package/esm2020/src/pages/catalog/catalog.component.mjs +3 -3
  132. package/esm2020/src/pages/product/product.component.mjs +2 -2
  133. package/esm2020/src/pages/remote/remote.component.mjs +1 -1
  134. package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +3 -3
  135. package/esm2020/src/services/flow-dialog.service.mjs +15 -15
  136. package/esm2020/src/types/flow-customization.types.mjs +1 -1
  137. package/fesm2015/veloceapps-sdk-cms.mjs +774 -356
  138. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  139. package/fesm2015/veloceapps-sdk-core.mjs +300 -36
  140. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  141. package/fesm2015/veloceapps-sdk-runtime.mjs +7 -4
  142. package/fesm2015/veloceapps-sdk-runtime.mjs.map +1 -1
  143. package/fesm2015/veloceapps-sdk.mjs +141 -94
  144. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  145. package/fesm2020/veloceapps-sdk-cms.mjs +857 -358
  146. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  147. package/fesm2020/veloceapps-sdk-core.mjs +293 -36
  148. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  149. package/fesm2020/veloceapps-sdk-runtime.mjs +7 -4
  150. package/fesm2020/veloceapps-sdk-runtime.mjs.map +1 -1
  151. package/fesm2020/veloceapps-sdk.mjs +139 -92
  152. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  153. package/package.json +1 -1
  154. package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +3 -3
  155. package/runtime/services/runtime.service.d.ts +2 -2
  156. package/runtime/types/runtime.types.d.ts +2 -2
  157. package/src/components/doc-gen/doc-gen.component.d.ts +2 -1
  158. package/src/components/header/cart-overlay/cart-preview.component.d.ts +1 -1
  159. package/src/components/header/cart-overlay/cart-preview.module.d.ts +1 -1
  160. package/src/components/header/header.component.d.ts +2 -3
  161. package/src/components/header/header.module.d.ts +2 -1
  162. package/src/components/header/metrics/metrics.component.d.ts +10 -2
  163. package/src/components/header/metrics/metrics.module.d.ts +2 -1
  164. package/src/guards/context.guard.d.ts +3 -2
  165. package/src/pages/assets/assets.component.d.ts +2 -1
  166. package/src/pages/catalog/catalog.component.d.ts +2 -1
  167. package/src/pages/product/product.component.d.ts +2 -1
  168. package/src/pages/remote/remote.component.d.ts +2 -1
  169. package/src/pages/shopping-cart/shopping-cart.component.d.ts +2 -1
  170. package/src/types/flow-customization.types.d.ts +1 -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, isLegacyUIDefinition, 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";
@@ -111,16 +112,10 @@ class RuntimeContextService {
111
112
  }
112
113
  getUIDefinition(runtimeData) {
113
114
  var _a;
114
- let rawUiDefinitions;
115
- try {
116
- rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
117
- }
118
- catch (e) {
119
- return;
120
- }
121
- const uiDefinitions = rawUiDefinitions.filter(uiDef => uiDef.version);
122
- const uiDefinition = (_a = uiDefinitions.find(uiDef => uiDef.primary)) !== null && _a !== void 0 ? _a : uiDefinitions[0];
123
- return uiDefinition;
115
+ const uiDefinitions = runtimeData.uiDefinitions
116
+ .map(({ source }) => source)
117
+ .filter((uiDefinition) => !isLegacyUIDefinition(uiDefinition));
118
+ return (_a = uiDefinitions.find(uiDef => uiDef.primary)) !== null && _a !== void 0 ? _a : uiDefinitions[0];
124
119
  }
125
120
  }
126
121
  RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -158,7 +153,7 @@ class ConfigurationRuntimeService {
158
153
  runtimeMode: RuntimeMode.TEST,
159
154
  };
160
155
  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),
156
+ 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
157
  });
163
158
  this._isInitialized = true;
164
159
  }));
@@ -243,15 +238,22 @@ const removeLineItem = (lineItem, idToRemove) => {
243
238
  })
244
239
  .filter(r => !!r) });
245
240
  };
246
- const replaceLineItem = (lineItem, replaceTo) => {
241
+ const replaceLineItem = (lineItem, replaceTo, skipCardinalityCalculation = false) => {
247
242
  if (lineItem.id === replaceTo.id) {
248
- return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
243
+ if (!skipCardinalityCalculation) {
244
+ return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
245
+ }
246
+ else {
247
+ return Object.assign({}, replaceTo);
248
+ }
249
249
  }
250
- return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo)) });
250
+ return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo, skipCardinalityCalculation)) });
251
251
  };
252
252
  const calculateCardinalityVariables = (lineItems) => {
253
253
  const cardVars = new Map();
254
- lineItems.forEach(li => {
254
+ lineItems
255
+ .filter(({ port, type }) => !!port && !!type)
256
+ .forEach(li => {
255
257
  var _a;
256
258
  const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
257
259
  cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
@@ -289,13 +291,13 @@ const upsertAttributes = (originalAttributes, attributesToUpsert) => {
289
291
  ];
290
292
  }, originalAttributes);
291
293
  };
292
- const patchAttributes = (rootLineItem, id, attrs) => {
294
+ const patchAttributes = (rootLineItem, id, attrs, skipCardinalityCalculation = false) => {
293
295
  const lineItem = findLineItem(id, [rootLineItem]);
294
296
  if (!lineItem) {
295
297
  return rootLineItem;
296
298
  }
297
299
  const attributes = upsertAttributes(lineItem.attributes, attrs);
298
- return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }));
300
+ return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }), skipCardinalityCalculation);
299
301
  };
300
302
  const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
301
303
  const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
@@ -343,10 +345,10 @@ const getOriginParent = (lineItems, currentLineItem) => {
343
345
  return target;
344
346
  };
345
347
  const isLineItemModified = (lineItem) => {
346
- if (lineItem.status === 'PENDING' && lineItem.actionCode === 'EXIST') {
348
+ if (lineItem.actionCode === 'EXIST' && lineItem.status === 'PENDING') {
347
349
  return false;
348
350
  }
349
- return lineItem.status !== 'EXIST';
351
+ return lineItem.actionCode !== 'EXIST';
350
352
  };
351
353
  const multiplyLineItems = (lineItem, qty, split) => {
352
354
  if (split) {
@@ -359,10 +361,14 @@ const multiplyLineItems = (lineItem, qty, split) => {
359
361
  ];
360
362
  }
361
363
  };
364
+ const filterOutTechnicalAttributes = (attributes) => {
365
+ return attributes.filter(({ name }) => !name.startsWith('#') && !name.startsWith('$'));
366
+ };
362
367
 
363
368
  var lineItem_utils = /*#__PURE__*/Object.freeze({
364
369
  __proto__: null,
365
370
  calculateCardinalityVariables: calculateCardinalityVariables,
371
+ filterOutTechnicalAttributes: filterOutTechnicalAttributes,
366
372
  findLineItem: findLineItem,
367
373
  findLineItemWithComparator: findLineItemWithComparator,
368
374
  generateLineItem: generateLineItem,
@@ -392,11 +398,11 @@ class LineItemWorker {
392
398
  remove(id) {
393
399
  return new LineItemWorker(removeLineItem(this.li, id));
394
400
  }
395
- replace(toReplace) {
396
- return new LineItemWorker(replaceLineItem(this.li, toReplace));
401
+ replace(toReplace, skipCardinalityCalculation = false) {
402
+ return new LineItemWorker(replaceLineItem(this.li, toReplace, skipCardinalityCalculation));
397
403
  }
398
- patchAttribute(attrs, id) {
399
- return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
404
+ patchAttribute(attrs, id, skipCardinalityCalculation = false) {
405
+ return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs, skipCardinalityCalculation));
400
406
  }
401
407
  }
402
408
 
@@ -631,11 +637,12 @@ class ConfigurationService {
631
637
  this.charges.next({});
632
638
  this.pricePlans.next({});
633
639
  }
634
- patch$(lineItem) {
640
+ patch$(lineItem, options) {
635
641
  if (!this.lineItem.value) {
636
642
  return throwError(() => new Error(`Source LineItem not found`));
637
643
  }
638
- this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
644
+ const skipCardinalityCalculation = (options === null || options === void 0 ? void 0 : options.skipCardinalityCalculation) || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
645
+ this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
639
646
  return this.configure().pipe(catchError(error => {
640
647
  console.error(error);
641
648
  if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
@@ -650,8 +657,8 @@ class ConfigurationService {
650
657
  }
651
658
  }));
652
659
  }
653
- patch(lineItem) {
654
- this.patch$(lineItem).subscribe();
660
+ patch(lineItem, options) {
661
+ this.patch$(lineItem, options).subscribe();
655
662
  }
656
663
  setConfigurableRamp(lineItem) {
657
664
  this.configurableRamp = lineItem;
@@ -1225,16 +1232,273 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1225
1232
  args: [{ providedIn: 'root' }]
1226
1233
  }], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
1227
1234
 
1235
+ class RuntimeSettingsService {
1236
+ constructor(configurationSettingsApiService) {
1237
+ this.configurationSettingsApiService = configurationSettingsApiService;
1238
+ this.configurationSettings$ = new BehaviorSubject({});
1239
+ this.currencySettings$ = new BehaviorSubject({
1240
+ iso: DEFAULT_CURRENCY_ISO_CODE,
1241
+ symbol: DEFAULT_CURRENCY_SYMBOL,
1242
+ });
1243
+ this.getCurrencySymbol = (locale, currency) => {
1244
+ return (0)
1245
+ .toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
1246
+ .replace(/\d/g, '')
1247
+ .trim();
1248
+ };
1249
+ }
1250
+ create() {
1251
+ return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
1252
+ this.configurationSettings$.next(configurationSettings);
1253
+ this.formattingSettings = this.getFormattingSettings();
1254
+ }), map$2(() => undefined));
1255
+ }
1256
+ initCurrency(iso) {
1257
+ if (iso) {
1258
+ const symbol = this.getCurrencySymbol('en-US', iso);
1259
+ this.currencySettings$.next({ iso, symbol });
1260
+ }
1261
+ }
1262
+ getFormattingSettings() {
1263
+ var _a, _b, _c, _d;
1264
+ if (this.formattingSettings) {
1265
+ return this.formattingSettings;
1266
+ }
1267
+ const shoppingCartSettings = (_a = this.getConfigurationSettings()['shopping-cart']) === null || _a === void 0 ? void 0 : _a.reduce((acc, setting) => {
1268
+ return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
1269
+ }, {});
1270
+ const currencySettings = this.getCurrencySettings();
1271
+ 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)) ||
1272
+ DEFAULT_DATE_FORMAT;
1273
+ const decimalSeparator = (_c = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DECIMAL_SEPARATOR) !== null && _c !== void 0 ? _c : DEFAULT_DECIMAL_SEPARATOR;
1274
+ const thousandsSeparator = (_d = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.THOUSANDS_SEPARATOR) !== null && _d !== void 0 ? _d : DEFAULT_THOUSANDS_SEPARATOR;
1275
+ return {
1276
+ currencySymbol: currencySettings.symbol,
1277
+ dateFormats: getSupportedDateFormats(dateFormat),
1278
+ decimalSeparator: (['.', ','].includes(decimalSeparator) && decimalSeparator) || DEFAULT_DECIMAL_SEPARATOR,
1279
+ decimalsCount: (!isNaN(Number(shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE)) && Number(shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE)) ||
1280
+ DEFAULT_DECIMALS_COUNT,
1281
+ thousandsSeparator: ['.', ',', ''].includes(thousandsSeparator)
1282
+ ? thousandsSeparator
1283
+ : DEFAULT_THOUSANDS_SEPARATOR,
1284
+ };
1285
+ }
1286
+ getConfigurationSettings() {
1287
+ return this.configurationSettings$.value;
1288
+ }
1289
+ getCurrencySettings() {
1290
+ return this.currencySettings$.value;
1291
+ }
1292
+ parseConfigurationSettings(settings) {
1293
+ return settings.reduce((acc, setting) => {
1294
+ switch (setting.key) {
1295
+ case 'shopping-cart':
1296
+ acc['shopping-cart'] = parseJsonSafely(setting.value, []);
1297
+ break;
1298
+ case 'navigation':
1299
+ acc.navigation = parseJsonSafely(setting.value, {});
1300
+ break;
1301
+ case 'flows':
1302
+ acc.flows = parseJsonSafely(setting.value, []);
1303
+ break;
1304
+ default:
1305
+ acc[setting.key] = setting.value;
1306
+ }
1307
+ return acc;
1308
+ }, {});
1309
+ }
1310
+ }
1311
+ RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1312
+ RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
1313
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, decorators: [{
1314
+ type: Injectable,
1315
+ args: [{ providedIn: 'root' }]
1316
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
1317
+
1318
+ const DEFAULT_FORMATTING_SETTINGS = {
1319
+ currencySymbol: DEFAULT_CURRENCY_SYMBOL,
1320
+ decimalsCount: DEFAULT_DECIMALS_COUNT,
1321
+ dateFormats: getSupportedDateFormats(DEFAULT_DATE_FORMAT),
1322
+ decimalSeparator: DEFAULT_DECIMAL_SEPARATOR,
1323
+ thousandsSeparator: DEFAULT_THOUSANDS_SEPARATOR,
1324
+ };
1228
1325
  class SdkCoreModule {
1229
1326
  }
1230
1327
  SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1231
1328
  SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1232
- SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService], imports: [ConfigurationModule, FlowConfigurationModule] });
1329
+ SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
1330
+ ContextService,
1331
+ QuoteDraftService,
1332
+ ProductImagesService,
1333
+ MetricsCalculationService,
1334
+ RuntimeSettingsService,
1335
+ {
1336
+ provide: FORMATTING_SETTINGS_TOKEN,
1337
+ useExisting: RuntimeSettingsService,
1338
+ },
1339
+ ], imports: [ConfigurationModule, FlowConfigurationModule] });
1233
1340
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
1234
1341
  type: NgModule,
1235
1342
  args: [{
1236
1343
  imports: [ConfigurationModule, FlowConfigurationModule],
1237
- providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService],
1344
+ providers: [
1345
+ ContextService,
1346
+ QuoteDraftService,
1347
+ ProductImagesService,
1348
+ MetricsCalculationService,
1349
+ RuntimeSettingsService,
1350
+ {
1351
+ provide: FORMATTING_SETTINGS_TOKEN,
1352
+ useExisting: RuntimeSettingsService,
1353
+ },
1354
+ ],
1355
+ }]
1356
+ }] });
1357
+
1358
+ class CalendarDirective {
1359
+ constructor() {
1360
+ var _a;
1361
+ this.ngControl = inject(NgControl, { host: true, optional: true });
1362
+ this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
1363
+ this.destroy$ = new Subject();
1364
+ }
1365
+ set vlCalendar(calendar) {
1366
+ this.calendar = calendar;
1367
+ }
1368
+ ngOnDestroy() {
1369
+ this.destroy$.next();
1370
+ this.destroy$.complete();
1371
+ }
1372
+ ngOnInit() {
1373
+ var _a, _b;
1374
+ if (this.calendar) {
1375
+ this.calendar.dateFormat = (_b = (_a = this.formattingSettings) === null || _a === void 0 ? void 0 : _a.dateFormats.primengFormat) !== null && _b !== void 0 ? _b : DEFAULT_DATE_FORMAT;
1376
+ if (this.ngControl && this.ngControl.control) {
1377
+ const control = this.ngControl.control;
1378
+ control.setValue(control.value, { emitEvent: false });
1379
+ }
1380
+ }
1381
+ }
1382
+ }
1383
+ CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1384
+ CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: CalendarDirective, selector: "[vlCalendar]", inputs: { vlCalendar: "vlCalendar" }, ngImport: i0 });
1385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, decorators: [{
1386
+ type: Directive,
1387
+ args: [{
1388
+ selector: '[vlCalendar]',
1389
+ }]
1390
+ }], propDecorators: { vlCalendar: [{
1391
+ type: Input
1392
+ }] } });
1393
+
1394
+ class SdkDirectivesModule {
1395
+ }
1396
+ SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1397
+ SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, declarations: [CalendarDirective], exports: [CalendarDirective] });
1398
+ SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule });
1399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, decorators: [{
1400
+ type: NgModule,
1401
+ args: [{
1402
+ declarations: [CalendarDirective],
1403
+ exports: [CalendarDirective],
1404
+ }]
1405
+ }] });
1406
+
1407
+ class DatePipe {
1408
+ constructor() {
1409
+ var _a;
1410
+ this.locale = inject(LOCALE_ID);
1411
+ this.defaultOptions = inject(DATE_PIPE_DEFAULT_OPTIONS, { optional: true });
1412
+ this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
1413
+ this.destroy$ = new Subject();
1414
+ }
1415
+ ngOnDestroy() {
1416
+ this.destroy$.next();
1417
+ this.destroy$.complete();
1418
+ }
1419
+ transform(date) {
1420
+ var _a, _b;
1421
+ if (!date) {
1422
+ return '';
1423
+ }
1424
+ try {
1425
+ 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);
1426
+ }
1427
+ catch (error) {
1428
+ return new Date(date).toString();
1429
+ }
1430
+ }
1431
+ }
1432
+ DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1433
+ DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, name: "vlDate" });
1434
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, decorators: [{
1435
+ type: Pipe,
1436
+ args: [{
1437
+ name: 'vlDate',
1438
+ }]
1439
+ }] });
1440
+
1441
+ class NumberPipe {
1442
+ constructor() {
1443
+ var _a;
1444
+ this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
1445
+ this.destroy$ = new Subject();
1446
+ }
1447
+ ngOnDestroy() {
1448
+ this.destroy$.next();
1449
+ this.destroy$.complete();
1450
+ }
1451
+ transform(price) {
1452
+ var _a, _b, _c;
1453
+ 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);
1454
+ }
1455
+ }
1456
+ NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1457
+ NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, name: "vlNumber" });
1458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, decorators: [{
1459
+ type: Pipe,
1460
+ args: [{
1461
+ name: 'vlNumber',
1462
+ }]
1463
+ }] });
1464
+
1465
+ class PricePipe {
1466
+ constructor() {
1467
+ var _a;
1468
+ this.formattingSettings = (_a = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })) === null || _a === void 0 ? void 0 : _a.getFormattingSettings();
1469
+ this.destroy$ = new Subject();
1470
+ }
1471
+ ngOnDestroy() {
1472
+ this.destroy$.next();
1473
+ this.destroy$.complete();
1474
+ }
1475
+ transform(price) {
1476
+ var _a, _b, _c, _d;
1477
+ if (price == null || price === '') {
1478
+ return '';
1479
+ }
1480
+ 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)}`;
1481
+ }
1482
+ }
1483
+ PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1484
+ PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, name: "vlPrice" });
1485
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, decorators: [{
1486
+ type: Pipe,
1487
+ args: [{
1488
+ name: 'vlPrice',
1489
+ }]
1490
+ }] });
1491
+
1492
+ class SdkPipesModule {
1493
+ }
1494
+ SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1495
+ SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, declarations: [NumberPipe, PricePipe, DatePipe], exports: [NumberPipe, PricePipe, DatePipe] });
1496
+ SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule });
1497
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, decorators: [{
1498
+ type: NgModule,
1499
+ args: [{
1500
+ declarations: [NumberPipe, PricePipe, DatePipe],
1501
+ exports: [NumberPipe, PricePipe, DatePipe],
1238
1502
  }]
1239
1503
  }] });
1240
1504
 
@@ -1242,5 +1506,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1242
1506
  * Generated bundle index. Do not edit.
1243
1507
  */
1244
1508
 
1245
- 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 };
1509
+ 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 };
1246
1510
  //# sourceMappingURL=veloceapps-sdk-core.mjs.map