@veloceapps/sdk 6.0.0-4 → 6.0.0-40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/bundles/veloceapps-sdk-cms.umd.js +1409 -822
  2. package/bundles/veloceapps-sdk-cms.umd.js.map +1 -1
  3. package/bundles/veloceapps-sdk-core.umd.js +735 -610
  4. package/bundles/veloceapps-sdk-core.umd.js.map +1 -1
  5. package/bundles/veloceapps-sdk-runtime.umd.js +209 -142
  6. package/bundles/veloceapps-sdk-runtime.umd.js.map +1 -1
  7. package/bundles/veloceapps-sdk.umd.js +361 -298
  8. package/bundles/veloceapps-sdk.umd.js.map +1 -1
  9. package/cms/components/element-children/element-children.component.d.ts +13 -3
  10. package/cms/components/element-children/element-children.module.d.ts +4 -2
  11. package/cms/components/element-drop-handle/element-drop-handle.component.d.ts +12 -0
  12. package/cms/components/element-drop-handle/element-drop-handle.module.d.ts +9 -0
  13. package/cms/components/element-renderer/element-renderer.component.d.ts +3 -3
  14. package/cms/components/preview/index.d.ts +1 -0
  15. package/cms/components/preview/preview.component.d.ts +9 -8
  16. package/cms/components/preview/preview.module.d.ts +2 -1
  17. package/cms/components/preview/preview.types.d.ts +11 -0
  18. package/cms/index.d.ts +2 -0
  19. package/cms/launcher.module.d.ts +3 -1
  20. package/cms/modules/migrations/index.d.ts +2 -0
  21. package/cms/modules/migrations/migrations.d.ts +2 -0
  22. package/cms/modules/migrations/migrations.module.d.ts +6 -0
  23. package/cms/modules/migrations/services/migrations.service.d.ts +10 -0
  24. package/cms/modules/migrations/types/migrations.types.d.ts +2 -0
  25. package/cms/modules/runtime/index.d.ts +2 -0
  26. package/cms/modules/runtime/runtime.module.d.ts +8 -0
  27. package/cms/modules/runtime/services/compilation.service.d.ts +18 -0
  28. package/cms/modules/runtime/services/runtime-editor.service.d.ts +18 -0
  29. package/cms/modules/runtime/services/runtime.service.d.ts +27 -0
  30. package/cms/modules/runtime/tokens.d.ts +3 -0
  31. package/cms/{types → modules/runtime/types}/compilation.types.d.ts +1 -1
  32. package/cms/modules/runtime/types/runtime.actions.d.ts +9 -0
  33. package/cms/plugins/element-hover.plugin.d.ts +32 -0
  34. package/cms/services/index.d.ts +0 -1
  35. package/cms/services/io-provider.service.d.ts +3 -3
  36. package/cms/types/common.types.d.ts +1 -1
  37. package/cms/types/configuration.types.d.ts +1 -0
  38. package/cms/types/index.d.ts +1 -1
  39. package/cms/utils/elements-resolver.d.ts +3 -2
  40. package/cms/utils/index.d.ts +1 -0
  41. package/cms/utils/path.utils.d.ts +0 -1
  42. package/cms/utils/ui-definition.utils.d.ts +6 -0
  43. package/cms/vendor-map.d.ts +26 -14
  44. package/core/modules/configuration/services/configuration-runtime.service.d.ts +2 -4
  45. package/core/modules/configuration/services/configuration.service.d.ts +6 -4
  46. package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -2
  47. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +6 -3
  48. package/core/services/metric-calculation/metric-calculation.service.d.ts +5 -1
  49. package/core/services/quote-draft.service.d.ts +2 -2
  50. package/core/types/index.d.ts +0 -1
  51. package/core/types/ui-definition.types.d.ts +19 -4
  52. package/core/utils/index.d.ts +1 -0
  53. package/core/utils/line-item.utils.d.ts +2 -0
  54. package/core/utils/ui-definition.utils.d.ts +2 -0
  55. package/esm2015/cms/cms.elements.js +17 -4
  56. package/esm2015/cms/components/element-children/element-children.component.js +24 -8
  57. package/esm2015/cms/components/element-children/element-children.module.js +8 -6
  58. package/esm2015/cms/components/element-drop-handle/element-drop-handle.component.js +32 -0
  59. package/esm2015/cms/components/element-drop-handle/element-drop-handle.module.js +19 -0
  60. package/esm2015/cms/components/element-renderer/element-renderer.component.js +9 -9
  61. package/esm2015/cms/components/element-renderer/element-renderer.module.js +4 -4
  62. package/esm2015/cms/components/plugin.component.js +3 -3
  63. package/esm2015/cms/components/preview/index.js +2 -1
  64. package/esm2015/cms/components/preview/preview.component.js +21 -36
  65. package/esm2015/cms/components/preview/preview.module.js +7 -6
  66. package/esm2015/cms/components/preview/preview.types.js +2 -0
  67. package/esm2015/cms/directives/custom-template.directive.js +3 -3
  68. package/esm2015/cms/index.js +3 -1
  69. package/esm2015/cms/launcher.module.js +10 -9
  70. package/esm2015/cms/modules/federated/federated.component.js +3 -3
  71. package/esm2015/cms/modules/federated/federated.module.js +4 -4
  72. package/esm2015/cms/modules/migrations/index.js +3 -0
  73. package/esm2015/cms/modules/migrations/migrations.js +11 -0
  74. package/esm2015/cms/modules/migrations/migrations.module.js +15 -0
  75. package/esm2015/cms/modules/migrations/services/migrations.service.js +43 -0
  76. package/esm2015/cms/modules/migrations/types/migrations.types.js +2 -0
  77. package/esm2015/cms/modules/runtime/index.js +3 -0
  78. package/esm2015/cms/modules/runtime/runtime.module.js +32 -0
  79. package/esm2015/cms/modules/runtime/services/compilation.service.js +84 -0
  80. package/esm2015/cms/modules/runtime/services/runtime-editor.service.js +27 -0
  81. package/esm2015/cms/modules/runtime/services/runtime.service.js +74 -0
  82. package/esm2015/cms/modules/runtime/tokens.js +3 -0
  83. package/esm2015/cms/modules/runtime/types/compilation.types.js +2 -0
  84. package/esm2015/cms/modules/runtime/types/runtime.actions.js +2 -0
  85. package/esm2015/cms/plugins/configuration.plugin.js +12 -4
  86. package/esm2015/cms/plugins/element-hover.plugin.js +157 -0
  87. package/esm2015/cms/plugins/io.plugin.js +3 -3
  88. package/esm2015/cms/plugins/script.plugin.js +3 -3
  89. package/esm2015/cms/services/element-context.service.js +3 -3
  90. package/esm2015/cms/services/index.js +1 -2
  91. package/esm2015/cms/services/integration.state.js +3 -3
  92. package/esm2015/cms/services/io-provider.service.js +9 -9
  93. package/esm2015/cms/services/templates.service.js +3 -3
  94. package/esm2015/cms/types/common.types.js +1 -1
  95. package/esm2015/cms/types/configuration.types.js +1 -1
  96. package/esm2015/cms/types/index.js +2 -2
  97. package/esm2015/cms/utils/elements-resolver.js +18 -8
  98. package/esm2015/cms/utils/index.js +2 -1
  99. package/esm2015/cms/utils/path.utils.js +2 -13
  100. package/esm2015/cms/utils/ui-definition.utils.js +82 -0
  101. package/esm2015/cms/vendor-map.js +11 -4
  102. package/esm2015/core/core.module.js +4 -4
  103. package/esm2015/core/modules/configuration/configuration.module.js +4 -4
  104. package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +5 -10
  105. package/esm2015/core/modules/configuration/services/configuration.service.js +27 -24
  106. package/esm2015/core/modules/configuration/services/runtime-context.service.js +3 -3
  107. package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +1 -1
  108. package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +4 -4
  109. package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +17 -9
  110. package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +3 -3
  111. package/esm2015/core/services/context.service.js +3 -3
  112. package/esm2015/core/services/metric-calculation/metric-calculation.service.js +18 -9
  113. package/esm2015/core/services/product-images.service.js +3 -3
  114. package/esm2015/core/services/quote-draft.service.js +7 -7
  115. package/esm2015/core/types/index.js +1 -2
  116. package/esm2015/core/types/ui-definition.types.js +2 -2
  117. package/esm2015/core/utils/index.js +2 -1
  118. package/esm2015/core/utils/line-item.utils.js +27 -11
  119. package/esm2015/core/utils/ui-definition.utils.js +9 -0
  120. package/esm2015/runtime/components/component-preview/component-preview.component.js +4 -4
  121. package/esm2015/runtime/components/section-renderer/section-renderer.component.js +3 -3
  122. package/esm2015/runtime/components/ui-runtime/runtime.component.js +3 -3
  123. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +3 -3
  124. package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +6 -6
  125. package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +3 -3
  126. package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +3 -3
  127. package/esm2015/runtime/execution/components/federated/federated.component.js +3 -3
  128. package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +3 -3
  129. package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +3 -3
  130. package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +3 -3
  131. package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +3 -3
  132. package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +3 -3
  133. package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +3 -3
  134. package/esm2015/runtime/execution/directives/section-script.directive.js +3 -3
  135. package/esm2015/runtime/execution/directives/sf-query.directive.js +3 -3
  136. package/esm2015/runtime/execution/directives/velo-attribute.directive.js +3 -3
  137. package/esm2015/runtime/execution/directives/velo-port.directive.js +18 -18
  138. package/esm2015/runtime/execution/directives/vl-approval.directive.js +3 -3
  139. package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +3 -3
  140. package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +3 -3
  141. package/esm2015/runtime/execution/directives/vl-quote.directive.js +4 -4
  142. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +3 -3
  143. package/esm2015/runtime/execution/runtime-execution.module.js +4 -4
  144. package/esm2015/runtime/runtime.module.js +4 -4
  145. package/esm2015/runtime/services/cart.service.js +3 -3
  146. package/esm2015/runtime/services/collapsible-state.service.js +3 -3
  147. package/esm2015/runtime/services/configuration.service.js +4 -4
  148. package/esm2015/runtime/services/current-state.service.js +3 -3
  149. package/esm2015/runtime/services/form-scope.service.js +3 -3
  150. package/esm2015/runtime/services/product-model-cache.service.js +3 -3
  151. package/esm2015/runtime/services/runtime-context.service.js +3 -3
  152. package/esm2015/runtime/services/runtime-form.service.js +3 -3
  153. package/esm2015/runtime/services/runtime.service.js +4 -4
  154. package/esm2015/runtime/services/section-helper.service.js +3 -3
  155. package/esm2015/runtime/services/section-scope.service.js +3 -3
  156. package/esm2015/runtime/services/section-store.service.js +3 -3
  157. package/esm2015/runtime/services/section.service.js +6 -6
  158. package/esm2015/runtime/types/index.js +2 -1
  159. package/esm2015/runtime/types/quote-states.types.js +2 -0
  160. package/esm2015/src/components/dialog/dialog.component.js +3 -3
  161. package/esm2015/src/components/dialog/dialog.module.js +4 -4
  162. package/esm2015/src/components/doc-gen/doc-gen.component.js +3 -3
  163. package/esm2015/src/components/doc-gen/doc-gen.module.js +4 -4
  164. package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +3 -3
  165. package/esm2015/src/components/header/cart-overlay/cart-preview.module.js +4 -4
  166. package/esm2015/src/components/header/header.component.js +8 -9
  167. package/esm2015/src/components/header/header.module.js +4 -4
  168. package/esm2015/src/components/header/metrics/metrics.component.js +79 -67
  169. package/esm2015/src/components/header/metrics/metrics.definitions.js +1 -8
  170. package/esm2015/src/components/header/metrics/metrics.module.js +4 -4
  171. package/esm2015/src/flow-routing.module.js +4 -4
  172. package/esm2015/src/flow.component.js +3 -3
  173. package/esm2015/src/flow.module.js +4 -4
  174. package/esm2015/src/guards/context.guard.js +3 -3
  175. package/esm2015/src/guards/product-unload.guard.js +3 -3
  176. package/esm2015/src/guards/root.guard.js +3 -3
  177. package/esm2015/src/pages/catalog/catalog.component.js +3 -3
  178. package/esm2015/src/pages/catalog/catalog.module.js +4 -4
  179. package/esm2015/src/pages/debug/debug.component.js +3 -3
  180. package/esm2015/src/pages/debug/debug.module.js +4 -4
  181. package/esm2015/src/pages/empty-account/empty-account.component.js +3 -3
  182. package/esm2015/src/pages/empty-account/empty-account.module.js +4 -4
  183. package/esm2015/src/pages/legacy-product/legacy-product.component.js +4 -4
  184. package/esm2015/src/pages/legacy-product/legacy-product.module.js +4 -4
  185. package/esm2015/src/pages/product/product.component.js +5 -12
  186. package/esm2015/src/pages/product/product.module.js +4 -4
  187. package/esm2015/src/pages/record-not-found/record-not-found.component.js +3 -3
  188. package/esm2015/src/pages/record-not-found/record-not-found.module.js +4 -4
  189. package/esm2015/src/pages/remote/remote.component.js +5 -8
  190. package/esm2015/src/pages/remote/remote.module.js +4 -4
  191. package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +3 -3
  192. package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +4 -4
  193. package/esm2015/src/resolvers/flow.resolver.js +3 -3
  194. package/esm2015/src/resolvers/quote.resolver.js +8 -8
  195. package/esm2015/src/services/doc-gen.service.js +3 -3
  196. package/esm2015/src/services/flow-dialog.service.js +3 -3
  197. package/esm2015/src/services/flow-router.service.js +3 -3
  198. package/esm2015/src/services/flow.service.js +3 -3
  199. package/esm2015/src/utils/flow.utils.js +3 -3
  200. package/fesm2015/veloceapps-sdk-cms.js +1181 -713
  201. package/fesm2015/veloceapps-sdk-cms.js.map +1 -1
  202. package/fesm2015/veloceapps-sdk-core.js +557 -517
  203. package/fesm2015/veloceapps-sdk-core.js.map +1 -1
  204. package/fesm2015/veloceapps-sdk-runtime.js +138 -138
  205. package/fesm2015/veloceapps-sdk-runtime.js.map +1 -1
  206. package/fesm2015/veloceapps-sdk.js +239 -244
  207. package/fesm2015/veloceapps-sdk.js.map +1 -1
  208. package/package.json +5 -3
  209. package/runtime/services/configuration.service.d.ts +2 -1
  210. package/runtime/services/runtime.service.d.ts +2 -1
  211. package/runtime/types/index.d.ts +1 -0
  212. package/src/components/header/metrics/metrics.component.d.ts +15 -6
  213. package/src/components/header/metrics/metrics.definitions.d.ts +0 -3
  214. package/src/pages/product/product.component.d.ts +0 -1
  215. package/cms/services/dynamic-module.service.d.ts +0 -15
  216. package/cms/services/launcher.service.d.ts +0 -18
  217. package/esm2015/cms/services/dynamic-module.service.js +0 -33
  218. package/esm2015/cms/services/launcher.service.js +0 -58
  219. package/esm2015/cms/types/compilation.types.js +0 -2
  220. package/esm2015/core/types/quote-states.types.js +0 -2
  221. /package/{core → runtime}/types/quote-states.types.d.ts +0 -0
