@veloceapps/sdk 7.0.2-5 → 7.0.2-51

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) 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 +13 -7
  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 +7 -2
  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 +38 -16
  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/doc-gen/doc-gen.component.mjs +2 -2
  121. package/esm2020/src/components/header/header.component.mjs +39 -33
  122. package/esm2020/src/components/header/header.module.mjs +7 -3
  123. package/esm2020/src/components/header/metrics/metrics.component.mjs +9 -7
  124. package/esm2020/src/components/header/metrics/metrics.module.mjs +7 -3
  125. package/esm2020/src/flow-routing.module.mjs +1 -1
  126. package/esm2020/src/guards/context.guard.mjs +11 -8
  127. package/esm2020/src/pages/assets/assets.component.mjs +2 -2
  128. package/esm2020/src/pages/catalog/catalog.component.mjs +3 -3
  129. package/esm2020/src/pages/product/product.component.mjs +2 -2
  130. package/esm2020/src/pages/remote/remote.component.mjs +1 -1
  131. package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +3 -3
  132. package/esm2020/src/types/flow-customization.types.mjs +1 -1
  133. package/fesm2015/veloceapps-sdk-cms.mjs +774 -356
  134. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  135. package/fesm2015/veloceapps-sdk-core.mjs +321 -43
  136. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  137. package/fesm2015/veloceapps-sdk-runtime.mjs +7 -4
  138. package/fesm2015/veloceapps-sdk-runtime.mjs.map +1 -1
  139. package/fesm2015/veloceapps-sdk.mjs +70 -52
  140. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  141. package/fesm2020/veloceapps-sdk-cms.mjs +857 -358
  142. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  143. package/fesm2020/veloceapps-sdk-core.mjs +314 -43
  144. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  145. package/fesm2020/veloceapps-sdk-runtime.mjs +7 -4
  146. package/fesm2020/veloceapps-sdk-runtime.mjs.map +1 -1
  147. package/fesm2020/veloceapps-sdk.mjs +68 -51
  148. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  149. package/package.json +1 -1
  150. package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +3 -3
  151. package/runtime/services/runtime.service.d.ts +2 -2
  152. package/runtime/types/runtime.types.d.ts +2 -2
  153. package/src/components/doc-gen/doc-gen.component.d.ts +2 -1
  154. package/src/components/header/header.component.d.ts +2 -3
  155. package/src/components/header/header.module.d.ts +2 -1
  156. package/src/components/header/metrics/metrics.component.d.ts +4 -2
  157. package/src/components/header/metrics/metrics.module.d.ts +2 -1
  158. package/src/guards/context.guard.d.ts +3 -2
  159. package/src/pages/assets/assets.component.d.ts +2 -1
  160. package/src/pages/catalog/catalog.component.d.ts +2 -1
  161. package/src/pages/product/product.component.d.ts +2 -1
  162. package/src/pages/remote/remote.component.d.ts +2 -1
  163. package/src/pages/shopping-cart/shopping-cart.component.d.ts +2 -1
  164. 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 { Injectable, InjectionToken, 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 * 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';
@@ -10,10 +10,13 @@ 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 'primeng/calendar';
15
+ import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
13
16
 
14
17
  const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
15
18
  const id = UUID.UUID();
16
- const lineItem = {
19
+ return {
17
20
  id,
18
21
  type: uiDefinitionProperties.rootType ?? '',
19
22
  cfgStatus: 'Default',
@@ -21,11 +24,8 @@ const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
21
24
  qty,
22
25
  productName: context.properties?.['displayName'] || context.productName,
23
26
  productId: context.productId ?? '',
24
- ...(context.offeringId
25
- ? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
26
- : {}),
27
+ ...(uiDefinitionProperties.offeringId ? { offeringId: uiDefinitionProperties.offeringId } : {}),
27
28
  };
28
- return lineItem;
29
29
  };
30
30
 
31
31
  class ContextService {
@@ -84,6 +84,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
84
84
  args: [{ providedIn: 'root' }]
85
85
  }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
86
86
 
87
+ const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
88
+
87
89
  var RuntimeMode;
88
90
  (function (RuntimeMode) {
89
91
  RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
@@ -127,16 +129,10 @@ class RuntimeContextService {
127
129
  }));
128
130
  }
