@veloceapps/sdk 6.0.0-10 → 6.0.0-101

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 (241) hide show
  1. package/README.md +10 -2
  2. package/bundles/veloceapps-sdk-cms.umd.js +1269 -798
  3. package/bundles/veloceapps-sdk-cms.umd.js.map +1 -1
  4. package/bundles/veloceapps-sdk-core.umd.js +783 -650
  5. package/bundles/veloceapps-sdk-core.umd.js.map +1 -1
  6. package/bundles/veloceapps-sdk-runtime.umd.js +216 -150
  7. package/bundles/veloceapps-sdk-runtime.umd.js.map +1 -1
  8. package/bundles/veloceapps-sdk.umd.js +582 -310
  9. package/bundles/veloceapps-sdk.umd.js.map +1 -1
  10. package/cms/cms.actions.d.ts +2 -4
  11. package/cms/components/element-children/element-children.component.d.ts +13 -3
  12. package/cms/components/element-children/element-children.module.d.ts +4 -2
  13. package/cms/components/element-drop-handle/element-drop-handle.component.d.ts +12 -0
  14. package/cms/components/element-drop-handle/element-drop-handle.module.d.ts +9 -0
  15. package/cms/components/element-renderer/element-renderer.component.d.ts +3 -3
  16. package/cms/components/preview/index.d.ts +1 -0
  17. package/cms/components/preview/preview.component.d.ts +9 -8
  18. package/cms/components/preview/preview.module.d.ts +2 -1
  19. package/cms/components/preview/preview.types.d.ts +11 -0
  20. package/cms/index.d.ts +2 -0
  21. package/cms/launcher.module.d.ts +3 -1
  22. package/cms/modules/migrations/index.d.ts +2 -0
  23. package/cms/modules/migrations/migrations.d.ts +2 -0
  24. package/cms/modules/migrations/migrations.module.d.ts +6 -0
  25. package/cms/modules/migrations/services/migrations.service.d.ts +10 -0
  26. package/cms/modules/migrations/types/migrations.types.d.ts +2 -0
  27. package/cms/modules/runtime/index.d.ts +2 -0
  28. package/cms/modules/runtime/runtime.module.d.ts +8 -0
  29. package/cms/modules/runtime/services/compilation.service.d.ts +18 -0
  30. package/cms/modules/runtime/services/runtime-editor.service.d.ts +18 -0
  31. package/cms/modules/runtime/services/runtime.service.d.ts +27 -0
  32. package/cms/modules/runtime/tokens.d.ts +3 -0
  33. package/cms/{types → modules/runtime/types}/compilation.types.d.ts +1 -1
  34. package/cms/modules/runtime/types/runtime.actions.d.ts +9 -0
  35. package/cms/services/index.d.ts +1 -1
  36. package/cms/services/integration.state.d.ts +2 -3
  37. package/cms/services/io-provider.service.d.ts +3 -3
  38. package/cms/services/resources.service.d.ts +10 -0
  39. package/cms/types/common.types.d.ts +1 -1
  40. package/cms/types/configuration.types.d.ts +1 -0
  41. package/cms/types/index.d.ts +1 -1
  42. package/cms/types/integration.types.d.ts +5 -0
  43. package/cms/utils/elements-resolver.d.ts +3 -2
  44. package/cms/utils/index.d.ts +1 -0
  45. package/cms/utils/path.utils.d.ts +0 -1
  46. package/cms/utils/ui-definition.utils.d.ts +6 -0
  47. package/cms/vendor-map.d.ts +52 -31
  48. package/core/modules/configuration/services/configuration-runtime.service.d.ts +2 -4
  49. package/core/modules/configuration/services/configuration.service.d.ts +6 -4
  50. package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -2
  51. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +3 -2
  52. package/core/modules/flow-configuration/services/flow-update.service.d.ts +3 -2
  53. package/core/services/context.service.d.ts +1 -0
  54. package/core/services/metric-calculation/metric-calculation.service.d.ts +5 -1
  55. package/core/services/quote-draft.service.d.ts +2 -2
  56. package/core/types/index.d.ts +0 -1
  57. package/core/types/ui-definition.types.d.ts +19 -4
  58. package/core/utils/index.d.ts +1 -0
  59. package/core/utils/line-item.utils.d.ts +3 -0
  60. package/core/utils/ui-definition.utils.d.ts +2 -0
  61. package/esm2015/cms/cms.actions.js +1 -6
  62. package/esm2015/cms/components/element-children/element-children.component.js +24 -8
  63. package/esm2015/cms/components/element-children/element-children.module.js +8 -6
  64. package/esm2015/cms/components/element-drop-handle/element-drop-handle.component.js +32 -0
  65. package/esm2015/cms/components/element-drop-handle/element-drop-handle.module.js +19 -0
  66. package/esm2015/cms/components/element-renderer/element-renderer.component.js +9 -9
  67. package/esm2015/cms/components/element-renderer/element-renderer.module.js +4 -4
  68. package/esm2015/cms/components/plugin.component.js +3 -3
  69. package/esm2015/cms/components/preview/index.js +2 -1
  70. package/esm2015/cms/components/preview/preview.component.js +21 -36
  71. package/esm2015/cms/components/preview/preview.module.js +7 -6
  72. package/esm2015/cms/components/preview/preview.types.js +2 -0
  73. package/esm2015/cms/directives/custom-template.directive.js +3 -3
  74. package/esm2015/cms/index.js +3 -1
  75. package/esm2015/cms/launcher.module.js +11 -10
  76. package/esm2015/cms/modules/federated/federated.component.js +3 -3
  77. package/esm2015/cms/modules/federated/federated.module.js +4 -4
  78. package/esm2015/cms/modules/migrations/index.js +3 -0
  79. package/esm2015/cms/modules/migrations/migrations.js +11 -0
  80. package/esm2015/cms/modules/migrations/migrations.module.js +15 -0
  81. package/esm2015/cms/modules/migrations/services/migrations.service.js +43 -0
  82. package/esm2015/cms/modules/migrations/types/migrations.types.js +2 -0
  83. package/esm2015/cms/modules/runtime/index.js +3 -0
  84. package/esm2015/cms/modules/runtime/runtime.module.js +32 -0
  85. package/esm2015/cms/modules/runtime/services/compilation.service.js +84 -0
  86. package/esm2015/cms/modules/runtime/services/runtime-editor.service.js +27 -0
  87. package/esm2015/cms/modules/runtime/services/runtime.service.js +74 -0
  88. package/esm2015/cms/modules/runtime/tokens.js +3 -0
  89. package/esm2015/cms/modules/runtime/types/compilation.types.js +2 -0
  90. package/esm2015/cms/modules/runtime/types/runtime.actions.js +2 -0
  91. package/esm2015/cms/plugins/configuration.plugin.js +12 -4
  92. package/esm2015/cms/plugins/io.plugin.js +3 -3
  93. package/esm2015/cms/plugins/script.plugin.js +3 -3
  94. package/esm2015/cms/services/element-context.service.js +3 -3
  95. package/esm2015/cms/services/index.js +2 -2
  96. package/esm2015/cms/services/integration.state.js +4 -4
  97. package/esm2015/cms/services/io-provider.service.js +9 -9
  98. package/esm2015/cms/services/resources.service.js +50 -0
  99. package/esm2015/cms/services/templates.service.js +3 -3
  100. package/esm2015/cms/types/common.types.js +1 -1
  101. package/esm2015/cms/types/configuration.types.js +1 -1
  102. package/esm2015/cms/types/index.js +2 -2
  103. package/esm2015/cms/types/integration.types.js +1 -1
  104. package/esm2015/cms/utils/elements-resolver.js +18 -8
  105. package/esm2015/cms/utils/index.js +2 -1
  106. package/esm2015/cms/utils/path.utils.js +2 -13
  107. package/esm2015/cms/utils/ui-definition.utils.js +82 -0
  108. package/esm2015/cms/vendor-map.js +26 -10
  109. package/esm2015/core/core.module.js +4 -4
  110. package/esm2015/core/modules/configuration/configuration.module.js +4 -4
  111. package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +5 -10
  112. package/esm2015/core/modules/configuration/services/configuration.service.js +38 -34
  113. package/esm2015/core/modules/configuration/services/runtime-context.service.js +3 -3
  114. package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +1 -1
  115. package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +4 -4
  116. package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +11 -10
  117. package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +9 -9
  118. package/esm2015/core/services/context.service.js +7 -4
  119. package/esm2015/core/services/metric-calculation/metric-calculation.service.js +18 -9
  120. package/esm2015/core/services/product-images.service.js +3 -3
  121. package/esm2015/core/services/quote-draft.service.js +7 -7
  122. package/esm2015/core/types/index.js +1 -2
  123. package/esm2015/core/types/ui-definition.types.js +2 -2
  124. package/esm2015/core/utils/index.js +2 -1
  125. package/esm2015/core/utils/line-item.utils.js +43 -11
  126. package/esm2015/core/utils/ui-definition.utils.js +9 -0
  127. package/esm2015/runtime/components/component-preview/component-preview.component.js +4 -4
  128. package/esm2015/runtime/components/section-renderer/section-renderer.component.js +3 -3
  129. package/esm2015/runtime/components/ui-runtime/runtime.component.js +3 -3
  130. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +3 -3
  131. package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +6 -6
  132. package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +3 -3
  133. package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +3 -3
  134. package/esm2015/runtime/execution/components/federated/federated.component.js +3 -3
  135. package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +3 -3
  136. package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +3 -3
  137. package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +3 -3
  138. package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +3 -3
  139. package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +3 -3
  140. package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +3 -3
  141. package/esm2015/runtime/execution/directives/section-script.directive.js +3 -3
  142. package/esm2015/runtime/execution/directives/sf-query.directive.js +3 -3
  143. package/esm2015/runtime/execution/directives/velo-attribute.directive.js +3 -3
  144. package/esm2015/runtime/execution/directives/velo-port.directive.js +18 -18
  145. package/esm2015/runtime/execution/directives/vl-approval.directive.js +3 -3
  146. package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +3 -3
  147. package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +3 -3
  148. package/esm2015/runtime/execution/directives/vl-quote.directive.js +4 -4
  149. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +3 -3
  150. package/esm2015/runtime/execution/runtime-execution.module.js +4 -4
  151. package/esm2015/runtime/runtime.module.js +4 -4
  152. package/esm2015/runtime/services/cart.service.js +3 -3
  153. package/esm2015/runtime/services/collapsible-state.service.js +3 -3
  154. package/esm2015/runtime/services/configuration.service.js +11 -12
  155. package/esm2015/runtime/services/current-state.service.js +3 -3
  156. package/esm2015/runtime/services/form-scope.service.js +3 -3
  157. package/esm2015/runtime/services/product-model-cache.service.js +3 -3
  158. package/esm2015/runtime/services/runtime-context.service.js +3 -3
  159. package/esm2015/runtime/services/runtime-form.service.js +3 -3
  160. package/esm2015/runtime/services/runtime.service.js +4 -4
  161. package/esm2015/runtime/services/section-helper.service.js +3 -3
  162. package/esm2015/runtime/services/section-scope.service.js +3 -3
  163. package/esm2015/runtime/services/section-store.service.js +3 -3
  164. package/esm2015/runtime/services/section.service.js +6 -6
  165. package/esm2015/runtime/types/index.js +2 -1
  166. package/esm2015/runtime/types/quote-states.types.js +2 -0
  167. package/esm2015/src/components/dialog/dialog.component.js +16 -6
  168. package/esm2015/src/components/dialog/dialog.module.js +4 -4
  169. package/esm2015/src/components/dialog/dialog.types.js +1 -1
  170. package/esm2015/src/components/doc-gen/doc-gen.component.js +3 -3
  171. package/esm2015/src/components/doc-gen/doc-gen.module.js +4 -4
  172. package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +3 -3
  173. package/esm2015/src/components/header/cart-overlay/cart-preview.module.js +4 -4
  174. package/esm2015/src/components/header/header.component.js +39 -13
  175. package/esm2015/src/components/header/header.module.js +4 -4
  176. package/esm2015/src/components/header/metrics/metrics.component.js +79 -67
  177. package/esm2015/src/components/header/metrics/metrics.definitions.js +1 -8
  178. package/esm2015/src/components/header/metrics/metrics.module.js +4 -4
  179. package/esm2015/src/flow-routing.module.js +18 -5
  180. package/esm2015/src/flow.component.js +3 -3
  181. package/esm2015/src/flow.module.js +4 -4
  182. package/esm2015/src/guards/context.guard.js +3 -3
  183. package/esm2015/src/guards/product-unload.guard.js +5 -5
  184. package/esm2015/src/guards/root.guard.js +3 -3
  185. package/esm2015/src/pages/assets/assets.component.js +117 -0
  186. package/esm2015/src/pages/assets/assets.module.js +20 -0
  187. package/esm2015/src/pages/catalog/catalog.component.js +6 -6
  188. package/esm2015/src/pages/catalog/catalog.module.js +4 -4
  189. package/esm2015/src/pages/debug/debug.component.js +3 -3
  190. package/esm2015/src/pages/debug/debug.module.js +4 -4
  191. package/esm2015/src/pages/empty-account/empty-account.component.js +3 -3
  192. package/esm2015/src/pages/empty-account/empty-account.module.js +4 -4
  193. package/esm2015/src/pages/legacy-product/legacy-product.component.js +4 -4
  194. package/esm2015/src/pages/legacy-product/legacy-product.module.js +4 -4
  195. package/esm2015/src/pages/product/product.component.js +5 -12
  196. package/esm2015/src/pages/product/product.module.js +4 -4
  197. package/esm2015/src/pages/record-not-found/record-not-found.component.js +3 -3
  198. package/esm2015/src/pages/record-not-found/record-not-found.module.js +4 -4
  199. package/esm2015/src/pages/remote/remote.component.js +5 -8
  200. package/esm2015/src/pages/remote/remote.module.js +4 -4
  201. package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +6 -6
  202. package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +4 -4
  203. package/esm2015/src/resolvers/flow.resolver.js +3 -3
  204. package/esm2015/src/resolvers/quote.resolver.js +28 -14
  205. package/esm2015/src/services/doc-gen.service.js +3 -3
  206. package/esm2015/src/services/flow-dialog.service.js +5 -4
  207. package/esm2015/src/services/flow-router.service.js +12 -4
  208. package/esm2015/src/services/flow.service.js +12 -5
  209. package/esm2015/src/types/flow-customization.types.js +1 -1
  210. package/esm2015/src/utils/flow.utils.js +3 -3
  211. package/fesm2015/veloceapps-sdk-cms.js +1073 -718
  212. package/fesm2015/veloceapps-sdk-cms.js.map +1 -1
  213. package/fesm2015/veloceapps-sdk-core.js +574 -520
  214. package/fesm2015/veloceapps-sdk-core.js.map +1 -1
  215. package/fesm2015/veloceapps-sdk-runtime.js +145 -146
  216. package/fesm2015/veloceapps-sdk-runtime.js.map +1 -1
  217. package/fesm2015/veloceapps-sdk.js +455 -264
  218. package/fesm2015/veloceapps-sdk.js.map +1 -1
  219. package/package.json +5 -3
  220. package/runtime/services/configuration.service.d.ts +2 -1
  221. package/runtime/services/runtime.service.d.ts +2 -1
  222. package/runtime/types/index.d.ts +1 -0
  223. package/src/components/dialog/dialog.types.d.ts +1 -0
  224. package/src/components/header/header.component.d.ts +10 -3
  225. package/src/components/header/metrics/metrics.component.d.ts +15 -6
  226. package/src/components/header/metrics/metrics.definitions.d.ts +0 -3
  227. package/src/flow-routing.module.d.ts +4 -3
  228. package/src/pages/assets/assets.component.d.ts +32 -0
  229. package/src/pages/assets/assets.module.d.ts +10 -0
  230. package/src/pages/product/product.component.d.ts +0 -1
  231. package/src/resolvers/quote.resolver.d.ts +5 -1
  232. package/src/services/flow-router.service.d.ts +2 -0
  233. package/src/services/flow.service.d.ts +1 -0
  234. package/src/types/flow-customization.types.d.ts +1 -0
  235. package/cms/services/dynamic-module.service.d.ts +0 -15
  236. package/cms/services/launcher.service.d.ts +0 -18
  237. package/esm2015/cms/services/dynamic-module.service.js +0 -33
  238. package/esm2015/cms/services/launcher.service.js +0 -58
  239. package/esm2015/cms/types/compilation.types.js +0 -2
  240. package/esm2015/core/types/quote-states.types.js +0 -2
  241. /package/{core → runtime}/types/quote-states.types.d.ts +0 -0
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@veloceapps/core'), require('rxjs'), require('rxjs/operators'), require('@veloceapps/api'), require('lodash'), require('@veloceapps/components'), require('primeng/api'), require('primeng/dynamicdialog'), require('moment')) :
3
3
  typeof define === 'function' && define.amd ? define('@veloceapps/sdk/core', ['exports', '@angular/core', '@veloceapps/core', 'rxjs', 'rxjs/operators', '@veloceapps/api', 'lodash', '@veloceapps/components', 'primeng/api', 'primeng/dynamicdialog', 'moment'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloceapps = global.veloceapps || {}, global.veloceapps.sdk = global.veloceapps.sdk || {}, global.veloceapps.sdk.core = {}), global.ng.core, global["@veloceapps/core"], global.rxjs, global.rxjs.operators, global["@veloceapps/api"], global.lodash, global["@veloceapps/components"], global["primeng/api"], global["primeng/dynamicdialog"], global.moment));