@@ -1,14 +1,14 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, NgModule } from '@angular/core';
3
- import { UUID, ConfigurationContext, ConfigurationContextMode, RuntimeModel, SalesforceIdUtils, ConfigurationMode, ChargeGroupUtils } from '@veloceapps/core';
4
- import { BehaviorSubject, zip, noop, combineLatest, Subject, take as take$1, map as map$1, distinctUntilChanged, catchError, of, tap as tap$1, throwError, shareReplay as shareReplay$1, switchMap as switchMap$1 } from 'rxjs';
5
- import { filter, tap, map, switchMap, skip, take, shareReplay, first, catchError as catchError$1, finalize } from 'rxjs/operators';
3
+ import { UUID, ConfigurationContext, RuntimeModel, ConfigurationContextMode, SalesforceIdUtils, ConfigurationMode, ChargeGroupUtils } from '@veloceapps/core';
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
+ import { filter, tap, map, first, switchMap, skip, take, shareReplay, catchError, finalize } from 'rxjs/operators';
6
6
  import * as i1 from '@veloceapps/api';
7
7
  import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
8
- import { merge, isEqual, uniq, flatten, sortBy, map as map$2, cloneDeep } from 'lodash';
8
+ import { merge, flatten, sortBy, map as map$1, isEqual, omit, cloneDeep, uniq } from 'lodash';
9
9
  import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
10
- import * as i4 from 'primeng/api';
11
- import * as i5 from 'primeng/dynamicdialog';
10
+ import * as i5 from 'primeng/api';
11
+ import * as i6 from 'primeng/dynamicdialog';
12
12
  import moment from 'moment';
13
13
 
14
14
  const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
@@ -36,392 +36,50 @@ var RuntimeStep;
36
36
  RuntimeStep["UPDATE"] = "UPDATE";
37
37
  })(RuntimeStep || (RuntimeStep = {}));
38
38
 