129
131
  getUIDefinition(runtimeData) {
130
- let rawUiDefinitions;
131
- try {
132
- rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
133
- }
134
- catch (e) {
135
- return;
136
- }
137
- const uiDefinitions = rawUiDefinitions.filter(uiDef => uiDef.version);
138
- const uiDefinition = uiDefinitions.find(uiDef => uiDef.primary) ?? uiDefinitions[0];
139
- return uiDefinition;
132
+ const uiDefinitions = runtimeData.uiDefinitions
133
+ .map(({ source }) => source)
134
+ .filter((uiDefinition) => !isLegacyUIDefinition(uiDefinition));
135
+ return uiDefinitions.find(uiDef => uiDef.primary) ?? uiDefinitions[0];
140
136
  }
141
137
  }
142
138
  RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -180,6 +176,7 @@ class ConfigurationRuntimeService {
180
176
  PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
181
177
  StartDate: new Date().toISOString().substring(0, 10),
182
178
  PriceListId: this.uiDefinitionProperties.priceList,
179
+ offeringId: this.uiDefinitionProperties.offeringId,
183
180
  standalone: 'true',
184
181
  ...uiDefinitionExternals,
185
182
  },
@@ -503,18 +500,25 @@ const removeLineItem = (lineItem, idToRemove) => {
503
500
  .filter(r => !!r),
504
501
  };
505
502
  };
506
- const replaceLineItem = (lineItem, replaceTo) => {
503
+ const replaceLineItem = (lineItem, replaceTo, skipCardinalityCalculation = false) => {
507
504
  if (lineItem.id === replaceTo.id) {
508
- return { ...recalculateCardinalityVariables(lineItem, replaceTo) };
505
+ if (!skipCardinalityCalculation) {
506
+ return { ...recalculateCardinalityVariables(lineItem, replaceTo) };
507
+ }
508
+ else {
509
+ return { ...replaceTo };
510
+ }
509
511
  }
510
512
  return {
511
513
  ...lineItem,
512
- lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo)),
514
+ lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo, skipCardinalityCalculation)),
513
515
  };
514
516
  };
515
517
  const calculateCardinalityVariables = (lineItems) => {
516
518
  const cardVars = new Map();
517
- lineItems.forEach(li => {
519
+ lineItems
520
+ .filter(({ port, type }) => !!port && !!type)
521
+ .forEach(li => {
518
522
  const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
519
523
  cardVars.set(cardinalityVariableName, (cardVars.get(cardinalityVariableName) ?? 0) + li.qty);
520
524
  });
@@ -554,13 +558,13 @@ const upsertAttributes = (originalAttributes, attributesToUpsert) => {
554
558
  ];
555
559
  }, originalAttributes);
556
560
  };
