@veloceapps/sdk 7.0.0-9 → 7.0.1-0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (436) hide show
  1. package/cms/README.md +45 -0
  2. package/cms/cms.actions.d.ts +10 -0
  3. package/cms/components/element-children/element-children.component.d.ts +1 -1
  4. package/cms/components/element-drop-handle/element-drop-handle.component.d.ts +1 -1
  5. package/cms/components/element-renderer/element-renderer.component.d.ts +1 -1
  6. package/cms/components/plugin.component.d.ts +2 -2
  7. package/cms/components/preview/preview.component.d.ts +4 -3
  8. package/cms/directives/custom-template.directive.d.ts +1 -1
  9. package/cms/modules/federated/federated-host.directive.d.ts +8 -0
  10. package/cms/modules/federated/federated.component.d.ts +5 -7
  11. package/cms/modules/federated/federated.module.d.ts +4 -3
  12. package/cms/modules/federated/federated.types.d.ts +1 -5
  13. package/cms/modules/migrations/types/migrations.types.d.ts +1 -1
  14. package/cms/plugins/configuration.plugin.d.ts +1 -1
  15. package/cms/plugins/io.plugin.d.ts +1 -1
  16. package/cms/plugins/region.plugin.d.ts +1 -1
  17. package/cms/plugins/script.plugin.d.ts +1 -1
  18. package/cms/services/templates.service.d.ts +1 -1
  19. package/cms/types/common.types.d.ts +2 -2
  20. package/cms/types/elements.types.d.ts +1 -1
  21. package/cms/types/integration.types.d.ts +1 -1
  22. package/cms/types/layouts.types.d.ts +1 -1
  23. package/cms/utils/element.utils.d.ts +2 -2
  24. package/cms/vendor-map.d.ts +2 -1
  25. package/core/README.md +5 -0
  26. package/core/modules/flow-configuration/types/update.types.d.ts +2 -2
  27. package/core/services/metric-calculation/metric-calculation.types.d.ts +1 -1
  28. package/core/types/ui-definition.types.d.ts +2 -2
  29. package/esm2020/cms/cms.actions.mjs +56 -0
  30. package/esm2020/cms/components/element-children/element-children.component.mjs +35 -0
  31. package/esm2020/cms/components/element-children/element-children.module.mjs +20 -0
  32. package/esm2020/cms/components/element-drop-handle/element-drop-handle.component.mjs +28 -0
  33. package/esm2020/cms/components/element-drop-handle/element-drop-handle.module.mjs +19 -0
  34. package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +160 -0
  35. package/{esm2015/cms/components/element-renderer/element-renderer.module.js → esm2020/cms/components/element-renderer/element-renderer.module.mjs} +5 -5
  36. package/esm2020/cms/components/element.component.mjs +45 -0
  37. package/esm2020/cms/components/plugin.component.mjs +17 -0
  38. package/esm2020/cms/components/preview/preview.component.mjs +103 -0
  39. package/esm2020/cms/components/preview/preview.module.mjs +24 -0
  40. package/esm2020/cms/directives/custom-template.directive.mjs +26 -0
  41. package/esm2020/cms/engine/models/entity.mjs +17 -0
  42. package/esm2020/cms/launcher.module.mjs +24 -0
  43. package/esm2020/cms/modules/federated/federated-host.directive.mjs +16 -0
  44. package/esm2020/cms/modules/federated/federated.component.mjs +64 -0
  45. package/esm2020/cms/modules/federated/federated.module.mjs +20 -0
  46. package/esm2020/cms/modules/federated/federated.types.mjs +2 -0
  47. package/esm2020/cms/modules/migrations/migrations.mjs +15 -0
  48. package/{esm2015/cms/modules/migrations/migrations.module.js → esm2020/cms/modules/migrations/migrations.module.mjs} +5 -5
  49. package/esm2020/cms/modules/migrations/services/migrations.service.mjs +43 -0
  50. package/{esm2015/cms/modules/runtime/runtime.module.js → esm2020/cms/modules/runtime/runtime.module.mjs} +6 -6
  51. package/esm2020/cms/modules/runtime/services/compilation.service.mjs +83 -0
  52. package/esm2020/cms/modules/runtime/services/runtime-editor.service.mjs +28 -0
  53. package/esm2020/cms/modules/runtime/services/runtime.service.mjs +74 -0
  54. package/esm2020/cms/plugins/configuration.plugin.mjs +105 -0
  55. package/esm2020/cms/plugins/io.plugin.mjs +36 -0
  56. package/esm2020/cms/plugins/region.plugin.mjs +58 -0
  57. package/esm2020/cms/plugins/script.plugin.mjs +65 -0
  58. package/{esm2015/cms/services/element-context.service.js → esm2020/cms/services/element-context.service.mjs} +4 -4
  59. package/esm2020/cms/services/integration.state.mjs +40 -0
  60. package/esm2020/cms/services/io-provider.service.mjs +50 -0
  61. package/esm2020/cms/services/resources.service.mjs +49 -0
  62. package/{esm2015/cms/services/templates.service.js → esm2020/cms/services/templates.service.mjs} +4 -4
  63. package/esm2020/cms/utils/element.utils.mjs +160 -0
  64. package/esm2020/cms/utils/elements-resolver.mjs +189 -0
  65. package/esm2020/cms/utils/path.utils.mjs +53 -0
  66. package/esm2020/cms/utils/ui-definition.utils.mjs +87 -0
  67. package/esm2020/cms/vendor-map.mjs +67 -0
  68. package/esm2020/core/core.module.mjs +18 -0
  69. package/{esm2015/core/modules/configuration/configuration.module.js → esm2020/core/modules/configuration/configuration.module.mjs} +6 -6
  70. package/esm2020/core/modules/configuration/helpers.mjs +18 -0
  71. package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +106 -0
  72. package/esm2020/core/modules/configuration/services/configuration.service.mjs +183 -0
  73. package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +50 -0
  74. package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +18 -0
  75. package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +150 -0
  76. package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +129 -0
  77. package/esm2020/core/services/context.service.mjs +64 -0
  78. package/esm2020/core/services/metric-calculation/metric-calculation.service.mjs +85 -0
  79. package/esm2020/core/services/product-images.service.mjs +31 -0
  80. package/esm2020/core/services/quote-draft.service.mjs +232 -0
  81. package/esm2020/core/utils/line-item.utils.mjs +161 -0
  82. package/esm2020/core/utils/line-item.worker.mjs +19 -0
  83. package/esm2020/runtime/components/component-preview/component-preview.component.mjs +125 -0
  84. package/esm2020/runtime/components/section-renderer/section-renderer.component.mjs +67 -0
  85. package/esm2020/runtime/components/ui-runtime/runtime.component.mjs +440 -0
  86. package/esm2020/runtime/components/ui-runtime-preview/runtime-preview.component.mjs +108 -0
  87. package/esm2020/runtime/execution/components/children-placeholder/children-placeholder.component.mjs +60 -0
  88. package/esm2020/runtime/execution/components/context-provider/context-provider.component.mjs +39 -0
  89. package/esm2020/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.mjs +67 -0
  90. package/esm2020/runtime/execution/components/federated/federated.component.mjs +74 -0
  91. package/esm2020/runtime/execution/components/velo-attribute/velo-attribute.component.mjs +60 -0
  92. package/esm2020/runtime/execution/components/velo-multiselect/velo-multiselect.component.mjs +130 -0
  93. package/esm2020/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.mjs +72 -0
  94. package/esm2020/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.mjs +97 -0
  95. package/esm2020/runtime/execution/components/velo-port-radio/velo-port-radio.component.mjs +142 -0
  96. package/esm2020/runtime/execution/components/velo-type/velo-type.component.mjs +119 -0
  97. package/esm2020/runtime/execution/directives/section-script.directive.mjs +247 -0
  98. package/esm2020/runtime/execution/directives/sf-query.directive.mjs +35 -0
  99. package/esm2020/runtime/execution/directives/velo-attribute.directive.mjs +88 -0
  100. package/esm2020/runtime/execution/directives/velo-port.directive.mjs +376 -0
  101. package/esm2020/runtime/execution/directives/vl-approval.directive.mjs +23 -0
  102. package/esm2020/runtime/execution/directives/vl-document-attachments.directive.mjs +36 -0
  103. package/esm2020/runtime/execution/directives/vl-document-templates.directive.mjs +60 -0
  104. package/esm2020/runtime/execution/directives/vl-quote.directive.mjs +42 -0
  105. package/esm2020/runtime/execution/directives/vl-ramp.directive.mjs +55 -0
  106. package/esm2020/runtime/execution/runtime-execution.module.mjs +133 -0
  107. package/esm2020/runtime/execution/utils/federated.util.mjs +32 -0
  108. package/esm2020/runtime/runtime.module.mjs +74 -0
  109. package/esm2020/runtime/services/cart.service.mjs +29 -0
  110. package/{esm2015/runtime/services/collapsible-state.service.js → esm2020/runtime/services/collapsible-state.service.mjs} +4 -4
  111. package/esm2020/runtime/services/configuration.service.mjs +119 -0
  112. package/{esm2015/runtime/services/current-state.service.js → esm2020/runtime/services/current-state.service.mjs} +4 -4
  113. package/{esm2015/runtime/services/form-scope.service.js → esm2020/runtime/services/form-scope.service.mjs} +4 -4
  114. package/esm2020/runtime/services/product-model-cache.service.mjs +31 -0
  115. package/esm2020/runtime/services/runtime-context.service.mjs +57 -0
  116. package/esm2020/runtime/services/runtime-form.service.mjs +219 -0
  117. package/esm2020/runtime/services/runtime.service.mjs +115 -0
  118. package/{esm2015/runtime/services/section-helper.service.js → esm2020/runtime/services/section-helper.service.mjs} +4 -4
  119. package/{esm2015/runtime/services/section-scope.service.js → esm2020/runtime/services/section-scope.service.mjs} +4 -4
  120. package/{esm2015/runtime/services/section-store.service.js → esm2020/runtime/services/section-store.service.mjs} +4 -4
  121. package/esm2020/runtime/services/section.service.mjs +117 -0
  122. package/esm2020/runtime/types/script-registry.types.mjs +51 -0
  123. package/esm2020/runtime/utils/line-item.util.mjs +270 -0
  124. package/esm2020/src/components/dialog/dialog.component.mjs +36 -0
  125. package/esm2020/src/components/dialog/dialog.module.mjs +19 -0
  126. package/esm2020/src/components/doc-gen/doc-gen.component.mjs +107 -0
  127. package/esm2020/src/components/doc-gen/doc-gen.module.mjs +19 -0
  128. package/esm2020/src/components/header/cart-overlay/cart-preview.component.mjs +120 -0
  129. package/{esm2015/src/components/header/cart-overlay/cart-preview.module.js → esm2020/src/components/header/cart-overlay/cart-preview.module.mjs} +11 -13
  130. package/esm2020/src/components/header/header.component.mjs +333 -0
  131. package/{esm2015/src/components/header/header.module.js → esm2020/src/components/header/header.module.mjs} +12 -14
  132. package/esm2020/src/components/header/metrics/metrics.component.mjs +227 -0
  133. package/{esm2015/src/components/header/metrics/metrics.module.js → esm2020/src/components/header/metrics/metrics.module.mjs} +17 -19
  134. package/{esm2015/src/flow-routing.module.js → esm2020/src/flow-routing.module.mjs} +12 -14
  135. package/esm2020/src/flow.component.mjs +45 -0
  136. package/esm2020/src/flow.module.mjs +58 -0
  137. package/esm2020/src/guards/context.guard.mjs +93 -0
  138. package/esm2020/src/guards/product-unload.guard.mjs +46 -0
  139. package/esm2020/src/guards/root.guard.mjs +42 -0
  140. package/esm2020/src/pages/assets/assets.component.mjs +111 -0
  141. package/esm2020/src/pages/assets/assets.module.mjs +20 -0
  142. package/esm2020/src/pages/catalog/catalog.component.mjs +111 -0
  143. package/esm2020/src/pages/catalog/catalog.module.mjs +20 -0
  144. package/esm2020/src/pages/debug/debug.component.mjs +62 -0
  145. package/{esm2015/src/pages/debug/debug.module.js → esm2020/src/pages/debug/debug.module.mjs} +12 -14
  146. package/esm2020/src/pages/empty-account/empty-account.component.mjs +12 -0
  147. package/esm2020/src/pages/empty-account/empty-account.module.mjs +20 -0
  148. package/esm2020/src/pages/legacy-product/legacy-product.component.mjs +137 -0
  149. package/esm2020/src/pages/legacy-product/legacy-product.module.mjs +19 -0
  150. package/esm2020/src/pages/product/product.component.mjs +94 -0
  151. package/esm2020/src/pages/product/product.module.mjs +20 -0
  152. package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +25 -0
  153. package/esm2020/src/pages/record-not-found/record-not-found.module.mjs +20 -0
  154. package/esm2020/src/pages/remote/remote.component.mjs +342 -0
  155. package/esm2020/src/pages/remote/remote.module.mjs +20 -0
  156. package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +111 -0
  157. package/esm2020/src/pages/shopping-cart/shopping-cart.module.mjs +20 -0
  158. package/esm2020/src/resolvers/flow.resolver.mjs +70 -0
  159. package/esm2020/src/resolvers/quote.resolver.mjs +90 -0
  160. package/esm2020/src/services/doc-gen.service.mjs +33 -0
  161. package/esm2020/src/services/flow-dialog.service.mjs +126 -0
  162. package/esm2020/src/services/flow-router.service.mjs +144 -0
  163. package/esm2020/src/services/flow.service.mjs +86 -0
  164. package/esm2020/src/utils/flow.utils.mjs +21 -0
  165. package/fesm2015/{veloceapps-sdk-cms.js → veloceapps-sdk-cms.mjs} +178 -207
  166. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -0
  167. package/fesm2015/{veloceapps-sdk-core.js → veloceapps-sdk-core.mjs} +76 -76
  168. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -0
  169. package/fesm2015/{veloceapps-sdk-runtime.js → veloceapps-sdk-runtime.mjs} +242 -370
  170. package/fesm2015/veloceapps-sdk-runtime.mjs.map +1 -0
  171. package/fesm2015/veloceapps-sdk.mjs +2877 -0
  172. package/fesm2015/veloceapps-sdk.mjs.map +1 -0
  173. package/fesm2020/veloceapps-sdk-cms.mjs +2036 -0
  174. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -0
  175. package/fesm2020/veloceapps-sdk-core.mjs +1289 -0
  176. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -0
  177. package/fesm2020/veloceapps-sdk-runtime.mjs +3764 -0
  178. package/fesm2020/veloceapps-sdk-runtime.mjs.map +1 -0
  179. package/fesm2020/veloceapps-sdk.mjs +2857 -0
  180. package/fesm2020/veloceapps-sdk.mjs.map +1 -0
  181. package/package.json +59 -33
  182. package/runtime/README.md +5 -0
  183. package/runtime/components/component-preview/component-preview.component.d.ts +2 -2
  184. package/runtime/components/section-renderer/section-renderer.component.d.ts +1 -1
  185. package/runtime/components/ui-runtime/runtime.component.d.ts +1 -1
  186. package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +1 -1
  187. package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +2 -2
  188. package/runtime/execution/components/context-provider/context-provider.component.d.ts +1 -1
  189. package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +1 -1
  190. package/runtime/execution/components/federated/federated.component.d.ts +1 -1
  191. package/runtime/execution/components/velo-attribute/velo-attribute.component.d.ts +1 -1
  192. package/runtime/execution/components/velo-multiselect/velo-multiselect.component.d.ts +1 -1
  193. package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +1 -1
  194. package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +1 -1
  195. package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +1 -1
  196. package/runtime/execution/components/velo-type/velo-type.component.d.ts +1 -1
  197. package/runtime/execution/directives/section-script.directive.d.ts +1 -1
  198. package/runtime/execution/directives/sf-query.directive.d.ts +1 -1
  199. package/runtime/execution/directives/velo-attribute.directive.d.ts +1 -1
  200. package/runtime/execution/directives/velo-port.directive.d.ts +6 -6
  201. package/runtime/execution/directives/vl-approval.directive.d.ts +1 -1
  202. package/runtime/execution/directives/vl-document-attachments.directive.d.ts +1 -1
  203. package/runtime/execution/directives/vl-document-templates.directive.d.ts +1 -1
  204. package/runtime/execution/directives/vl-quote.directive.d.ts +1 -1
  205. package/runtime/execution/directives/vl-ramp.directive.d.ts +1 -1
  206. package/runtime/execution/runtime-execution.module.d.ts +3 -5
  207. package/runtime/execution/utils/federated.util.d.ts +1 -1
  208. package/runtime/runtime.module.d.ts +3 -5
  209. package/runtime/services/section.service.d.ts +1 -1
  210. package/src/components/dialog/dialog.component.d.ts +1 -1
  211. package/src/components/doc-gen/doc-gen.component.d.ts +1 -1
  212. package/src/components/header/cart-overlay/cart-preview.component.d.ts +2 -2
  213. package/src/components/header/header.component.d.ts +1 -1
  214. package/src/components/header/metrics/metrics.component.d.ts +1 -1
  215. package/src/flow.component.d.ts +1 -1
  216. package/src/pages/assets/assets.component.d.ts +1 -1
  217. package/src/pages/catalog/catalog.component.d.ts +1 -1
  218. package/src/pages/debug/debug.component.d.ts +5 -3
  219. package/src/pages/empty-account/empty-account.component.d.ts +1 -1
  220. package/src/pages/legacy-product/legacy-product.component.d.ts +1 -1
  221. package/src/pages/legacy-product/legacy-product.module.d.ts +1 -2
  222. package/src/pages/product/product.component.d.ts +1 -1
  223. package/src/pages/record-not-found/record-not-found.component.d.ts +1 -1
  224. package/src/pages/remote/remote.component.d.ts +1 -1
  225. package/src/pages/shopping-cart/shopping-cart.component.d.ts +1 -1
  226. package/bundles/veloceapps-sdk-cms.umd.js +0 -2531
  227. package/bundles/veloceapps-sdk-cms.umd.js.map +0 -1
  228. package/bundles/veloceapps-sdk-core.umd.js +0 -1916
  229. package/bundles/veloceapps-sdk-core.umd.js.map +0 -1
  230. package/bundles/veloceapps-sdk-runtime.umd.js +0 -4415
  231. package/bundles/veloceapps-sdk-runtime.umd.js.map +0 -1
  232. package/bundles/veloceapps-sdk.umd.js +0 -3583
  233. package/bundles/veloceapps-sdk.umd.js.map +0 -1
  234. package/cms/modules/federated/federated.utils.d.ts +0 -1
  235. package/cms/package.json +0 -10
  236. package/cms/veloceapps-sdk-cms.d.ts +0 -5
  237. package/core/package.json +0 -10
  238. package/core/veloceapps-sdk-core.d.ts +0 -5
  239. package/esm2015/cms/cms.actions.js +0 -42
  240. package/esm2015/cms/components/element-children/element-children.component.js +0 -39
  241. package/esm2015/cms/components/element-children/element-children.module.js +0 -20
  242. package/esm2015/cms/components/element-drop-handle/element-drop-handle.component.js +0 -32
  243. package/esm2015/cms/components/element-drop-handle/element-drop-handle.module.js +0 -19
  244. package/esm2015/cms/components/element-renderer/element-renderer.component.js +0 -169
  245. package/esm2015/cms/components/element.component.js +0 -44
  246. package/esm2015/cms/components/plugin.component.js +0 -16
  247. package/esm2015/cms/components/preview/preview.component.js +0 -93
  248. package/esm2015/cms/components/preview/preview.module.js +0 -24
  249. package/esm2015/cms/directives/custom-template.directive.js +0 -25
  250. package/esm2015/cms/engine/models/entity.js +0 -18
  251. package/esm2015/cms/launcher.module.js +0 -24
  252. package/esm2015/cms/modules/federated/federated.component.js +0 -82
  253. package/esm2015/cms/modules/federated/federated.module.js +0 -19
  254. package/esm2015/cms/modules/federated/federated.types.js +0 -2
  255. package/esm2015/cms/modules/federated/federated.utils.js +0 -37
  256. package/esm2015/cms/modules/migrations/migrations.js +0 -11
  257. package/esm2015/cms/modules/migrations/services/migrations.service.js +0 -43
  258. package/esm2015/cms/modules/runtime/services/compilation.service.js +0 -84
  259. package/esm2015/cms/modules/runtime/services/runtime-editor.service.js +0 -27
  260. package/esm2015/cms/modules/runtime/services/runtime.service.js +0 -74
  261. package/esm2015/cms/plugins/configuration.plugin.js +0 -106
  262. package/esm2015/cms/plugins/io.plugin.js +0 -37
  263. package/esm2015/cms/plugins/region.plugin.js +0 -58
  264. package/esm2015/cms/plugins/script.plugin.js +0 -66
  265. package/esm2015/cms/services/integration.state.js +0 -40
  266. package/esm2015/cms/services/io-provider.service.js +0 -51
  267. package/esm2015/cms/services/resources.service.js +0 -50
  268. package/esm2015/cms/utils/element.utils.js +0 -157
  269. package/esm2015/cms/utils/elements-resolver.js +0 -163
  270. package/esm2015/cms/utils/path.utils.js +0 -56
  271. package/esm2015/cms/utils/ui-definition.utils.js +0 -82
  272. package/esm2015/cms/vendor-map.js +0 -51
  273. package/esm2015/core/core.module.js +0 -18
  274. package/esm2015/core/modules/configuration/helpers.js +0 -10
  275. package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +0 -87
  276. package/esm2015/core/modules/configuration/services/configuration.service.js +0 -177
  277. package/esm2015/core/modules/configuration/services/runtime-context.service.js +0 -51
  278. package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +0 -18
  279. package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +0 -150
  280. package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +0 -129
  281. package/esm2015/core/services/context.service.js +0 -53
  282. package/esm2015/core/services/metric-calculation/metric-calculation.service.js +0 -83
  283. package/esm2015/core/services/product-images.service.js +0 -30
  284. package/esm2015/core/services/quote-draft.service.js +0 -217
  285. package/esm2015/core/utils/line-item.utils.js +0 -143
  286. package/esm2015/core/utils/line-item.worker.js +0 -19
  287. package/esm2015/runtime/components/component-preview/component-preview.component.js +0 -125
  288. package/esm2015/runtime/components/section-renderer/section-renderer.component.js +0 -71
  289. package/esm2015/runtime/components/ui-runtime/runtime.component.js +0 -429
  290. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +0 -109
  291. package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +0 -68
  292. package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +0 -36
  293. package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +0 -72
  294. package/esm2015/runtime/execution/components/federated/federated.component.js +0 -81
  295. package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +0 -65
  296. package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +0 -136
  297. package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +0 -80
  298. package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +0 -101
  299. package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +0 -150
  300. package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +0 -121
  301. package/esm2015/runtime/execution/directives/section-script.directive.js +0 -242
  302. package/esm2015/runtime/execution/directives/sf-query.directive.js +0 -34
  303. package/esm2015/runtime/execution/directives/velo-attribute.directive.js +0 -86
  304. package/esm2015/runtime/execution/directives/velo-port.directive.js +0 -373
  305. package/esm2015/runtime/execution/directives/vl-approval.directive.js +0 -22
  306. package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +0 -35
  307. package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +0 -59
  308. package/esm2015/runtime/execution/directives/vl-quote.directive.js +0 -41
  309. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +0 -51
  310. package/esm2015/runtime/execution/runtime-execution.module.js +0 -163
  311. package/esm2015/runtime/execution/utils/federated.util.js +0 -37
  312. package/esm2015/runtime/runtime.module.js +0 -104
  313. package/esm2015/runtime/services/cart.service.js +0 -27
  314. package/esm2015/runtime/services/configuration.service.js +0 -101
  315. package/esm2015/runtime/services/product-model-cache.service.js +0 -30
  316. package/esm2015/runtime/services/runtime-context.service.js +0 -56
  317. package/esm2015/runtime/services/runtime-form.service.js +0 -224
  318. package/esm2015/runtime/services/runtime.service.js +0 -108
  319. package/esm2015/runtime/services/section.service.js +0 -124
  320. package/esm2015/runtime/types/script-registry.types.js +0 -51
  321. package/esm2015/runtime/utils/line-item.util.js +0 -273
  322. package/esm2015/src/components/dialog/dialog.component.js +0 -40
  323. package/esm2015/src/components/dialog/dialog.module.js +0 -19
  324. package/esm2015/src/components/doc-gen/doc-gen.component.js +0 -109
  325. package/esm2015/src/components/doc-gen/doc-gen.module.js +0 -19
  326. package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +0 -122
  327. package/esm2015/src/components/header/header.component.js +0 -336
  328. package/esm2015/src/components/header/metrics/metrics.component.js +0 -232
  329. package/esm2015/src/flow.component.js +0 -45
  330. package/esm2015/src/flow.module.js +0 -60
  331. package/esm2015/src/guards/context.guard.js +0 -84
  332. package/esm2015/src/guards/product-unload.guard.js +0 -43
  333. package/esm2015/src/guards/root.guard.js +0 -41
  334. package/esm2015/src/pages/assets/assets.component.js +0 -117
  335. package/esm2015/src/pages/assets/assets.module.js +0 -20
  336. package/esm2015/src/pages/catalog/catalog.component.js +0 -117
  337. package/esm2015/src/pages/catalog/catalog.module.js +0 -20
  338. package/esm2015/src/pages/debug/debug.component.js +0 -61
  339. package/esm2015/src/pages/empty-account/empty-account.component.js +0 -17
  340. package/esm2015/src/pages/empty-account/empty-account.module.js +0 -20
  341. package/esm2015/src/pages/legacy-product/legacy-product.component.js +0 -132
  342. package/esm2015/src/pages/legacy-product/legacy-product.module.js +0 -21
  343. package/esm2015/src/pages/product/product.component.js +0 -101
  344. package/esm2015/src/pages/product/product.module.js +0 -20
  345. package/esm2015/src/pages/record-not-found/record-not-found.component.js +0 -29
  346. package/esm2015/src/pages/record-not-found/record-not-found.module.js +0 -20
  347. package/esm2015/src/pages/remote/remote.component.js +0 -350
  348. package/esm2015/src/pages/remote/remote.module.js +0 -20
  349. package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +0 -117
  350. package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +0 -20
  351. package/esm2015/src/resolvers/flow.resolver.js +0 -62
  352. package/esm2015/src/resolvers/quote.resolver.js +0 -88
  353. package/esm2015/src/services/doc-gen.service.js +0 -33
  354. package/esm2015/src/services/flow-dialog.service.js +0 -124
  355. package/esm2015/src/services/flow-router.service.js +0 -144
  356. package/esm2015/src/services/flow.service.js +0 -84
  357. package/esm2015/src/utils/flow.utils.js +0 -22
  358. package/fesm2015/veloceapps-sdk-cms.js.map +0 -1
  359. package/fesm2015/veloceapps-sdk-core.js.map +0 -1
  360. package/fesm2015/veloceapps-sdk-runtime.js.map +0 -1
  361. package/fesm2015/veloceapps-sdk.js +0 -2953
  362. package/fesm2015/veloceapps-sdk.js.map +0 -1
  363. package/runtime/package.json +0 -10
  364. package/runtime/veloceapps-sdk-runtime.d.ts +0 -5
  365. package/veloceapps-sdk.d.ts +0 -5
  366. /package/{esm2015/cms/cms.default.js → esm2020/cms/cms.default.mjs} +0 -0
  367. /package/{esm2015/cms/cms.elements.js → esm2020/cms/cms.elements.mjs} +0 -0
  368. /package/{esm2015/cms/cms.layouts.js → esm2020/cms/cms.layouts.mjs} +0 -0
  369. /package/{esm2015/cms/components/index.js → esm2020/cms/components/index.mjs} +0 -0
  370. /package/{esm2015/cms/components/preview/index.js → esm2020/cms/components/preview/index.mjs} +0 -0
  371. /package/{esm2015/cms/components/preview/preview.types.js → esm2020/cms/components/preview/preview.types.mjs} +0 -0
  372. /package/{esm2015/cms/decorators/element.decorator.js → esm2020/cms/decorators/element.decorator.mjs} +0 -0
  373. /package/{esm2015/cms/decorators/index.js → esm2020/cms/decorators/index.mjs} +0 -0
  374. /package/{esm2015/cms/engine/models/plugin.js → esm2020/cms/engine/models/plugin.mjs} +0 -0
  375. /package/{esm2015/cms/index.js → esm2020/cms/index.mjs} +0 -0
  376. /package/{esm2015/cms/injection-tokens.js → esm2020/cms/injection-tokens.mjs} +0 -0
  377. /package/{esm2015/cms/modules/federated/default-options.js → esm2020/cms/modules/federated/default-options.mjs} +0 -0
  378. /package/{esm2015/cms/modules/federated/export.js → esm2020/cms/modules/federated/export.mjs} +0 -0
  379. /package/{esm2015/cms/modules/migrations/index.js → esm2020/cms/modules/migrations/index.mjs} +0 -0
  380. /package/{esm2015/cms/modules/migrations/types/migrations.types.js → esm2020/cms/modules/migrations/types/migrations.types.mjs} +0 -0
  381. /package/{esm2015/cms/modules/runtime/index.js → esm2020/cms/modules/runtime/index.mjs} +0 -0
  382. /package/{esm2015/cms/modules/runtime/tokens.js → esm2020/cms/modules/runtime/tokens.mjs} +0 -0
  383. /package/{esm2015/cms/modules/runtime/types/compilation.types.js → esm2020/cms/modules/runtime/types/compilation.types.mjs} +0 -0
  384. /package/{esm2015/cms/modules/runtime/types/runtime.actions.js → esm2020/cms/modules/runtime/types/runtime.actions.mjs} +0 -0
  385. /package/{esm2015/cms/services/index.js → esm2020/cms/services/index.mjs} +0 -0
  386. /package/{esm2015/cms/types/common.types.js → esm2020/cms/types/common.types.mjs} +0 -0
  387. /package/{esm2015/cms/types/configuration.types.js → esm2020/cms/types/configuration.types.mjs} +0 -0
  388. /package/{esm2015/cms/types/elements.types.js → esm2020/cms/types/elements.types.mjs} +0 -0
  389. /package/{esm2015/cms/types/index.js → esm2020/cms/types/index.mjs} +0 -0
  390. /package/{esm2015/cms/types/integration.types.js → esm2020/cms/types/integration.types.mjs} +0 -0
  391. /package/{esm2015/cms/types/layouts.types.js → esm2020/cms/types/layouts.types.mjs} +0 -0
  392. /package/{esm2015/cms/types/path.types.js → esm2020/cms/types/path.types.mjs} +0 -0
  393. /package/{esm2015/cms/utils/index.js → esm2020/cms/utils/index.mjs} +0 -0
  394. /package/{esm2015/cms/veloceapps-sdk-cms.js → esm2020/cms/veloceapps-sdk-cms.mjs} +0 -0
  395. /package/{esm2015/core/index.js → esm2020/core/index.mjs} +0 -0
  396. /package/{esm2015/core/modules/configuration/index.js → esm2020/core/modules/configuration/index.mjs} +0 -0
  397. /package/{esm2015/core/modules/configuration/types/configuration-runtime.types.js → esm2020/core/modules/configuration/types/configuration-runtime.types.mjs} +0 -0
  398. /package/{esm2015/core/modules/flow-configuration/index.js → esm2020/core/modules/flow-configuration/index.mjs} +0 -0
  399. /package/{esm2015/core/modules/flow-configuration/types/update.types.js → esm2020/core/modules/flow-configuration/types/update.types.mjs} +0 -0
  400. /package/{esm2015/core/modules/index.js → esm2020/core/modules/index.mjs} +0 -0
  401. /package/{esm2015/core/services/index.js → esm2020/core/services/index.mjs} +0 -0
  402. /package/{esm2015/core/services/metric-calculation/metric-calculation.types.js → esm2020/core/services/metric-calculation/metric-calculation.types.mjs} +0 -0
  403. /package/{esm2015/core/services/metric-calculation/metric-calculation.utils.js → esm2020/core/services/metric-calculation/metric-calculation.utils.mjs} +0 -0
  404. /package/{esm2015/core/types/index.js → esm2020/core/types/index.mjs} +0 -0
  405. /package/{esm2015/core/types/runtime.types.js → esm2020/core/types/runtime.types.mjs} +0 -0
  406. /package/{esm2015/core/types/ui-definition.types.js → esm2020/core/types/ui-definition.types.mjs} +0 -0
  407. /package/{esm2015/core/utils/index.js → esm2020/core/utils/index.mjs} +0 -0
  408. /package/{esm2015/core/utils/ui-definition.utils.js → esm2020/core/utils/ui-definition.utils.mjs} +0 -0
  409. /package/{esm2015/core/veloceapps-sdk-core.js → esm2020/core/veloceapps-sdk-core.mjs} +0 -0
  410. /package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  411. /package/{esm2015/runtime/components/index.js → esm2020/runtime/components/index.mjs} +0 -0
  412. /package/{esm2015/runtime/index.js → esm2020/runtime/index.mjs} +0 -0
  413. /package/{esm2015/runtime/services/index.js → esm2020/runtime/services/index.mjs} +0 -0
  414. /package/{esm2015/runtime/types/bound-data.types.js → esm2020/runtime/types/bound-data.types.mjs} +0 -0
  415. /package/{esm2015/runtime/types/index.js → esm2020/runtime/types/index.mjs} +0 -0
  416. /package/{esm2015/runtime/types/quote-states.types.js → esm2020/runtime/types/quote-states.types.mjs} +0 -0
  417. /package/{esm2015/runtime/types/runtime.types.js → esm2020/runtime/types/runtime.types.mjs} +0 -0
  418. /package/{esm2015/runtime/utils/section.utils.js → esm2020/runtime/utils/section.utils.mjs} +0 -0
  419. /package/{esm2015/runtime/utils/sections-binder.helper.js → esm2020/runtime/utils/sections-binder.helper.mjs} +0 -0
  420. /package/{esm2015/runtime/veloceapps-sdk-runtime.js → esm2020/runtime/veloceapps-sdk-runtime.mjs} +0 -0
  421. /package/{esm2015/src/components/dialog/dialog.types.js → esm2020/src/components/dialog/dialog.types.mjs} +0 -0
  422. /package/{esm2015/src/components/header/header.types.js → esm2020/src/components/header/header.types.mjs} +0 -0
  423. /package/{esm2015/src/components/header/metrics/index.js → esm2020/src/components/header/metrics/index.mjs} +0 -0
  424. /package/{esm2015/src/components/header/metrics/metrics.definitions.js → esm2020/src/components/header/metrics/metrics.definitions.mjs} +0 -0
  425. /package/{esm2015/src/constants.js → esm2020/src/constants.mjs} +0 -0
  426. /package/{esm2015/src/guards/index.js → esm2020/src/guards/index.mjs} +0 -0
  427. /package/{esm2015/src/index.js → esm2020/src/index.mjs} +0 -0
  428. /package/{esm2015/src/pages/remote/remote.types.js → esm2020/src/pages/remote/remote.types.mjs} +0 -0
  429. /package/{esm2015/src/services/index.js → esm2020/src/services/index.mjs} +0 -0
  430. /package/{esm2015/src/types/context-route.types.js → esm2020/src/types/context-route.types.mjs} +0 -0
  431. /package/{esm2015/src/types/flow-customization.types.js → esm2020/src/types/flow-customization.types.mjs} +0 -0
  432. /package/{esm2015/src/types/index.js → esm2020/src/types/index.mjs} +0 -0
  433. /package/{esm2015/src/types/metrics.types.js → esm2020/src/types/metrics.types.mjs} +0 -0
  434. /package/{esm2015/src/types/route.types.js → esm2020/src/types/route.types.mjs} +0 -0
  435. /package/{esm2015/src/utils/index.js → esm2020/src/utils/index.mjs} +0 -0
  436. /package/{esm2015/veloceapps-sdk.js → esm2020/veloceapps-sdk.mjs} +0 -0