39
+ const UI_DEFINITION_VERSION = 3;
40
+
39
41
  class ContextService {
40
42
  constructor(contextApiService) {
41
43
  this.contextApiService = contextApiService;
42
44
  this.context = new BehaviorSubject(null);
43
45
  }
44
- get isInitialized() {
45
- return Boolean(this.context.value);
46
- }
47
- resolve() {
48
- if (!this.context.value) {
49
- throw new Error('Context is not initialized yet!');
50
- }
51
- return Object.assign({}, this.context.value);
52
- }
53
- resolve$() {
54
- return this.context.pipe(filter((ctx) => Boolean(ctx)));
55
- }
56
- create(headerId, mode) {
57
- return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
58
- }
59
- update(partialContext) {
60
- const originalContext = this.resolve();
61
- const updatedContext = Object.assign(Object.assign(Object.assign({}, originalContext), partialContext), { properties: Object.assign(Object.assign({}, originalContext.properties), partialContext.properties) });
62
- this.context.next(updatedContext);
63
- return updatedContext;
64
- }
65
- set(context) {
66
- const originalContext = this.resolve();
67
- const updatedContext = Object.assign(Object.assign({}, originalContext), context);
68
- this.context.next(updatedContext);
69
- return updatedContext;
70
- }
71
- delete() {
72
- this.context.next(null);
73
- }
74
- }
75
- ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
76
- ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextService, providedIn: 'root' });
77
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextService, decorators: [{
78
- type: Injectable,
79
- args: [{ providedIn: 'root' }]
80
- }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
81
-
82
- function calculateMetricByMethod(lineItems, metric, method) {
83
- const items = getLineItemsByMethod(lineItems, method);
84
- return items.reduce((acc, li) => {
85
- let value = li.reduce((accProduct, item) => accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0), 0);
86
- if (method === 'avg' && li.length > 0) {
87
- value /= li.length;
88
- }
89
- return acc + value;
90
- }, 0);
91
- }
92
- function getLineItemsByMethod(lineItems, method) {
93
- switch (method) {
94
- case 'first': {
95
- return lineItems.filter(li => !li.rampInstanceId).map(item => [item]);
96
- }
97
- case 'last': {
98
- const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
99
- const products = rootTermItems.map(lineItem => [
100
- lineItem,
101
- ...lineItems.filter(li => li.rampInstanceId === lineItem.id),
102
- ]);
103
- return products
104
- .map(items => [...items].sort((a, b) => getDateValue(a.endDate || '') - getDateValue(b.endDate || '')).pop())
105
- .filter((li) => Boolean(li))
106
- .map(item => [item]);
107
- }
108
- case 'avg': {
109
- const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
110
- return rootTermItems.map(lineItem => [lineItem, ...lineItems.filter(li => li.rampInstanceId === lineItem.id)]);
111
- }
112
- case 'sum': {
113
- return lineItems.map(item => [item]);
114
- }
115
- default: {
116
- return lineItems.map(item => [item]);
117
- }
118
- }
119
- }
120
- function getDateValue(date) {
121
- return date ? new Date(date).getTime() : 0;
122
- }
123
-
124
- class QuoteDraftService {
125
- constructor(context, quoteApiService, priceApiService) {
126
- this.context = context;
127
- this.quoteApiService = quoteApiService;
128
- this.priceApiService = priceApiService;
129
- this.quoteSubj$ = new BehaviorSubject(null);
130
- this.resetSubj$ = new BehaviorSubject(true);
131
- this.isInitializedSubj$ = new BehaviorSubject(false);
132
- this.initialCurrentState = [];
133
- this._hasUnsavedChanges = false;
134
- this.allPriceLists = [];
135
- this.assetPriceLists = [];
136
- this.reset$ = this.resetSubj$.asObservable();
137
- this.activePriceList$ = this.context.resolve$().pipe(map(ctx => this.allPriceLists.find(priceList => priceList.id === ctx.properties.PriceListId)), map(priceList => priceList !== null && priceList !== void 0 ? priceList : null));
138
- this.isInitializedSubj$
139
- .pipe(filter(isInitialized => isInitialized), switchMap(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
140
- .subscribe();
141
- }
142
- get isInitialized() {
143
- return this.isInitializedSubj$.getValue();
144
- }
145
- set isInitialized(value) {
146
- if (this.isInitialized !== value) {
147
- this.isInitializedSubj$.next(value);
148
- }
149
- }
150
- get hasUnsavedChanges() {
151
- return this._hasUnsavedChanges;
152
- }
153
- set hasUnsavedChanges(value) {
154
- var _a, _b;
155
- this._hasUnsavedChanges = value;
156
- if (!this._hasUnsavedChanges) {
157
- this.initialCurrentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
158
- }
159
- }
160
- get hasAssets$() {
161
- return this.quoteSubj$.pipe(map(() => this.hasAssets));
162
- }
163
- get hasAssets() {
164
- const quoteDraft = this.quoteSubj$.value;
165
- return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
166
- }
167
- reset() {
168
- this.resetSubj$.next(true);
169
- this.quoteSubj$.next(null);
170
- this.hasUnsavedChanges = false;
171
- }
172
- init(quoteId, params) {
173
- return zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(tap(([quote, allPriceLists]) => {
174
- this.allPriceLists = allPriceLists;
175
- this.quoteSubj$.next(quote);
176
- this.context.update(quote.context);
177
- this.populateActivePriceLists$();
178
- }), map(() => noop()), take(1));
179
- }
180
- setCurrentLineItemState(lineItems) {
181
- const quoteDraft = this.quoteSubj$.value;
182
- if (!quoteDraft) {
183
- return;
184
- }
185
- this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
186
- }
187
- updateQuoteDraft(update) {
188
- const quoteDraft = this.quoteSubj$.value;
189
- if (!quoteDraft) {
190
- return;
191
- }
192
- if (update.context) {
193
- this.context.set(update.context);
194
- }
195
- this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
196
- }
197
- updateByPriceSummary(priceSummary) {
198
- const quoteDraft = this.quoteSubj$.value;
199
- if (!quoteDraft) {
200
- return;
201
- }
202
- const updatedCurrentState = this.currentState.map(lineItem => {
203
- const updated = priceSummary.lineItems.find(li => li.id === lineItem.id);
204
- return updated !== null && updated !== void 0 ? updated : lineItem;
205
- });
206
- this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
207
- }
208
- get quoteDraft$() {
209
- return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
210
- }
211
- get quoteDraft() {
212
- const quote = this.quoteSubj$.value;
213
- if (!quote) {
214
- return null;
215
- }
216
- return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
217
- }
218
- get quoteDraftForActivePriceList() {
219
- const quoteDraft = this.quoteDraft;
220
- if (!quoteDraft) {
221
- return null;
222
- }
223
- return Object.assign(Object.assign({}, quoteDraft), { initialState: this.filterByActivePriceList(quoteDraft.initialState), currentState: this.filterByActivePriceList(quoteDraft.currentState) });
224
- }
225
- get currentState$() {
226
- return this.quoteDraft$.pipe(map(quote => quote.currentState));
227
- }
228
- get currentState() {
229
- var _a, _b;
230
- return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
231
- }
232
- /**
233
- * Stream of activeCurrentState
234
- */
235
- get activeCurrentState$() {
236
- return this.quoteDraft$.pipe(map(() => this.activeCurrentState));
237
- }
238
- /**
239
- * activeCurrentState is currentState passed through additional filters
240
- */
241
- get activeCurrentState() {
242
- var _a, _b;
243
- let currentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
244
- currentState = this.filterByActivePriceList(currentState);
245
- return currentState;
246
- }
247
- /**
248
- * Stream of activeInitialState
249
- */
250
- get activeInitialState$() {
251
- return this.quoteDraft$.pipe(map(() => this.activeInitialState));
252
- }
253
- /**
254
- * activeInitialState is initialState passed through additional filters
255
- */
256
- get activeInitialState() {
257
- var _a, _b;
258
- const ctx = this.context.resolve();
259
- let initialState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState) !== null && _b !== void 0 ? _b : [];
260
- if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
261
- initialState = this.filterByActivePriceList(initialState);
262
- }
263
- return initialState;
264
- }
265
- get isStandalone() {
266
- return this.context.resolve().properties.standalone === 'true';
267
- }
268
- get isStandalone$() {
269
- return this.context.resolve$().pipe(map(() => this.isStandalone));
270
- }
271
- getInitialCurrentState() {
272
- return this.initialCurrentState;
273
- }
274
- isEditMode$() {
275
- return this.context.resolve$().pipe(map(() => this.isEditMode()));
276
- }
277
- isEditMode() {
278
- const context = this.context.resolve();
279
- if (context.mode === ConfigurationContextMode.ACCOUNT) {
280
- return true;
281
- }
282
- if (context.mode === ConfigurationContextMode.QUOTE) {
283
- return context.properties.Status === 'Draft';
284
- }
285
- return false;
286
- }
287
- updateActivePriceList(priceListId) {
288
- this.context.update({ properties: { PriceListId: priceListId } });
289
- }
290
- populateActivePriceLists$() {
291
- const ctx = this.context.resolve();
292
- const quoteDraft = this.quoteDraft;
293
- if (!quoteDraft) {
294
- return;
295
- }
296
- // In ACCOUNT mode populate price lists from related assets
297
- if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
298
- // Populate list of price lists
299
- this.assetPriceLists = quoteDraft.currentState
300
- .map(({ priceListId }) => priceListId)
301
- .reduce((trunk, priceListId) => {
302
- var _a, _b;
303
- if (!priceListId || trunk.some(item => item.id === priceListId)) {
304
- return trunk;
305
- }
306
- return [
307
- ...trunk,
308
- { id: priceListId, name: (_b = (_a = this.allPriceLists.find(item => item.id === priceListId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
309
- ];
310
- }, []);
311
- }
312
- }
313
- filterByActivePriceList(lineItems) {
314
- const ctx = this.context.resolve();
315
- return lineItems.filter(li => !li.priceListId || li.priceListId === ctx.properties.PriceListId);
316
- }
317
- markAsUpdated(quote) {
318
- if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === ConfigurationContextMode.ACCOUNT) {
319
- this.hasUnsavedChanges = !!quote && !quote.currentState.every(li => li.actionCode === 'EXIST');
320
- }
321
- else {
322
- this.hasUnsavedChanges = !isEqual(this.initialCurrentState, quote === null || quote === void 0 ? void 0 : quote.currentState);
323
- }
324
- }
325
- }
326
- QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }], target: i0.ɵɵFactoryTarget.Injectable });
327
- QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteDraftService, providedIn: 'root' });
328
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteDraftService, decorators: [{
329
- type: Injectable,
330
- args: [{ providedIn: 'root' }]
331
- }], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }]; } });
332
-
333
- class MetricsCalculationService {
334
- constructor(quoteDraftService, settingsService) {
335
- this.quoteDraftService = quoteDraftService;
336
- this.settingsService = settingsService;
337
- this.metricsUpdated$ = new Subject();
338
- this.quoteMetricsSettings = {};
339
- this.metricsCalculationMethodMap = {};
340
- this.metricsData = {};
341
- combineLatest([
342
- this.quoteDraftService.currentState$,
343
- this.settingsService.fetchSetting('QUOTE_LEVEL_METRIC_CALCULATION_METHOD').pipe(take$1(1)),
344
- ]).subscribe(([lineItems, setting]) => {
345
- let settingsData = {};
346
- try {
347
- settingsData = JSON.parse((setting === null || setting === void 0 ? void 0 : setting.value) || '{}');
348
- }
349
- catch (error) {
350
- settingsData = {};
351
- }
352
- this.quoteMetricsSettings = settingsData;
353
- this.updateMetrics(lineItems);
354
- });
355
- }
356
- get onMetricsUpdate$() {
357
- return this.metricsUpdated$.asObservable();
358
- }
359
- getMetricValue(metric) {
360
- return this.metricsData[metric] || 0;
361
- }
362
- updateMetrics(lineItems) {
363
- const metricKeys = this.collectMetricKeys(lineItems).filter(key => !key.includes('Effective_'));
364
- this.metricsCalculationMethodMap = this.buildMetricsCalculationMethods(metricKeys, this.metricsCalculationMethodMap);
365
- this.metricsData = metricKeys.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: this.calculateMetric(lineItems, key) })), {});
366
- this.metricsUpdated$.next();
367
- }
368
- calculateMetric(lineItems, metric) {
369
- return calculateMetricByMethod(lineItems, metric, this.metricsCalculationMethodMap[metric] || 'sum');
370
- }
371
- buildMetricsCalculationMethods(metricKeys, initial) {
372
- return metricKeys.reduce((acc, name) => {
373
- if (acc[name]) {
374
- return acc;
375
- }
376
- acc = Object.assign(Object.assign({}, acc), { [name]: 'sum' });
377
- const settingKey = name.replace(/VDM_|Total_/g, '');
378
- if (this.quoteMetricsSettings[settingKey]) {
379
- acc = Object.assign(Object.assign({}, acc), { [name]: this.quoteMetricsSettings[settingKey] });
380
- }
381
- return acc;
382
- }, initial);
383
- }
384
- collectMetricKeys(lineItems) {
385
- const keys = [];
386
- lineItems.forEach(lineItem => {
387
- keys.push(...Object.keys(lineItem.totalMetrics || {}));
388
- keys.push(...this.collectMetricKeys(lineItem.lineItems));
389
- });
390
- return uniq(keys);
391
- }
392
- }
393
- MetricsCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
394
- MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MetricsCalculationService, providedIn: 'root' });
395
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: MetricsCalculationService, decorators: [{
396
- type: Injectable,
397
- args: [{ providedIn: 'root' }]
398
- }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: i1.ConfigurationSettingsApiService }]; } });
399
-
400
- class ProductImagesService {
401
- constructor(productApiService) {
402
- this.productApiService = productApiService;
403
- this.imagesMap$ = new BehaviorSubject({});
46
+ get isInitialized() {
47
+ return Boolean(this.context.value);
404
48
  }
405
- getImageUrl$(productId) {
406
- if (this.imagesMap$.value[productId] == null) {
407
- this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: '' }));
408
- this.fetchProductImage(productId);
49
+ resolve() {
50
+ if (!this.context.value) {
51
+ throw new Error('Context is not initialized yet!');
409
52
  }
410
- return this.imagesMap$.pipe(map$1(imagesMap => imagesMap[productId]), distinctUntilChanged());
53
+ return Object.assign({}, this.context.value);
411
54
  }
412
- fetchProductImage(productId) {
413
- this.productApiService
414
- .fetchImage$(productId)
415
- .pipe(map$1(file => URL.createObjectURL(file)), catchError(() => of('')), tap$1(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
416
- .subscribe();
55
+ resolve$() {
56
+ return this.context.pipe(filter((ctx) => Boolean(ctx)));
57
+ }
58
+ create(headerId, mode) {
59
+ return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
60
+ }
61
+ update(partialContext) {
62
+ const originalContext = this.resolve();
63
+ const updatedContext = Object.assign(Object.assign(Object.assign({}, originalContext), partialContext), { properties: Object.assign(Object.assign({}, originalContext.properties), partialContext.properties) });
64
+ this.context.next(updatedContext);
65
+ return updatedContext;
66
+ }
67
+ set(context) {
68
+ const originalContext = this.resolve();
69
+ const updatedContext = Object.assign(Object.assign({}, originalContext), context);
70
+ this.context.next(updatedContext);
71
+ return updatedContext;
72
+ }
73
+ delete() {
74
+ this.context.next(null);
417
75
  }
418
76
  }
419
- ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
420
- ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductImagesService, providedIn: 'root' });
421
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductImagesService, decorators: [{
77
+ ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
78
+ ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ContextService, providedIn: 'root' });
79
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ContextService, decorators: [{
422
80
  type: Injectable,
423
81
  args: [{ providedIn: 'root' }]
424
- }], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
82
+ }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
425
83
 