5
- })(this, (function (exports, i0, core, rxjs, operators, i1, lodash, components, i4, i5, moment) { 'use strict';
5
+ })(this, (function (exports, i0, core, rxjs, operators, i1, lodash, components, i5, i6, moment) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -26,8 +26,8 @@
26
26
 
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
28
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
30
29
  var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
30
+ var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
31
31
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
32
32
 
33
33
  var getDefaultLineItem = function (context, uiDefinitionProperties, qty) {
@@ -40,7 +40,7 @@
40
40
  return lineItem;
41
41
  };
42
42
 
43
- /*! *****************************************************************************
43
+ /******************************************************************************
44
44
  Copyright (c) Microsoft Corporation.
45
45
 
46
46
  Permission to use, copy, modify, and/or distribute this software for any
@@ -107,6 +107,64 @@
107
107
  function __param(paramIndex, decorator) {
108
108
  return function (target, key) { decorator(target, key, paramIndex); };
109
109
  }
110
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
111
+ function accept(f) { if (f !== void 0 && typeof f !== "function")
112
+ throw new TypeError("Function expected"); return f; }
113
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
114
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
115
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
116
+ var _, done = false;
117
+ for (var i = decorators.length - 1; i >= 0; i--) {
118
+ var context = {};
119
+ for (var p in contextIn)
120
+ context[p] = p === "access" ? {} : contextIn[p];
121
+ for (var p in contextIn.access)
122
+ context.access[p] = contextIn.access[p];
123
+ context.addInitializer = function (f) { if (done)
124
+ throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
125
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
126
+ if (kind === "accessor") {
127
+ if (result === void 0)
128
+ continue;
129
+ if (result === null || typeof result !== "object")
130
+ throw new TypeError("Object expected");
131
+ if (_ = accept(result.get))
132
+ descriptor.get = _;
133
+ if (_ = accept(result.set))
134
+ descriptor.set = _;
135
+ if (_ = accept(result.init))
136
+ initializers.push(_);
137
+ }
138
+ else if (_ = accept(result)) {
139
+ if (kind === "field")
140
+ initializers.push(_);
141
+ else
142
+ descriptor[key] = _;
143
+ }
144
+ }
145
+ if (target)
146
+ Object.defineProperty(target, contextIn.name, descriptor);
147
+ done = true;
148
+ }
149
+ ;
150
+ function __runInitializers(thisArg, initializers, value) {
151
+ var useValue = arguments.length > 2;
152
+ for (var i = 0; i < initializers.length; i++) {
153
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
154
+ }
155
+ return useValue ? value : void 0;
156
+ }
157
+ ;
158
+ function __propKey(x) {
159
+ return typeof x === "symbol" ? x : "".concat(x);
160
+ }
161
+ ;
162
+ function __setFunctionName(f, name, prefix) {
163
+ if (typeof name === "symbol")
164
+ name = name.description ? "[".concat(name.description, "]") : "";
165
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
166
+ }
167
+ ;
110
168
  function __metadata(metadataKey, metadataValue) {
111
169
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
112
170
  return Reflect.metadata(metadataKey, metadataValue);
@@ -138,7 +196,7 @@
138
196
  function step(op) {
139
197
  if (f)
140
198
  throw new TypeError("Generator is already executing.");
141
- while (_)
199
+ while (g && (g = 0, op[0] && (_ = 0)), _)
142
200
  try {
143
201
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
144
202
  return t;
@@ -202,7 +260,11 @@
202
260
  var __createBinding = Object.create ? (function (o, m, k, k2) {
203
261
  if (k2 === undefined)
204
262
  k2 = k;
205
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
263
+ var desc = Object.getOwnPropertyDescriptor(m, k);
264
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
265
+ desc = { enumerable: true, get: function () { return m[k]; } };
266
+ }
267
+ Object.defineProperty(o, k2, desc);
206
268
  }) : (function (o, m, k, k2) {
207
269
  if (k2 === undefined)
208
270
  k2 = k;
@@ -302,7 +364,7 @@
302
364
  function __asyncDelegator(o) {
303
365
  var i, p;
304
366
  return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
305
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
367
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
306
368
  }
307
369
  function __asyncValues(o) {
308
370
  if (!Symbol.asyncIterator)
@@ -357,6 +419,11 @@
357
419
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
358
420
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
359
421
  }
422
+ function __classPrivateFieldIn(state, receiver) {
423
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
424
+ throw new TypeError("Cannot use 'in' operator on non-object");
425
+ return typeof state === "function" ? receiver === state : state.has(receiver);
426
+ }
360
427
 
361
428
  exports.RuntimeMode = void 0;
362
429
  (function (RuntimeMode) {
@@ -374,6 +441,8 @@
374
441
  RuntimeStep["UPDATE"] = "UPDATE";
375
442
  })(exports.RuntimeStep || (exports.RuntimeStep = {}));
376
443
 
444
+ var UI_DEFINITION_VERSION = 3;
445
+
377
446
  var ContextService = /** @class */ (function () {
378
447
  function ContextService(contextApiService) {
379
448
  this.contextApiService = contextApiService;
@@ -386,6 +455,13 @@
386
455
  enumerable: false,
387
456
  configurable: true
388
457
  });
458
+ Object.defineProperty(ContextService.prototype, "mode", {
459
+ get: function () {
460
+ return this.resolve().properties.mode;
461
+ },
462
+ enumerable: false,
463
+ configurable: true
464
+ });
389
465
  ContextService.prototype.resolve = function () {
390
466
  if (!this.context.value) {
391
467
  throw new Error('Context is not initialized yet!');
@@ -416,149 +492,451 @@
416
492
  };
417
493
  return ContextService;
418
494
  }());
419
- ContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ContextService, deps: [{ token: i1__namespace.ContextApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
420
- ContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ContextService, providedIn: 'root' });
421
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ContextService, decorators: [{
495
+ ContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextService, deps: [{ token: i1__namespace.ContextApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
496
+ ContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextService, providedIn: 'root' });
497
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextService, decorators: [{
422
498
  type: i0.Injectable,
423
499
  args: [{ providedIn: 'root' }]
424
500
  }], ctorParameters: function () { return [{ type: i1__namespace.ContextApiService }]; } });
425
501
 
426
- function calculateMetricByMethod(lineItems, metric, method) {
427
- var items = getLineItemsByMethod(lineItems, method);
428
- return items.reduce(function (acc, li) {
429
- var value = li.reduce(function (accProduct, item) { return accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0); }, 0);
430
- if (method === 'avg' && li.length > 0) {
431
- value /= li.length;
432
- }
433
- return acc + value;
434
- }, 0);
435
- }
436
- function getLineItemsByMethod(lineItems, method) {
437
- switch (method) {
438
- case 'first': {
439
- return lineItems.filter(function (li) { return !li.rampInstanceId; }).map(function (item) { return [item]; });
440
- }
441
- case 'last': {
442
- var rootTermItems = lineItems.filter(function (li) { return !li.rampInstanceId; });
443
- var products = rootTermItems.map(function (lineItem) { return __spreadArray([
444
- lineItem
445
- ], __read(lineItems.filter(function (li) { return li.rampInstanceId === lineItem.id; }))); });
446
- return products
447
- .map(function (items) { return __spreadArray([], __read(items)).sort(function (a, b) { return getDateValue(a.endDate || '') - getDateValue(b.endDate || ''); }).pop(); })
448
- .filter(function (li) { return Boolean(li); })
449
- .map(function (item) { return [item]; });
450
- }
451
- case 'avg': {
452
- var rootTermItems = lineItems.filter(function (li) { return !li.rampInstanceId; });
453
- return rootTermItems.map(function (lineItem) { return __spreadArray([lineItem], __read(lineItems.filter(function (li) { return li.rampInstanceId === lineItem.id; }))); });
454
- }
455
- case 'sum': {
456
- return lineItems.map(function (item) { return [item]; });
502
+ var RuntimeContextService = /** @class */ (function () {
503
+ function RuntimeContextService(configurationApiService) {
504
+ this.configurationApiService = configurationApiService;
505
+ }
506
+ RuntimeContextService.prototype.getRuntimeContext = function (productId, offeringId) {
507
+ var _this = this;
508
+ return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(operators.map(function (runtimeData) {
509
+ var _a, _b, _c;
510
+ var uiDefinition = _this.getUIDefinition(runtimeData);
511
+ var runtimeModel = core.RuntimeModel.create(runtimeData.types, runtimeData.products);
512
+ var _d = (_a = Array.from(runtimeModel.components.values()).find(function (c) { return c.productId === productId; })) !== null && _a !== void 0 ? _a : {}, productName = _d.productName, properties = _d.properties;
513
+ return {
514
+ modelId: runtimeData.modelId,
515
+ uiDefinition: uiDefinition,
516
+ runtimeModel: runtimeModel,
517
+ runtimeMode: exports.RuntimeMode.PROD,
518
+ productId: productId,
519
+ productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
520
+ offeringId: offeringId,
521
+ properties: {
522
+ PricingEnabled: ((_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled) ? 'true' : 'false',
523
+ PriceListId: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.priceList,
524
+ },
525
+ };
526
+ }));
527
+ };
528
+ RuntimeContextService.prototype.getUIDefinition = function (runtimeData) {
529
+ var _a;
530
+ var rawUiDefinitions;
531
+ try {
532
+ rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
457
533
  }
458
- default: {
459
- return lineItems.map(function (item) { return [item]; });
534
+ catch (e) {
535
+ return;
460
536
  }
461
- }
462
- }
463
- function getDateValue(date) {
464
- return date ? new Date(date).getTime() : 0;
465
- }
537
+ var uiDefinitions = rawUiDefinitions.filter(function (uiDef) { return uiDef.version; });
538
+ var uiDefinition = (_a = uiDefinitions.find(function (uiDef) { return uiDef.primary; })) !== null && _a !== void 0 ? _a : uiDefinitions[0];
539
+ return uiDefinition;
540
+ };
541
+ return RuntimeContextService;
542
+ }());
543
+ RuntimeContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeContextService, deps: [{ token: i1__namespace.ConfigurationApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
544
+ RuntimeContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeContextService });
545
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeContextService, decorators: [{
546
+ type: i0.Injectable
547
+ }], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }]; } });
466
548
 