@@ -0,0 +1,1289 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, NgModule } from '@angular/core';
3
+ import { UUID, ConfigurationContext, RuntimeModel, ConfigurationContextMode, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils } from '@veloceapps/core';
4
+ import * as i1 from '@veloceapps/api';
5
+ import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
6
+ import { BehaviorSubject, combineLatest, zip, noop, throwError, shareReplay as shareReplay$1, tap as tap$1, map as map$2, of, switchMap as switchMap$1, catchError as catchError$1, Subject, take as take$1, distinctUntilChanged } from 'rxjs';
7
+ import { filter, tap, map, first, switchMap, skip, take, shareReplay, catchError, finalize } from 'rxjs/operators';
8
+ import { merge, isEqual, flatten, sortBy, map as map$1, omit, cloneDeep, uniq } from 'lodash';
9
+ import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
10
+ import * as i5 from 'primeng/api';
11
+ import * as i6 from 'primeng/dynamicdialog';
12
+ import moment from 'moment';
13
+
14
+ const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
15
+ const id = UUID.UUID();
16
+ const lineItem = {
17
+ id,
18
+ type: uiDefinitionProperties.rootType ?? '',
19
+ cfgStatus: 'Default',
20
+ actionCode: 'ADD',
21
+ qty,
22
+ productName: context.properties?.['displayName'] || context.productName,
23
+ productId: context.productId ?? '',
24
+ ...(context.offeringId
25
+ ? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
26
+ : {}),
27
+ };
28
+ return lineItem;
29
+ };
30
+
31
+ class ContextService {
32
+ constructor(contextApiService) {
33
+ this.contextApiService = contextApiService;
34
+ this.context = new BehaviorSubject(null);
35
+ }
36
+ get isInitialized() {
37
+ return Boolean(this.context.value);
38
+ }
39
+ get mode() {
40
+ return this.resolve().properties.mode;
41
+ }
42
+ resolve() {
43
+ if (!this.context.value) {
44
+ throw new Error('Context is not initialized yet!');
45
+ }
46
+ return { ...this.context.value };
47
+ }
48
+ resolve$() {
49
+ return this.context.pipe(filter((ctx) => Boolean(ctx)));
50
+ }
51
+ create(headerId, mode) {
52
+ return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
53
+ }
54
+ update(partialContext) {
55
+ const originalContext = this.resolve();
56
+ const updatedContext = {
57
+ ...originalContext,
58
+ ...partialContext,
59
+ properties: {
60
+ ...originalContext.properties,
61
+ ...partialContext.properties,
62
+ },
63
+ };
64
+ this.context.next(updatedContext);
65
+ return updatedContext;
66
+ }
67
+ set(context) {
68
+ const originalContext = this.resolve();
69
+ const updatedContext = {
70
+ ...originalContext,
71
+ ...context,
72
+ };
73
+ this.context.next(updatedContext);
74
+ return updatedContext;
75
+ }
76
+ delete() {
77
+ this.context.next(null);
78
+ }
79
+ }
80
+ ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
81
+ ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ContextService, providedIn: 'root' });
82
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ContextService, decorators: [{
83
+ type: Injectable,
84
+ args: [{ providedIn: 'root' }]
85
+ }], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
86
+
87
+ var RuntimeMode;
88
+ (function (RuntimeMode) {
89
+ RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
90
+ RuntimeMode[RuntimeMode["PROD"] = 1] = "PROD";
91
+ })(RuntimeMode || (RuntimeMode = {}));
92
+ var RuntimeOperation;
93
+ (function (RuntimeOperation) {
94
+ RuntimeOperation["INIT"] = "INIT";
95
+ RuntimeOperation["UPDATE"] = "UPDATE";
96
+ })(RuntimeOperation || (RuntimeOperation = {}));
97
+ var RuntimeStep;
98
+ (function (RuntimeStep) {
99
+ RuntimeStep["START"] = "START";
100
+ RuntimeStep["UPDATE"] = "UPDATE";
101
+ })(RuntimeStep || (RuntimeStep = {}));
102
+
103
+ const UI_DEFINITION_VERSION = 3;
104
+
105
+ class RuntimeContextService {
106
+ constructor(configurationApiService) {
107
+ this.configurationApiService = configurationApiService;
108
+ }
109
+ getRuntimeContext(productId, offeringId) {
110
+ return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
111
+ const uiDefinition = this.getUIDefinition(runtimeData);
112
+ const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
113
+ const { productName, properties } = Array.from(runtimeModel.components.values()).find(c => c.productId === productId) ?? {};
114
+ return {
115
+ modelId: runtimeData.modelId,
116
+ uiDefinition: uiDefinition,
117
+ runtimeModel: runtimeModel,
118
+ runtimeMode: RuntimeMode.PROD,
119
+ productId: productId,
120
+ productType: properties?.['displayName'] || productName,
121
+ offeringId: offeringId,
122
+ properties: {
123
+ PricingEnabled: uiDefinition?.properties?.pricingEnabled ? 'true' : 'false',
124
+ PriceListId: uiDefinition?.properties?.priceList,
125
+ },
126
+ };
127
+ }));
128
+ }
129
+ getUIDefinition(runtimeData) {
130
+ let rawUiDefinitions;
131
+ try {
132
+ rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
133
+ }
134
+ catch (e) {
135
+ return;
136
+ }
137
+ const uiDefinitions = rawUiDefinitions.filter(uiDef => uiDef.version);
138
+ const uiDefinition = uiDefinitions.find(uiDef => uiDef.primary) ?? uiDefinitions[0];
139
+ return uiDefinition;
140
+ }
141
+ }
142
+ RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
143
+ RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService });
144
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeContextService, decorators: [{
145
+ type: Injectable
146
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
147
+
148
+ class ConfigurationRuntimeService {
149
+ constructor(apiService, contextService, runtimeContextService) {
150
+ this.apiService = apiService;
151
+ this.contextService = contextService;
152
+ this.runtimeContextService = runtimeContextService;
153
+ this._isInitialized = false;
154
+ this.uiDefinitionProperties = {};
155
+ }
156
+ reset() {
157
+ this._isInitialized = false;
158
+ this._runtimeContext = undefined;
159
+ this.initializationProps = undefined;
160
+ this.uiDefinitionProperties = {};
161
+ }
162
+ initTestMode(modelId, uiDefinition) {
163
+ this.uiDefinitionProperties = uiDefinition.properties ?? {};
164
+ const uiDefinitionExternals = uiDefinition.externals ?? {};
165
+ return combineLatest([
166
+ this.apiService.getRuntimeDataByModelId(modelId),
167
+ this.contextService.create('TestId', ConfigurationContextMode.TEST),
168
+ ]).pipe(first(), tap(([runtimeData, context]) => {
169
+ this._runtimeContext = {
170
+ modelId: modelId,
171
+ runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
172
+ runtimeMode: RuntimeMode.TEST,
173
+ };
174
+ this.contextService.update({
175
+ properties: {
176
+ ...this.runtimeContext?.properties,
177
+ ...context.properties,
178
+ ModelId: modelId,
179
+ RuntimeMode: ConfigurationContextMode.TEST,
180
+ PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false',
181
+ StartDate: new Date().toISOString().substring(0, 10),
182
+ PriceListId: this.uiDefinitionProperties.priceList,
183
+ standalone: 'true',
184
+ ...uiDefinitionExternals,
185
+ },
186
+ });
187
+ this._isInitialized = true;
188
+ }));
189
+ }
190
+ init(props) {
191
+ this.initializationProps = props;
192
+ const context = this.contextService.resolve();
193
+ return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
194
+ this.uiDefinitionProperties = runtimeContext.uiDefinition?.properties ?? {};
195
+ const { PriceListId } = context.properties ?? {};
196
+ const mergeContext = {
197
+ ...runtimeContext,
198
+ properties: {
199
+ ...runtimeContext.properties,
200
+ ...context.properties,
201
+ PricingEnabled: PriceListId ? 'true' : 'false',
202
+ },
203
+ };
204
+ this.id15to18('AccountId', mergeContext.properties);
205
+ this._runtimeContext = mergeContext;
206
+ if (context.properties && this._runtimeContext.properties?.StartDate) {
207
+ this.contextService.update({
208
+ properties: {
209
+ ...this._runtimeContext.properties,
210
+ ...context.properties,
211
+ },
212
+ });
213
+ }
214
+ this._isInitialized = true;
215
+ }));
216
+ }
217
+ id15to18(propertyName, source) {
218
+ if (!source) {
219
+ return;
220
+ }
221
+ const value = source[propertyName];
222
+ if (typeof value === 'string' && value.length === 15) {
223
+ source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
224
+ }
225
+ }
226
+ get isInitialized() {
227
+ return this._isInitialized;
228
+ }
229
+ get runtimeModel() {
230
+ return this.runtimeContext?.runtimeModel;
231
+ }
232
+ get runtimeContext() {
233
+ return this._runtimeContext;
234
+ }
235
+ }
236
+ ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
237
+ ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationRuntimeService });
238
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
239
+ type: Injectable
240
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
241
+
242
+ class QuoteDraftService {
243
+ get isInitialized() {
244
+ return this.isInitializedSubj$.getValue();
245
+ }
246
+ set isInitialized(value) {
247
+ if (this.isInitialized !== value) {
248
+ this.isInitializedSubj$.next(value);
249
+ }
250
+ }
251
+ get hasUnsavedChanges() {
252
+ return this._hasUnsavedChanges;
253
+ }
254
+ set hasUnsavedChanges(value) {
255
+ this._hasUnsavedChanges = value;
256
+ if (!this._hasUnsavedChanges) {
257
+ this.initialCurrentState = this.quoteDraft?.currentState ?? [];
258
+ }
259
+ }
260
+ get hasProducts$() {
261
+ return this.quoteSubj$.pipe(map(() => this.hasProducts));
262
+ }
263
+ get hasProducts() {
264
+ const quoteDraft = this.quoteSubj$.value;
265
+ return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
266
+ }
267
+ constructor(context, quoteApiService, priceApiService) {
268
+ this.context = context;
269
+ this.quoteApiService = quoteApiService;
270
+ this.priceApiService = priceApiService;
271
+ this.quoteSubj$ = new BehaviorSubject(null);
272
+ this.resetSubj$ = new BehaviorSubject(true);
273
+ this.isInitializedSubj$ = new BehaviorSubject(false);
274
+ this.initialCurrentState = [];
275
+ this._hasUnsavedChanges = false;
276
+ this.allPriceLists = [];
277
+ this.assetPriceLists = [];
278
+ this.reset$ = this.resetSubj$.asObservable();
279
+ this.activePriceList$ = this.context.resolve$().pipe(map(ctx => this.allPriceLists.find(priceList => priceList.id === ctx.properties.PriceListId)), map(priceList => priceList ?? null));
280
+ this.isInitializedSubj$
281
+ .pipe(filter(isInitialized => isInitialized), switchMap(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
282
+ .subscribe();
283
+ }
284
+ reset() {
285
+ this.resetSubj$.next(true);
286
+ this.quoteSubj$.next(null);
287
+ this.hasUnsavedChanges = false;
288
+ }
289
+ init(quoteId, params) {
290
+ return zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(tap(([quote, allPriceLists]) => {
291
+ this.allPriceLists = allPriceLists;
292
+ this.quoteSubj$.next(quote);
293
+ this.context.update(quote.context);
294
+ this.populateActivePriceLists$();
295
+ }), map(() => noop()), take(1));
296
+ }
297
+ setCurrentLineItemState(lineItems) {
298
+ const quoteDraft = this.quoteSubj$.value;
299
+ if (!quoteDraft) {
300
+ return;
301
+ }
302
+ this.quoteSubj$.next({
303
+ ...quoteDraft,
304
+ currentState: lineItems,
305
+ });
306
+ }
307
+ updateQuoteDraft(update) {
308
+ const quoteDraft = this.quoteSubj$.value;
309
+ if (!quoteDraft) {
310
+ return;
311
+ }
312
+ if (update.context) {
313
+ this.context.set(update.context);
314
+ }
315
+ this.quoteSubj$.next({
316
+ ...quoteDraft,
317
+ ...update,
318
+ });
319
+ }
320
+ updateByPriceSummary(priceSummary) {
321
+ const quoteDraft = this.quoteSubj$.value;
322
+ if (!quoteDraft) {
323
+ return;
324
+ }
325
+ const updatedCurrentState = this.currentState.map(lineItem => {
326
+ const updated = priceSummary.lineItems.find(li => li.id === lineItem.id);
327
+ return updated ?? lineItem;
328
+ });
329
+ this.quoteSubj$.next({
330
+ ...quoteDraft,
331
+ currentState: updatedCurrentState,
332
+ totalPrices: priceSummary.totalPrices,
333
+ approvalItems: priceSummary.approvalItems,
334
+ });
335
+ }
336
+ get quoteDraft$() {
337
+ return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
338
+ }
339
+ get quoteDraft() {
340
+ const quote = this.quoteSubj$.value;
341
+ if (!quote) {
342
+ return null;
343
+ }
344
+ return {
345
+ ...quote,
346
+ context: this.context.resolve(),
347
+ };
348
+ }
349
+ get quoteDraftForActivePriceList() {
350
+ const quoteDraft = this.quoteDraft;
351
+ if (!quoteDraft) {
352
+ return null;
353
+ }
354
+ return {
355
+ ...quoteDraft,
356
+ initialState: this.filterByActivePriceList(quoteDraft.initialState),
357
+ currentState: this.filterByActivePriceList(quoteDraft.currentState),
358
+ };
359
+ }
360
+ get currentState$() {
361
+ return this.quoteDraft$.pipe(map(quote => quote.currentState));
362
+ }
363
+ get currentState() {
364
+ return this.quoteDraft?.currentState ?? [];
365
+ }
366
+ /**
367
+ * Stream of activeCurrentState
368
+ */
369
+ get activeCurrentState$() {
370
+ return this.quoteDraft$.pipe(map(() => this.activeCurrentState));
371
+ }
372
+ /**
373
+ * activeCurrentState is currentState passed through additional filters
374
+ */
375
+ get activeCurrentState() {
376
+ let currentState = this.quoteDraft?.currentState ?? [];
377
+ currentState = this.filterByActivePriceList(currentState);
378
+ return currentState;
379
+ }
380
+ /**
381
+ * Stream of activeInitialState
382
+ */
383
+ get activeInitialState$() {
384
+ return this.quoteDraft$.pipe(map(() => this.activeInitialState));
385
+ }
386
+ /**
387
+ * activeInitialState is initialState passed through additional filters
388
+ */
389
+ get activeInitialState() {
390
+ const ctx = this.context.resolve();
391
+ let initialState = this.quoteDraft?.initialState ?? [];
392
+ if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
393
+ initialState = this.filterByActivePriceList(initialState);
394
+ }
395
+ return initialState;
396
+ }
397
+ get isStandalone() {
398
+ return this.context.resolve().properties.standalone === 'true';
399
+ }
400
+ get isStandalone$() {
401
+ return this.context.resolve$().pipe(map(() => this.isStandalone));
402
+ }
403
+ getInitialCurrentState() {
404
+ return this.initialCurrentState;
405
+ }
406
+ isEditMode$() {
407
+ return this.context.resolve$().pipe(map(() => this.isEditMode()));
408
+ }
409
+ isEditMode() {
410
+ const context = this.context.resolve();
411
+ if (context.mode === ConfigurationContextMode.ACCOUNT) {
412
+ return true;
413
+ }
414
+ if (context.mode === ConfigurationContextMode.QUOTE) {
415
+ return context.properties.Status === 'Draft';
416
+ }
417
+ return false;
418
+ }
419
+ updateActivePriceList(priceListId) {
420
+ this.context.update({ properties: { PriceListId: priceListId } });
421
+ }
422
+ populateActivePriceLists$() {
423
+ const ctx = this.context.resolve();
424
+ const quoteDraft = this.quoteDraft;
425
+ if (!quoteDraft) {
426
+ return;
427
+ }
428
+ // In ACCOUNT mode populate price lists from related assets
429
+ if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
430
+ // Populate list of price lists
431
+ this.assetPriceLists = quoteDraft.currentState
432
+ .map(({ priceListId }) => priceListId)
433
+ .reduce((trunk, priceListId) => {
434
+ if (!priceListId || trunk.some(item => item.id === priceListId)) {
435
+ return trunk;
436
+ }
437
+ return [
438
+ ...trunk,
439
+ { id: priceListId, name: this.allPriceLists.find(item => item.id === priceListId)?.name ?? '' },
440
+ ];
441
+ }, []);
442
+ }
443
+ }
444
+ filterByActivePriceList(lineItems) {
445
+ const ctx = this.context.resolve();
446
+ return lineItems.filter(li => !li.priceListId || li.priceListId === ctx.properties.PriceListId);
447
+ }
448
+ markAsUpdated(quote) {
449
+ if (quote?.context.properties.mode === ConfigurationContextMode.ACCOUNT) {
450
+ this.hasUnsavedChanges = !!quote && !quote.currentState.every(li => li.actionCode === 'EXIST');
451
+ }
452
+ else {
453
+ this.hasUnsavedChanges = !isEqual(this.initialCurrentState, quote?.currentState);
454
+ }
455
+ }
456
+ }
457
+ QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }], target: i0.ɵɵFactoryTarget.Injectable });
458
+ QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: QuoteDraftService, providedIn: 'root' });
459
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: QuoteDraftService, decorators: [{
460
+ type: Injectable,
461
+ args: [{ providedIn: 'root' }]
462
+ }], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }]; } });
463
+
464
+ const findLineItem = (id, lineItems) => {
465
+ return findLineItemWithComparator(lineItems, (li) => li.id === id);
466
+ };
467
+ const findLineItemWithComparator = (lineItems, comparator) => {
468
+ let currentLevel = lineItems;
469
+ while (currentLevel.length) {
470
+ const found = currentLevel.find(comparator);
471
+ if (found) {
472
+ return found;
473
+ }
474
+ currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
475
+ }
476
+ return;
477
+ };
478
+ const insertLineItem = (lineItem, parentId, toInsert) => {
479
+ const insertData = lineItem.id === parentId ? [toInsert] : [];
480
+ return {
481
+ ...lineItem,
482
+ lineItems: [
483
+ ...insertData,
484
+ ...lineItem.lineItems.map(li => {
485
+ return insertLineItem(li, parentId, toInsert);
486
+ }),
487
+ ],
488
+ };
489
+ };
490
+ const removeLineItem = (lineItem, idToRemove) => {
491
+ return {
492
+ ...lineItem,
493
+ lineItems: lineItem.lineItems
494
+ .map(li => {
495
+ if (li.id === idToRemove) {
496
+ return;
497
+ }
498
+ else if (li.lineItems.length) {
499
+ return removeLineItem(li, idToRemove);
500
+ }
501
+ return li;
502
+ })
503
+ .filter(r => !!r),
504
+ };
505
+ };
506
+ const replaceLineItem = (lineItem, replaceTo) => {
507
+ if (lineItem.id === replaceTo.id) {
508
+ return { ...recalculateCardinalityVariables(lineItem, replaceTo) };
509
+ }
510
+ return {
511
+ ...lineItem,
512
+ lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo)),
513
+ };
514
+ };
515
+ const calculateCardinalityVariables = (lineItems) => {
516
+ const cardVars = new Map();
517
+ lineItems.forEach(li => {
518
+ const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
519
+ cardVars.set(cardinalityVariableName, (cardVars.get(cardinalityVariableName) ?? 0) + li.qty);
520
+ });
521
+ return cardVars;
522
+ };
523
+ const recalculateCardinalityVariables = (original, updated) => {
524
+ const cardinalityVariables = calculateCardinalityVariables(updated.lineItems);
525
+ const originalCardinalityVariables = calculateCardinalityVariables(original.lineItems);
526
+ originalCardinalityVariables.forEach((value, key) => {
527
+ if (cardinalityVariables.get(key) === value) {
528
+ // no need to update cardinality if no changes
529
+ cardinalityVariables.delete(key);
530
+ }
531
+ else if (!cardinalityVariables.has(key)) {
532
+ // remove last item from port
533
+ cardinalityVariables.set(key, 0);
534
+ }
535
+ });
536
+ return {
537
+ ...updated,
538
+ attributes: upsertAttributes(updated.attributes, [...cardinalityVariables].map(([name, value]) => ({ name, value }))),
539
+ };
540
+ };
541
+ const mapAttributes = (attributes) => {
542
+ return attributes.reduce((acc, { name, value }) => ({ ...acc, [name]: value }), {});
543
+ };
544
+ const getAttributes = (attributes, names = []) => {
545
+ const filtered = attributes.filter(({ name }) => names.includes(name));
546
+ return sortBy(filtered, [({ name }) => names.indexOf(name)]);
547
+ };
548
+ const upsertAttributes = (originalAttributes, attributesToUpsert) => {
549
+ return attributesToUpsert.reduce((acc, { name, value }) => {
550
+ const [origAttr] = getAttributes(acc, [name]);
551
+ return [
552
+ ...acc.filter(attr => attr.name !== name),
553
+ { ...(origAttr ?? { name }), cfgStatus: 'User', value },
554
+ ];
555
+ }, originalAttributes);
556
+ };
557
+ const patchAttributes = (rootLineItem, id, attrs) => {
558
+ const lineItem = findLineItem(id, [rootLineItem]);
559
+ if (!lineItem) {
560
+ return rootLineItem;
561
+ }
562
+ const attributes = upsertAttributes(lineItem.attributes, attrs);
563
+ return replaceLineItem(rootLineItem, { ...lineItem, attributes });
564
+ };
565
+ const getAttributeValue = (attributes, name) => attributes.find(attr => attr.name === name)?.value;
566
+ const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
567
+ return {
568
+ id: UUID.UUID(),
569
+ port,
570
+ type,
571
+ actionCode: 'ADD',
572
+ cfgStatus: 'New',
573
+ attributes: attributes.map(({ name, value }) => ({ cfgStatus: 'User', name, value })),
574
+ lineItems,
575
+ parentId,
576
+ qty: 1,
577
+ };
578
+ };
579
+ const getRecommendedPrices = (portDomain, type) => {
580
+ const domainType = portDomain.domainTypes.find(({ name }) => name === type);
581
+ const [net, list] = domainType?.recommendedPrices
582
+ ?.filter(({ chargeMethod }) => chargeMethod === 'ONE_TIME')
583
+ .reduce((acc, rp) => {
584
+ const [netPrice, listPrice] = acc;
585
+ return [netPrice + rp.netPrice, listPrice + rp.listPrice];
586
+ }, [0, 0]) ?? [0, 0];
587
+ return { net, list };
588
+ };
589
+ const generateModifiedAssetsMap = (lineItems) => {
590
+ return lineItems.reduce((acc, li) => {
591
+ if (li.rampInstanceId && li.status !== 'EXIST') {
592
+ let target = li;
593
+ while (target && target.rampInstanceId) {
594
+ target = lineItems.find(sub => sub.id === li.rampInstanceId);
595
+ }
596
+ const id = target?.assetId ?? target?.openOrderLineItemId;
597
+ if (id) {
598
+ acc[id] = true;
599
+ }
600
+ }
601
+ return acc;
602
+ }, {});
603
+ };
604
+ const multiplyLineItems = (lineItem, qty, split) => {
605
+ if (split) {
606
+ const unifyIds = (lineItem) => ({
607
+ ...lineItem,
608
+ id: UUID.UUID(),
609
+ lineItems: lineItem.lineItems.map(unifyIds),
610
+ });
611
+ return map$1(new Array(qty), () => unifyIds(lineItem));
612
+ }
613
+ else {
614
+ return [
615
+ {
616
+ ...lineItem,
617
+ qty: qty,
618
+ },
619
+ ];
620
+ }
621
+ };
622
+
623
+ var lineItem_utils = /*#__PURE__*/Object.freeze({
624
+ __proto__: null,
625
+ calculateCardinalityVariables: calculateCardinalityVariables,
626
+ findLineItem: findLineItem,
627
+ findLineItemWithComparator: findLineItemWithComparator,
628
+ generateLineItem: generateLineItem,
629
+ generateModifiedAssetsMap: generateModifiedAssetsMap,
630
+ getAttributeValue: getAttributeValue,
631
+ getAttributes: getAttributes,
632
+ getRecommendedPrices: getRecommendedPrices,
633
+ insertLineItem: insertLineItem,
634
+ mapAttributes: mapAttributes,
635
+ multiplyLineItems: multiplyLineItems,
636
+ patchAttributes: patchAttributes,
637
+ recalculateCardinalityVariables: recalculateCardinalityVariables,
638
+ removeLineItem: removeLineItem,
639
+ replaceLineItem: replaceLineItem,
640
+ upsertAttributes: upsertAttributes
641
+ });
642
+
643
+ class LineItemWorker {
644
+ constructor(src) {
645
+ this.li = { ...src };
646
+ }
647
+ insert(parentId, toInsert) {
648
+ return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
649
+ }
650
+ remove(id) {
651
+ return new LineItemWorker(removeLineItem(this.li, id));
652
+ }
653
+ replace(toReplace) {
654
+ return new LineItemWorker(replaceLineItem(this.li, toReplace));
655
+ }
656
+ patchAttribute(attrs, id) {
657
+ return new LineItemWorker(patchAttributes(this.li, id ?? this.li.id, attrs));
658
+ }
659
+ }
660
+
661
+ class ConfigurationService {
662
+ constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
663
+ this.quoteDraftService = quoteDraftService;
664
+ this.runtimeService = runtimeService;
665
+ this.contextService = contextService;
666
+ this.configurationApiService = configurationApiService;
667
+ this.messageService = messageService;
668
+ this.dialogService = dialogService;
669
+ this.mode = ConfigurationMode.SEARCH;
670
+ this.lineItem = new BehaviorSubject(undefined);
671
+ this.charges = new BehaviorSubject({});
672
+ this.pricePlans = new BehaviorSubject({});
673
+ this.hasUnsavedChanges = false;
674
+ }
675
+ reset() {
676
+ this.hasUnsavedChanges = false;
677
+ this.runtimeService.reset();
678
+ this.configurableRamp = undefined;
679
+ this.lineItem.next(undefined);
680
+ this.charges.next({});
681
+ this.pricePlans.next({});
682
+ }
683
+ patch$(lineItem) {
684
+ if (!this.lineItem.value) {
685
+ return throwError(() => new Error(`Source LineItem not found`));
686
+ }
687
+ this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
688
+ return this.configure().pipe(catchError(error => {
689
+ console.error(error);
690
+ if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
691
+ this.messageService.add({ severity: 'error', summary: error });
692
+ }
693
+ // bounce back if configuration call has failed
694
+ this.lineItem.next(this.lineItem.value ? { ...this.lineItem.value } : undefined);
695
+ return throwError(() => error);
696
+ }), tap(() => {
697
+ if (!this.hasUnsavedChanges) {
698
+ this.hasUnsavedChanges = true;
699
+ }
700
+ }));
701
+ }
702
+ patch(lineItem) {
703
+ this.patch$(lineItem).subscribe();
704
+ }
705
+ setConfigurableRamp(lineItem) {
706
+ this.configurableRamp = lineItem;
707
+ }
708
+ get() {
709
+ return this.lineItem.asObservable().pipe(shareReplay$1());
710
+ }
711
+ getSnapshot() {
712
+ return this.lineItem.value ? { ...this.lineItem.value } : undefined;
713
+ }
714
+ getRuntimeModel() {
715
+ return this.runtimeService.runtimeModel;
716
+ }
717
+ getRuntimeContext() {
718
+ return this.runtimeService.runtimeContext;
719
+ }
720
+ get contextSnapshot() {
721
+ return this.contextService.resolve();
722
+ }
723
+ get context$() {
724
+ return this.contextService.resolve$();
725
+ }
726
+ get charges$() {
727
+ return this.charges.asObservable();
728
+ }
729
+ get chargesSnapshot() {
730
+ return this.charges.value;
731
+ }
732
+ get pricePlans$() {
733
+ return this.pricePlans.asObservable();
734
+ }
735
+ get pricePlansSnapshot() {
736
+ return this.pricePlans.value;
737
+ }
738
+ configure() {
739
+ const runtimeContext = this.getRuntimeContext();
740
+ const runtimeModel = this.getRuntimeModel();
741
+ if (!runtimeContext || !runtimeModel) {
742
+ return throwError(() => new Error('Runtime context/model not initialized'));
743
+ }
744
+ const uiDefinitionProperties = {
745
+ ...(runtimeContext.uiDefinition?.properties ?? {}),
746
+ ...(this.runtimeService.uiDefinitionProperties ?? {}),
747
+ };
748
+ const qty = this.runtimeService.initializationProps?.defaultQty;
749
+ const lineItem = this.configurableRamp ?? getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
750
+ const configurationRequest = this.createRequest(lineItem);
751
+ const mainPricingEnabled = runtimeContext.properties?.PricingEnabled;
752
+ const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
753
+ return this.configurationApiService
754
+ .configureLineItem({ configurationRequest, runtimeModel, pricingEnabled })
755
+ .pipe(map(({ lineItem, context, charges, pricePlans, deletedLineItems }) => {
756
+ this.contextService.update(context ?? {});
757
+ this.charges.next(charges ?? {});
758
+ this.pricePlans.next(pricePlans ?? {});
759
+ if (deletedLineItems?.length) {
760
+ this.showInactiveProductsConfirmation();
761
+ }
762
+ return lineItem;
763
+ }))
764
+ .pipe(tap(lineItem => lineItem && this.lineItem.next(lineItem)), catchError(error => throwError(() => new Error(error.error?.message || error.message || JSON.stringify(error)))));
765
+ }
766
+ configureExternal$(productId, qty) {
767
+ return this.runtimeService.init({ productId, defaultQty: qty }).pipe(switchMap(() => this.configure()), first(), catchError(error => {
768
+ this.messageService.add({ severity: ToastType.error, summary: error });
769
+ throw error;
770
+ }), finalize(() => this.reset()));
771
+ }
772
+ createRequest(lineItem) {
773
+ let request = {
774
+ lineItem,
775
+ mode: this.mode,
776
+ step: !this.lineItem.value ? RuntimeStep.START : RuntimeStep.UPDATE,
777
+ attributeDomainMode: 'ALL',
778
+ context: this.contextService.resolve(),
779
+ lineItems: this.quoteDraftService.quoteDraft?.currentState || [],
780
+ asset: this.getAsset(),
781
+ };
782
+ request = ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
783
+ return request;
784
+ }
785
+ showInactiveProductsConfirmation() {
786
+ const confirmationConfig = {
787
+ title: ' ',
788
+ description: 'This quote contains inactive products. Do you want to remove them?',
789
+ primaryButtonLabel: 'Remove products',
790
+ secondaryButtonLabel: 'Back to Quote',
791
+ };
792
+ this.dialogService
793
+ .open(ConfirmationComponent, {
794
+ dismissableMask: false,
795
+ closeOnEscape: false,
796
+ closable: false,
797
+ showHeader: true,
798
+ header: `Inactive Products in Quote`,
799
+ width: '440px',
800
+ data: { confirmationConfig },
801
+ })
802
+ .onClose.subscribe(result => {
803
+ if (!result) {
804
+ const context = this.contextService.resolve();
805
+ window['VELO_BACK_FN'].apply(null, [context.headerId]);
806
+ }
807
+ });
808
+ }
809
+ getAsset() {
810
+ const lineItem = this.configurableRamp;
811
+ if (!lineItem) {
812
+ return;
813
+ }
814
+ return this.quoteDraftService.quoteDraft?.initialState.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
815
+ }
816
+ }
817
+ ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i5.MessageService }, { token: i6.DialogService }], target: i0.ɵɵFactoryTarget.Injectable });
818
+ ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationService });
819
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationService, decorators: [{
820
+ type: Injectable
821
+ }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6.DialogService }]; } });
822
+
823
+ function extractMetadata(uiDefinition) {
824
+ return omit(uiDefinition, [
825
+ 'children',
826
+ 'pages',
827
+ 'components',
828
+ ]);
829
+ }
830
+
831
+ class FlowUpdateService {
832
+ update(rootLineItems, updates, charges) {
833
+ let remainingUpdates = [...updates];
834
+ let currentLevel = rootLineItems;
835
+ while (currentLevel.length && remainingUpdates.length) {
836
+ currentLevel.forEach(li => {
837
+ const unhandledUpdates = [];
838
+ remainingUpdates.forEach(update => {
839
+ let updated = false;
840
+ switch (update.dataType) {
841
+ case 'LINEITEM':
842
+ updated = this.applyLineItemUpdate(li, update, charges);
843
+ break;
844
+ case 'CHARGE':
845
+ updated = this.applyChargeUpdate(li, update);
846
+ break;
847
+ case 'GROUP_CHARGE':
848
+ updated = this.applyChargeGroupUpdate(li, update);
849
+ break;
850
+ default:
851
+ // Unknown dataType. Do not try to handle it anymore
852
+ updated = true;
853
+ }
854
+ if (!updated) {
855
+ unhandledUpdates.push(update);
856
+ }
857
+ });
858
+ remainingUpdates = unhandledUpdates;
859
+ });
860
+ currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
861
+ }
862
+ }
863
+ delete(lineItems, id) {
864
+ const idsToRemove = [id];
865
+ const topLevelLineItem = lineItems.find(li => li.id === id);
866
+ if (topLevelLineItem) {
867
+ // find term-related line items (which are only top level)
868
+ // expired term line items won't be deleted
869
+ let foundTermLineItem = topLevelLineItem;
870
+ while (foundTermLineItem) {
871
+ foundTermLineItem = lineItems.find(li => foundTermLineItem && li.rampInstanceId === foundTermLineItem.id);
872
+ if (foundTermLineItem) {
873
+ idsToRemove.push(foundTermLineItem.id);
874
+ }
875
+ }
876
+ }
877
+ const filtered = lineItems.filter(lineItem => !idsToRemove.includes(lineItem.id));
878
+ return filtered.map(lineItem => new LineItemWorker(lineItem).remove(id).li);
879
+ }
880
+ applyLineItemUpdate(lineItem, update, charges) {
881
+ if (lineItem.id !== update.id) {
882
+ return false;
883
+ }
884
+ switch (update.attributeType) {
885
+ case 'QTY':
886
+ lineItem.qty = update.newValue;
887
+ break;
888
+ case 'EFFECTIVE_START_DATE':
889
+ lineItem.properties['StartDate'] = moment(update.newValue).format('YYYY-MM-DD');
890
+ break;
891
+ case 'END_DATE':
892
+ lineItem.properties['EndDate'] = moment(update.newValue).format('YYYY-MM-DD');
893
+ break;
894
+ case 'PRICE_ADJUSTMENT':
895
+ {
896
+ const charge = lineItem.chargeItems.find(charge => (charges || {})[charge.chargeId]?.main);
897
+ if (charge) {
898
+ charge.priceAdjustment = update.newValue;
899
+ }
900
+ }
901
+ break;
902
+ case 'LIST_PRICE_ADJUSTMENT':
903
+ {
904
+ const charge = lineItem.chargeItems.find(charge => (charges || {})[charge.chargeId]?.main);
905
+ if (charge) {
906
+ charge.listPriceAdjustment = update.newValue;
907
+ }
908
+ }
909
+ break;
910
+ default:
911
+ throw new Error(`Not suppored AttributeType for LineItem update: ${update.attributeType}`);
912
+ }
913
+ return true;
914
+ }
915
+ applyChargeUpdate(lineItem, update) {
916
+ const foundCharge = lineItem.chargeItems.find(({ id }) => id === update.id);
917
+ if (!foundCharge) {
918
+ return false;
919
+ }
920
+ if (update.attributeType === 'PRICE_ADJUSTMENT') {
921
+ foundCharge.priceAdjustment = update.newValue;
922
+ }
923
+ else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
924
+ foundCharge.listPriceAdjustment = update.newValue;
925
+ }
926
+ else {
927
+ throw new Error(`Not suppored AttributeType for Charge Item update: ${update.attributeType}`);
928
+ }
929
+ return true;
930
+ }
931
+ applyChargeGroupUpdate(lineItem, update) {
932
+ const foundChargeGroup = ChargeGroupUtils.findChargeGroupById(update.id, lineItem);
933
+ if (!foundChargeGroup) {
934
+ return false;
935
+ }
936
+ if (update.attributeType === 'PRICE_ADJUSTMENT') {
937
+ foundChargeGroup.priceAdjustment = update.newValue;
938
+ }
939
+ else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
940
+ foundChargeGroup.listPriceAdjustment = update.newValue;
941
+ }
942
+ else {
943
+ throw new Error(`Not suppored AttributeType for Charge Group Item update: ${update.attributeType}`);
944
+ }
945
+ return true;
946
+ }
947
+ }
948
+ FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
949
+ FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowUpdateService });
950
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowUpdateService, decorators: [{
951
+ type: Injectable
952
+ }] });
953
+
954
+ class FlowConfigurationService {
955
+ constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
956
+ this.proceduresApiService = proceduresApiService;
957
+ this.contextService = contextService;
958
+ this.quoteDraftService = quoteDraftService;
959
+ this.updateService = updateService;
960
+ this.configurationService = configurationService;
961
+ }
962
+ calculate$(quoteDraft) {
963
+ return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
964
+ // sort the result current state based on the quote draft initial state
965
+ const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
966
+ result.currentState = result.currentState
967
+ .slice()
968
+ .sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
969
+ this.quoteDraftService.updateQuoteDraft(result);
970
+ }), map$2(noop));
971
+ }
972
+ calculate(quoteDraft) {
973
+ this.calculate$(quoteDraft).subscribe();
974
+ }
975
+ update$(updates) {
976
+ const quoteDraft = this.quoteDraftService.quoteDraft;
977
+ if (!quoteDraft) {
978
+ return of(null);
979
+ }
980
+ return of([]).pipe(map$2(() => {
981
+ const updatedState = cloneDeep(quoteDraft.currentState);
982
+ this.updateService.update(updatedState, updates, quoteDraft.charges);
983
+ return updatedState;
984
+ }), switchMap$1(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
985
+ }
986
+ update(updates) {
987
+ this.update$(updates).subscribe();
988
+ }
989
+ revert$(lineItemId) {
990
+ const quoteDraft = this.quoteDraftService.quoteDraft;
991
+ const initialCurrentState = this.quoteDraftService.getInitialCurrentState();
992
+ const currentState = this.quoteDraftService.activeCurrentState;
993
+ const currentLineItemIndex = currentState.findIndex(({ id }) => id === lineItemId);
994
+ const currentLineItem = currentState[currentLineItemIndex];
995
+ const initialLineItem = initialCurrentState.find(({ integrationId }) => integrationId === currentLineItem?.integrationId);
996
+ if (!quoteDraft || !currentLineItem || !initialLineItem) {
997
+ return of(null);
998
+ }
999
+ const updatedState = cloneDeep(currentState);
1000
+ updatedState.splice(currentLineItemIndex, 1, initialLineItem);
1001
+ return of([]).pipe(tap$1(() => {
1002
+ this.quoteDraftService.setCurrentLineItemState(updatedState);
1003
+ }), switchMap$1(() => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1004
+ }
1005
+ revert(lineItemId) {
1006
+ this.revert$(lineItemId).subscribe();
1007
+ }
1008
+ delete$(ids) {
1009
+ const quoteDraft = this.quoteDraftService.quoteDraft;
1010
+ const currentState = this.quoteDraftService.currentState;
1011
+ if (!quoteDraft) {
1012
+ return of(null);
1013
+ }
1014
+ return of([]).pipe(map$2(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap$1(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1015
+ }
1016
+ delete(ids) {
1017
+ this.delete$(ids).subscribe();
1018
+ }
1019
+ addTerm$(term) {
1020
+ const quoteDraft = this.quoteDraftService.quoteDraft;
1021
+ if (!quoteDraft) {
1022
+ return of(null);
1023
+ }
1024
+ const updatedState = [...quoteDraft.currentState, term];
1025
+ return of([]).pipe(switchMap$1(() => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1026
+ }
1027
+ addToCart$(productId, qty) {
1028
+ const quoteDraft = this.quoteDraftService.quoteDraft;
1029
+ if (!quoteDraft) {
1030
+ return of(null);
1031
+ }
1032
+ return this.configurationService.configureExternal$(productId, qty).pipe(map$2(lineItem => {
1033
+ const model = this.configurationService.getRuntimeModel();
1034
+ const split = model?.types.find(type => type.name === lineItem.type)?.split ?? false;
1035
+ const lineItems = multiplyLineItems(lineItem, qty ?? 1, split);
1036
+ return [...quoteDraft.currentState, ...lineItems];
1037
+ }), switchMap$1(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$2(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1038
+ }
1039
+ get() {
1040
+ return this.quoteDraftService.quoteDraft$.pipe(map$2(() => this.quoteDraftService.activeCurrentState), shareReplay$1());
1041
+ }
1042
+ getSnapshot() {
1043
+ return this.quoteDraftService?.currentState.slice() ?? [];
1044
+ }
1045
+ get charges$() {
1046
+ return this.quoteDraftService.quoteDraft$.pipe(map$2(({ charges }) => charges));
1047
+ }
1048
+ get pricePlans$() {
1049
+ return this.quoteDraftService.quoteDraft$.pipe(map$2(({ pricePlans }) => pricePlans));
1050
+ }
1051
+ get activeMetrics$() {
1052
+ return this.quoteDraftService.quoteDraft$.pipe(map$2(({ activeMetrics }) => activeMetrics));
1053
+ }
1054
+ get chargesSnapshot() {
1055
+ return this.quoteDraftService.quoteDraft?.charges ?? {};
1056
+ }
1057
+ get pricePlansSnapshot() {
1058
+ return this.quoteDraftService.quoteDraft?.pricePlans ?? {};
1059
+ }
1060
+ get activeMetricsSnapshot() {
1061
+ return this.quoteDraftService.quoteDraft?.activeMetrics ?? [];
1062
+ }
1063
+ get contextSnapshot() {
1064
+ return this.contextService.resolve();
1065
+ }
1066
+ get context$() {
1067
+ return this.contextService.resolve$();
1068
+ }
1069
+ handleErrorAndBounceBack() {
1070
+ return (source$) => {
1071
+ return source$.pipe(catchError$1(error => {
1072
+ console.error(error);
1073
+ // bounce back if configuration call has failed
1074
+ const quoteDraft = this.quoteDraftService.quoteDraft;
1075
+ if (quoteDraft) {
1076
+ this.quoteDraftService.updateQuoteDraft(quoteDraft);
1077
+ }
1078
+ return throwError(() => error);
1079
+ }));
1080
+ };
1081
+ }
1082
+ }
1083
+ FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
1084
+ FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationService });
1085
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationService, decorators: [{
1086
+ type: Injectable
1087
+ }], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1088
+
1089
+ class FlowConfigurationModule {
1090
+ }
1091
+ FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1092
+ FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule });
1093
+ FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService] });
1094
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FlowConfigurationModule, decorators: [{
1095
+ type: NgModule,
1096
+ args: [{
1097
+ imports: [],
1098
+ providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
1099
+ }]
1100
+ }] });
1101
+
1102
+ class ConfigurationModule {
1103
+ }
1104
+ ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1105
+ ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
1106
+ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, providers: [
1107
+ ContextApiService,
1108
+ ProductModelApiService,
1109
+ ConfigurationApiService,
1110
+ ConfigurationRuntimeService,
1111
+ RuntimeContextService,
1112
+ ConfigurationService,
1113
+ ], imports: [ConfirmationDialogModule] });
1114
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationModule, decorators: [{
1115
+ type: NgModule,
1116
+ args: [{
1117
+ imports: [ConfirmationDialogModule],
1118
+ providers: [
1119
+ ContextApiService,
1120
+ ProductModelApiService,
1121
+ ConfigurationApiService,
1122
+ ConfigurationRuntimeService,
1123
+ RuntimeContextService,
1124
+ ConfigurationService,
1125
+ ],
1126
+ }]
1127
+ }] });
1128
+
1129
+ function calculateMetricByMethod(lineItems, metric, method) {
1130
+ const items = getLineItemsByMethod(lineItems, method);
1131
+ return items.reduce((acc, li) => {
1132
+ let value = li.reduce((accProduct, item) => accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0), 0);
1133
+ if (method === 'avg' && li.length > 0) {
1134
+ value /= li.length;
1135
+ }
1136
+ return acc + value;
1137
+ }, 0);
1138
+ }
1139
+ function getLineItemsByMethod(lineItems, method) {
1140
+ switch (method) {
1141
+ case 'first': {
1142
+ return lineItems.filter(li => !li.rampInstanceId).map(item => [item]);
1143
+ }
1144
+ case 'last': {
1145
+ const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
1146
+ const products = rootTermItems.map(lineItem => [
1147
+ lineItem,
1148
+ ...lineItems.filter(li => li.rampInstanceId === lineItem.id),
1149
+ ]);
1150
+ return products
1151
+ .map(items => [...items].sort((a, b) => getDateValue(a.endDate || '') - getDateValue(b.endDate || '')).pop())
1152
+ .filter((li) => Boolean(li))
1153
+ .map(item => [item]);
1154
+ }
1155
+ case 'avg': {
1156
+ const rootTermItems = lineItems.filter(li => !li.rampInstanceId);
1157
+ return rootTermItems.map(lineItem => [lineItem, ...lineItems.filter(li => li.rampInstanceId === lineItem.id)]);
1158
+ }
1159
+ case 'sum': {
1160
+ return lineItems.map(item => [item]);
1161
+ }
1162
+ default: {
1163
+ return lineItems.map(item => [item]);
1164
+ }
1165
+ }
1166
+ }
1167
+ function getDateValue(date) {
1168
+ return date ? new Date(date).getTime() : 0;
1169
+ }
1170
+
1171
+ class MetricsCalculationService {
1172
+ get onMetricsUpdate$() {
1173
+ return this.metricsUpdated$.asObservable();
1174
+ }
1175
+ constructor(quoteDraftService, flowConfiguration, settingsService) {
1176
+ this.quoteDraftService = quoteDraftService;
1177
+ this.flowConfiguration = flowConfiguration;
1178
+ this.settingsService = settingsService;
1179
+ this.metricsUpdated$ = new Subject();
1180
+ this.quoteMetricsSettings = {};
1181
+ this.metricsCalculationMethodMap = {};
1182
+ this.metricsData = {};
1183
+ this.activeMetricRules = [];
1184
+ this.activeMetricRules = this.flowConfiguration.activeMetricsSnapshot.filter(metricRule => metricRule.metrics.some(metric => !!metric.totalName));
1185
+ combineLatest([
1186
+ this.quoteDraftService.currentState$,
1187
+ this.settingsService.fetchSetting('QUOTE_LEVEL_METRIC_CALCULATION_METHOD').pipe(take$1(1)),
1188
+ ]).subscribe(([lineItems, setting]) => {
1189
+ let settingsData = {};
1190
+ try {
1191
+ settingsData = JSON.parse(setting?.value || '{}');
1192
+ }
1193
+ catch (error) {
1194
+ settingsData = {};
1195
+ }
1196
+ this.quoteMetricsSettings = settingsData;
1197
+ this.updateMetrics(lineItems);
1198
+ });
1199
+ }
1200
+ getMetricValue(metric) {
1201
+ return this.metricsData[metric] || 0;
1202
+ }
1203
+ updateMetrics(lineItems) {
1204
+ const metricKeys = this.collectMetricKeys(lineItems).filter(key => !key.includes('Effective_'));
1205
+ this.metricsCalculationMethodMap = this.buildMetricsCalculationMethods(metricKeys, this.metricsCalculationMethodMap);
1206
+ this.metricsData = metricKeys.reduce((acc, key) => ({ ...acc, [key]: this.calculateMetric(lineItems, key) }), {});
1207
+ this.metricsUpdated$.next();
1208
+ }
1209
+ calculateMetric(lineItems, metric) {
1210
+ return calculateMetricByMethod(lineItems, metric, this.metricsCalculationMethodMap[metric] || 'sum');
1211
+ }
1212
+ buildMetricsCalculationMethods(metricKeys, initial) {
1213
+ return metricKeys.reduce((acc, name) => {
1214
+ if (acc[name]) {
1215
+ return acc;
1216
+ }
1217
+ acc = { ...acc, [name]: 'sum' };
1218
+ const metricRule = this.getMetricRuleByTotalMetricName(name);
1219
+ const settingKey = metricRule?.metrics?.find(metric => metric.totalName === name)?.name || name;
1220
+ if (this.quoteMetricsSettings[settingKey]) {
1221
+ acc = { ...acc, [name]: this.quoteMetricsSettings[settingKey] };
1222
+ }
1223
+ return acc;
1224
+ }, initial);
1225
+ }
1226
+ collectMetricKeys(lineItems) {
1227
+ const keys = [];
1228
+ lineItems.forEach(lineItem => {
1229
+ keys.push(...Object.keys(lineItem.totalMetrics || {}));
1230
+ keys.push(...this.collectMetricKeys(lineItem.lineItems));
1231
+ });
1232
+ return uniq(keys);
1233
+ }
1234
+ getMetricRuleByTotalMetricName(name) {
1235
+ return this.activeMetricRules.find(metricRule => metricRule.metrics.find(metric => metric.totalName === name));
1236
+ }
1237
+ }
1238
+ MetricsCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: FlowConfigurationService }, { token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1239
+ MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MetricsCalculationService, providedIn: 'root' });
1240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MetricsCalculationService, decorators: [{
1241
+ type: Injectable,
1242
+ args: [{ providedIn: 'root' }]
1243
+ }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: FlowConfigurationService }, { type: i1.ConfigurationSettingsApiService }]; } });
1244
+
1245
+ class ProductImagesService {
1246
+ constructor(productApiService) {
1247
+ this.productApiService = productApiService;
1248
+ this.imagesMap$ = new BehaviorSubject({});
1249
+ }
1250
+ getImageUrl$(productId) {
1251
+ if (this.imagesMap$.value[productId] == null) {
1252
+ this.imagesMap$.next({ ...this.imagesMap$.value, [productId]: '' });
1253
+ this.fetchProductImage(productId);
1254
+ }
1255
+ return this.imagesMap$.pipe(map$2(imagesMap => imagesMap[productId]), distinctUntilChanged());
1256
+ }
1257
+ fetchProductImage(productId) {
1258
+ this.productApiService
1259
+ .fetchImage$(productId)
1260
+ .pipe(map$2(file => URL.createObjectURL(file)), catchError$1(() => of('')), tap$1(url => this.imagesMap$.next({ ...this.imagesMap$.value, [productId]: url })))
1261
+ .subscribe();
1262
+ }
1263
+ }
1264
+ ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
1265
+ ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProductImagesService, providedIn: 'root' });
1266
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ProductImagesService, decorators: [{
1267
+ type: Injectable,
1268
+ args: [{ providedIn: 'root' }]
1269
+ }], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
1270
+
1271
+ class SdkCoreModule {
1272
+ }
1273
+ SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1274
+ SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
1275
+ SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService], imports: [ConfigurationModule, FlowConfigurationModule] });
1276
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
1277
+ type: NgModule,
1278
+ args: [{
1279
+ imports: [ConfigurationModule, FlowConfigurationModule],
1280
+ providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService],
1281
+ }]
1282
+ }] });
1283
+
1284
+ /**
1285
+ * Generated bundle index. Do not edit.
1286
+ */
1287
+
1288
+ export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeStep, SdkCoreModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getRecommendedPrices, insertLineItem, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
1289
+ //# sourceMappingURL=veloceapps-sdk-core.mjs.map