426
84
  class RuntimeContextService {
427
85
  constructor(configurationApiService) {
@@ -462,9 +120,9 @@ class RuntimeContextService {
462
120
  return uiDefinition;
463
121
  }
464
122
  }
465
- RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
466
- RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService });
467
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, decorators: [{
123
+ RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
124
+ RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RuntimeContextService });
125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RuntimeContextService, decorators: [{
468
126
  type: Injectable
469
127
  }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
470
128
 
@@ -479,7 +137,6 @@ class ConfigurationRuntimeService {
479
137
  reset() {
480
138
  this._isInitialized = false;
481
139
  this._runtimeContext = undefined;
482
- this._assets = undefined;
483
140
  this.initializationProps = undefined;
484
141
  this.uiDefinitionProperties = {};
485
142
  }
@@ -505,7 +162,6 @@ class ConfigurationRuntimeService {
505
162
  }
506
163
  init(props) {
507
164
  this.initializationProps = props;
508
- this._assets = props.assets;
509
165
  const context = this.contextService.resolve();
510
166
  return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
511
167
  var _a, _b, _c, _d;
@@ -531,9 +187,6 @@ class ConfigurationRuntimeService {
531
187
  source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
532
188
  }
533
189
  }
534
- getAsset(lineItem) {
535
- return this._assets && this._assets.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
536
- }
537
190
  get isInitialized() {
538
191
  return this._isInitialized;
539
192
  }
@@ -545,9 +198,9 @@ class ConfigurationRuntimeService {
545
198
  return this._runtimeContext;
546
199
  }
547
200
  }
548
- ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
549
- ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationRuntimeService });
550
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
201
+ ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
202
+ ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationRuntimeService });
203
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
551
204
  type: Injectable
552
205
  }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
553
206
 
@@ -589,17 +242,33 @@ const removeLineItem = (lineItem, idToRemove) => {
589
242
  };
590
243
  const replaceLineItem = (lineItem, replaceTo) => {
591
244
  if (lineItem.id === replaceTo.id) {
592
- return Object.assign({}, replaceTo);
245
+ return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
593
246
  }
594
- return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => {
595
- if (li.id === replaceTo.id) {
596
- return replaceTo;
597
- }
598
- else if (li.lineItems.length) {
599
- return replaceLineItem(li, replaceTo);
600
- }
601
- return li;
602
- }) });
247
+ return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo)) });
248
+ };
249
+ const calculateCardinalityVariables = (lineItems) => {
250
+ const cardVars = new Map();
251
+ lineItems.forEach(li => {
252
+ var _a;
253
+ const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
254
+ cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
255
+ });
256
+ return cardVars;
257
+ };
258
+ const recalculateCardinalityVariables = (original, updated) => {
259
+ const cardinalityVariables = calculateCardinalityVariables(updated.lineItems);
260
+ const originalCardinalityVariables = calculateCardinalityVariables(original.lineItems);
261
+ originalCardinalityVariables.forEach((value, key) => {
262
+ if (cardinalityVariables.get(key) === value) {
263
+ // no need to update cardinality if no changes
264
+ cardinalityVariables.delete(key);
265
+ }
266
+ else if (!cardinalityVariables.has(key)) {
267
+ // remove last item from port
268
+ cardinalityVariables.set(key, 0);
269
+ }
270
+ });
271
+ return Object.assign(Object.assign({}, updated), { attributes: upsertAttributes(updated.attributes, [...cardinalityVariables].map(([name, value]) => ({ name, value }))) });
603
272
  };