467
- var QuoteDraftService = /** @class */ (function () {
468
- function QuoteDraftService(context, quoteApiService, priceApiService) {
469
- var _this = this;
470
- this.context = context;
471
- this.quoteApiService = quoteApiService;
472
- this.priceApiService = priceApiService;
473
- this.quoteSubj$ = new rxjs.BehaviorSubject(null);
474
- this.resetSubj$ = new rxjs.BehaviorSubject(true);
475
- this.isInitializedSubj$ = new rxjs.BehaviorSubject(false);
476
- this.initialCurrentState = [];
477
- this._hasUnsavedChanges = false;
478
- this.allPriceLists = [];
479
- this.assetPriceLists = [];
480
- this.reset$ = this.resetSubj$.asObservable();
481
- this.activePriceList$ = this.context.resolve$().pipe(operators.map(function (ctx) { return _this.allPriceLists.find(function (priceList) { return priceList.id === ctx.properties.PriceListId; }); }), operators.map(function (priceList) { return priceList !== null && priceList !== void 0 ? priceList : null; }));
482
- this.isInitializedSubj$
483
- .pipe(operators.filter(function (isInitialized) { return isInitialized; }), operators.switchMap(function () { return _this.quoteSubj$.asObservable(); }), operators.skip(1), operators.tap(function (quote) { return _this.markAsUpdated(quote); }))
484
- .subscribe();
549
+ var ConfigurationRuntimeService = /** @class */ (function () {
550
+ function ConfigurationRuntimeService(apiService, contextService, runtimeContextService) {
551
+ this.apiService = apiService;
552
+ this.contextService = contextService;
553
+ this.runtimeContextService = runtimeContextService;
554
+ this._isInitialized = false;
555
+ this.uiDefinitionProperties = {};
485
556
  }
486
- Object.defineProperty(QuoteDraftService.prototype, "isInitialized", {
487
- get: function () {
488
- return this.isInitializedSubj$.getValue();
489
- },
490
- set: function (value) {
491
- if (this.isInitialized !== value) {
492
- this.isInitializedSubj$.next(value);
557
+ ConfigurationRuntimeService.prototype.reset = function () {
558
+ this._isInitialized = false;
559
+ this._runtimeContext = undefined;
560
+ this.initializationProps = undefined;
561
+ this.uiDefinitionProperties = {};
562
+ };
563
+ ConfigurationRuntimeService.prototype.initTestMode = function (modelId, uiDefinition) {
564
+ var _this = this;
565
+ var _a, _b;
566
+ this.uiDefinitionProperties = (_a = uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
567
+ var uiDefinitionExternals = (_b = uiDefinition.externals) !== null && _b !== void 0 ? _b : {};
568
+ return rxjs.combineLatest([
569
+ this.apiService.getRuntimeDataByModelId(modelId),
570
+ this.contextService.create('TestId', core.ConfigurationContextMode.TEST),
571
+ ]).pipe(operators.first(), operators.tap(function (_e) {
572
+ var _f = __read(_e, 2), runtimeData = _f[0], context = _f[1];
573
+ var _a;
574
+ _this._runtimeContext = {
575
+ modelId: modelId,
576
+ runtimeModel: core.RuntimeModel.create(runtimeData.types, runtimeData.products),
577
+ runtimeMode: exports.RuntimeMode.TEST,
578
+ };
579
+ _this.contextService.update({
580
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = _this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: _this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: _this.uiDefinitionProperties.priceList, standalone: 'true' }), uiDefinitionExternals),
581
+ });
582
+ _this._isInitialized = true;
583
+ }));
584
+ };
585
+ ConfigurationRuntimeService.prototype.init = function (props) {
586
+ var _this = this;
587
+ this.initializationProps = props;
588
+ var context = this.contextService.resolve();
589
+ return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(operators.tap(function (runtimeContext) {
590
+ var _a, _b, _c, _d;
591
+ _this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
592
+ var PriceListId = ((_c = context.properties) !== null && _c !== void 0 ? _c : {}).PriceListId;
593
+ var mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
594
+ _this.id15to18('AccountId', mergeContext.properties);
595
+ _this._runtimeContext = mergeContext;
596
+ if (context.properties && ((_d = _this._runtimeContext.properties) === null || _d === void 0 ? void 0 : _d.StartDate)) {
597
+ _this.contextService.update({
598
+ properties: Object.assign(Object.assign({}, _this._runtimeContext.properties), context.properties),
599
+ });
493
600
  }
494
- },
495
- enumerable: false,
496
- configurable: true
497
- });
498
- Object.defineProperty(QuoteDraftService.prototype, "hasUnsavedChanges", {
601
+ _this._isInitialized = true;
602
+ }));
603
+ };
604
+ ConfigurationRuntimeService.prototype.id15to18 = function (propertyName, source) {
605
+ if (!source) {
606
+ return;
607
+ }
608
+ var value = source[propertyName];
609
+ if (typeof value === 'string' && value.length === 15) {
610
+ source[propertyName] = core.SalesforceIdUtils.generateId18FromId15(value);
611
+ }
612
+ };
613
+ Object.defineProperty(ConfigurationRuntimeService.prototype, "isInitialized", {
499
614
  get: function () {
500
- return this._hasUnsavedChanges;
501
- },
502
- set: function (value) {
503
- var _a, _b;
504
- this._hasUnsavedChanges = value;
505
- if (!this._hasUnsavedChanges) {
506
- this.initialCurrentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
507
- }
615
+ return this._isInitialized;
508
616
  },
509
617
  enumerable: false,
510
618
  configurable: true
511
619
  });
512
- Object.defineProperty(QuoteDraftService.prototype, "hasAssets$", {
620
+ Object.defineProperty(ConfigurationRuntimeService.prototype, "runtimeModel", {
513
621
  get: function () {
514
- var _this = this;
515
- return this.quoteSubj$.pipe(operators.map(function () { return _this.hasAssets; }));
622
+ var _a;
623
+ return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
516
624
  },
517
625
  enumerable: false,
518
626
  configurable: true
519
627
  });
520
- Object.defineProperty(QuoteDraftService.prototype, "hasAssets", {
628
+ Object.defineProperty(ConfigurationRuntimeService.prototype, "runtimeContext", {
521
629
  get: function () {
522
- var quoteDraft = this.quoteSubj$.value;
523
- return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
630
+ return this._runtimeContext;
524
631
  },
525
632
  enumerable: false,
526
633
  configurable: true
527
634
  });
528
- QuoteDraftService.prototype.reset = function () {
529
- this.resetSubj$.next(true);
530
- this.quoteSubj$.next(null);
531
- this.hasUnsavedChanges = false;
532
- };
533
- QuoteDraftService.prototype.init = function (quoteId, params) {
534
- var _this = this;
535
- return rxjs.zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(operators.tap(function (_c) {
536
- var _d = __read(_c, 2), quote = _d[0], allPriceLists = _d[1];
537
- _this.allPriceLists = allPriceLists;
538
- _this.quoteSubj$.next(quote);
539
- _this.context.update(quote.context);
540
- _this.populateActivePriceLists$();
541
- }), operators.map(function () { return rxjs.noop(); }), operators.take(1));
542
- };
543
- QuoteDraftService.prototype.setCurrentLineItemState = function (lineItems) {
544
- var quoteDraft = this.quoteSubj$.value;
545
- if (!quoteDraft) {
546
- return;
547
- }
548
- this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
549
- };
550
- QuoteDraftService.prototype.updateQuoteDraft = function (update) {
551
- var quoteDraft = this.quoteSubj$.value;
552
- if (!quoteDraft) {
553
- return;
554
- }
555
- if (update.context) {
556
- this.context.set(update.context);
635
+ return ConfigurationRuntimeService;
636
+ }());
637
+ ConfigurationRuntimeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationRuntimeService, deps: [{ token: i1__namespace.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
638
+ ConfigurationRuntimeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationRuntimeService });
639
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationRuntimeService, decorators: [{
640
+ type: i0.Injectable
641
+ }], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
642
+
643
+ var findLineItem = function (id, lineItems) {
644
+ return findLineItemWithComparator(lineItems, function (li) { return li.id === id; });
645
+ };
646
+ var findLineItemWithComparator = function (lineItems, comparator) {
647
+ var currentLevel = lineItems;
648
+ while (currentLevel.length) {
649
+ var found = currentLevel.find(comparator);
650
+ if (found) {
651
+ return found;
557
652
  }
558
- this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
559
- };
560
- QuoteDraftService.prototype.updateByPriceSummary = function (priceSummary) {
561
- var quoteDraft = this.quoteSubj$.value;
653
+ currentLevel = lodash.flatten(currentLevel.map(function (parent) { return parent.lineItems; }));
654
+ }
655
+ return;
656
+ };
657
+ var insertLineItem = function (lineItem, parentId, toInsert) {
658
+ var insertData = lineItem.id === parentId ? [toInsert] : [];
659
+ return Object.assign(Object.assign({}, lineItem), { lineItems: __spreadArray(__spreadArray([], __read(insertData)), __read(lineItem.lineItems.map(function (li) {
660
+ return insertLineItem(li, parentId, toInsert);
661
+ }))) });
662
+ };
663
+ var removeLineItem = function (lineItem, idToRemove) {
664
+ return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems
665
+ .map(function (li) {
666
+ if (li.id === idToRemove) {
667
+ return;
668
+ }
669
+ else if (li.lineItems.length) {
670
+ return removeLineItem(li, idToRemove);
671
+ }
672
+ return li;
673
+ })
674
+ .filter(function (r) { return !!r; }) });
675
+ };
676
+ var replaceLineItem = function (lineItem, replaceTo) {
677
+ if (lineItem.id === replaceTo.id) {
678
+ return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
679
+ }
680
+ return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(function (li) { return replaceLineItem(li, replaceTo); }) });
681
+ };
682
+ var calculateCardinalityVariables = function (lineItems) {
683
+ var cardVars = new Map();
684
+ lineItems.forEach(function (li) {
685
+ var _a;
686
+ var cardinalityVariableName = "#CV-" + li.type + "@" + li.port;
687
+ cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
688
+ });
689
+ return cardVars;
690
+ };
691
+ var recalculateCardinalityVariables = function (original, updated) {
692
+ var cardinalityVariables = calculateCardinalityVariables(updated.lineItems);
693
+ var originalCardinalityVariables = calculateCardinalityVariables(original.lineItems);
694
+ originalCardinalityVariables.forEach(function (value, key) {
695
+ if (cardinalityVariables.get(key) === value) {
696
+ // no need to update cardinality if no changes
697
+ cardinalityVariables.delete(key);
698
+ }
699
+ else if (!cardinalityVariables.has(key)) {
700
+ // remove last item from port
701
+ cardinalityVariables.set(key, 0);
702
+ }
703
+ });
704
+ return Object.assign(Object.assign({}, updated), { attributes: upsertAttributes(updated.attributes, __spreadArray([], __read(cardinalityVariables)).map(function (_c) {
705
+ var _d = __read(_c, 2), name = _d[0], value = _d[1];
706
+ return ({ name: name, value: value });
707
+ })) });
708
+ };
709
+ var mapAttributes = function (attributes) {
710
+ return attributes.reduce(function (acc, _c) {
711
+ var _d;
712
+ var name = _c.name, value = _c.value;
713
+ return (Object.assign(Object.assign({}, acc), (_d = {}, _d[name] = value, _d)));
714
+ }, {});
715
+ };
716
+ var getAttributes = function (attributes, names) {
717
+ if (names === void 0) { names = []; }
718
+ var filtered = attributes.filter(function (_c) {
719
+ var name = _c.name;
720
+ return names.includes(name);
721
+ });
722
+ return lodash.sortBy(filtered, [function (_c) {
723
+ var name = _c.name;
724
+ return names.indexOf(name);
725
+ }]);
726
+ };
727
+ var upsertAttributes = function (originalAttributes, attributesToUpsert) {
728
+ return attributesToUpsert.reduce(function (acc, _c) {
729
+ var name = _c.name, value = _c.value;
730
+ var _d = __read(getAttributes(acc, [name]), 1), origAttr = _d[0];
731
+ return __spreadArray(__spreadArray([], __read(acc.filter(function (attr) { return attr.name !== name; }))), [
732
+ Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name: name })), { cfgStatus: 'User', value: value }),
733
+ ]);
734
+ }, originalAttributes);
735
+ };
736
+ var patchAttributes = function (rootLineItem, id, attrs) {
737
+ var lineItem = findLineItem(id, [rootLineItem]);
738
+ if (!lineItem) {
739
+ return rootLineItem;
740
+ }
741
+ var attributes = upsertAttributes(lineItem.attributes, attrs);
742
+ return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes: attributes }));
743
+ };
744
+ var getAttributeValue = function (attributes, name) { var _a; return (_a = attributes.find(function (attr) { return attr.name === name; })) === null || _a === void 0 ? void 0 : _a.value; };
745
+ var generateLineItem = function (port, type, parentId, attributes, lineItems) {
746
+ if (attributes === void 0) { attributes = []; }
747
+ if (lineItems === void 0) { lineItems = []; }
748
+ return {
749
+ id: core.UUID.UUID(),
750
+ port: port,
751
+ type: type,
752
+ actionCode: 'ADD',
753
+ cfgStatus: 'New',
754
+ attributes: attributes.map(function (_c) {
755
+ var name = _c.name, value = _c.value;
756
+ return ({ cfgStatus: 'User', name: name, value: value });
757
+ }),
758
+ lineItems: lineItems,
759
+ parentId: parentId,
760
+ qty: 1,
761
+ };
762
+ };
763
+ var getRecommendedPrices = function (portDomain, type) {
764
+ var _a, _b;
765
+ var domainType = portDomain.domainTypes.find(function (_c) {
766
+ var name = _c.name;
767
+ return name === type;
768
+ });
769
+ var _c = __read((_b = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.recommendedPrices) === null || _a === void 0 ? void 0 : _a.filter(function (_c) {
770
+ var chargeMethod = _c.chargeMethod;
771
+ return chargeMethod === 'ONE_TIME';
772
+ }).reduce(function (acc, rp) {
773
+ var _c = __read(acc, 2), netPrice = _c[0], listPrice = _c[1];
774
+ return [netPrice + rp.netPrice, listPrice + rp.listPrice];
775
+ }, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0], 2), net = _c[0], list = _c[1];
776
+ return { net: net, list: list };
777
+ };
778
+ var generateModifiedAssetsMap = function (lineItems) {
779
+ return lineItems.reduce(function (acc, li) {
780
+ var _a;
781
+ if (li.rampInstanceId && li.status !== 'EXIST') {
782
+ var target = li;
783
+ while (target && target.rampInstanceId) {
784
+ target = lineItems.find(function (sub) { return sub.id === li.rampInstanceId; });
785
+ }
786
+ var id = (_a = target === null || target === void 0 ? void 0 : target.assetId) !== null && _a !== void 0 ? _a : target === null || target === void 0 ? void 0 : target.openOrderLineItemId;
787
+ if (id) {
788
+ acc[id] = true;
789
+ }
790
+ }
791
+ return acc;
792
+ }, {});
793
+ };
794
+ var multiplyLineItems = function (lineItem, qty, split) {
795
+ if (split) {
796
+ var unifyIds_1 = function (lineItem) { return (Object.assign(Object.assign({}, lineItem), { id: core.UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds_1) })); };
797
+ return lodash.map(new Array(qty), function () { return unifyIds_1(lineItem); });
798
+ }
799
+ else {
800
+ return [
801
+ Object.assign(Object.assign({}, lineItem), { qty: qty }),
802
+ ];
803
+ }
804
+ };
805
+
806
+ var lineItem_utils = /*#__PURE__*/Object.freeze({
807
+ __proto__: null,
808
+ findLineItem: findLineItem,
809
+ findLineItemWithComparator: findLineItemWithComparator,
810
+ insertLineItem: insertLineItem,
811
+ removeLineItem: removeLineItem,
812
+ replaceLineItem: replaceLineItem,
813
+ calculateCardinalityVariables: calculateCardinalityVariables,
814
+ recalculateCardinalityVariables: recalculateCardinalityVariables,
815
+ mapAttributes: mapAttributes,
816
+ getAttributes: getAttributes,
817
+ upsertAttributes: upsertAttributes,
818
+ patchAttributes: patchAttributes,
819
+ getAttributeValue: getAttributeValue,
820
+ generateLineItem: generateLineItem,
821
+ getRecommendedPrices: getRecommendedPrices,
822
+ generateModifiedAssetsMap: generateModifiedAssetsMap,
823
+ multiplyLineItems: multiplyLineItems
824
+ });
825
+
826
+ var LineItemWorker = /** @class */ (function () {
827
+ function LineItemWorker(src) {
828
+ this.li = Object.assign({}, src);
829
+ }
830
+ LineItemWorker.prototype.insert = function (parentId, toInsert) {
831
+ return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
832
+ };
833
+ LineItemWorker.prototype.remove = function (id) {
834
+ return new LineItemWorker(removeLineItem(this.li, id));
835
+ };
836
+ LineItemWorker.prototype.replace = function (toReplace) {
837
+ return new LineItemWorker(replaceLineItem(this.li, toReplace));
838
+ };
839
+ LineItemWorker.prototype.patchAttribute = function (attrs, id) {
840
+ return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
841
+ };
842
+ return LineItemWorker;
843
+ }());
844
+
845
+ var QuoteDraftService = /** @class */ (function () {
846
+ function QuoteDraftService(context, quoteApiService, priceApiService) {
847
+ var _this = this;
848
+ this.context = context;
849
+ this.quoteApiService = quoteApiService;
850
+ this.priceApiService = priceApiService;
851
+ this.quoteSubj$ = new rxjs.BehaviorSubject(null);
852
+ this.resetSubj$ = new rxjs.BehaviorSubject(true);
853
+ this.isInitializedSubj$ = new rxjs.BehaviorSubject(false);
854
+ this.initialCurrentState = [];
855
+ this._hasUnsavedChanges = false;
856
+ this.allPriceLists = [];
857
+ this.assetPriceLists = [];
858
+ this.reset$ = this.resetSubj$.asObservable();
859
+ this.activePriceList$ = this.context.resolve$().pipe(operators.map(function (ctx) { return _this.allPriceLists.find(function (priceList) { return priceList.id === ctx.properties.PriceListId; }); }), operators.map(function (priceList) { return priceList !== null && priceList !== void 0 ? priceList : null; }));
860
+ this.isInitializedSubj$
861
+ .pipe(operators.filter(function (isInitialized) { return isInitialized; }), operators.switchMap(function () { return _this.quoteSubj$.asObservable(); }), operators.skip(1), operators.tap(function (quote) { return _this.markAsUpdated(quote); }))
862
+ .subscribe();
863
+ }
864
+ Object.defineProperty(QuoteDraftService.prototype, "isInitialized", {
865
+ get: function () {
866
+ return this.isInitializedSubj$.getValue();
867
+ },
868
+ set: function (value) {
869
+ if (this.isInitialized !== value) {
870
+ this.isInitializedSubj$.next(value);
871
+ }
872
+ },
873
+ enumerable: false,
874
+ configurable: true
875
+ });
876
+ Object.defineProperty(QuoteDraftService.prototype, "hasUnsavedChanges", {
877
+ get: function () {
878
+ return this._hasUnsavedChanges;
879
+ },
880
+ set: function (value) {
881
+ var _a, _b;
882
+ this._hasUnsavedChanges = value;
883
+ if (!this._hasUnsavedChanges) {
884
+ this.initialCurrentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
885
+ }
886
+ },
887
+ enumerable: false,
888
+ configurable: true
889
+ });
890
+ Object.defineProperty(QuoteDraftService.prototype, "hasProducts$", {
891
+ get: function () {
892
+ var _this = this;
893
+ return this.quoteSubj$.pipe(operators.map(function () { return _this.hasProducts; }));
894
+ },
895
+ enumerable: false,
896
+ configurable: true
897
+ });
898
+ Object.defineProperty(QuoteDraftService.prototype, "hasProducts", {
899
+ get: function () {
900
+ var quoteDraft = this.quoteSubj$.value;
901
+ return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
902
+ },
903
+ enumerable: false,
904
+ configurable: true
905
+ });
906
+ QuoteDraftService.prototype.reset = function () {
907
+ this.resetSubj$.next(true);
908
+ this.quoteSubj$.next(null);
909
+ this.hasUnsavedChanges = false;
910
+ };
911
+ QuoteDraftService.prototype.init = function (quoteId, params) {
912
+ var _this = this;
913
+ return rxjs.zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(operators.tap(function (_c) {
914
+ var _d = __read(_c, 2), quote = _d[0], allPriceLists = _d[1];
915
+ _this.allPriceLists = allPriceLists;
916
+ _this.quoteSubj$.next(quote);
917
+ _this.context.update(quote.context);
918
+ _this.populateActivePriceLists$();
919
+ }), operators.map(function () { return rxjs.noop(); }), operators.take(1));
920
+ };
921
+ QuoteDraftService.prototype.setCurrentLineItemState = function (lineItems) {
922
+ var quoteDraft = this.quoteSubj$.value;
923
+ if (!quoteDraft) {
924
+ return;
925
+ }
926
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
927
+ };
928
+ QuoteDraftService.prototype.updateQuoteDraft = function (update) {
929
+ var quoteDraft = this.quoteSubj$.value;
930
+ if (!quoteDraft) {
931
+ return;
932
+ }
933
+ if (update.context) {
934
+ this.context.set(update.context);
935
+ }
936
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
937
+ };
938
+ QuoteDraftService.prototype.updateByPriceSummary = function (priceSummary) {
939
+ var quoteDraft = this.quoteSubj$.value;
562
940
  if (!quoteDraft) {
563
941
  return;
564
942
  }
@@ -689,485 +1067,62 @@
689
1067
  QuoteDraftService.prototype.isEditMode = function () {
690
1068
  var context = this.context.resolve();
691
1069
  if (context.mode === core.ConfigurationContextMode.ACCOUNT) {
692
- return true;
693
- }
694
- if (context.mode === core.ConfigurationContextMode.QUOTE) {
695
- return context.properties.Status === 'Draft';
696
- }
697
- return false;
698
- };
699
- QuoteDraftService.prototype.updateActivePriceList = function (priceListId) {
700
- this.context.update({ properties: { PriceListId: priceListId } });
701
- };
702
- QuoteDraftService.prototype.populateActivePriceLists$ = function () {
703
- var _this = this;
704
- var ctx = this.context.resolve();
705
- var quoteDraft = this.quoteDraft;
706
- if (!quoteDraft) {
707
- return;
708
- }
709
- // In ACCOUNT mode populate price lists from related assets
710
- if (ctx.mode === core.ConfigurationContextMode.ACCOUNT) {
711
- // Populate list of price lists
712
- this.assetPriceLists = quoteDraft.currentState
713
- .map(function (_c) {
714
- var priceListId = _c.priceListId;
715
- return priceListId;
716
- })
717
- .reduce(function (trunk, priceListId) {
718
- var _a, _b;
719
- if (!priceListId || trunk.some(function (item) { return item.id === priceListId; })) {
720
- return trunk;
721
- }
722
- return __spreadArray(__spreadArray([], __read(trunk)), [
723
- { id: priceListId, name: (_b = (_a = _this.allPriceLists.find(function (item) { return item.id === priceListId; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
724
- ]);
725
- }, []);
726
- }
727
- };
728
- QuoteDraftService.prototype.filterByActivePriceList = function (lineItems) {
729
- var ctx = this.context.resolve();
730
- return lineItems.filter(function (li) { return !li.priceListId || li.priceListId === ctx.properties.PriceListId; });
731
- };
732
- QuoteDraftService.prototype.markAsUpdated = function (quote) {
733
- if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === core.ConfigurationContextMode.ACCOUNT) {
734
- this.hasUnsavedChanges = !!quote && !quote.currentState.every(function (li) { return li.actionCode === 'EXIST'; });
735
- }
736
- else {
737
- this.hasUnsavedChanges = !lodash.isEqual(this.initialCurrentState, quote === null || quote === void 0 ? void 0 : quote.currentState);
738
- }
739
- };
740
- return QuoteDraftService;
741
- }());
742
- QuoteDraftService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1__namespace.QuoteApiService }, { token: i1__namespace.PriceApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
743
- QuoteDraftService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteDraftService, providedIn: 'root' });
744
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteDraftService, decorators: [{
745
- type: i0.Injectable,
746
- args: [{ providedIn: 'root' }]
747
- }], ctorParameters: function () { return [{ type: ContextService }, { type: i1__namespace.QuoteApiService }, { type: i1__namespace.PriceApiService }]; } });
748
-
749
- var MetricsCalculationService = /** @class */ (function () {
750
- function MetricsCalculationService(quoteDraftService, settingsService) {
751
- var _this = this;
752
- this.quoteDraftService = quoteDraftService;
753
- this.settingsService = settingsService;
754
- this.metricsUpdated$ = new rxjs.Subject();
755
- this.quoteMetricsSettings = {};
756
- this.metricsCalculationMethodMap = {};
757
- this.metricsData = {};
758
- rxjs.combineLatest([
759
- this.quoteDraftService.currentState$,
760
- this.settingsService.fetchSetting('QUOTE_LEVEL_METRIC_CALCULATION_METHOD').pipe(rxjs.take(1)),
761
- ]).subscribe(function (_a) {
762
- var _b = __read(_a, 2), lineItems = _b[0], setting = _b[1];
763
- var settingsData = {};
764
- try {
765
- settingsData = JSON.parse((setting === null || setting === void 0 ? void 0 : setting.value) || '{}');
766
- }
767
- catch (error) {
768
- settingsData = {};
769
- }
770
- _this.quoteMetricsSettings = settingsData;
771
- _this.updateMetrics(lineItems);
772
- });
773
- }
774
- Object.defineProperty(MetricsCalculationService.prototype, "onMetricsUpdate$", {
775
- get: function () {
776
- return this.metricsUpdated$.asObservable();
777
- },
778
- enumerable: false,
779
- configurable: true
780
- });
781
- MetricsCalculationService.prototype.getMetricValue = function (metric) {
782
- return this.metricsData[metric] || 0;
783
- };
784
- MetricsCalculationService.prototype.updateMetrics = function (lineItems) {
785
- var _this = this;
786
- var metricKeys = this.collectMetricKeys(lineItems).filter(function (key) { return !key.includes('Effective_'); });
787
- this.metricsCalculationMethodMap = this.buildMetricsCalculationMethods(metricKeys, this.metricsCalculationMethodMap);
788
- this.metricsData = metricKeys.reduce(function (acc, key) {
789
- var _a;
790
- return (Object.assign(Object.assign({}, acc), (_a = {}, _a[key] = _this.calculateMetric(lineItems, key), _a)));
791
- }, {});
792
- this.metricsUpdated$.next();
793
- };
794
- MetricsCalculationService.prototype.calculateMetric = function (lineItems, metric) {
795
- return calculateMetricByMethod(lineItems, metric, this.metricsCalculationMethodMap[metric] || 'sum');
796
- };
797
- MetricsCalculationService.prototype.buildMetricsCalculationMethods = function (metricKeys, initial) {
798
- var _this = this;
799
- return metricKeys.reduce(function (acc, name) {
800
- var _a, _b;
801
- if (acc[name]) {
802
- return acc;
803
- }
804
- acc = Object.assign(Object.assign({}, acc), (_a = {}, _a[name] = 'sum', _a));
805
- var settingKey = name.replace(/VDM_|Total_/g, '');
806
- if (_this.quoteMetricsSettings[settingKey]) {
807
- acc = Object.assign(Object.assign({}, acc), (_b = {}, _b[name] = _this.quoteMetricsSettings[settingKey], _b));
808
- }
809
- return acc;
810
- }, initial);
811
- };
812
- MetricsCalculationService.prototype.collectMetricKeys = function (lineItems) {
813
- var _this = this;
814
- var keys = [];
815
- lineItems.forEach(function (lineItem) {
816
- keys.push.apply(keys, __spreadArray([], __read(Object.keys(lineItem.totalMetrics || {}))));
817
- keys.push.apply(keys, __spreadArray([], __read(_this.collectMetricKeys(lineItem.lineItems))));
818
- });
819
- return lodash.uniq(keys);
820
- };
821
- return MetricsCalculationService;
822
- }());
823
- MetricsCalculationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: i1__namespace.ConfigurationSettingsApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
824
- MetricsCalculationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: MetricsCalculationService, providedIn: 'root' });
825
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: MetricsCalculationService, decorators: [{
826
- type: i0.Injectable,
827
- args: [{ providedIn: 'root' }]
828
- }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: i1__namespace.ConfigurationSettingsApiService }]; } });
829
-
830
- var ProductImagesService = /** @class */ (function () {
831
- function ProductImagesService(productApiService) {
832
- this.productApiService = productApiService;
833
- this.imagesMap$ = new rxjs.BehaviorSubject({});
834
- }
835
- ProductImagesService.prototype.getImageUrl$ = function (productId) {
836
- var _a;
837
- if (this.imagesMap$.value[productId] == null) {
838
- this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), (_a = {}, _a[productId] = '', _a)));
839
- this.fetchProductImage(productId);
840
- }
841
- return this.imagesMap$.pipe(rxjs.map(function (imagesMap) { return imagesMap[productId]; }), rxjs.distinctUntilChanged());
842
- };
843
- ProductImagesService.prototype.fetchProductImage = function (productId) {
844
- var _this = this;
845
- this.productApiService
846
- .fetchImage$(productId)
847
- .pipe(rxjs.map(function (file) { return URL.createObjectURL(file); }), rxjs.catchError(function () { return rxjs.of(''); }), rxjs.tap(function (url) {
848
- var _a;
849
- return _this.imagesMap$.next(Object.assign(Object.assign({}, _this.imagesMap$.value), (_a = {}, _a[productId] = url, _a)));
850
- }))
851
- .subscribe();
852
- };
853
- return ProductImagesService;
854
- }());
855
- ProductImagesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ProductImagesService, deps: [{ token: i1__namespace.ProductApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
856
- ProductImagesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ProductImagesService, providedIn: 'root' });
857
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ProductImagesService, decorators: [{
858
- type: i0.Injectable,
859
- args: [{ providedIn: 'root' }]
860
- }], ctorParameters: function () { return [{ type: i1__namespace.ProductApiService }]; } });
861
-
862
- var RuntimeContextService = /** @class */ (function () {
863
- function RuntimeContextService(configurationApiService) {
864
- this.configurationApiService = configurationApiService;
865
- }
866
- RuntimeContextService.prototype.getRuntimeContext = function (productId, offeringId) {
867
- var _this = this;
868
- return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(operators.map(function (runtimeData) {
869
- var _a, _b, _c;
870
- var uiDefinition = _this.getUIDefinition(runtimeData);
871
- var runtimeModel = core.RuntimeModel.create(runtimeData.types, runtimeData.products);
872
- var _d = (_a = Array.from(runtimeModel.components.values()).find(function (c) { return c.productId === productId; })) !== null && _a !== void 0 ? _a : {}, productName = _d.productName, properties = _d.properties;
873
- return {
874
- modelId: runtimeData.modelId,
875
- uiDefinition: uiDefinition,
876
- runtimeModel: runtimeModel,
877
- runtimeMode: exports.RuntimeMode.PROD,
878
- productId: productId,
879
- productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
880
- offeringId: offeringId,
881
- properties: {
882
- PricingEnabled: ((_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled) ? 'true' : 'false',
883
- PriceListId: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.priceList,
884
- },
885
- };
886
- }));
887
- };
888
- RuntimeContextService.prototype.getUIDefinition = function (runtimeData) {
889
- var _a;
890
- var rawUiDefinitions;
891
- try {
892
- rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
893
- }
894
- catch (e) {
895
- return;
896
- }
897
- var uiDefinitions = rawUiDefinitions.filter(function (uiDef) { return uiDef.version; });
898
- var uiDefinition = (_a = uiDefinitions.find(function (uiDef) { return uiDef.primary; })) !== null && _a !== void 0 ? _a : uiDefinitions[0];
899
- return uiDefinition;
900
- };
901
- return RuntimeContextService;
902
- }());
903
- RuntimeContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RuntimeContextService, deps: [{ token: i1__namespace.ConfigurationApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
904
- RuntimeContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RuntimeContextService });
905
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RuntimeContextService, decorators: [{
906
- type: i0.Injectable
907
- }], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }]; } });
908
-
909
- var ConfigurationRuntimeService = /** @class */ (function () {
910
- function ConfigurationRuntimeService(apiService, contextService, runtimeContextService) {
911
- this.apiService = apiService;
912
- this.contextService = contextService;
913
- this.runtimeContextService = runtimeContextService;
914
- this._isInitialized = false;
915
- this.uiDefinitionProperties = {};
916
- }
917
- ConfigurationRuntimeService.prototype.reset = function () {
918
- this._isInitialized = false;
919
- this._runtimeContext = undefined;
920
- this._assets = undefined;
921
- this.initializationProps = undefined;
922
- this.uiDefinitionProperties = {};
923
- };
924
- ConfigurationRuntimeService.prototype.initTestMode = function (modelId, uiDefinition) {
925
- var _this = this;
926
- var _a, _b;
927
- this.uiDefinitionProperties = (_a = uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
928
- var uiDefinitionExternals = (_b = uiDefinition.externals) !== null && _b !== void 0 ? _b : {};
929
- return rxjs.combineLatest([
930
- this.apiService.getRuntimeDataByModelId(modelId),
931
- this.contextService.create('TestId', core.ConfigurationContextMode.TEST),
932
- ]).pipe(operators.first(), operators.tap(function (_e) {
933
- var _f = __read(_e, 2), runtimeData = _f[0], context = _f[1];
934
- var _a;
935
- _this._runtimeContext = {
936
- modelId: modelId,
937
- runtimeModel: core.RuntimeModel.create(runtimeData.types, runtimeData.products),
938
- runtimeMode: exports.RuntimeMode.TEST,
939
- };
940
- _this.contextService.update({
941
- properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = _this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: _this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: _this.uiDefinitionProperties.priceList, standalone: 'true' }), uiDefinitionExternals),
942
- });
943
- _this._isInitialized = true;
944
- }));
945
- };
946
- ConfigurationRuntimeService.prototype.init = function (props) {
947
- var _this = this;
948
- this.initializationProps = props;
949
- this._assets = props.assets;
950
- var context = this.contextService.resolve();
951
- return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(operators.tap(function (runtimeContext) {
952
- var _a, _b, _c, _d;
953
- _this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
954
- var PriceListId = ((_c = context.properties) !== null && _c !== void 0 ? _c : {}).PriceListId;
955
- var mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
956
- _this.id15to18('AccountId', mergeContext.properties);
957
- _this._runtimeContext = mergeContext;
958
- if (context.properties && ((_d = _this._runtimeContext.properties) === null || _d === void 0 ? void 0 : _d.StartDate)) {
959
- _this.contextService.update({
960
- properties: Object.assign(Object.assign({}, _this._runtimeContext.properties), context.properties),
961
- });
962
- }
963
- _this._isInitialized = true;
964
- }));
965
- };
966
- ConfigurationRuntimeService.prototype.id15to18 = function (propertyName, source) {
967
- if (!source) {
968
- return;
969
- }
970
- var value = source[propertyName];
971
- if (typeof value === 'string' && value.length === 15) {
972
- source[propertyName] = core.SalesforceIdUtils.generateId18FromId15(value);
973
- }
974
- };
975
- ConfigurationRuntimeService.prototype.getAsset = function (lineItem) {
976
- return this._assets && this._assets.find(function (a) { return a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId; });
977
- };
978
- Object.defineProperty(ConfigurationRuntimeService.prototype, "isInitialized", {
979
- get: function () {
980
- return this._isInitialized;
981
- },
982
- enumerable: false,
983
- configurable: true
984
- });
985
- Object.defineProperty(ConfigurationRuntimeService.prototype, "runtimeModel", {
986
- get: function () {
987
- var _a;
988
- return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
989
- },
990
- enumerable: false,
991
- configurable: true
992
- });
993
- Object.defineProperty(ConfigurationRuntimeService.prototype, "runtimeContext", {
994
- get: function () {
995
- return this._runtimeContext;
996
- },
997
- enumerable: false,
998
- configurable: true
999
- });
1000
- return ConfigurationRuntimeService;
1001
- }());
1002
- ConfigurationRuntimeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationRuntimeService, deps: [{ token: i1__namespace.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1003
- ConfigurationRuntimeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationRuntimeService });
1004
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationRuntimeService, decorators: [{
1005
- type: i0.Injectable
1006
- }], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
1007
-
1008
- var findLineItem = function (id, lineItems) {
1009
- return findLineItemWithComparator(lineItems, function (li) { return li.id === id; });
1010
- };
1011
- var findLineItemWithComparator = function (lineItems, comparator) {
1012
- var currentLevel = lineItems;
1013
- while (currentLevel.length) {
1014
- var found = currentLevel.find(comparator);
1015
- if (found) {
1016
- return found;
1017
- }
1018
- currentLevel = lodash.flatten(currentLevel.map(function (parent) { return parent.lineItems; }));
1019
- }
1020
- return;
1021
- };
1022
- var insertLineItem = function (lineItem, parentId, toInsert) {
1023
- var insertData = lineItem.id === parentId ? [toInsert] : [];
1024
- return Object.assign(Object.assign({}, lineItem), { lineItems: __spreadArray(__spreadArray([], __read(insertData)), __read(lineItem.lineItems.map(function (li) {
1025
- return insertLineItem(li, parentId, toInsert);
1026
- }))) });
1027
- };
1028
- var removeLineItem = function (lineItem, idToRemove) {
1029
- return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems
1030
- .map(function (li) {
1031
- if (li.id === idToRemove) {
1032
- return;
1033
- }
1034
- else if (li.lineItems.length) {
1035
- return removeLineItem(li, idToRemove);
1036
- }
1037
- return li;
1038
- })
1039
- .filter(function (r) { return !!r; }) });
1040
- };
1041
- var replaceLineItem = function (lineItem, replaceTo) {
1042
- if (lineItem.id === replaceTo.id) {
1043
- return Object.assign({}, replaceTo);
1044
- }
1045
- return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(function (li) {
1046
- if (li.id === replaceTo.id) {
1047
- return replaceTo;
1048
- }
1049
- else if (li.lineItems.length) {
1050
- return replaceLineItem(li, replaceTo);
1051
- }
1052
- return li;
1053
- }) });
1054
- };
1055
- var mapAttributes = function (attributes) {
1056
- return attributes.reduce(function (acc, _c) {
1057
- var _d;
1058
- var name = _c.name, value = _c.value;
1059
- return (Object.assign(Object.assign({}, acc), (_d = {}, _d[name] = value, _d)));
1060
- }, {});
1061
- };
1062
- var getAttributes = function (attributes, names) {
1063
- if (names === void 0) { names = []; }
1064
- var filtered = attributes.filter(function (_c) {
1065
- var name = _c.name;
1066
- return names.includes(name);
1067
- });
1068
- return lodash.sortBy(filtered, [function (_c) {
1069
- var name = _c.name;
1070
- return names.indexOf(name);
1071
- }]);
1072
- };
1073
- var upsertAttributes = function (originalAttributes, attributesToUpsert) {
1074
- return attributesToUpsert.reduce(function (acc, _c) {
1075
- var name = _c.name, value = _c.value;
1076
- var _d = __read(getAttributes(acc, [name]), 1), origAttr = _d[0];
1077
- return __spreadArray(__spreadArray([], __read(acc.filter(function (attr) { return attr.name !== name; }))), [
1078
- Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name: name })), { cfgStatus: 'User', value: value }),
1079
- ]);
1080
- }, originalAttributes);
1081
- };
1082
- var patchAttributes = function (rootLineItem, id, attrs) {
1083
- var lineItem = findLineItem(id, [rootLineItem]);
1084
- if (!lineItem) {
1085
- return rootLineItem;
1086
- }
1087
- var attributes = upsertAttributes(lineItem.attributes, attrs);
1088
- return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes: attributes }));
1089
- };
1090
- var getAttributeValue = function (attributes, name) { var _a; return (_a = attributes.find(function (attr) { return attr.name === name; })) === null || _a === void 0 ? void 0 : _a.value; };
1091
- var generateLineItem = function (port, type, parentId, attributes, lineItems) {
1092
- if (attributes === void 0) { attributes = []; }
1093
- if (lineItems === void 0) { lineItems = []; }
1094
- return {
1095
- id: core.UUID.UUID(),
1096
- port: port,
1097
- type: type,
1098
- actionCode: 'ADD',
1099
- cfgStatus: 'New',
1100
- attributes: attributes.map(function (_c) {
1101
- var name = _c.name, value = _c.value;
1102
- return ({ cfgStatus: 'User', name: name, value: value });
1103
- }),
1104
- lineItems: lineItems,
1105
- parentId: parentId,
1106
- qty: 1,
1070
+ return true;
1071
+ }
1072
+ if (context.mode === core.ConfigurationContextMode.QUOTE) {
1073
+ return context.properties.Status === 'Draft';
1074
+ }
1075
+ return false;
1107
1076
  };