557
- const patchAttributes = (rootLineItem, id, attrs) => {
561
+ const patchAttributes = (rootLineItem, id, attrs, skipCardinalityCalculation = false) => {
558
562
  const lineItem = findLineItem(id, [rootLineItem]);
559
563
  if (!lineItem) {
560
564
  return rootLineItem;
561
565
  }
562
566
  const attributes = upsertAttributes(lineItem.attributes, attrs);
563
- return replaceLineItem(rootLineItem, { ...lineItem, attributes });
567
+ return replaceLineItem(rootLineItem, { ...lineItem, attributes }, skipCardinalityCalculation);
564
568
  };
565
569
  const getAttributeValue = (attributes, name) => attributes.find(attr => attr.name === name)?.value;
566
570
  const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
@@ -588,19 +592,31 @@ const getRecommendedPrices = (portDomain, type) => {
588
592
  };
589
593
  const generateModifiedAssetsMap = (lineItems) => {
590
594
  return lineItems.reduce((acc, li) => {
591
- if (li.rampInstanceId && li.status !== 'EXIST') {
592
- let target = li;
593
- while (target && target.rampInstanceId) {
594
- target = lineItems.find(sub => sub.id === li.rampInstanceId);
595
- }
596
- const id = target?.assetId ?? target?.openOrderLineItemId;
597
- if (id) {
598
- acc[id] = true;
599
- }
595
+ const isModified = isLineItemModified(li);
596
+ if (!isModified) {
597
+ return acc;
598
+ }
599
+ const target = getOriginParent(lineItems, li);
600
+ const id = target?.assetId ?? target?.openOrderLineItemId;
601
+ if (id) {
602
+ acc[id] = true;
600
603
  }
601
604
  return acc;
602
605
  }, {});
603
606
  };
607
+ const getOriginParent = (lineItems, currentLineItem) => {
608
+ let target = currentLineItem;
609
+ while (target && target.rampInstanceId) {
610
+ target = lineItems.find(sub => sub.id === currentLineItem.rampInstanceId);
611
+ }
612
+ return target;
613
+ };
614
+ const isLineItemModified = (lineItem) => {
615
+ if (lineItem.actionCode === 'EXIST' && lineItem.status === 'PENDING') {
616
+ return false;
617
+ }
618
+ return lineItem.actionCode !== 'EXIST';
619
+ };
604
620
  const multiplyLineItems = (lineItem, qty, split) => {
605
621
  if (split) {
606
622
  const unifyIds = (lineItem) => ({
@@ -619,18 +635,24 @@ const multiplyLineItems = (lineItem, qty, split) => {
619
635
  ];
620
636
  }
621
637
  };
638
+ const filterOutTechnicalAttributes = (attributes) => {
639
+ return attributes.filter(({ name }) => !name.startsWith('#') && !name.startsWith('$'));
640
+ };
622
641
 
623
642
  var lineItem_utils = /*#__PURE__*/Object.freeze({
624
643
  __proto__: null,
625
644
  calculateCardinalityVariables: calculateCardinalityVariables,
645
+ filterOutTechnicalAttributes: filterOutTechnicalAttributes,
626
646
  findLineItem: findLineItem,
627
647
  findLineItemWithComparator: findLineItemWithComparator,
628
648
  generateLineItem: generateLineItem,
629
649
  generateModifiedAssetsMap: generateModifiedAssetsMap,
630
650
  getAttributeValue: getAttributeValue,
631
651
  getAttributes: getAttributes,
652
+ getOriginParent: getOriginParent,
632
653
  getRecommendedPrices: getRecommendedPrices,
633
654
  insertLineItem: insertLineItem,
655
+ isLineItemModified: isLineItemModified,
634
656
  mapAttributes: mapAttributes,
635
657
  multiplyLineItems: multiplyLineItems,
636
658
  patchAttributes: patchAttributes,
@@ -650,11 +672,11 @@ class LineItemWorker {
650
672
  remove(id) {
651
673
  return new LineItemWorker(removeLineItem(this.li, id));
652
674
  }
653
- replace(toReplace) {
654
- return new LineItemWorker(replaceLineItem(this.li, toReplace));
675
+ replace(toReplace, skipCardinalityCalculation = false) {
676
+ return new LineItemWorker(replaceLineItem(this.li, toReplace, skipCardinalityCalculation));
655
677
  }
656
- patchAttribute(attrs, id) {
657
- return new LineItemWorker(patchAttributes(this.li, id ?? this.li.id, attrs));
678
+ patchAttribute(attrs, id, skipCardinalityCalculation = false) {
679
+ return new LineItemWorker(patchAttributes(this.li, id ?? this.li.id, attrs, skipCardinalityCalculation));
658
680
  }
659
681
  }
660
682
 
@@ -680,11 +702,12 @@ class ConfigurationService {
680
702
  this.charges.next({});
681
703
  this.pricePlans.next({});
682
704
  }
683
- patch$(lineItem) {
705
+ patch$(lineItem, options) {
684
706
  if (!this.lineItem.value) {
685
707
  return throwError(() => new Error(`Source LineItem not found`));
686
708
  }
687
- this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
709
+ const skipCardinalityCalculation = options?.skipCardinalityCalculation || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
710
+ this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
688
711
  return this.configure().pipe(catchError(error => {
689
712
  console.error(error);
690
713
  if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
@@ -699,8 +722,8 @@ class ConfigurationService {
699
722
  }
700
723
  }));
701
724
  }
702
- patch(lineItem) {
703
- this.patch$(lineItem).subscribe();
725
+ patch(lineItem, options) {
726
+ this.patch$(lineItem, options).subscribe();
704
727
  }
705
728
  setConfigurableRamp(lineItem) {
706
729
  this.configurableRamp = lineItem;
@@ -1268,16 +1291,264 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1268
1291
  args: [{ providedIn: 'root' }]
1269
1292
  }], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
1270
1293
 
1294
+ class RuntimeSettingsService {
1295
+ constructor(configurationSettingsApiService) {
1296
+ this.configurationSettingsApiService = configurationSettingsApiService;
1297
+ this.configurationSettings$ = new BehaviorSubject({});
1298
+ this.currencySettings$ = new BehaviorSubject({
1299
+ iso: DEFAULT_CURRENCY_ISO_CODE,
1300
+ symbol: DEFAULT_CURRENCY_SYMBOL,
1301
+ });
1302
+ this.getCurrencySymbol = (locale, currency) => {
1303
+ return (0)
1304
+ .toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
1305
+ .replace(/\d/g, '')
1306
+ .trim();
1307
+ };
1308
+ }
1309
+ create() {
1310
+ return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
1311
+ this.configurationSettings$.next(configurationSettings);
1312
+ this.formattingSettings = this.getFormattingSettings();
1313
+ }), map$2(() => undefined));
1314
+ }
1315
+ initCurrency(iso) {
1316
+ if (iso) {
1317
+ const symbol = this.getCurrencySymbol('en-US', iso);
1318
+ this.currencySettings$.next({ iso, symbol });
1319
+ }
1320
+ }
1321
+ getFormattingSettings() {
1322
+ if (this.formattingSettings) {
1323
+ return this.formattingSettings;
1324
+ }
1325
+ const shoppingCartSettings = this.getConfigurationSettings()['shopping-cart']?.reduce((acc, setting) => {
1326
+ return { ...acc, [setting.id]: setting.properties };
1327
+ }, {});
1328
+ const currencySettings = this.getCurrencySettings();
1329
+ const dateFormat = (validateDateFormat(shoppingCartSettings?.DATE_FORMAT ?? '') && shoppingCartSettings?.DATE_FORMAT) ||
1330
+ DEFAULT_DATE_FORMAT;
1331
+ const decimalSeparator = shoppingCartSettings?.DECIMAL_SEPARATOR ?? DEFAULT_DECIMAL_SEPARATOR;
1332
+ const thousandsSeparator = shoppingCartSettings?.THOUSANDS_SEPARATOR ?? DEFAULT_THOUSANDS_SEPARATOR;
1333
+ return {
1334
+ currencySymbol: currencySettings.symbol,
1335
+ dateFormats: getSupportedDateFormats(dateFormat),
1336
+ decimalSeparator: (['.', ','].includes(decimalSeparator) && decimalSeparator) || DEFAULT_DECIMAL_SEPARATOR,
1337
+ decimalsCount: (!isNaN(Number(shoppingCartSettings?.PRICE_SCALE)) && Number(shoppingCartSettings?.PRICE_SCALE)) ||
1338
+ DEFAULT_DECIMALS_COUNT,
1339
+ thousandsSeparator: ['.', ',', ''].includes(thousandsSeparator)
1340
+ ? thousandsSeparator
1341
+ : DEFAULT_THOUSANDS_SEPARATOR,
1342
+ };
1343
+ }
1344
+ getConfigurationSettings() {
1345
+ return this.configurationSettings$.value;
1346
+ }
1347
+ getCurrencySettings() {
1348
+ return this.currencySettings$.value;
1349
+ }
1350
+ parseConfigurationSettings(settings) {
1351
+ return settings.reduce((acc, setting) => {
1352
+ switch (setting.key) {
1353
+ case 'shopping-cart':
1354
+ acc['shopping-cart'] = parseJsonSafely(setting.value, []);
1355
+ break;
1356
+ case 'navigation':
1357
+ acc.navigation = parseJsonSafely(setting.value, {});
1358
+ break;
1359
+ case 'flows':
1360
+ acc.flows = parseJsonSafely(setting.value, []);
1361
+ break;
1362
+ default:
1363
+ acc[setting.key] = setting.value;
1364
+ }
1365
+ return acc;
1366
+ }, {});
1367
+ }
1368
+ }
1369
+ RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1370
+ RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
1371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, decorators: [{
1372
+ type: Injectable,
1373
+ args: [{ providedIn: 'root' }]
1374
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
1375
+
1376
+ const DEFAULT_FORMATTING_SETTINGS = {
1377
+ currencySymbol: DEFAULT_CURRENCY_SYMBOL,
1378
+ decimalsCount: DEFAULT_DECIMALS_COUNT,
1379
+ dateFormats: getSupportedDateFormats(DEFAULT_DATE_FORMAT),
1380
+ decimalSeparator: DEFAULT_DECIMAL_SEPARATOR,
1381
+ thousandsSeparator: DEFAULT_THOUSANDS_SEPARATOR,
1382
+ };
1271
1383
  class SdkCoreModule {
1272
1384
  }
1273
1385
  SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1274
1386
  SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1275
- SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService], imports: [ConfigurationModule, FlowConfigurationModule] });
1387
+ SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
1388
+ ContextService,
1389
+ QuoteDraftService,
1390
+ ProductImagesService,
1391
+ MetricsCalculationService,
1392
+ RuntimeSettingsService,
1393
+ {
1394
+ provide: FORMATTING_SETTINGS_TOKEN,
1395
+ useExisting: RuntimeSettingsService,
1396
+ },
1397
+ ], imports: [ConfigurationModule, FlowConfigurationModule] });
1276
1398
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
1277
1399
  type: NgModule,
1278
1400
  args: [{
1279
1401
  imports: [ConfigurationModule, FlowConfigurationModule],
1280
- providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService],
1402
+ providers: [
1403
+ ContextService,
1404
+ QuoteDraftService,
1405
+ ProductImagesService,
1406
+ MetricsCalculationService,
1407
+ RuntimeSettingsService,
1408
+ {
1409
+ provide: FORMATTING_SETTINGS_TOKEN,
1410
+ useExisting: RuntimeSettingsService,
1411
+ },
1412
+ ],
1413
+ }]
1414
+ }] });
1415
+
1416
+ class CalendarDirective {
1417
+ constructor() {
1418
+ this.ngControl = inject(NgControl, { host: true, optional: true });
1419
+ this.formattingSettings = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })?.getFormattingSettings();
1420
+ this.destroy$ = new Subject();
1421
+ }
1422
+ set vlCalendar(calendar) {
1423
+ this.calendar = calendar;
1424
+ }
1425
+ ngOnDestroy() {
1426
+ this.destroy$.next();
1427
+ this.destroy$.complete();
1428
+ }
1429
+ ngOnInit() {
1430
+ if (this.calendar) {
1431
+ this.calendar.dateFormat = this.formattingSettings?.dateFormats.primengFormat ?? DEFAULT_DATE_FORMAT;
1432
+ if (this.ngControl && this.ngControl.control) {
1433
+ const control = this.ngControl.control;
1434
+ control.setValue(control.value, { emitEvent: false });
1435
+ }
1436
+ }
1437
+ }
1438
+ }
1439
+ CalendarDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1440
+ CalendarDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: CalendarDirective, selector: "[vlCalendar]", inputs: { vlCalendar: "vlCalendar" }, ngImport: i0 });
1441
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CalendarDirective, decorators: [{
1442
+ type: Directive,
1443
+ args: [{
1444
+ selector: '[vlCalendar]',
1445
+ }]
1446
+ }], propDecorators: { vlCalendar: [{
1447
+ type: Input
1448
+ }] } });
1449
+
1450
+ class SdkDirectivesModule {
1451
+ }
1452
+ SdkDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1453
+ SdkDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, declarations: [CalendarDirective], exports: [CalendarDirective] });
1454
+ SdkDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule });
1455
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkDirectivesModule, decorators: [{
1456
+ type: NgModule,
1457
+ args: [{
1458
+ declarations: [CalendarDirective],
1459
+ exports: [CalendarDirective],
1460
+ }]
1461
+ }] });
1462
+
1463
+ class DatePipe {
1464
+ constructor() {
1465
+ this.locale = inject(LOCALE_ID);
1466
+ this.defaultOptions = inject(DATE_PIPE_DEFAULT_OPTIONS, { optional: true });
1467
+ this.formattingSettings = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })?.getFormattingSettings();
1468
+ this.destroy$ = new Subject();
1469
+ }
1470
+ ngOnDestroy() {
1471
+ this.destroy$.next();
1472
+ this.destroy$.complete();
1473
+ }
1474
+ transform(date) {
1475
+ if (!date) {
1476
+ return '';
1477
+ }
1478
+ try {
1479
+ return formatDate(date, this.formattingSettings?.dateFormats.datePipeFormat || DEFAULT_DATE_FORMAT, this.locale, this.defaultOptions?.timezone);
1480
+ }
1481
+ catch (error) {
1482
+ return new Date(date).toString();
1483
+ }
1484
+ }
1485
+ }
1486
+ DatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1487
+ DatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, name: "vlDate" });
1488
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: DatePipe, decorators: [{
1489
+ type: Pipe,
1490
+ args: [{
1491
+ name: 'vlDate',
1492
+ }]
1493
+ }] });
1494
+
1495
+ class NumberPipe {
1496
+ constructor() {
1497
+ this.formattingSettings = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })?.getFormattingSettings();
1498
+ this.destroy$ = new Subject();
1499
+ }
1500
+ ngOnDestroy() {
1501
+ this.destroy$.next();
1502
+ this.destroy$.complete();
1503
+ }
1504
+ transform(price) {
1505
+ return formatNumber(price, this.formattingSettings?.thousandsSeparator, this.formattingSettings?.decimalSeparator, this.formattingSettings?.decimalsCount);
1506
+ }
1507
+ }
1508
+ NumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1509
+ NumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, name: "vlNumber" });
1510
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: NumberPipe, decorators: [{
1511
+ type: Pipe,
1512
+ args: [{
1513
+ name: 'vlNumber',
1514
+ }]
1515
+ }] });
1516
+
1517
+ class PricePipe {
1518
+ constructor() {
1519
+ this.formattingSettings = inject(FORMATTING_SETTINGS_TOKEN, { optional: true })?.getFormattingSettings();
1520
+ this.destroy$ = new Subject();
1521
+ }
1522
+ ngOnDestroy() {
1523
+ this.destroy$.next();
1524
+ this.destroy$.complete();
1525
+ }
1526
+ transform(price) {
1527
+ if (price == null || price === '') {
1528
+ return '';
1529
+ }
1530
+ return `${this.formattingSettings?.currencySymbol || DEFAULT_CURRENCY_SYMBOL}${formatNumber(price, this.formattingSettings?.thousandsSeparator, this.formattingSettings?.decimalSeparator, this.formattingSettings?.decimalsCount)}`;
1531
+ }
1532
+ }
1533
+ PricePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1534
+ PricePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, name: "vlPrice" });
1535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PricePipe, decorators: [{
1536
+ type: Pipe,
1537
+ args: [{
1538
+ name: 'vlPrice',
1539
+ }]
1540
+ }] });
1541
+
1542
+ class SdkPipesModule {
1543
+ }
1544
+ SdkPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1545
+ SdkPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, declarations: [NumberPipe, PricePipe, DatePipe], exports: [NumberPipe, PricePipe, DatePipe] });
1546
+ SdkPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule });
1547
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkPipesModule, decorators: [{
1548
+ type: NgModule,
1549
+ args: [{
1550
+ declarations: [NumberPipe, PricePipe, DatePipe],
1551
+ exports: [NumberPipe, PricePipe, DatePipe],
1281
1552
  }]
1282
1553
  }] });
1283
1554
 
@@ -1285,5 +1556,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1285
1556
  * Generated bundle index. Do not edit.
1286
1557
  */
1287
1558
 
1288
- 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 };
1559
+ 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 };
1289
1560
  //# sourceMappingURL=veloceapps-sdk-core.mjs.map