604
273
  const mapAttributes = (attributes) => {
605
274
  return attributes.reduce((acc, { name, value }) => (Object.assign(Object.assign({}, acc), { [name]: value })), {});
@@ -622,78 +291,289 @@ const patchAttributes = (rootLineItem, id, attrs) => {
622
291
  if (!lineItem) {
623
292
  return rootLineItem;
624
293
  }
625
- const attributes = upsertAttributes(lineItem.attributes, attrs);
626
- return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }));
627
- };
628
- const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
629
- const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
630
- return {
631
- id: UUID.UUID(),
632
- port,
633
- type,
634
- actionCode: 'ADD',
635
- cfgStatus: 'New',
636
- attributes: attributes.map(({ name, value }) => ({ cfgStatus: 'User', name, value })),
637
- lineItems,
638
- parentId,
639
- qty: 1,
640
- };
641
- };
642
- const getRecommendedPrices = (portDomain, type) => {
643
- var _a, _b;
644
- const domainType = portDomain.domainTypes.find(({ name }) => name === type);
645
- const [net, list] = (_b = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.recommendedPrices) === null || _a === void 0 ? void 0 : _a.filter(({ chargeMethod }) => chargeMethod === 'ONE_TIME').reduce((acc, rp) => {
646
- const [netPrice, listPrice] = acc;
647
- return [netPrice + rp.netPrice, listPrice + rp.listPrice];
648
- }, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0];
649
- return { net, list };
650
- };
651
- const multiplyLineItems = (lineItem, qty, split) => {
652
- if (split) {
653
- const unifyIds = (lineItem) => (Object.assign(Object.assign({}, lineItem), { id: UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds) }));
654
- return map$2(new Array(qty), () => unifyIds(lineItem));
294
+ const attributes = upsertAttributes(lineItem.attributes, attrs);
295
+ return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }));
296
+ };
297
+ const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
298
+ const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
299
+ return {
300
+ id: UUID.UUID(),
301
+ port,
302
+ type,
303
+ actionCode: 'ADD',
304
+ cfgStatus: 'New',
305
+ attributes: attributes.map(({ name, value }) => ({ cfgStatus: 'User', name, value })),
306
+ lineItems,
307
+ parentId,
308
+ qty: 1,
309
+ };
310
+ };
311
+ const getRecommendedPrices = (portDomain, type) => {
312
+ var _a, _b;
313
+ const domainType = portDomain.domainTypes.find(({ name }) => name === type);
314
+ const [net, list] = (_b = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.recommendedPrices) === null || _a === void 0 ? void 0 : _a.filter(({ chargeMethod }) => chargeMethod === 'ONE_TIME').reduce((acc, rp) => {
315
+ const [netPrice, listPrice] = acc;
316
+ return [netPrice + rp.netPrice, listPrice + rp.listPrice];
317
+ }, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0];
318
+ return { net, list };
319
+ };
320
+ const multiplyLineItems = (lineItem, qty, split) => {
321
+ if (split) {
322
+ const unifyIds = (lineItem) => (Object.assign(Object.assign({}, lineItem), { id: UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds) }));
323
+ return map$1(new Array(qty), () => unifyIds(lineItem));
324
+ }
325
+ else {
326
+ return [
327
+ Object.assign(Object.assign({}, lineItem), { qty: qty }),
328
+ ];
329
+ }
330
+ };
331
+
332
+ var lineItem_utils = /*#__PURE__*/Object.freeze({
333
+ __proto__: null,
334
+ findLineItem: findLineItem,
335
+ findLineItemWithComparator: findLineItemWithComparator,
336
+ insertLineItem: insertLineItem,
337
+ removeLineItem: removeLineItem,
338
+ replaceLineItem: replaceLineItem,
339
+ calculateCardinalityVariables: calculateCardinalityVariables,
340
+ recalculateCardinalityVariables: recalculateCardinalityVariables,
341
+ mapAttributes: mapAttributes,
342
+ getAttributes: getAttributes,
343
+ upsertAttributes: upsertAttributes,
344
+ patchAttributes: patchAttributes,
345
+ getAttributeValue: getAttributeValue,
346
+ generateLineItem: generateLineItem,
347
+ getRecommendedPrices: getRecommendedPrices,
348
+ multiplyLineItems: multiplyLineItems
349
+ });
350
+
351
+ class LineItemWorker {
352
+ constructor(src) {
353
+ this.li = Object.assign({}, src);
354
+ }
355
+ insert(parentId, toInsert) {
356
+ return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
357
+ }
358
+ remove(id) {
359
+ return new LineItemWorker(removeLineItem(this.li, id));
360
+ }
361
+ replace(toReplace) {
362
+ return new LineItemWorker(replaceLineItem(this.li, toReplace));
363
+ }
364
+ patchAttribute(attrs, id) {
365
+ return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
366
+ }
367
+ }
368
+
369
+ class QuoteDraftService {
370
+ constructor(context, quoteApiService, priceApiService) {
371
+ this.context = context;
372
+ this.quoteApiService = quoteApiService;
373
+ this.priceApiService = priceApiService;
374
+ this.quoteSubj$ = new BehaviorSubject(null);
375
+ this.resetSubj$ = new BehaviorSubject(true);
376
+ this.isInitializedSubj$ = new BehaviorSubject(false);
377
+ this.initialCurrentState = [];
378
+ this._hasUnsavedChanges = false;
379
+ this.allPriceLists = [];
380
+ this.assetPriceLists = [];
381
+ this.reset$ = this.resetSubj$.asObservable();
382
+ this.activePriceList$ = this.context.resolve$().pipe(map(ctx => this.allPriceLists.find(priceList => priceList.id === ctx.properties.PriceListId)), map(priceList => priceList !== null && priceList !== void 0 ? priceList : null));
383
+ this.isInitializedSubj$
384
+ .pipe(filter(isInitialized => isInitialized), switchMap(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
385
+ .subscribe();
386
+ }
387
+ get isInitialized() {
388
+ return this.isInitializedSubj$.getValue();
389
+ }
390
+ set isInitialized(value) {
391
+ if (this.isInitialized !== value) {
392
+ this.isInitializedSubj$.next(value);
393
+ }
394
+ }
395
+ get hasUnsavedChanges() {
396
+ return this._hasUnsavedChanges;
397
+ }
398
+ set hasUnsavedChanges(value) {
399
+ var _a, _b;
400
+ this._hasUnsavedChanges = value;
401
+ if (!this._hasUnsavedChanges) {
402
+ this.initialCurrentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
403
+ }
404
+ }
405
+ get hasProducts$() {
406
+ return this.quoteSubj$.pipe(map(() => this.hasProducts));
407
+ }
408
+ get hasProducts() {
409
+ const quoteDraft = this.quoteSubj$.value;
410
+ return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
411
+ }
412
+ reset() {
413
+ this.resetSubj$.next(true);
414
+ this.quoteSubj$.next(null);
415
+ this.hasUnsavedChanges = false;
416
+ }
417
+ init(quoteId, params) {
418
+ return zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(tap(([quote, allPriceLists]) => {
419
+ this.allPriceLists = allPriceLists;
420
+ this.quoteSubj$.next(quote);
421
+ this.context.update(quote.context);
422
+ this.populateActivePriceLists$();
423
+ }), map(() => noop()), take(1));
424
+ }
425
+ setCurrentLineItemState(lineItems) {
426
+ const quoteDraft = this.quoteSubj$.value;
427
+ if (!quoteDraft) {
428
+ return;
429
+ }
430
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
431
+ }
432
+ updateQuoteDraft(update) {
433
+ const quoteDraft = this.quoteSubj$.value;
434
+ if (!quoteDraft) {
435
+ return;
436
+ }
437
+ if (update.context) {
438
+ this.context.set(update.context);
439
+ }
440
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
441
+ }
442
+ updateByPriceSummary(priceSummary) {
443
+ const quoteDraft = this.quoteSubj$.value;
444
+ if (!quoteDraft) {
445
+ return;
446
+ }
447
+ const updatedCurrentState = this.currentState.map(lineItem => {
448
+ const updated = priceSummary.lineItems.find(li => li.id === lineItem.id);
449
+ return updated !== null && updated !== void 0 ? updated : lineItem;
450
+ });
451
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
452
+ }
453
+ get quoteDraft$() {
454
+ return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
455
+ }
456
+ get quoteDraft() {
457
+ const quote = this.quoteSubj$.value;
458
+ if (!quote) {
459
+ return null;
460
+ }
461
+ return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
462
+ }
463
+ get quoteDraftForActivePriceList() {
464
+ const quoteDraft = this.quoteDraft;
465
+ if (!quoteDraft) {
466
+ return null;
467
+ }
468
+ return Object.assign(Object.assign({}, quoteDraft), { initialState: this.filterByActivePriceList(quoteDraft.initialState), currentState: this.filterByActivePriceList(quoteDraft.currentState) });
469
+ }
470
+ get currentState$() {
471
+ return this.quoteDraft$.pipe(map(quote => quote.currentState));
472
+ }
473
+ get currentState() {
474
+ var _a, _b;
475
+ return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
476
+ }
477
+ /**
478
+ * Stream of activeCurrentState
479
+ */
480
+ get activeCurrentState$() {
481
+ return this.quoteDraft$.pipe(map(() => this.activeCurrentState));
482
+ }
483
+ /**
484
+ * activeCurrentState is currentState passed through additional filters
485
+ */
486
+ get activeCurrentState() {
487
+ var _a, _b;
488
+ let currentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
489
+ currentState = this.filterByActivePriceList(currentState);
490
+ return currentState;
491
+ }
492
+ /**
493
+ * Stream of activeInitialState
494
+ */
495
+ get activeInitialState$() {
496
+ return this.quoteDraft$.pipe(map(() => this.activeInitialState));
497
+ }
498
+ /**
499
+ * activeInitialState is initialState passed through additional filters
500
+ */
501
+ get activeInitialState() {
502
+ var _a, _b;
503
+ const ctx = this.context.resolve();
504
+ let initialState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState) !== null && _b !== void 0 ? _b : [];
505
+ if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
506
+ initialState = this.filterByActivePriceList(initialState);
507
+ }
508
+ return initialState;
509
+ }
510
+ get isStandalone() {
511
+ return this.context.resolve().properties.standalone === 'true';
655
512
  }
656
- else {
657
- return [
658
- Object.assign(Object.assign({}, lineItem), { qty: qty }),
659
- ];
513
+ get isStandalone$() {
514
+ return this.context.resolve$().pipe(map(() => this.isStandalone));
660
515
  }
661
- };
662
-
663
- var lineItem_utils = /*#__PURE__*/Object.freeze({
664
- __proto__: null,
665
- findLineItem: findLineItem,
666
- findLineItemWithComparator: findLineItemWithComparator,
667
- insertLineItem: insertLineItem,
668
- removeLineItem: removeLineItem,
669
- replaceLineItem: replaceLineItem,
670
- mapAttributes: mapAttributes,
671
- getAttributes: getAttributes,
672
- upsertAttributes: upsertAttributes,
673
- patchAttributes: patchAttributes,
674
- getAttributeValue: getAttributeValue,
675
- generateLineItem: generateLineItem,
676
- getRecommendedPrices: getRecommendedPrices,
677
- multiplyLineItems: multiplyLineItems
678
- });
679
-
680
- class LineItemWorker {
681
- constructor(src) {
682
- this.li = Object.assign({}, src);
516
+ getInitialCurrentState() {
517
+ return this.initialCurrentState;
683
518
  }
684
- insert(parentId, toInsert) {
685
- return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
519
+ isEditMode$() {
520
+ return this.context.resolve$().pipe(map(() => this.isEditMode()));
686
521
  }
687
- remove(id) {
688
- return new LineItemWorker(removeLineItem(this.li, id));
522
+ isEditMode() {
523
+ const context = this.context.resolve();
524
+ if (context.mode === ConfigurationContextMode.ACCOUNT) {
525
+ return true;
526
+ }
527
+ if (context.mode === ConfigurationContextMode.QUOTE) {
528
+ return context.properties.Status === 'Draft';
529
+ }
530
+ return false;
689
531
  }
690
- replace(toReplace) {
691
- return new LineItemWorker(replaceLineItem(this.li, toReplace));
532
+ updateActivePriceList(priceListId) {
533
+ this.context.update({ properties: { PriceListId: priceListId } });
692
534
  }
693
- patchAttribute(attrs, id) {
694
- return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
535
+ populateActivePriceLists$() {
536
+ const ctx = this.context.resolve();
537
+ const quoteDraft = this.quoteDraft;
538
+ if (!quoteDraft) {
539
+ return;
540
+ }
541
+ // In ACCOUNT mode populate price lists from related assets
542
+ if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
543
+ // Populate list of price lists
544
+ this.assetPriceLists = quoteDraft.currentState
545
+ .map(({ priceListId }) => priceListId)
546
+ .reduce((trunk, priceListId) => {
547
+ var _a, _b;
548
+ if (!priceListId || trunk.some(item => item.id === priceListId)) {
549
+ return trunk;
550
+ }
551
+ return [
552
+ ...trunk,
553
+ { id: priceListId, name: (_b = (_a = this.allPriceLists.find(item => item.id === priceListId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
554
+ ];
555
+ }, []);
556
+ }
557
+ }
558
+ filterByActivePriceList(lineItems) {
559
+ const ctx = this.context.resolve();
560
+ return lineItems.filter(li => !li.priceListId || li.priceListId === ctx.properties.PriceListId);
561
+ }
562
+ markAsUpdated(quote) {
563
+ if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === ConfigurationContextMode.ACCOUNT) {
564
+ this.hasUnsavedChanges = !!quote && !quote.currentState.every(li => li.actionCode === 'EXIST');
565
+ }
566
+ else {
567
+ this.hasUnsavedChanges = !isEqual(this.initialCurrentState, quote === null || quote === void 0 ? void 0 : quote.currentState);
568
+ }
695
569
  }
696
570
  }
571
+ QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }], target: i0.ɵɵFactoryTarget.Injectable });
572
+ QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: QuoteDraftService, providedIn: 'root' });
573
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: QuoteDraftService, decorators: [{
574
+ type: Injectable,
575
+ args: [{ providedIn: 'root' }]
576
+ }], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }]; } });
697
577
 