1108
- };
1109
- var getRecommendedPrices = function (portDomain, type) {
1110
- var _a, _b;
1111
- var domainType = portDomain.domainTypes.find(function (_c) {
1112
- var name = _c.name;
1113
- return name === type;
1114
- });
1115
- var _c = __read((_b = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.recommendedPrices) === null || _a === void 0 ? void 0 : _a.filter(function (_c) {
1116
- var chargeMethod = _c.chargeMethod;
1117
- return chargeMethod === 'ONE_TIME';
1118
- }).reduce(function (acc, rp) {
1119
- var _c = __read(acc, 2), netPrice = _c[0], listPrice = _c[1];
1120
- return [netPrice + rp.netPrice, listPrice + rp.listPrice];
1121
- }, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0], 2), net = _c[0], list = _c[1];
1122
- return { net: net, list: list };
1123
- };
1124
- var multiplyLineItems = function (lineItem, qty, split) {
1125
- if (split) {
1126
- var unifyIds_1 = function (lineItem) { return (Object.assign(Object.assign({}, lineItem), { id: core.UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds_1) })); };
1127
- return lodash.map(new Array(qty), function () { return unifyIds_1(lineItem); });
1128
- }
1129
- else {
1130
- return [
1131
- Object.assign(Object.assign({}, lineItem), { qty: qty }),
1132
- ];
1133
- }
1134
- };
1135
-
1136
- var lineItem_utils = /*#__PURE__*/Object.freeze({
1137
- __proto__: null,
1138
- findLineItem: findLineItem,
1139
- findLineItemWithComparator: findLineItemWithComparator,
1140
- insertLineItem: insertLineItem,
1141
- removeLineItem: removeLineItem,
1142
- replaceLineItem: replaceLineItem,
1143
- mapAttributes: mapAttributes,
1144
- getAttributes: getAttributes,
1145
- upsertAttributes: upsertAttributes,
1146
- patchAttributes: patchAttributes,
1147
- getAttributeValue: getAttributeValue,
1148
- generateLineItem: generateLineItem,
1149
- getRecommendedPrices: getRecommendedPrices,
1150
- multiplyLineItems: multiplyLineItems
1151
- });
1152
-
1153
- var LineItemWorker = /** @class */ (function () {
1154
- function LineItemWorker(src) {
1155
- this.li = Object.assign({}, src);
1156
- }
1157
- LineItemWorker.prototype.insert = function (parentId, toInsert) {
1158
- return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
1077
+ QuoteDraftService.prototype.updateActivePriceList = function (priceListId) {
1078
+ this.context.update({ properties: { PriceListId: priceListId } });
1159
1079
  };
1160
- LineItemWorker.prototype.remove = function (id) {
1161
- return new LineItemWorker(removeLineItem(this.li, id));
1080
+ QuoteDraftService.prototype.populateActivePriceLists$ = function () {
1081
+ var _this = this;
1082
+ var ctx = this.context.resolve();
1083
+ var quoteDraft = this.quoteDraft;
1084
+ if (!quoteDraft) {
1085
+ return;
1086
+ }
1087
+ // In ACCOUNT mode populate price lists from related assets
1088
+ if (ctx.mode === core.ConfigurationContextMode.ACCOUNT) {
1089
+ // Populate list of price lists
1090
+ this.assetPriceLists = quoteDraft.currentState
1091
+ .map(function (_c) {
1092
+ var priceListId = _c.priceListId;
1093
+ return priceListId;
1094
+ })
1095
+ .reduce(function (trunk, priceListId) {
1096
+ var _a, _b;
1097
+ if (!priceListId || trunk.some(function (item) { return item.id === priceListId; })) {
1098
+ return trunk;
1099
+ }
1100
+ return __spreadArray(__spreadArray([], __read(trunk)), [
1101
+ { id: priceListId, name: (_b = (_a = _this.allPriceLists.find(function (item) { return item.id === priceListId; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
1102
+ ]);
1103
+ }, []);
1104
+ }
1162
1105
  };
1163
- LineItemWorker.prototype.replace = function (toReplace) {
1164
- return new LineItemWorker(replaceLineItem(this.li, toReplace));
1106
+ QuoteDraftService.prototype.filterByActivePriceList = function (lineItems) {
1107
+ var ctx = this.context.resolve();
1108
+ return lineItems.filter(function (li) { return !li.priceListId || li.priceListId === ctx.properties.PriceListId; });
1165
1109
  };
1166
- LineItemWorker.prototype.patchAttribute = function (attrs, id) {
1167
- return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
1110
+ QuoteDraftService.prototype.markAsUpdated = function (quote) {
1111
+ if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === core.ConfigurationContextMode.ACCOUNT) {
1112
+ this.hasUnsavedChanges = !!quote && !quote.currentState.every(function (li) { return li.actionCode === 'EXIST'; });
1113
+ }
1114
+ else {
1115
+ this.hasUnsavedChanges = !lodash.isEqual(this.initialCurrentState, quote === null || quote === void 0 ? void 0 : quote.currentState);
1116
+ }
1168
1117
  };
1169
- return LineItemWorker;
1118
+ return QuoteDraftService;
1170
1119
  }());
1120
+ QuoteDraftService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1__namespace.QuoteApiService }, { token: i1__namespace.PriceApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1121
+ QuoteDraftService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteDraftService, providedIn: 'root' });
1122
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteDraftService, decorators: [{
1123
+ type: i0.Injectable,
1124
+ args: [{ providedIn: 'root' }]
1125
+ }], ctorParameters: function () { return [{ type: ContextService }, { type: i1__namespace.QuoteApiService }, { type: i1__namespace.PriceApiService }]; } });
1171
1126
 
1172
1127
  var ConfigurationService = /** @class */ (function () {
1173
1128
  function ConfigurationService(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
@@ -1178,7 +1133,6 @@
1178
1133
  this.messageService = messageService;
1179
1134
  this.dialogService = dialogService;
1180
1135
  this.mode = core.ConfigurationMode.SEARCH;
1181
- this.states = {};
1182
1136
  this.lineItem = new rxjs.BehaviorSubject(undefined);
1183
1137
  this.charges = new rxjs.BehaviorSubject({});
1184
1138
  this.pricePlans = new rxjs.BehaviorSubject({});
@@ -1187,7 +1141,7 @@
1187
1141
  ConfigurationService.prototype.reset = function () {
1188
1142
  this.hasUnsavedChanges = false;
1189
1143
  this.runtimeService.reset();
1190
- this.states = {};
1144
+ this.configurableRamp = undefined;
1191
1145
  this.lineItem.next(undefined);
1192
1146
  this.charges.next({});
1193
1147
  this.pricePlans.next({});
@@ -1197,10 +1151,7 @@
1197
1151
  if (!this.lineItem.value) {
1198
1152
  return rxjs.throwError(function () { return new Error("Source LineItem not found"); });
1199
1153
  }
1200
- this.states.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
1201
- this.states.asset = this.states.configurableRamp
1202
- ? this.runtimeService.getAsset(this.states.configurableRamp)
1203
- : undefined;
1154
+ this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
1204
1155
  return this.configure().pipe(operators.catchError(function (error) {
1205
1156
  console.error(error);
1206
1157
  if (!_this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
@@ -1218,8 +1169,8 @@
1218
1169
  ConfigurationService.prototype.patch = function (lineItem) {
1219
1170
  this.patch$(lineItem).subscribe();
1220
1171
  };
1221
- ConfigurationService.prototype.updateCurrentStates = function (update) {
1222
- this.states = Object.assign(Object.assign({}, this.states), update);
1172
+ ConfigurationService.prototype.setConfigurableRamp = function (lineItem) {
1173
+ this.configurableRamp = lineItem;
1223
1174
  };
1224
1175
  ConfigurationService.prototype.get = function () {
1225
1176
  return this.lineItem.asObservable().pipe(rxjs.shareReplay());
@@ -1285,7 +1236,7 @@
1285
1236
  }
1286
1237
  var 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 : {}));
1287
1238
  var qty = (_d = this.runtimeService.initializationProps) === null || _d === void 0 ? void 0 : _d.defaultQty;
1288
- var lineItem = (_e = this.states.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
1239
+ var lineItem = (_e = this.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
1289
1240
  var configurationRequest = this.createRequest(lineItem);
1290
1241
  var mainPricingEnabled = (_f = runtimeContext.properties) === null || _f === void 0 ? void 0 : _f.PricingEnabled;
1291
1242
  var pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
@@ -1305,27 +1256,33 @@
1305
1256
  };
1306
1257
  ConfigurationService.prototype.configureExternal$ = function (productId, qty) {
1307
1258
  var _this = this;
1308
- this.updateCurrentStates({
1309
- currentState: this.quoteDraftService.currentState,
1310
- });
1311
1259
  return this.runtimeService.init({ productId: productId, defaultQty: qty }).pipe(operators.switchMap(function () { return _this.configure(); }), operators.first(), operators.catchError(function (error) {
1312
1260
  _this.messageService.add({ severity: components.ToastType.error, summary: error });
1313
1261
  throw error;
1314
1262
  }), operators.finalize(function () { return _this.reset(); }));
1315
1263
  };
1316
1264
  ConfigurationService.prototype.createRequest = function (lineItem) {
1317
- return {
1265
+ var _a;
1266
+ var request = {
1318
1267
  lineItem: lineItem,
1319
1268
  mode: this.mode,
1320
1269
  step: !this.lineItem.value ? exports.RuntimeStep.START : exports.RuntimeStep.UPDATE,
1321
1270
  attributeDomainMode: 'ALL',
1322
1271
  context: this.contextService.resolve(),
1323
- lineItems: this.states.currentState || [],
1324
- asset: this.states.asset,
1272
+ lineItems: ((_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) || [],
1273
+ asset: this.getAsset(),
1325
1274
  };
1275
+ request = core.ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
1276
+ return request;
1326
1277
  };
1327
1278
  ConfigurationService.prototype.showInactiveProductsConfirmation = function () {
1328
1279
  var _this = this;
1280
+ var confirmationConfig = {
1281
+ title: ' ',
1282
+ description: 'This quote contains inactive products. Do you want to remove them?',
1283
+ primaryButtonLabel: 'Remove products',
1284
+ secondaryButtonLabel: 'Back to Quote',
1285
+ };
1329
1286
  this.dialogService
1330
1287
  .open(components.ConfirmationComponent, {
1331
1288
  dismissableMask: false,
@@ -1334,14 +1291,7 @@
1334
1291
  showHeader: true,
1335
1292
  header: "Inactive Products in Quote",
1336
1293
  width: '440px',
1337
- data: {
1338
- confirmationConfig: {
1339
- title: ' ',
1340
- description: 'This quote contains inactive products. Do you want to remove them?',
1341
- submitBtn: 'Remove products',
1342
- cancelBtn: 'Back to Quote',
1343
- },
1344
- },
1294
+ data: { confirmationConfig: confirmationConfig },
1345
1295
  })
1346
1296
  .onClose.subscribe(function (result) {
1347
1297
  if (!result) {
@@ -1350,18 +1300,34 @@
1350
1300
  }
1351
1301
  });
1352
1302
  };
1303
+ ConfigurationService.prototype.getAsset = function () {
1304
+ var _a;
1305
+ var lineItem = this.configurableRamp;
1306
+ if (!lineItem) {
1307
+ return;
1308
+ }
1309
+ return (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState.find(function (a) { return a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId; });
1310
+ };
1353
1311
  return ConfigurationService;
1354
1312
  }());
1355
- ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i4__namespace.MessageService }, { token: i5__namespace.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1356
- ConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService });
1357
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, decorators: [{
1313
+ ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i5__namespace.MessageService }, { token: i6__namespace.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1314
+ ConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationService });
1315
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationService, decorators: [{
1358
1316
  type: i0.Injectable
1359
- }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1__namespace.ConfigurationApiService }, { type: i4__namespace.MessageService }, { type: i5__namespace.DialogService }]; } });
1317
+ }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1__namespace.ConfigurationApiService }, { type: i5__namespace.MessageService }, { type: i6__namespace.DialogService }]; } });
1318
+
1319
+ function extractMetadata(uiDefinition) {
1320
+ return lodash.omit(uiDefinition, [
1321
+ 'children',
1322
+ 'pages',
1323
+ 'components',
1324
+ ]);
1325
+ }
1360
1326
 
1361
1327
  var FlowUpdateService = /** @class */ (function () {
1362
1328
  function FlowUpdateService() {
1363
1329
  }
1364
- FlowUpdateService.prototype.update = function (rootLineItems, updates) {
1330
+ FlowUpdateService.prototype.update = function (rootLineItems, updates, charges) {
1365
1331
  var _this = this;
1366
1332
  var remainingUpdates = __spreadArray([], __read(updates));
1367
1333
  var currentLevel = rootLineItems;
@@ -1372,7 +1338,7 @@
1372
1338
  var updated = false;
1373
1339
  switch (update.dataType) {
1374
1340
  case 'LINEITEM':
1375
- updated = _this.applyLineItemUpdate(li, update);
1341
+ updated = _this.applyLineItemUpdate(li, update, charges);
1376
1342
  break;
1377
1343
  case 'CHARGE':
1378
1344
  updated = _this.applyChargeUpdate(li, update);
@@ -1410,7 +1376,7 @@
1410
1376
  var filtered = lineItems.filter(function (lineItem) { return !idsToRemove.includes(lineItem.id); });
1411
1377
  return filtered.map(function (lineItem) { return new LineItemWorker(lineItem).remove(id).li; });
1412
1378
  };
1413
- FlowUpdateService.prototype.applyLineItemUpdate = function (lineItem, update) {
1379
+ FlowUpdateService.prototype.applyLineItemUpdate = function (lineItem, update, charges) {
1414
1380
  if (lineItem.id !== update.id) {
1415
1381
  return false;
1416
1382
  }
@@ -1426,7 +1392,7 @@
1426
1392
  break;
1427
1393
  case 'PRICE_ADJUSTMENT':
1428
1394
  {
1429
- var _a = __read(lineItem.chargeItems, 1), charge = _a[0];
1395
+ var charge = lineItem.chargeItems.find(function (charge) { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
1430
1396
  if (charge) {
1431
1397
  charge.priceAdjustment = update.newValue;
1432
1398
  }
@@ -1434,7 +1400,7 @@
1434
1400
  break;
1435
1401
  case 'LIST_PRICE_ADJUSTMENT':
1436
1402
  {
1437
- var _b = __read(lineItem.chargeItems, 1), charge = _b[0];
1403
+ var charge = lineItem.chargeItems.find(function (charge) { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
1438
1404
  if (charge) {
1439
1405
  charge.listPriceAdjustment = update.newValue;
1440
1406
  }
@@ -1446,8 +1412,8 @@
1446
1412
  return true;
1447
1413
  };
1448
1414
  FlowUpdateService.prototype.applyChargeUpdate = function (lineItem, update) {
1449
- var foundCharge = lineItem.chargeItems.find(function (_a) {
1450
- var id = _a.id;
1415
+ var foundCharge = lineItem.chargeItems.find(function (_b) {
1416
+ var id = _b.id;
1451
1417
  return id === update.id;
1452
1418
  });
1453
1419
  if (!foundCharge) {
@@ -1482,9 +1448,9 @@
1482
1448
  };
1483
1449
  return FlowUpdateService;
1484
1450
  }());
1485
- FlowUpdateService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowUpdateService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1486
- FlowUpdateService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowUpdateService });
1487
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowUpdateService, decorators: [{
1451
+ FlowUpdateService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowUpdateService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1452
+ FlowUpdateService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowUpdateService });
1453
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowUpdateService, decorators: [{
1488
1454
  type: i0.Injectable
1489
1455
  }] });
1490
1456
 
@@ -1518,7 +1484,7 @@
1518
1484
  }
1519
1485
  return rxjs.of([]).pipe(rxjs.map(function () {
1520
1486
  var updatedState = lodash.cloneDeep(quoteDraft.currentState);
1521
- _this.updateService.update(updatedState, updates);
1487
+ _this.updateService.update(updatedState, updates, quoteDraft.charges);
1522
1488
  return updatedState;
1523
1489
  }), rxjs.switchMap(function (updatedState) { return _this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState })); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack());
1524
1490
  };
@@ -1678,9 +1644,9 @@
1678
1644
  };
1679
1645
  return FlowConfigurationService;
1680
1646
  }());
1681
- FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1682
- FlowConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService });
1683
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, decorators: [{
1647
+ FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1648
+ FlowConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationService });
1649
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationService, decorators: [{
1684
1650
  type: i0.Injectable
1685
1651
  }], ctorParameters: function () { return [{ type: i1__namespace.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1686
1652
 
@@ -1689,10 +1655,10 @@
1689
1655
  }
1690
1656
  return FlowConfigurationModule;
1691
1657
  }());
1692
- FlowConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1693
- FlowConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule });
1694
- FlowConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, i1.PriceApiService], imports: [[]] });
1695
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule, decorators: [{
1658
+ FlowConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1659
+ FlowConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule });
1660
+ FlowConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, i1.PriceApiService], imports: [[]] });
1661
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule, decorators: [{
1696
1662
  type: i0.NgModule,
1697
1663
  args: [{
1698
1664
  imports: [],
@@ -1705,9 +1671,9 @@
1705
1671
  }
1706
1672
  return ConfigurationModule;
1707
1673
  }());
1708
- ConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1709
- ConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationModule, imports: [components.ConfirmationDialogModule] });
1710
- ConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationModule, providers: [
1674
+ ConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1675
+ ConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, imports: [components.ConfirmationDialogModule] });
1676
+ ConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, providers: [
1711
1677
  i1.ContextApiService,
1712
1678
  i1.ProductModelApiService,
1713
1679
  i1.ConfigurationApiService,
@@ -1715,7 +1681,7 @@
1715
1681
  RuntimeContextService,
1716
1682
  ConfigurationService,
1717
1683
  ], imports: [[components.ConfirmationDialogModule]] });