698
578
  class ConfigurationService {
699
579
  constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
@@ -704,7 +584,6 @@ class ConfigurationService {
704
584
  this.messageService = messageService;
705
585
  this.dialogService = dialogService;
706
586
  this.mode = ConfigurationMode.SEARCH;
707
- this.states = {};
708
587
  this.lineItem = new BehaviorSubject(undefined);
709
588
  this.charges = new BehaviorSubject({});
710
589
  this.pricePlans = new BehaviorSubject({});
@@ -713,7 +592,7 @@ class ConfigurationService {
713
592
  reset() {
714
593
  this.hasUnsavedChanges = false;
715
594
  this.runtimeService.reset();
716
- this.states = {};
595
+ this.configurableRamp = undefined;
717
596
  this.lineItem.next(undefined);
718
597
  this.charges.next({});
719
598
  this.pricePlans.next({});
@@ -722,11 +601,8 @@ class ConfigurationService {
722
601
  if (!this.lineItem.value) {
723
602
  return throwError(() => new Error(`Source LineItem not found`));
724
603
  }
725
- this.states.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
726
- this.states.asset = this.states.configurableRamp
727
- ? this.runtimeService.getAsset(this.states.configurableRamp)
728
- : undefined;
729
- return this.configure().pipe(catchError$1(error => {
604
+ this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
605
+ return this.configure().pipe(catchError(error => {
730
606
  console.error(error);
731
607
  if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
732
608
  this.messageService.add({ severity: 'error', summary: error });
@@ -743,8 +619,8 @@ class ConfigurationService {
743
619
  patch(lineItem) {
744
620
  this.patch$(lineItem).subscribe();
745
621
  }
746
- updateCurrentStates(update) {
747
- this.states = Object.assign(Object.assign({}, this.states), update);
622
+ setConfigurableRamp(lineItem) {
623
+ this.configurableRamp = lineItem;
748
624
  }
749
625
  get() {
750
626
  return this.lineItem.asObservable().pipe(shareReplay$1());
@@ -785,7 +661,7 @@ class ConfigurationService {
785
661
  }
786
662
  const uiDefinitionProperties = Object.assign(Object.assign({}, ((_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {})), ((_c = this.runtimeService.uiDefinitionProperties) !== null && _c !== void 0 ? _c : {}));
787
663
  const qty = (_d = this.runtimeService.initializationProps) === null || _d === void 0 ? void 0 : _d.defaultQty;
788
- const lineItem = (_e = this.states.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
664
+ const lineItem = (_e = this.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
789
665
  const configurationRequest = this.createRequest(lineItem);
790
666
  const mainPricingEnabled = (_f = runtimeContext.properties) === null || _f === void 0 ? void 0 : _f.PricingEnabled;
791
667
  const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
@@ -800,26 +676,24 @@ class ConfigurationService {
800
676
  }
801
677
  return lineItem;
802
678
  }))
803
- .pipe(tap(lineItem => lineItem && this.lineItem.next(lineItem)), catchError$1(error => throwError(() => { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); })));
679
+ .pipe(tap(lineItem => lineItem && this.lineItem.next(lineItem)), catchError(error => throwError(() => { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); })));
804
680
  }
805
681
  configureExternal$(productId, qty) {
806
- this.updateCurrentStates({
807
- currentState: this.quoteDraftService.currentState,
808
- });
809
- return this.runtimeService.init({ productId, defaultQty: qty }).pipe(switchMap(() => this.configure()), first(), catchError$1(error => {
682
+ return this.runtimeService.init({ productId, defaultQty: qty }).pipe(switchMap(() => this.configure()), first(), catchError(error => {
810
683
  this.messageService.add({ severity: ToastType.error, summary: error });
811
684
  throw error;
812
685
  }), finalize(() => this.reset()));
813
686
  }
814
687
  createRequest(lineItem) {
688
+ var _a;
815
689
  return {
816
690
  lineItem,
817
691
  mode: this.mode,
818
692
  step: !this.lineItem.value ? RuntimeStep.START : RuntimeStep.UPDATE,
819
693
  attributeDomainMode: 'ALL',
820
694
  context: this.contextService.resolve(),
821
- lineItems: this.states.currentState || [],
822
- asset: this.states.asset,
695
+ lineItems: ((_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) || [],
696
+ asset: this.getAsset(),
823
697
  };
824
698
  }
825
699
  showInactiveProductsConfirmation() {
@@ -847,12 +721,28 @@ class ConfigurationService {
847
721
  }
848
722
  });
849
723
  }
724
+ getAsset() {
725
+ var _a;
726
+ const lineItem = this.configurableRamp;
727
+ if (!lineItem) {
728
+ return;
729
+ }
730
+ return (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
731
+ }
850
732
  }
851
- ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i4.MessageService }, { token: i5.DialogService }], target: i0.ɵɵFactoryTarget.Injectable });
852
- ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService });
853
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, decorators: [{
733
+ ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i5.MessageService }, { token: i6.DialogService }], target: i0.ɵɵFactoryTarget.Injectable });
734
+ ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationService });
735
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationService, decorators: [{
854
736
  type: Injectable
855
- }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i4.MessageService }, { type: i5.DialogService }]; } });
737
+ }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6.DialogService }]; } });
738
+
739
+ function extractMetadata(uiDefinition) {
740
+ return omit(uiDefinition, [
741
+ 'children',
742
+ 'pages',
743
+ 'components',
744
+ ]);
745
+ }
856
746
 
857
747
  class FlowUpdateService {
858
748
  update(rootLineItems, updates) {
@@ -971,9 +861,9 @@ class FlowUpdateService {
971
861
  return true;
972
862
  }
973
863
  }
974
- FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
975
- FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowUpdateService });
976
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowUpdateService, decorators: [{
864
+ FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
865
+ FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowUpdateService });
866
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowUpdateService, decorators: [{
977
867
  type: Injectable
978
868
  }] });
979
869
 
@@ -993,7 +883,7 @@ class FlowConfigurationService {
993
883
  .slice()
994
884
  .sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
995
885
  this.quoteDraftService.updateQuoteDraft(result);
996
- }), map$1(noop));
886
+ }), map$2(noop));
997
887
  }
998
888
  calculate(quoteDraft) {
999
889
  this.calculate$(quoteDraft).subscribe();
@@ -1003,11 +893,11 @@ class FlowConfigurationService {
1003
893
  if (!quoteDraft) {
1004
894
  return of(null);
1005
895
  }
1006
- return of([]).pipe(map$1(() => {
896
+ return of([]).pipe(map$2(() => {
1007
897
  const updatedState = cloneDeep(quoteDraft.currentState);
1008
898
  this.updateService.update(updatedState, updates);
1009
899
  return updatedState;
1010
- }), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
900
+ }), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1011
901
  }
1012
902
  update(updates) {
1013
903
  this.update$(updates).subscribe();
@@ -1026,7 +916,7 @@ class FlowConfigurationService {
1026
916
  updatedState.splice(currentLineItemIndex, 1, initialLineItem);
1027
917
  return of([]).pipe(tap$1(() => {
1028
918
  this.quoteDraftService.setCurrentLineItemState(updatedState);
1029
- }), switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
919
+ }), switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1030
920
  }
1031
921
  revert(lineItemId) {
1032
922
  this.revert$(lineItemId).subscribe();
@@ -1037,7 +927,7 @@ class FlowConfigurationService {
1037
927
  if (!quoteDraft) {
1038
928
  return of(null);
1039
929
  }
1040
- return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
930
+ return of([]).pipe(map$2(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1041
931
  }
1042
932
  delete(ids) {
1043
933
  this.delete$(ids).subscribe();
@@ -1048,33 +938,36 @@ class FlowConfigurationService {
1048
938
  return of(null);
1049
939
  }
1050
940
  const updatedState = [...quoteDraft.currentState, term];
1051
- return of([]).pipe(switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
941
+ return of([]).pipe(switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1052
942
  }
1053
943
  addToCart$(productId, qty) {
1054
944
  const quoteDraft = this.quoteDraftService.quoteDraft;
1055
945
  if (!quoteDraft) {
1056
946
  return of(null);
1057
947
  }
1058
- return this.configurationService.configureExternal$(productId, qty).pipe(map$1(lineItem => {
948
+ return this.configurationService.configureExternal$(productId, qty).pipe(map$2(lineItem => {
1059
949
  var _a, _b;
1060
950
  const model = this.configurationService.getRuntimeModel();
1061
951
  const split = (_b = (_a = model === null || model === void 0 ? void 0 : model.types.find(type => type.name === lineItem.type)) === null || _a === void 0 ? void 0 : _a.split) !== null && _b !== void 0 ? _b : false;
1062
952
  const lineItems = multiplyLineItems(lineItem, qty !== null && qty !== void 0 ? qty : 1, split);
1063
953
  return [...quoteDraft.currentState, ...lineItems];
1064
- }), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
954
+ }), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1065
955
  }
1066
956
  get() {
1067
- return this.quoteDraftService.quoteDraft$.pipe(map$1(() => this.quoteDraftService.activeCurrentState), shareReplay$1());
957
+ return this.quoteDraftService.quoteDraft$.pipe(map$2(() => this.quoteDraftService.activeCurrentState), shareReplay$1());
1068
958
  }
1069
959
  getSnapshot() {
1070
960
  var _a, _b;
1071
961
  return (_b = (_a = this.quoteDraftService) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
1072
962
  }
1073
963
  get charges$() {
1074
- return this.quoteDraftService.quoteDraft$.pipe(map$1(({ charges }) => charges));
964
+ return this.quoteDraftService.quoteDraft$.pipe(map$2(({ charges }) => charges));
1075
965
  }
1076
966
  get pricePlans$() {
1077
- return this.quoteDraftService.quoteDraft$.pipe(map$1(({ pricePlans }) => pricePlans));
967
+ return this.quoteDraftService.quoteDraft$.pipe(map$2(({ pricePlans }) => pricePlans));
968
+ }
969
+ get activeMetrics$() {
970
+ return this.quoteDraftService.quoteDraft$.pipe(map$2(({ activeMetrics }) => activeMetrics));
1078
971
  }
1079
972
  get chargesSnapshot() {
1080
973
  var _a, _b;
@@ -1084,6 +977,10 @@ class FlowConfigurationService {
1084
977
  var _a, _b;
1085
978
  return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.pricePlans) !== null && _b !== void 0 ? _b : {};
1086
979
  }
980
+ get activeMetricsSnapshot() {
981
+ var _a, _b;
982
+ return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.activeMetrics) !== null && _b !== void 0 ? _b : [];
983
+ }
1087
984
  get contextSnapshot() {
1088
985
  return this.contextService.resolve();
1089
986
  }
@@ -1092,7 +989,7 @@ class FlowConfigurationService {
1092
989
  }
1093
990
  handleErrorAndBounceBack() {
1094
991
  return (source$) => {
1095
- return source$.pipe(catchError(error => {
992
+ return source$.pipe(catchError$1(error => {
1096
993
  console.error(error);
1097
994
  // bounce back if configuration call has failed
1098
995
  const quoteDraft = this.quoteDraftService.quoteDraft;
@@ -1104,18 +1001,18 @@ class FlowConfigurationService {
1104
1001
  };
1105
1002
  }
1106
1003
  }
1107
- FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
1108
- FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationService });
1109
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationService, decorators: [{
1004
+ FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
1005
+ FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationService });
1006
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationService, decorators: [{
1110
1007
  type: Injectable
1111
1008
  }], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1112
1009
 
1113
1010
  class FlowConfigurationModule {
1114
1011
  }
1115
- FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1116
- FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule });
1117
- FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService], imports: [[]] });
1118
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule, decorators: [{
1012
+ FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1013
+ FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationModule });
1014
+ FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService], imports: [[]] });
1015
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FlowConfigurationModule, decorators: [{
1119
1016
  type: NgModule,
1120
1017
  args: [{
1121
1018
  imports: [],
@@ -1125,9 +1022,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1125
1022
 
1126
1023
  class ConfigurationModule {
1127
1024
  }
1128
- ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1129
- ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
1130
- ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, providers: [
1025
+ ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1026
+ ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
1027
+ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationModule, providers: [
1131
1028
  ContextApiService,
1132
1029
  ProductModelApiService,
1133
1030
  ConfigurationApiService,
@@ -1135,7 +1032,7 @@ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
1135
1032
  RuntimeContextService,
1136
1033
  ConfigurationService,
1137
1034
  ], imports: [[ConfirmationDialogModule]] });
1138
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, decorators: [{
1035
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConfigurationModule, decorators: [{
1139
1036
  type: NgModule,
1140
1037
  args: [{
1141
1038
  imports: [ConfirmationDialogModule],
@@ -1150,12 +1047,155 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1150
1047
  }]
1151
1048
  }] });
1152
1049
 
1050
+ function calculateMetricByMethod(lineItems, metric, method) {
1051
+ const items = getLineItemsByMethod(lineItems, method);
1052
+ return items.reduce((acc, li) => {
1053
+ let value = li.reduce((accProduct, item) => accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0), 0);
1054
+ if (method === 'avg' && li.length > 0) {
1055
+ value /= li.length;
1056
+ }
1057
+ return acc + value;
1058
+ }, 0);
1059
+ }
1060
+ function getLineItemsByMethod(lineItems, method) {
1061
+ switch (method) {
1062
+ case 'first': {
1063
+ return lineItems.filter(li => !li.rampInstanceId).map(item => [item]);
1064
+ }
1065
+ case 'last': {
1066
+ const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
1067
+ const products = rootTermItems.map(lineItem => [
1068
+ lineItem,
1069
+ ...lineItems.filter(li => li.rampInstanceId === lineItem.id),
1070
+ ]);
1071
+ return products
1072
+ .map(items => [...items].sort((a, b) => getDateValue(a.endDate || '') - getDateValue(b.endDate || '')).pop())
1073
+ .filter((li) => Boolean(li))
1074
+ .map(item => [item]);
1075
+ }
1076
+ case 'avg': {
1077
+ const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
1078
+ return rootTermItems.map(lineItem => [lineItem, ...lineItems.filter(li => li.rampInstanceId === lineItem.id)]);
1079
+ }
1080
+ case 'sum': {
1081
+ return lineItems.map(item => [item]);
1082
+ }
1083
+ default: {
1084
+ return lineItems.map(item => [item]);
1085
+ }
1086
+ }
1087
+ }
1088
+ function getDateValue(date) {
1089
+ return date ? new Date(date).getTime() : 0;
1090
+ }
1091
+
1092
+ class MetricsCalculationService {
1093
+ constructor(quoteDraftService, flowConfiguration, settingsService) {
1094
+ this.quoteDraftService = quoteDraftService;
1095
+ this.flowConfiguration = flowConfiguration;
1096
+ this.settingsService = settingsService;
1097
+ this.metricsUpdated$ = new Subject();
1098
+ this.quoteMetricsSettings = {};
1099
+ this.metricsCalculationMethodMap = {};
1100
+ this.metricsData = {};
1101
+ this.activeMetricRules = [];
1102
+ this.activeMetricRules = this.flowConfiguration.activeMetricsSnapshot.filter(metricRule => metricRule.metrics.some(metric => !!metric.totalName));
1103
+ combineLatest([
1104
+ this.quoteDraftService.currentState$,
1105
+ this.settingsService.fetchSetting('QUOTE_LEVEL_METRIC_CALCULATION_METHOD').pipe(take$1(1)),
1106
+ ]).subscribe(([lineItems, setting]) => {
1107
+ let settingsData = {};
1108
+ try {
1109
+ settingsData = JSON.parse((setting === null || setting === void 0 ? void 0 : setting.value) || '{}');
1110
+ }
1111
+ catch (error) {
1112
+ settingsData = {};
1113
+ }
1114
+ this.quoteMetricsSettings = settingsData;
1115
+ this.updateMetrics(lineItems);
1116
+ });
1117
+ }
1118
+ get onMetricsUpdate$() {
1119
+ return this.metricsUpdated$.asObservable();
1120
+ }
1121
+ getMetricValue(metric) {
1122
+ return this.metricsData[metric] || 0;
1123
+ }
1124
+ updateMetrics(lineItems) {
1125
+ const metricKeys = this.collectMetricKeys(lineItems).filter(key => !key.includes('Effective_'));
1126
+ this.metricsCalculationMethodMap = this.buildMetricsCalculationMethods(metricKeys, this.metricsCalculationMethodMap);
1127
+ this.metricsData = metricKeys.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: this.calculateMetric(lineItems, key) })), {});
1128
+ this.metricsUpdated$.next();
1129
+ }
1130
+ calculateMetric(lineItems, metric) {
1131
+ return calculateMetricByMethod(lineItems, metric, this.metricsCalculationMethodMap[metric] || 'sum');
1132
+ }
1133
+ buildMetricsCalculationMethods(metricKeys, initial) {
1134
+ return metricKeys.reduce((acc, name) => {
1135
+ var _a, _b;
1136
+ if (acc[name]) {
1137
+ return acc;
1138
+ }
1139
+ acc = Object.assign(Object.assign({}, acc), { [name]: 'sum' });
1140
+ const metricRule = this.getMetricRuleByTotalMetricName(name);
1141
+ const settingKey = ((_b = (_a = metricRule === null || metricRule === void 0 ? void 0 : metricRule.metrics) === null || _a === void 0 ? void 0 : _a.find(metric => metric.totalName === name)) === null || _b === void 0 ? void 0 : _b.name) || name;
1142
+ if (this.quoteMetricsSettings[settingKey]) {
1143
+ acc = Object.assign(Object.assign({}, acc), { [name]: this.quoteMetricsSettings[settingKey] });
1144
+ }
1145
+ return acc;
1146
+ }, initial);
1147
+ }
1148
+ collectMetricKeys(lineItems) {
1149
+ const keys = [];
1150
+ lineItems.forEach(lineItem => {
1151
+ keys.push(...Object.keys(lineItem.totalMetrics || {}));
1152
+ keys.push(...this.collectMetricKeys(lineItem.lineItems));
1153
+ });
1154
+ return uniq(keys);
1155
+ }
1156
+ getMetricRuleByTotalMetricName(name) {
1157
+ return this.activeMetricRules.find(metricRule => metricRule.metrics.find(metric => metric.totalName === name));
1158
+ }
1159
+ }
1160
+ MetricsCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: FlowConfigurationService }, { token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1161
+ MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MetricsCalculationService, providedIn: 'root' });
1162
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MetricsCalculationService, decorators: [{
1163
+ type: Injectable,
1164
+ args: [{ providedIn: 'root' }]
1165
+ }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: FlowConfigurationService }, { type: i1.ConfigurationSettingsApiService }]; } });
1166
+
1167
+ class ProductImagesService {
1168
+ constructor(productApiService) {
1169
+ this.productApiService = productApiService;
1170
+ this.imagesMap$ = new BehaviorSubject({});
1171
+ }
1172
+ getImageUrl$(productId) {
1173
+ if (this.imagesMap$.value[productId] == null) {
1174
+ this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: '' }));
1175
+ this.fetchProductImage(productId);
1176
+ }
1177
+ return this.imagesMap$.pipe(map$2(imagesMap => imagesMap[productId]), distinctUntilChanged());
1178
+ }
1179
+ fetchProductImage(productId) {
1180
+ this.productApiService
1181
+ .fetchImage$(productId)
1182
+ .pipe(map$2(file => URL.createObjectURL(file)), catchError$1(() => of('')), tap$1(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
1183
+ .subscribe();
1184
+ }
1185
+ }
1186
+ ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1187
+ ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductImagesService, providedIn: 'root' });
1188
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ProductImagesService, decorators: [{
1189
+ type: Injectable,
1190
+ args: [{ providedIn: 'root' }]
1191
+ }], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
1192
+
1153
1193
  class SdkCoreModule {
1154
1194
  }
1155
- SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1156
- SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1157
- SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService], imports: [[ConfigurationModule, FlowConfigurationModule]] });
1158
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, decorators: [{
1195
+ SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1196
+ SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1197
+ SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService], imports: [[ConfigurationModule, FlowConfigurationModule]] });
1198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SdkCoreModule, decorators: [{
1159
1199
  type: NgModule,
1160
1200
  args: [{
1161
1201
  imports: [ConfigurationModule, FlowConfigurationModule],
@@ -1167,5 +1207,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1167
1207
  * Generated bundle index. Do not edit.
1168
1208
  */
1169
1209
 
1170
- export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeStep, SdkCoreModule, findLineItem, findLineItemWithComparator, generateLineItem, getAttributeValue, getAttributes, getDefaultLineItem, getRecommendedPrices, insertLineItem, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, removeLineItem, replaceLineItem, upsertAttributes };
1210
+ export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeStep, SdkCoreModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, findLineItem, findLineItemWithComparator, generateLineItem, getAttributeValue, getAttributes, getDefaultLineItem, getRecommendedPrices, insertLineItem, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
1171
1211
  //# sourceMappingURL=veloceapps-sdk-core.js.map