1718
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationModule, decorators: [{
1684
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, decorators: [{
1719
1685
  type: i0.NgModule,
1720
1686
  args: [{
1721
1687
  imports: [components.ConfirmationDialogModule],
@@ -1730,15 +1696,177 @@
1730
1696
  }]
1731
1697
  }] });
1732
1698
 
1699
+ function calculateMetricByMethod(lineItems, metric, method) {
1700
+ var items = getLineItemsByMethod(lineItems, method);
1701
+ return items.reduce(function (acc, li) {
1702
+ var value = li.reduce(function (accProduct, item) { return accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0); }, 0);
1703
+ if (method === 'avg' && li.length > 0) {
1704
+ value /= li.length;
1705
+ }
1706
+ return acc + value;
1707
+ }, 0);
1708
+ }
1709
+ function getLineItemsByMethod(lineItems, method) {
1710
+ switch (method) {
1711
+ case 'first': {
1712
+ return lineItems.filter(function (li) { return !li.rampInstanceId; }).map(function (item) { return [item]; });
1713
+ }
1714
+ case 'last': {
1715
+ var rootTermItems = lineItems.filter(function (li) { return !li.rampInstanceId; });
1716
+ var products = rootTermItems.map(function (lineItem) { return __spreadArray([
1717
+ lineItem
1718
+ ], __read(lineItems.filter(function (li) { return li.rampInstanceId === lineItem.id; }))); });
1719
+ return products
1720
+ .map(function (items) { return __spreadArray([], __read(items)).sort(function (a, b) { return getDateValue(a.endDate || '') - getDateValue(b.endDate || ''); }).pop(); })
1721
+ .filter(function (li) { return Boolean(li); })
1722
+ .map(function (item) { return [item]; });
1723
+ }
1724
+ case 'avg': {
1725
+ var rootTermItems = lineItems.filter(function (li) { return !li.rampInstanceId; });
1726
+ return rootTermItems.map(function (lineItem) { return __spreadArray([lineItem], __read(lineItems.filter(function (li) { return li.rampInstanceId === lineItem.id; }))); });
1727
+ }
1728
+ case 'sum': {
1729
+ return lineItems.map(function (item) { return [item]; });
1730
+ }
1731
+ default: {
1732
+ return lineItems.map(function (item) { return [item]; });
1733
+ }
1734
+ }
1735
+ }
1736
+ function getDateValue(date) {
1737
+ return date ? new Date(date).getTime() : 0;
1738
+ }
1739
+
1740
+ var MetricsCalculationService = /** @class */ (function () {
1741
+ function MetricsCalculationService(quoteDraftService, flowConfiguration, settingsService) {
1742
+ var _this = this;
1743
+ this.quoteDraftService = quoteDraftService;
1744
+ this.flowConfiguration = flowConfiguration;
1745
+ this.settingsService = settingsService;
1746
+ this.metricsUpdated$ = new rxjs.Subject();
1747
+ this.quoteMetricsSettings = {};
1748
+ this.metricsCalculationMethodMap = {};
1749
+ this.metricsData = {};
1750
+ this.activeMetricRules = [];
1751
+ this.activeMetricRules = this.flowConfiguration.activeMetricsSnapshot.filter(function (metricRule) { return metricRule.metrics.some(function (metric) { return !!metric.totalName; }); });
1752
+ rxjs.combineLatest([
1753
+ this.quoteDraftService.currentState$,
1754
+ this.settingsService.fetchSetting('QUOTE_LEVEL_METRIC_CALCULATION_METHOD').pipe(rxjs.take(1)),
1755
+ ]).subscribe(function (_c) {
1756
+ var _d = __read(_c, 2), lineItems = _d[0], setting = _d[1];
1757
+ var settingsData = {};
1758
+ try {
1759
+ settingsData = JSON.parse((setting === null || setting === void 0 ? void 0 : setting.value) || '{}');
1760
+ }
1761
+ catch (error) {
1762
+ settingsData = {};
1763
+ }
1764
+ _this.quoteMetricsSettings = settingsData;
1765
+ _this.updateMetrics(lineItems);
1766
+ });
1767
+ }
1768
+ Object.defineProperty(MetricsCalculationService.prototype, "onMetricsUpdate$", {
1769
+ get: function () {
1770
+ return this.metricsUpdated$.asObservable();
1771
+ },
1772
+ enumerable: false,
1773
+ configurable: true
1774
+ });
1775
+ MetricsCalculationService.prototype.getMetricValue = function (metric) {
1776
+ return this.metricsData[metric] || 0;
1777
+ };
1778
+ MetricsCalculationService.prototype.updateMetrics = function (lineItems) {
1779
+ var _this = this;
1780
+ var metricKeys = this.collectMetricKeys(lineItems).filter(function (key) { return !key.includes('Effective_'); });
1781
+ this.metricsCalculationMethodMap = this.buildMetricsCalculationMethods(metricKeys, this.metricsCalculationMethodMap);
1782
+ this.metricsData = metricKeys.reduce(function (acc, key) {
1783
+ var _c;
1784
+ return (Object.assign(Object.assign({}, acc), (_c = {}, _c[key] = _this.calculateMetric(lineItems, key), _c)));
1785
+ }, {});
1786
+ this.metricsUpdated$.next();
1787
+ };
1788
+ MetricsCalculationService.prototype.calculateMetric = function (lineItems, metric) {
1789
+ return calculateMetricByMethod(lineItems, metric, this.metricsCalculationMethodMap[metric] || 'sum');
1790
+ };
1791
+ MetricsCalculationService.prototype.buildMetricsCalculationMethods = function (metricKeys, initial) {
1792
+ var _this = this;
1793
+ return metricKeys.reduce(function (acc, name) {
1794
+ var _c, _d;
1795
+ var _a, _b;
1796
+ if (acc[name]) {
1797
+ return acc;
1798
+ }
1799
+ acc = Object.assign(Object.assign({}, acc), (_c = {}, _c[name] = 'sum', _c));
1800
+ var metricRule = _this.getMetricRuleByTotalMetricName(name);
1801
+ var settingKey = ((_b = (_a = metricRule === null || metricRule === void 0 ? void 0 : metricRule.metrics) === null || _a === void 0 ? void 0 : _a.find(function (metric) { return metric.totalName === name; })) === null || _b === void 0 ? void 0 : _b.name) || name;
1802
+ if (_this.quoteMetricsSettings[settingKey]) {
1803
+ acc = Object.assign(Object.assign({}, acc), (_d = {}, _d[name] = _this.quoteMetricsSettings[settingKey], _d));
1804
+ }
1805
+ return acc;
1806
+ }, initial);
1807
+ };
1808
+ MetricsCalculationService.prototype.collectMetricKeys = function (lineItems) {
1809
+ var _this = this;
1810
+ var keys = [];
1811
+ lineItems.forEach(function (lineItem) {
1812
+ keys.push.apply(keys, __spreadArray([], __read(Object.keys(lineItem.totalMetrics || {}))));
1813
+ keys.push.apply(keys, __spreadArray([], __read(_this.collectMetricKeys(lineItem.lineItems))));
1814
+ });
1815
+ return lodash.uniq(keys);
1816
+ };
1817
+ MetricsCalculationService.prototype.getMetricRuleByTotalMetricName = function (name) {
1818
+ return this.activeMetricRules.find(function (metricRule) { return metricRule.metrics.find(function (metric) { return metric.totalName === name; }); });
1819
+ };
1820
+ return MetricsCalculationService;
1821
+ }());
1822
+ MetricsCalculationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: FlowConfigurationService }, { token: i1__namespace.ConfigurationSettingsApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1823
+ MetricsCalculationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MetricsCalculationService, providedIn: 'root' });
1824
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MetricsCalculationService, decorators: [{
1825
+ type: i0.Injectable,
1826
+ args: [{ providedIn: 'root' }]
1827
+ }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: FlowConfigurationService }, { type: i1__namespace.ConfigurationSettingsApiService }]; } });
1828
+
1829
+ var ProductImagesService = /** @class */ (function () {
1830
+ function ProductImagesService(productApiService) {
1831
+ this.productApiService = productApiService;
1832
+ this.imagesMap$ = new rxjs.BehaviorSubject({});
1833
+ }
1834
+ ProductImagesService.prototype.getImageUrl$ = function (productId) {
1835
+ var _a;
1836
+ if (this.imagesMap$.value[productId] == null) {
1837
+ this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), (_a = {}, _a[productId] = '', _a)));
1838
+ this.fetchProductImage(productId);
1839
+ }
1840
+ return this.imagesMap$.pipe(rxjs.map(function (imagesMap) { return imagesMap[productId]; }), rxjs.distinctUntilChanged());
1841
+ };
1842
+ ProductImagesService.prototype.fetchProductImage = function (productId) {
1843
+ var _this = this;
1844
+ this.productApiService
1845
+ .fetchImage$(productId)
1846
+ .pipe(rxjs.map(function (file) { return URL.createObjectURL(file); }), rxjs.catchError(function () { return rxjs.of(''); }), rxjs.tap(function (url) {
1847
+ var _a;
1848
+ return _this.imagesMap$.next(Object.assign(Object.assign({}, _this.imagesMap$.value), (_a = {}, _a[productId] = url, _a)));
1849
+ }))
1850
+ .subscribe();
1851
+ };
1852
+ return ProductImagesService;
1853
+ }());
1854
+ ProductImagesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductImagesService, deps: [{ token: i1__namespace.ProductApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1855
+ ProductImagesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductImagesService, providedIn: 'root' });
1856
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductImagesService, decorators: [{
1857
+ type: i0.Injectable,
1858
+ args: [{ providedIn: 'root' }]
1859
+ }], ctorParameters: function () { return [{ type: i1__namespace.ProductApiService }]; } });
1860
+
1733
1861
  var SdkCoreModule = /** @class */ (function () {
1734
1862
  function SdkCoreModule() {
1735
1863
  }
1736
1864
  return SdkCoreModule;
1737
1865
  }());
1738
- SdkCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SdkCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1739
- SdkCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1740
- SdkCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService], imports: [[ConfigurationModule, FlowConfigurationModule]] });
1741
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SdkCoreModule, decorators: [{
1866
+ SdkCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1867
+ SdkCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1868
+ SdkCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService], imports: [[ConfigurationModule, FlowConfigurationModule]] });
1869
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, decorators: [{
1742
1870
  type: i0.NgModule,
1743
1871
  args: [{
1744
1872
  imports: [ConfigurationModule, FlowConfigurationModule],
@@ -1761,9 +1889,13 @@
1761
1889
  exports.ProductImagesService = ProductImagesService;
1762
1890
  exports.QuoteDraftService = QuoteDraftService;
1763
1891
  exports.SdkCoreModule = SdkCoreModule;
1892
+ exports.UI_DEFINITION_VERSION = UI_DEFINITION_VERSION;
1893
+ exports.calculateCardinalityVariables = calculateCardinalityVariables;
1894
+ exports.extractMetadata = extractMetadata;
1764
1895
  exports.findLineItem = findLineItem;
1765
1896
  exports.findLineItemWithComparator = findLineItemWithComparator;
1766
1897
  exports.generateLineItem = generateLineItem;
1898
+ exports.generateModifiedAssetsMap = generateModifiedAssetsMap;
1767
1899
  exports.getAttributeValue = getAttributeValue;
1768
1900
  exports.getAttributes = getAttributes;
1769
1901
  exports.getDefaultLineItem = getDefaultLineItem;
@@ -1773,6 +1905,7 @@
1773
1905
  exports.mapAttributes = mapAttributes;
1774
1906
  exports.multiplyLineItems = multiplyLineItems;
1775
1907
  exports.patchAttributes = patchAttributes;
1908
+ exports.recalculateCardinalityVariables = recalculateCardinalityVariables;
1776
1909
  exports.removeLineItem = removeLineItem;
1777
1910
  exports.replaceLineItem = replaceLineItem;
1778
1911
  exports.upsertAttributes = upsertAttributes;